Merge pull request 'Redline: past submissions list + start-new-session with 10-session retention (MMDB-2925)' (#29) from feat/redline-sessions-history-20261011 into main
This commit was merged in pull request #29.
This commit is contained in:
@@ -46,6 +46,11 @@ enum PanelSnapshot {
|
||||
|
||||
let region = sampleRegion()
|
||||
|
||||
// Two real past sessions through the REAL store paths (one sent with a PDF in
|
||||
// the outbox, one closed without ever sending) so panel-06b has the exact two
|
||||
// states the Past submissions window must distinguish.
|
||||
try await seedPastSessions(to: model)
|
||||
|
||||
// 01 — Screen Recording missing (no public mutator; snapshot-only seam).
|
||||
model.snapshotSetScreenRecordingGranted(false)
|
||||
model.replaceRegion(nil)
|
||||
@@ -74,6 +79,15 @@ enum PanelSnapshot {
|
||||
to: directory.appendingPathComponent("panel-06-settings.png")
|
||||
)
|
||||
|
||||
// 06b — Past submissions window against the same isolated model: the two
|
||||
// seeded past sessions plus the live session's three captures from panel 04.
|
||||
model.setPastSessions(try await model.spool.archivedSessions())
|
||||
try render(
|
||||
PastSubmissionsView().environment(model),
|
||||
to: directory.appendingPathComponent("panel-06b-past-submissions.png"),
|
||||
width: 440
|
||||
)
|
||||
|
||||
// 07/08/09 — OneDrive-mode Settings + menu bar, on a SEPARATE isolated model so
|
||||
// this transport switch never bleeds into the AirDrop-mode panels above.
|
||||
try await captureOneDrivePanels(to: directory)
|
||||
@@ -188,6 +202,27 @@ enum PanelSnapshot {
|
||||
try renderMenuBar(model: updateModel, to: directory, name: "14-update-revert")
|
||||
}
|
||||
|
||||
@MainActor
|
||||
private static func seedPastSessions(to model: AppModel) async throws {
|
||||
_ = try await model.spool.append(
|
||||
pngData: try makePNGData(width: 192, height: 108, red: 0.55, green: 0.35, blue: 0.85),
|
||||
pixelWidth: 192, pixelHeight: 108, scale: 2.0, capturedAt: Date())
|
||||
_ = try await model.spool.append(
|
||||
pngData: try makePNGData(width: 192, height: 108, red: 0.25, green: 0.7, blue: 0.6),
|
||||
pixelWidth: 192, pixelHeight: 108, scale: 2.0, capturedAt: Date())
|
||||
let sentName = "Redline-\(DubaiTime.fileStamp(Date())).pdf"
|
||||
_ = try await model.spool.archiveCurrent(pdfFileName: sentName)
|
||||
// The real send writes the PDF to the outbox; the fixture does the same so the
|
||||
// row's PDF action is genuinely live in the snapshot.
|
||||
try Data("%PDF-1.4\n% snapshot fixture\n".utf8).write(
|
||||
to: model.paths.outbox.appendingPathComponent(sentName))
|
||||
|
||||
_ = try await model.spool.append(
|
||||
pngData: try makePNGData(width: 160, height: 90, red: 0.9, green: 0.55, blue: 0.2),
|
||||
pixelWidth: 160, pixelHeight: 90, scale: 2.0, capturedAt: Date())
|
||||
_ = try await model.spool.closeCurrentSession()
|
||||
}
|
||||
|
||||
@MainActor
|
||||
private static func renderMenuBar(model: AppModel, to directory: URL, name: String) throws {
|
||||
try render(
|
||||
@@ -197,9 +232,9 @@ enum PanelSnapshot {
|
||||
}
|
||||
|
||||
@MainActor
|
||||
private static func render(_ view: some View, to url: URL) throws {
|
||||
private static func render(_ view: some View, to url: URL, width: CGFloat = panelWidth) throws {
|
||||
let wrapped = view
|
||||
.frame(width: panelWidth, alignment: .topLeading)
|
||||
.frame(width: width, alignment: .topLeading)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.background(Color(nsColor: .windowBackgroundColor))
|
||||
|
||||
@@ -227,7 +262,7 @@ enum PanelSnapshot {
|
||||
size.height = hosting.intrinsicContentSize.height
|
||||
}
|
||||
if size.height < 1 { size.height = 240 }
|
||||
size.width = panelWidth
|
||||
size.width = width
|
||||
size.height = ceil(size.height)
|
||||
|
||||
hosting.setFrameSize(size)
|
||||
|
||||
Reference in New Issue
Block a user