Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1fcbec84e9
|
||
|
|
4c7d98b17f | ||
|
|
c854e42116 | ||
|
|
c59e85babc | ||
|
|
8bd3fc3264 | ||
|
|
28f6337d13 | ||
|
|
1de10e711c | ||
|
|
3757eb8910 | ||
|
|
ab34fd6ace | ||
|
|
d053405aa9 |
No files matched your search
@@ -1,95 +0,0 @@
|
||||
# A version tag builds the four packages, each on its own system, and publishes them.
|
||||
name: Release
|
||||
on:
|
||||
push:
|
||||
tags: ['v*']
|
||||
permissions:
|
||||
contents: write
|
||||
jobs:
|
||||
version:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
# The tag must name the version each build file carries.
|
||||
- run: |
|
||||
v=${GITHUB_REF_NAME#v}
|
||||
grep -qF "project(omaphoto VERSION $v " CMakeLists.txt || { echo "CMakeLists.txt is not $v"; exit 1; }
|
||||
grep -qxF "pkgver=$v" packaging/arch/PKGBUILD || { echo "PKGBUILD is not $v"; exit 1; }
|
||||
grep -qF "version = \"$v\";" flake.nix || { echo "flake.nix is not $v"; exit 1; }
|
||||
deb:
|
||||
needs: version
|
||||
runs-on: ubuntu-24.04
|
||||
# One DEB per Ubuntu LTS: each names its own libraries.
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- codename: noble
|
||||
base: ubuntu:24.04
|
||||
- codename: resolute
|
||||
base: ubuntu:26.04
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
# The dev image carries ONNX Runtime, its notices and the model.
|
||||
- run: docker build -t omaphoto-dev --build-arg BASE=${{ matrix.base }} -f Dockerfile.dev .
|
||||
- run: |
|
||||
docker run --rm -u "$(id -u):$(id -g)" -e HOME=/tmp -v "$PWD:/src" -w /src omaphoto-dev sh -c '
|
||||
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr \
|
||||
-DOMAPHOTO_BUNDLE_ORT=ON -DOMAPHOTO_MODEL=/usr/local/share/omaphoto/u2net.onnx &&
|
||||
cmake --build build --target omaphoto && cd build && cpack -G DEB'
|
||||
mv build/omaphoto_*.deb omaphoto-${{ matrix.codename }}_amd64.deb
|
||||
- uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: deb-${{ matrix.codename }}
|
||||
path: omaphoto-${{ matrix.codename }}_amd64.deb
|
||||
rpm:
|
||||
needs: version
|
||||
runs-on: ubuntu-24.04
|
||||
# One RPM per Fedora release: each names its own LibRaw.
|
||||
strategy:
|
||||
matrix:
|
||||
release: [43, 44]
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- run: docker build -t omaphoto-fedora --build-arg RELEASE=${{ matrix.release }} scripts/distro/fedora
|
||||
- run: |
|
||||
docker run --rm -u "$(id -u):$(id -g)" -e HOME=/tmp -v "$PWD:/src" -w /src omaphoto-fedora sh -c '
|
||||
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr \
|
||||
-DOMAPHOTO_BUNDLE_ORT=ON -DOMAPHOTO_MODEL=/usr/local/share/omaphoto/u2net.onnx &&
|
||||
cmake --build build --target omaphoto && cd build && cpack -G RPM'
|
||||
mv build/omaphoto-*.x86_64.rpm omaphoto-fc${{ matrix.release }}.x86_64.rpm
|
||||
- uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: rpm-fc${{ matrix.release }}
|
||||
path: omaphoto-fc${{ matrix.release }}.x86_64.rpm
|
||||
arch:
|
||||
needs: version
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- run: docker build -t omaphoto-arch scripts/distro/arch
|
||||
# makepkg refuses root; a user of the runner's id builds.
|
||||
- run: |
|
||||
docker run --rm -v "$PWD:/src" omaphoto-arch sh -c "
|
||||
useradd -u $(id -u) builder && chown -R builder /src &&
|
||||
su builder -c 'cd /src/packaging/arch && makepkg -f'"
|
||||
mv packaging/arch/omaphoto-[0-9]*-x86_64.pkg.tar.zst omaphoto-x86_64.pkg.tar.zst
|
||||
- uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: arch
|
||||
path: omaphoto-x86_64.pkg.tar.zst
|
||||
publish:
|
||||
needs: [deb, rpm, arch]
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- uses: actions/download-artifact@v8
|
||||
with:
|
||||
merge-multiple: true
|
||||
path: packages
|
||||
- working-directory: packages
|
||||
run: sha256sum omaphoto-noble_amd64.deb omaphoto-resolute_amd64.deb omaphoto-fc43.x86_64.rpm omaphoto-fc44.x86_64.rpm omaphoto-x86_64.pkg.tar.zst > SHA256SUMS
|
||||
- env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
gh release create "$GITHUB_REF_NAME" packages/* --title "OmaPhoto ${GITHUB_REF_NAME#v}" \
|
||||
--notes "Install with the script for your system: see the README's Install section."
|
||||
@@ -7,3 +7,7 @@
|
||||
/packaging/arch/u2net.onnx
|
||||
|
||||
/Compositor-Ref/
|
||||
/build-appimage/
|
||||
/AppDir/
|
||||
/*.AppImage
|
||||
/release/
|
||||
@@ -1,10 +1,10 @@
|
||||
# OmaPhoto — agent notes
|
||||
|
||||
OmaPhoto is the Linux port of Compositor, the macOS app at https://github.com/robbietilton/Compositor. That repository's Swift tree (`Compositor/`, `CompositorTests/`) is the specification; this repository mirrors it. Its checkout at `../Compositor-spec`, pinned to the tag being ported (v1.4.5 since item 13), is where the Swift sources are read; never edit it for OmaPhoto work.
|
||||
OmaPhoto is the Linux port of Compositor, the macOS app at https://github.com/robbietilton/Compositor. That repository's Swift tree (`Compositor/`, `CompositorTests/`) is the specification; this repository mirrors it. Its checkout at `Compositor-Ref`, inside this repository and ignored by git, pinned to the tag being ported (v1.4.5 since item 13), is where the Swift sources are read; never edit it for OmaPhoto work.
|
||||
|
||||
## Status
|
||||
|
||||
Paused on 2026-10-02 for a system reinstall, in the middle of item 13 (Compositor v1.4.5, released as OmaPhoto 1.4.5). Items 13.2 to 13.18 are ported. The release, 13.19, is open, and some review fixes are committed but untested. Read the status lines under 13.19 in `TASKS.md` before any work. They list what is unfinished, the failing tests, the setup after a reinstall and the next steps. Work in this one checkout: no worktrees or copies beside it.
|
||||
Item 13 (Compositor v1.4.5, released as OmaPhoto 1.4.5) resumed on 2026-10-03 after a system reinstall. Items 13.2 to 13.18 are ported. The release, 13.19, is open; its steps are listed under 13.19 in `TASKS.md` and checked off as each passes review. Read the status lines under 13.19 in `TASKS.md` before any work. They list what is unfinished, the failing tests, the setup after a reinstall and the next steps. Work in this one checkout: no worktrees or copies beside it.
|
||||
|
||||
## Designing or editing a project
|
||||
|
||||
@@ -15,7 +15,7 @@ To make or change an image in a `.comp` project, the source is not needed: read
|
||||
- The repository root: the app. C++20, Qt 6 Widgets (floor Qt 6.4), CMake, Qt Test. CPU raster only: QPainter plus the C kernels in `kernels/`, copied unchanged from Compositor's `Compositor/Rendering/*.c` and compiled in place.
|
||||
- `packaging/`: the desktop entry, MIME type, icons (Compositor's app icon) and the Arch `PKGBUILD`; `flake.nix` at the root for NixOS.
|
||||
- `scripts/install/`: one install script per distribution family, each fetching the latest release's package.
|
||||
- `.github/workflows/release.yml`: a `v*` tag builds the DEBs, the RPMs and the Arch package and publishes them.
|
||||
- `scripts/release.sh`: builds a tag's DEBs, RPMs, Arch package and AppImage in Docker and publishes them as a release on the project's Gitea, https://git.zacharyzhang.com/ZacharyZhang-NY/OmaPhoto (the GitHub repository is gone; GitHub suspended the account in 2026-10).
|
||||
- `docs/acceptance.md`: the MVP acceptance table, its screenshots in `docs/acceptance/`.
|
||||
- `TASKS.md`: ordered task list and progress truth. Its entries before 11.4b speak of the port's old home, `linux/` inside Compositor's repository.
|
||||
|
||||
@@ -78,18 +78,18 @@ Platform adaptations, each forced by a missing Qt analog:
|
||||
- The clipboard (7.4): `SelectionClipboard.cpp` twins Swift's extension as far as the raster edits exist. `PixelClipboard` and `CopiedPixels` (Swift's tuple) live in `Document/SelectionClipboard.h`. `renderSelectedPixels` and `renderMergedPixels` draw into the copy region and multiply the selection's coverage in with `DestinationIn` through `BrushRaster::alphaView` (`clipTo`), where Swift clips the context (`SelectionClip::apply` has no twin); a mask copies as opaque gray with `LayerMask::background` for its ground when placed apart and `LayerRenderer::drawCoverage` for its white, each pass multiplied on its own (the white in a second surface), because CoreGraphics clips both and a soft edge then stacks: half coverage under a white mask is alpha 192, not 128. `store` gives the system clipboard the image and a PNG through `QMimeData`, and keeps a `QPointer` to the `QMimeData` it hands the clipboard where Swift reads the pasteboard's change count (since 12.10b; Qt's `dataChanged` is no count, since Wayland announces one copy twice): while this app owns the clipboard Qt returns that very object (offscreen, X11's client clipboard, Wayland's selection source), any other copy, a history manager's restore of the same bytes included, is another object, and a replaced object is deleted, which nulls the pointer, so a copy once replaced never counts again, as a change count never returns; a paste puts our pixels back in place while the clipboard still holds that object (`clipboardHolds`), else takes another app's image through `QMimeData::imageData`, converted to sRGB first when it carries another colour space (CoreGraphics converts as it draws; `QPainter` copies the numbers), then to the working format, tagged sRGB and centred. A cleared clipboard has no `QMimeData` at all, so `canPaste` checks the pointer. A working copy that cannot be allocated is a warning, as Swift's `try?` beeps there, where a failed Layer via Copy sets `brushError` as Swift's `catch` does. The clipboard is touched only by a copy or a paste, so session tests without one run under `QTEST_GUILESS_MAIN` still; `SelectionClipboardTests` runs under `QTEST_MAIN`. `addPixelLayer`'s shape and text arrived with 8.8 and 8.9a. Swift's `cutSelection`, `PixelMove` and the whole `FloatingSelection` extension need `clearSelectedPixels` and the brush raster, so the cut arrived with 8.2 and the rest with 8.2b, where `canEditLayers` and `ProjectWorkspace::canSwitch` gained their `pixelMove` terms. The Edit menu's Copy and Paste check when chosen, as Swift's (a text field keeps its own, as with Select All); Copy Merged follows `canCopyMerged`; the Layer menu's Ctrl+J is `layerViaCopy`, titled by the selection and enabled as Swift's: `canCopyPixels`, or no selection on an editable layer (a folder too since 12.10b). Swift's beeps are warnings on `omaphoto.app`.
|
||||
- Content-Aware Fill (7.5): `ContentFill.c` compiles in place beside the other kernels; `Document/ContentFill.cpp` includes its header in angle brackets, because the twin's own header shares the name. `ContentFill::run` draws the job's image into a premultiplied context and takes the pixels to make from `PixelAdjust::coverage` (the selection through the inverse mapping, as Swift clips the mask context and fills white), the kernel's 0 is `ContentFillError(noSource)` with Swift's message and its −1 `ExportError(render)`. `Document/Filters.h` holds what Swift's `Filters.swift` holds as far as it exists: `FilterKind` (`rawValue` and `isAutomatic` are free functions; the other kinds came with 9.4a), `FilterJob` (its settings, scale and seed came with 9.4a), `PixelFilter::run` (the kind's filter, then `PixelAdjust::blend` through the selection) and `FilterEdit`, a plain class in a `std::optional` of the session, since only the session writes it; its `id` stands for Swift's object identity, so a preview lands on the edit it was made for. `FilterEdit` grows through `grow` (the blur's growth and the preview copy came with 9.4a). The session's extension is `Filters+Session.cpp`: Swift's file holds 473 lines, its twin's two halves about 500. `canContentAwareFill` without its `isMaskSelected`, `filterEdit` and `isEmpty` terms (`canAdjustColors` holds all three; it sits in `HueSaturation.cpp`, the twin of its Swift file, alone until 9.3, with the terms that exist), `beginFilter` (`cancelCrop` waits for the crop), `updateFilter` (its settings came with 9.4a), `cancelFilter`, `commitFilter` with a completion callback, `finishFilterCommit` (Swift's guards, the mask carried through `LayerMask::clipImage`). Swift's `previewTask` is one `QFutureWatcher`: `renderFilterPreview` marks the edit preparing and starts the worker, or leaves the job pending behind the one running and runs it when that finishes, a run counting as running until its finish has run (`m_filterRendering`, as Levels' queue); a commit that awaits the preview (`isAutomatic`) is kept in `m_filterCommitWaiting` with its edit's id and called again from `finishFilterPreview` (every waiter is, and one whose edit has gone just returns); the wait is on `preparing`, which only the delivery clears; Preview off is 9.4a's; the workers catch `ContentFillError` and `ExportError` alone. `brushRevision` moves where Swift's does (a delivered preview, Preview switched either way, a cancel, a commit's end), so the canvas's `DisplayState` sees each new preview. `displayedTransform` and `displayedMaskPlacement` take the grown transform while the edit previews, and the canvas draws `previewImage` in the layer's place. `canEditLayers` and `ProjectWorkspace::canSwitch` read `filterEdit`. `FilterSheet` (a `filterPanel`'s content since 9.4b): the kind's words, Preview, the error in `BrightText`, "Limited to the selection" while a selection exists (never for an adjustment layer's editor, since 9.5d), Cancel, the spinner with "Working…" or "Applying…", and OK as the default button, disabled while an automatic kind prepares or failed, so Return then does nothing; Escape and the close button cancel, as Swift's `cancelAction` and `onClose`. The Edit menu's Content-Aware Fill… is Shift+Backspace (Swift's `.delete` is that key) and follows `canContentAwareFill`; the canvas takes Shift with Backspace or Delete ahead of the selection keys, as Swift's `keyDown` does.
|
||||
- The brush on the CPU (8.1): `Rendering/BrushCoverage` twins `MetalBrushCoverage`: the shader's maths in float, pixel for pixel (the centre sample, the hard tip's antialiased silhouette over `max`, the soft tip's optical density under Gauss–Legendre quadrature per segment at the deposition spacing, the 20 cap, the permanent paint apart from the replaceable tail), one band of 32 rows a QtConcurrent task where Metal dispatched one tile a thread group. A `Tile` keeps the permanent density alone: Swift's preview buffer is the gray coverage context itself, written row by row, so nothing is copied back. A tile that cannot be allocated is `ExportError(render)`. The class with its `shared` device is a namespace. `Document/BrushStroke` keeps Swift's continuous path alone: the dab fallback for machines without Metal (`walk`, `dab`, `tip`, `stamp`, `gridTip`, `falloff`, `drawTail`, `removeTail`, `curve`, `tailBackup`, `distanceToNext`, `dirtyTiles`) is dead where the CPU coverage always exists, and `spacingFraction` stays because the integral reads it. `BrushStroke.swift` runs to 899 lines, so the twin splits: `BrushStroke.cpp` (`BrushRaster`, with `fill`, source-over of a colour at coverage × clip × alpha byte by byte on RGBA and gray alike, 1:1 by construction), `BrushStroke+Stroke.cpp` (the grid, samples, the centripetal Catmull–Rom subdivided within 0.2 px, keys, tiles, coverage and `publish`) and `BrushStroke+Commit.cpp` (`transform(for:)`, `paintSnapshot`, `commitInput`, `BrushCommit` as a namespace, since Swift's actor only serialises). The grid is worked out first (`Grid`) so the const members can follow Swift's `let`s; Swift's guards throw `ProjectError(tooLarge)` as one, and the extent is judged as a double before it becomes an `int`, because past `int` the conversion is undefined where Swift's `Int` just holds the number. The stroke's source is the asset itself (`m_source`, an `ImportedImage`), so a painted layer draws from its tiles and never flattens; `commitInput` hands the asset on, and `BrushCommit::render` draws it the same way. A selection clips the context in Swift; `fill` takes the selection's `PixelAdjust::coverage` on the tile's grid as its clip and rounds coverage × clip × alpha once, as CoreGraphics composites a clipped context. A commit whose crop cannot be allocated is `ExportError(render)`, as Swift's `cropping` returning nil; so is a tile's context that cannot be copied on publish (`QImage::detach` leaves a null image where CoreGraphics' `makeImage` returns nil). Tile keys (row × columns + column) are `qint64`, Swift's `Int`: a small layer scaled to a point across a big canvas passes `int`. A tile is rebuilt whole on every publish (`dirtyTiles` only ever narrowed the dab fallback's rebuilds); `base` is the tile's first pixels, kept apart by QImage's copy on write. `BrushSettings` holds the tip and colour; `erasing`, `healing` and `healingMode` arrive with 8.2 and 8.4, `selectionClip` is here since `publish` reads it, `clone`, `isBlur`, `replacesWithClone`, `editName`, `fillGradient`, `fill`, `clearPixels`, `paintCanvas`, `liftSelection`, `moveLifted` and `heal` with their items. `BrushIntersectionTests` runs the one path where Swift loops over `useGPU`; `BrushTests` holds the stroke-level halves of Swift's session tests, driven on a `BrushStroke` made from a layer, with `LayerRenderer::drawBrushPreview` as the live view and `BrushCommit::render` as the commit; the session halves arrive with 8.2. The early return of a segment past the tip's radius is an equivalent mutant: the density there is zero anyway.
|
||||
- The session's brush (8.2): `EditorSession+Brush.cpp` twins Swift's extension as far as the tools exist: `canPaint` with the terms that exist (the adjustment term since 9.5a), `makeRasterEdit` (the budgets, the selection clip; `pixelLimit` is `qint64`, Swift's `Int`, and may run below zero when other layers use more than the budget), `beginBrush` for the Brush (Spot Healing joins with 8.4, the other brush tools with their items; erase and the mask's black or white as Swift sets them), `continueBrush`, `shiftLineStart`, `cancelBrush`, `finishBrushImmediately` (busy, it waits; otherwise it flushes and commits the snapshot), `finishBrush` (Swift's `async` wrapper is a plain call here), `commitPaintSnapshot` (the tiles land at once with their undo entry; a mask that covered the old grid is regrown through `RasterSnapshot::replacing`), `commitRasterEdit` (a completion callback, the render through `QtConcurrent::run` and a `QFutureWatcher` with the project busy, the worker catching `ExportError` alone, the UI side keeping Swift's guards and the mask's `isEnabled` as it stands at commit), `usesOpacityKeys`, `typeOpacityDigit` (Swift's uptime is `std::chrono::steady_clock` unless the caller passes a time, as the tests do), `changeBrushHardness`, `changeBrushSize`. `brushStroke` is a `std::unique_ptr` read through a pointer, since a stroke's const members forbid copying; `brushSettings`, `brushMode` (`BrushToolMode` in `Document/SmudgeLiquify.h`, whose smear and liquify arrive with 8.6) and `maskPaintWhite` are getters and setters that notify; `lastBrushPoint` and `pendingOpacityDigit` are private structs. `brushRevision` exists after all, Swift's counter, because the canvas's `DisplayState` must change with every step of a stroke, whose patches it does not hold; a step that changes nothing else repaints the stroke's `dirtyDocumentRect` alone, in view points two points out (`strokeDirtyRect`), as Swift's `setNeedsDisplay` does, and any other change repaints the view. While a folder's mask is painted, the clip for the layers inside comes from the edit's tiles (`liveFolderMaskClip`, Swift's `liveMaskEdit`): `drawBrushPreview` draws the old mask and the patches, nearest, into gray coverage the size of the device, hidden outside the mask's grid, and that multiplies into the folder coverage; the old mask, or a painted mask's base, is halved near the size drawn first, as Swift's `displayImage` does, so a fine mask keeps its shade while painted. The session's private structs (`Decoded`, `Wanded`, `RasterMade` and the rest) live in `EditorSession+Jobs.h` as `SessionJobs` and are aliased in the class, so the header stays under 500 lines. The gates (`canInvert` and `canAdjustColors` among them), `selectLayer`, `selectLayers`, `selectTool` and `selectLayerTarget` refuse while a stroke lasts, `canStartProjectOperation` too, and `importImages` finishes a stroke first, as Swift's do; the tips' parking by tool family arrived with 8.5. `SelectionEdits.cpp` gains `canEditPixels`, `fillSelection` (the palette's colours are black and white until 8.10's `ColorPalette`; on a mask the background is the opposite of `maskPaintWhite`, as Swift's `paletteColor`), `clearSelectedPixels`, `deleteKeyPressed` (its effects term since 9.6a) and `applyPixelEdit`; `cutSelection` sits in `SelectionClipboard.cpp`. `BrushStroke` gains `erasing` in its settings (`BrushRaster::fill` takes `DestinationOut` for it, Swift's blend mode on the context; a mask never erases, so that mode on a gray context is a `logic_error`), `paintCanvas` (the base redrawn, the body under the inverse mapping and a hard canvas clip, then `PixelAdjust::blend` through the selection where Swift clips), `fill` and `clearPixels`; `placedMaskPreview` is declared in `BrushStroke.h` and defined in `LayerMask.cpp`, as Swift's extension, and a preview that cannot be made logs on `omaphoto.rendering` where Swift's `try?` is silent. On the canvas a pixel stroke draws its whole grid placed by `paintTransform` through `TiledLayerRenderer::drawStroke`, a mask stroke through `drawMaskStroke` under the layer's transform, and a mask on its own placement draws the layer through `placedMaskPreview`; the mask's clip takes the stroke's owner as Swift's `base` does. Delete and Backspace without Ctrl, Alt or Meta are `deleteKeyPressed` on the canvas and, plain, in the layer list; Shift with them stays the fill's. The Edit menu gains Cut (Ctrl+X, a text field's own), Fill with Foreground Color (Alt+Backspace) and Fill with Background Color (Ctrl+Backspace), which in a text field delete a word or the line as Swift's `deleteWordBackward` and `deleteToBeginningOfLine` (the selection when there is one, else backwards from the caret, so nothing goes at the start) (reachable from the opacity field alone: a rename or an empty document disables them, as `canEditPixels` does), and Clear Selection Pixels. `tests/BrushFixtures.h` shares the fixtures; `BrushSessionTests` and `PixelEditTests` hold the session halvLine truncated
|
||||
- The session's brush (8.2): `EditorSession+Brush.cpp` twins Swift's extension as far as the tools exist: `canPaint` with the terms that exist (the adjustment term since 9.5a), `makeRasterEdit` (the budgets, the selection clip; `pixelLimit` is `qint64`, Swift's `Int`, and may run below zero when other layers use more than the budget), `beginBrush` for the Brush (Spot Healing joins with 8.4, the other brush tools with their items; erase and the mask's black or white as Swift sets them), `continueBrush`, `shiftLineStart`, `cancelBrush`, `finishBrushImmediately` (busy, it waits; otherwise it flushes and commits the snapshot), `finishBrush` (Swift's `async` wrapper is a plain call here), `commitPaintSnapshot` (the tiles land at once with their undo entry; a mask that covered the old grid is regrown through `RasterSnapshot::replacing`), `commitRasterEdit` (a completion callback, the render through `QtConcurrent::run` and a `QFutureWatcher` with the project busy, the worker catching `ExportError` alone, the UI side keeping Swift's guards and the mask's `isEnabled` as it stands at commit; its continuation runs where the commit ends, not from the event loop, because Swift's caller resumes from `await` in the same job: `commitGradient` cancels the gradient and runs its caller's next step (a filter, Levels, Hue/Saturation or Invert begun on the same layer), a fill or clear hands on to its caller (`beginSelectionTransform` installs the floating edit), and the pixel move clears itself, all before any event lands; only early paths (nothing to commit, a busy project) post, as Swift's `Task` hops (since 13.19g: a press could arrive with the project free and the finished gradient still pending, which refused it; `CommitContinuationTests`)), `usesOpacityKeys`, `typeOpacityDigit` (Swift's uptime is `std::chrono::steady_clock` unless the caller passes a time, as the tests do), `changeBrushHardness`, `changeBrushSize`. `brushStroke` is a `std::unique_ptr` read through a pointer, since a stroke's const members forbid copying; `brushSettings`, `brushMode` (`BrushToolMode` in `Document/SmudgeLiquify.h`, whose smear and liquify arrive with 8.6) and `maskPaintWhite` are getters and setters that notify; `lastBrushPoint` and `pendingOpacityDigit` are private structs. `brushRevision` exists after all, Swift's counter, because the canvas's `DisplayState` must change with every step of a stroke, whose patches it does not hold; a step that changes nothing else repaints the stroke's `dirtyDocumentRect` alone, in view points two points out (`strokeDirtyRect`), as Swift's `setNeedsDisplay` does, and any other change repaints the view. While a folder's mask is painted, the clip for the layers inside comes from the edit's tiles (`liveFolderMaskClip`, Swift's `liveMaskEdit`): `drawBrushPreview` draws the old mask and the patches, nearest, into gray coverage the size of the device, hidden outside the mask's grid, and that multiplies into the folder coverage; the old mask, or a painted mask's base, is halved near the size drawn first, as Swift's `displayImage` does, so a fine mask keeps its shade while painted. The session's private structs (`Decoded`, `Wanded`, `RasterMade` and the rest) live in `EditorSession+Jobs.h` as `SessionJobs` and are aliased in the class, so the header stays under 500 lines. The gates (`canInvert` and `canAdjustColors` among them), `selectLayer`, `selectLayers`, `selectTool` and `selectLayerTarget` refuse while a stroke lasts, `canStartProjectOperation` too, and `importImages` finishes a stroke first, as Swift's do; the tips' parking by tool family arrived with 8.5. `SelectionEdits.cpp` gains `canEditPixels`, `fillSelection` (the palette's colours are black and white until 8.10's `ColorPalette`; on a mask the background is the opposite of `maskPaintWhite`, as Swift's `paletteColor`), `clearSelectedPixels`, `deleteKeyPressed` (its effects term since 9.6a) and `applyPixelEdit`; `cutSelection` sits in `SelectionClipboard.cpp`. `BrushStroke` gains `erasing` in its settings (`BrushRaster::fill` takes `DestinationOut` for it, Swift's blend mode on the context; a mask never erases, so that mode on a gray context is a `logic_error`), `paintCanvas` (the base redrawn, the body under the inverse mapping and a hard canvas clip, then `PixelAdjust::blend` through the selection where Swift clips), `fill` and `clearPixels`; `placedMaskPreview` is declared in `BrushStroke.h` and defined in `LayerMask.cpp`, as Swift's extension, and a preview that cannot be made logs on `omaphoto.rendering` where Swift's `try?` is silent. On the canvas a pixel stroke draws its whole grid placed by `paintTransform` through `TiledLayerRenderer::drawStroke`, a mask stroke through `drawMaskStroke` under the layer's transform, and a mask on its own placement draws the layer through `placedMaskPreview`; the mask's clip takes the stroke's owner as Swift's `base` does. Delete and Backspace without Ctrl, Alt or Meta are `deleteKeyPressed` on the canvas and, plaLine truncated
|
||||
- Moving and floating selected pixels (8.2b): `PixelMove` is a class in `Document/SelectionEdits.h`, Swift's `final class`. Its raster is a `std::shared_ptr<BrushStroke>`, because the canvas draws it while the commit runs, so `commitRasterEdit` takes a `std::shared_ptr<const BrushStroke>` (the brush hands its stroke over); its `offset` starts at zero, since a default `QSizeF` is −1 by −1. `beginPixelMove`, `movePixels`, `finishPixelMove` (a completion callback; the move stays set until the commit lands, so pixels and outline never show at the old place), `cancelPixelMove` and `nudgePixels` (Swift's beep is a warning on `omaphoto.app`) live in `SelectionEdits.cpp`; `displayedSelection` follows a pixel move and a floating edit. `BrushStroke::liftSelection` draws the source into the region, from its tiles when painted, and multiplies the selection's coverage in (`PixelAdjust::coverage` under `DestinationIn`) where Swift clips; `moveLifted` rebuilds each tile from its base, cuts the hole through the same coverage under `DestinationOut` (not for a copy) and places the lifted pixels on whole pixels: a landing between pixels (a scaled or turned layer) is resampled first by its fraction, bilinear and rows in parallel (`BrushRaster::shiftedByFraction`, shared with Clone Stamp), because QPainter snaps an unscaled image to whole pixels (probed on 6.4), where Swift draws it with `.high`. `FloatingSelection.cpp` twins Swift's file: `FloatingTransform` rides in `TransformEdit.floating` (last) as a `std::shared_ptr<const FloatingTransform>`, because the edit is copied freely and holds the whole document from before; `canTransformSelection`, `transformCommand`, `beginSelectionTransform` (a completion callback: the outer `Transform Selection` edit opens, `clearSelectedPixels` runs, and its callback inserts the `Floating Selection` layer), `floatingSelectionTransform`, `mergeFloatingTransform`, `cancelFloatingTransform`, and `FloatingMerge::merge`, a namespace with a `Merged` struct for Swift's tuple. The merge writes pixels, transform and mask into the source layer in place, where Swift rebuilds the layer from listed fields: the fields that list leaves out do not exist yet (`TASKS.md`, "Session hooks owed"). `DistortWarp::mapPath` came forward from 6.2's list: it walks the path's elements (Qt stores a quad as a cubic) and keeps the fill rule. `beginPixelMove` and `canTransformSelection` leave out Swift's `pixelMove == nil`, `transformEdit == nil` and `!selection.isEmpty`, which `canPaint` reads already (through `canEditPixels`). `displayedMaskPlacement`'s `floating == nil` term is dead and left out: the floating layer is made without a mask, and the open edit blocks adding one; `beginDistort` edits the edit in place, so `floating` carries over. The session's private structs sit in `SessionJobs`, now a private base struct of `EditorSession` (the aliases went; `MergePlan` and `TransformDuplicate` joined it), so the header stays under 500 lines. On the canvas a Ctrl-press inside the selection with a selection tool lifts and moves its pixels, Ctrl-Alt copies them, under `movePixelsCursor` (the arrow with scissors drawn as paths and haloed, where Swift badges the SF symbol) or the duplicate cursor, kept under Space as every drag keeps its own; `updateCursor` picks the outline and pixel drags' cursors ahead of Space, so `lassoCursor`, its only caller's helper, checks neither (Swift's has other callers); Ctrl-arrows nudge the selected pixels in any tool, Shift ten, never with Alt or Meta (macOS's Option and Control), ahead of the Move tool's arrows; losing focus cancels a pixel drag; `drawOwn` draws the move's raster as a stroke, and a step repaints the whole view, as Swift's (only a brush stroke repaints its rect). The Layer menu's Ctrl+T is `transformCommand`, titled `Transform Selection` while `canTransformSelection` holds and enabled by either gate. `canEditLayers`, `canInvert`, `canAdjustColors` and `ProjectWorkspace::canSwitch` read `pixelMove`.
|
||||
- The brush on the canvas (8.3): `EditorCanvas+Brush.cpp` holds Swift's gestures. A press begins a stroke, Shift drawing on from `shiftLineStart` through the press point; a drag continues it, and Shift holds an axis that the first three pixels from its anchor settle (the press under Shift, else the last pixel reached), the pixel waiting at the anchor until then. Swift clears the axis when Shift is let go and again when a new anchor is set; the first is dead and left out. The release reaches its own point, then `finishBrushImmediately` commits. A busy project holds the stroke: a drag, the release, Escape and a lost focus leave it. A stroke goes on only under a drag with the left button, as Swift's `mouseDragged` (a hover after a busy release paints nothing), and wheels and pinches neither pan nor zoom while it lasts, as Swift's `scrollWheel` and `magnify` refuse. A right-drag with a brush tool, no stroke and no Space, sizes the tip from the press (two view points a pixel, rounded, 1 to 2000), or with Shift sets hardness over 200 points, each putting the other back; the circle stays at the press. `BrushCursorOverlay` is no widget, like `TransformOverlay`: the canvas draws the circle last, white 2.5 under black 1, and while hardness is dragged a dashed inner ring (four points on, three off, given in pen widths as Qt counts dashes); `update` returns the old and new rings three points out, as Swift's `setNeedsDisplay`. Swift's `hardness > 0` is dead (a zero ellipse strokes nothing) and left out. The circle follows the pointer, hover included but not a pan (Swift's `mouseDragged` pans first), hides under Space, on leaving and on a lost focus, and shows with the brush tools alone. The canvas's `event` takes Tab before the focus chain (Shift-Tab stays the chain's) for `cycleToolMode`, which switches the Marquee's and the Lasso's shapes, the Brush's mode and Spot Healing's type (the other tools' modes arrive with them); B and E choose the Brush and its mode; a digit reaches `typeOpacityDigit` only where `usesOpacityKeys` holds, else it goes on to the parent, as Swift's `super.keyDown`; brackets step size and hardness, and the application filter takes them from any control but a text field unless the canvas has focus, so a focused canvas's `keyPressEvent` re-reads the modifiers as Swift's `keyDown` does. The layer list takes Tab and Shift-Tab (Swift's table cycles on both), B, E and digits alike. `BrushControls` is every brush tool's `ToolHeaderBar`: Paint and Erase in an exclusive group, size (1–2000), hardness and opacity as a slider in thousandths beside a whole-percent field (opacity from 1%), the sliders following the session under `QSignalBlocker` so nothing rounded is written back, the fields stepping with Up and Down from the session's exact value as Swift's `arrowSteps` does (a slider's 33.3% steps to 34.3%; `SelectionAmountField` takes Swift's `value` and `change` closures, and the Lasso and Wand fields round in `change` as theirs do, an equivalent mutant since their values are whole), and the mask's black-or-white picker and note while a mask is selected; the colour swatch arrived with 8.10a. `ContentView+Status.cpp` holds `percent`, `iconKind` and `hint`, the eraser's words and icon among them; `iconKind` checks its tool although every consumer ignores a kind that is not its own (an equivalent mutant). `updateCursor` and the modifier helpers moved to `EditorCanvas+Cursors.cpp`. `ContentView`'s destructor stops listening first: `~QWidget` closes a shown window after the members are gone, and the canvas's focus-out then notifies (`cancelBrush` bumps `brushRevision`, as Swift's does).
|
||||
- Brush speed (8.3's gate: 4K at a scale of 2, an 800 px soft brush, median frame at most 8 ms): 6.8–7.4 ms measured, from 47. The soft tip's density comes from a table of 8192 steps over d²/r² from h² to the rim, in radii because hardness alone shapes it, linear between steps; inside h the tip is solid, the table's first value, so a near-hard tip keeps every step across its fade (from 0.9995 on, a table over the whole radius missed the falloff by up to 46 levels). Once the table's steps are finer than float can tell apart ((1 − h²) / 8192 under float's epsilon, from about 0.9995), even that table misses by a few levels: there `tipDensity` evaluates the shader's own formula, float for float, for dabs and segments alike, its solid and empty ends returning at once what the formula yields, so only samples in the thin fade pay for `exp` and `log`. `BrushCoverageTests` holds dabs and strokes on both sides of the switch against the shader's own quadrature, replayed in float. The kernel keeps the shader's order of float operations to the letter (`midpoint ± halfLength · node − projection`, never regrouped): 8192 pixels along a near-hard stroke a regrouping moved a pixel three levels, and a reference written from the twin's own code repeated it. Its one read per lookup is checked at the upper step, so a lost bound aborts. Only a segment passing through the solid core can look up inside it, so the lower clamp runs for those alone (`quadrature<true>`): for every segment it cost 0.3 ms a frame. Bands of 32 rows are the tasks. The halving's bands take their rows, sums and source row from the caller's scratch, so a worker allocates nothing and a failed allocation throws where the caller catches it (QtConcurrent wraps a worker's exception in `QUnhandledException`). `publish` copies each tile and makes its selection coverage on the calling thread, so a failure throws there and a worker's malloc arena never meets a starved allocator, then fills side by side. Pieces compose and halve side by side (`sideBySide`), each halving unthreaded: Qt 6.4 deadlocks on a `blockingMap` inside a map task. The Lanczos colour rows sum four channels in a GCC vector (`vector_size(16)`), each lane as the scalar sum, and the vertical pass runs tap by tap over whole rows; `BrushCoverage.cpp` and `DownsampleCache.cpp` build at `-O3`, where GCC vectorises them. The shadow is skipped when the dirty rect lies inside the document, whose opaque fill covers it. Equivalent mutants: that skip, `fill`'s skip of a zero weight, the colour row's right clamp (it only ever reads padding), the table's interpolation (under a third of a level), its lower clamp at step 1 (the first steps of every fade sit at the density's cap), the clamped quadrature for every segment, the formula for every hardness and `tipDensity`'s two early returns (each only costs time). `BrushPerformanceTests` runs under `BRUSH_BENCHMARK=1`.
|
||||
- Canvas speed (11.1): `CanvasPerformanceTests` (under `CANVAS_BENCHMARK=1`, at a backing scale of two, as the brush benchmark) pans a 1000-point canvas by trackpad deltas through the canvas's own wheel path, at fit and at Actual Pixels (`zoom(1)`, as the menu sets it), and zooms it in 5% steps around its middle, over a 3840 × 2160 document of ten noise layers (photographs and halves, opacities, multiply, screen, overlay and two Hue layers). Measured on the dev container (32 cores): pan at fit 30 ms median (p95 37), pan at Actual Pixels 68 ms (p95 74), zoom 77 ms (p95 86); with every layer normal 16, 15 and 29 ms. The hand-blended HSL modes are the cost: `HslBlend::blend` ran one thread over the layer's device area, 40 ms a Hue layer at fit; its rows now blend side by side (pointers taken first, since `scanLine` detaches), the same bytes, 3× faster (pan at fit 85 → 30 ms), and the mode is checked before the rows start, since a worker's exception comes back wrapped. At Actual Pixels a Hue layer still costs about 25 ms at 2× (the backdrop's copy and conversion, the enlarged surface and its draw back); the rest is QPainter's single-threaded smooth scaling, about 40 megapixels a frame at this size. Painting the canvas in parallel bands would need its caches (pieces, strokes, effects previews) made safe across threads, and is not done. The guards sit at half again these medians (45, 100 and 115 ms), so a regression fails. Compared with `docs/brush-performance.md`: Swift measures strokes only (2.6–2.8 ms median on macOS); the twin's stroke gate is 8.3's (6.8–7.4 ms at 4K, scale two), and Swift has no pan or zoom figures to compare. `Rendering/PoolMap` (Linux-only) wraps every `QtConcurrent::blockingMap`: Qt 6.4's deadlocks when a pool thread waits on a full pool (a worker's blur or blend on one core, or two workers on two), so a pool thread lends its place while it waits (`releaseThread`, then `reserveThread`, Qt's documented remedy); `PoolMapTests` runs the blend, the blur and a map on a pool of one thread.
|
||||
- Desktop integration (11.2): the app id is `io.github.ZacharyZhang_NY.OmaPhoto` (Compositor's was its bundle identifier, `com.wonderassembly.compositor`), which names the desktop entry, the icon and the MIME package, and which `main` gives Qt as the desktop file name, so a Wayland compositor matches the window to its entry and icon; on X11 Qt 6.4 names the window class after the application (`omaphoto`, `OmaPhoto`), so the entry's `StartupWMClass` is `OmaPhoto`. `packaging/io.github.ZacharyZhang_NY.OmaPhoto.desktop` launches `omaphoto %F` (files named at launch reach `ProjectWorkspace::receive`, as Finder's Open With reaches the delegate) and lists Swift's two document types: its projects (`application/x-compositor-project`) and JPEG, PNG, HEIC and TIFF. `io.github.ZacharyZhang_NY.OmaPhoto.xml` declares the project type for shared-mime-info, a folder (`inode/directory`) named `*.comp`, commented "OmaPhoto Project", where Swift says "Compositor Project"; a file manager may still open such a folder as a folder, since a project is a directory on Linux. `cmake --install` lays down the app, the entry, the MIME package, Compositor's app icon (`packaging/icons`) at six hicolor sizes (16 to 512) and U²-Net's licence under `share/licenses/omaphoto`; `OMAPHOTO_MODEL`, a path, installs the model as `share/omaphoto/u2net.onnx` whatever its own name, the file itself when given a link (`file(REAL_PATH)`), where `SubjectRemoval` looks, and packages pass it (11.3). A direct install (no `DESTDIR`) runs `update-mime-database` on its prefix, required, so the project type registers at once; a staged install leaves that to the package's hooks. `DesktopIntegrationTests` reads both files, stages an install and compares the whole file list (the model included when the build was configured with one, read from its cache), and installs directly with a stand-in `update-mime-database` first on the path and any `DESTDIR` of the caller cleared; the call in `main` is not under test.
|
||||
- The acceptance run (11.5): `AcceptanceTests`, `AcceptanceColorTests` and `AcceptanceProjectTests` drive the app's own window as `main` builds it (`AcceptanceFixtures.h`'s `App`: an `OmarchyTheme` on a folder of the test's own, the workspace, the window at 1180 × 780), one scenario for each row of the README's feature list, through menu entries, canvas gestures, sheets and the real panels (`DialogDesk`), and check pixels, layers, sizes and files. With `ACCEPTANCE_SHOTS` naming a folder, each scenario saves the window with its shown floating panels drawn over it at their places (offscreen draws no title bars), after 300 ms of events, since posted geometry and previews land from the event loop; `docs/acceptance/` holds the committed shots and `docs/acceptance.md` the table. A fix the run found: `~CompositorMenus` disconnects from `QApplication::focusChanged` first, because its Keyboard Shortcuts panel, a member, hides as it goes and moves the focus into the half-destroyed menus (quitting with that panel active crashed); `KeyboardShortcutsSheetTests::theWindowGoesWhileThePanelHoldsTheKeys` holds it. So does `~ProjectWorkspaceView` with its session watch: a floating panel whose field holds typing (the colour picker, Levels, Hue/Saturation, a filter) commits as it hides, and the session's signal reached the window's toolbar and tab strip, already gone; `WindowTeardownTests` holds all four.
|
||||
- The acceptance run (11.5): `AcceptanceTests`, `AcceptanceColorTests` and `AcceptanceProjectTests` drive the app's own window as `main` builds it (`AcceptanceFixtures.h`'s `App`: an `OmarchyTheme` on a folder of the test's own, the workspace, the window at 1180 × 780), one scenario for each row of the README's feature list, through menu entries, canvas gestures, sheets and the real panels (`DialogDesk`), and check pixels, layers, sizes and files; `AcceptanceNewTests`, `AcceptanceEditTests` and `AcceptanceFinishTests` (13.19h) do the same for each row new in 1.4.5. With `ACCEPTANCE_SHOTS` naming a folder, each scenario saves the window with its shown floating panels drawn over it at their places (offscreen draws no title bars), after 300 ms of events, since posted geometry and previews land from the event loop; `docs/acceptance/` holds the committed shots and `docs/acceptance.md` the table. A fix the run found: `~CompositorMenus` disconnects from `QApplication::focusChanged` first, because its Keyboard Shortcuts panel, a member, hides as it goes and moves the focus into the half-destroyed menus (quitting with that panel active crashed); `KeyboardShortcutsSheetTests::theWindowGoesWhileThePanelHoldsTheKeys` holds it. So does `~ProjectWorkspaceView` with its session watch: a floating panel whose field holds typing (the colour picker, Levels, Hue/Saturation, a filter) commits as it hides, and the session's signal reached the window's toolbar and tab strip, already gone; `WindowTeardownTests` holds all four.
|
||||
- Packages (11.3): one CMake install serves every package. It lays down the app, its entry, MIME package, icons and both licences (the app's MIT `LICENSE` and U²-Net's, under `share/licenses/omaphoto`), and `OMAPHOTO_MODEL` adds the model. `OMAPHOTO_BUNDLE_ORT` (off by default) installs ONNX Runtime beside the app in `lib/omaphoto` (under the library folder) with the app's run path set there, and Microsoft's `LICENSE` and `ThirdPartyNotices.txt` with it (`OMAPHOTO_ORT_NOTICES`, where the images keep them from the release; a configure that cannot find them fails). Every package bundles (11.4d, issue #5): ONNX Runtime stamps each release's symbols with its version (`VERS_1.20.1`), so a package linked against a system's runtime refuses to install, or to start, once that system updates it. The DEB, the RPM and the Arch package carry Microsoft's 1.21.0 build, pinned by checksum, which the dev, Fedora and Arch images install into `/usr/local` too, so the tests run against the runtime that ships; the flake builds from nixpkgs' own, since Nix rebuilds its closure with it. `DesktopIntegrationTests` expects the runtime (in the configured library folder), its version link and its notices in a bundling build, as it expects the model in a build given one, reading what CMake itself evaluated through compile definitions (both checked by hand in a second build). CPack makes the DEB (Ubuntu) and the RPM (Fedora), each on its own system: the DEB's library dependencies come from `dpkg-shlibdeps`, which finds the bundled runtime through the run path, and it names what no library does (`libheif-plugin-libde265` for HEVC, `qt6-image-formats-plugins` for TIFF, `shared-mime-info`, `hicolor-icon-theme`); the RPM asks for `qt6-qtimageformats`, `shared-mime-info` and `hicolor-icon-theme`, its libraries found by rpmbuild but the bundled runtime left out of what it provides and requires (`__provides_exclude_from`, `__requires_exclude` in `CPACK_RPM_SPEC_MORE_DEFINE`), and suggests RPM Fusion's `libheif-freeworld`, since Fedora's own libheif decodes no HEVC. Packages stage their install (`DESTDIR`), so their systems' hooks and triggers refresh the MIME and icon caches. `Dockerfile.dev` gains `dpkg-dev`, `file` and `fakeroot` for the DEB. `packaging/arch/PKGBUILD` builds this checkout for Arch and Omarchy (`makepkg` there), fetching the model and Microsoft's runtime by their checksums; its `prepare()` lays the runtime out as that build's CMake config expects (`lib64`, `include/onnxruntime` beside `lib/cmake`) and the package bundles it. `flake.nix` sits at the repository root; it builds the app alone and installs staged (`DESTDIR=/`) so the store holds no MIME cache. The DEB was built and read back in the dev image; the RPM, the PKGBUILD and the flake are built on their own systems in 11.4.
|
||||
- Distro checks (11.4): `scripts/distro-check.sh arch|fedora|fedora44|nixos|resolute` builds `scripts/distro/<name>/Dockerfile` (for `resolute`, `Dockerfile.dev` on Ubuntu 26.04; `fedora` is 43 since 11.4d, `fedora44` the same file on 44 since 12.16) and runs dev.sh's configure, build and full test run in it, warnings as errors, as uid 1000 (root ignores the read-only folders and unreadable files the tests make), the tree mounted read-only and `HOME` and `TMPDIR` on a tmpfs (a sync on the container's overlay waits on the host's disk); NixOS builds the flake's package (nixpkgs pinned by the committed `flake.lock`) as root, since Nix writes its store, then runs the tests in its `devShells.default` as uid 1000 (`chroot --userspec`, with `HOME` and `TMPDIR` put back, since `nix develop` points `TMPDIR` at a folder root made); the shell sets the plugin path, the model's data path with shared-mime-info's beside it (a NixOS system has the database in its profile through `xdg.mime.enable`; without it Qt knows no camera RAW type, missed until 12.16) and a fontconfig file of DejaVu with fontconfig's own rules from the store, since NixOS keeps them in `/etc/fonts/conf.d`, which a container lacks. Every image carries DejaVu Sans, Serif and Mono, the faces the tests name (Fedora splits them into three packages). Ubuntu 24.04 is the dev image itself. What newer Qt and GCC asked for: `QImage::flipped` from Qt 6.9 where 6.4 has `mirrored`; `Q_OBJECT` on every class a test finds with `findChild` (Qt 6.11 refuses one without); `DistortWarp` projects points itself (`project` in `Distort.cpp`), since `QTransform::map` clamps w for points past the horizon from Qt 6.10 (6.10.2 and 6.11.2 probed; 6.4 divides), where Swift divides whatever its sign, and `DistortTests` pins it past the horizon (on 6.4 the two agree, so a mutant there is equivalent); a local pragma for GCC 16's false `-Wmismatched-new-delete` in `DownsampleTests`' replaced operators. Tests follow the systems where only a message or a count differs: libheif 1.23's longer messages, Qt 6.9's TIFF plugin logging libtiff's errors as criticals, fonts named rather than counted, the Type icon's letters in the system's own sans (Fedora's is Noto: the icon sheet compares them only under DejaVu Sans), and `QT_FORCE_STDERR_LOGGING` for the launched app, since a journald-built Qt logs to the journal when stderr is no console. The five starvation tests place their failure by Qt 6.4's own allocations and skip on any other Qt (`placesStarvation` in `AddressSpaceLimit.h`); the limit itself holds there. `ProjectExportFailureTests` opens a panel and an alert once in `initTestCase`, before any limit, as the app's window has before any export: a snapshot that fails opens its alert while the limit holds, and on every system that alert was the process's first font lookup and the panel's first open, costs the app never meets there. In the NixOS shell, which reads fontconfig's whole `conf.d` without a cache, the lookup's failed allocation segfaulted inside fontconfig (`FcHashTableFind`, found under gdb); on the dev image a panel test run alone ran out inside the panel's first open. `theJPEGRenderTakesTheSnapshotWithoutACopy` holds the JPEG render's snapshot to a move under a 2 MB limit, as `thePanelOpensWithoutCopyingTheSnapshot` holds the PNG panel's. The flake leaves out `dev.sh`'s `build/`, which nixpkgs' CMake hook would take for its own build folder.
|
||||
- Distro checks (11.4): `scripts/distro-check.sh arch|fedora|fedora44|nixos|resolute` builds `scripts/distro/<name>/Dockerfile` (for `resolute`, `Dockerfile.dev` on Ubuntu 26.04; `fedora` is 43 since 11.4d, `fedora44` the same file on 44 since 12.16) and runs dev.sh's configure, build and full test run in it, warnings as errors, as uid 1000 (root ignores the read-only folders and unreadable files the tests make), the tree mounted read-only and `HOME` and `TMPDIR` on a tmpfs (a sync on the container's overlay waits on the host's disk); NixOS builds the flake's package (nixpkgs pinned by the committed `flake.lock`) as root, since Nix writes its store, then runs the tests in its `devShells.default` as uid 1000 (`chroot --userspec`, with `HOME` and `TMPDIR` put back, since `nix develop` points `TMPDIR` at a folder root made); the shell sets the plugin path, the model's data path with shared-mime-info's beside it (a NixOS system has the database in its profile through `xdg.mime.enable`; without it Qt knows no camera RAW type, missed until 12.16) and a fontconfig file of DejaVu with fontconfig's own rules from the store, since NixOS keeps them in `/etc/fonts/conf.d`, which a container lacks. Every image carries DejaVu Sans, Serif and Mono, the faces the tests name (Fedora splits them into three packages). Ubuntu 24.04 is the dev image itself. What newer Qt and GCC asked for: `QImage::flipped` from Qt 6.9 where 6.4 has `mirrored`; `Q_OBJECT` on every class a test finds with `findChild` (Qt 6.11 refuses one without); `DistortWarp` projects points itself (`project` in `Distort.cpp`), since `QTransform::map` clamps w for points past the horizon from Qt 6.10 (6.10.2 and 6.11.2 probed; 6.4 divides), where Swift divides whatever its sign, and `DistortTests` pins it past the horizon (on 6.4 the two agree, so a mutant there is equivalent); a local pragma for GCC 16's false `-Wmismatched-new-delete` in `DownsampleTests`' replaced operators; from Qt 6.10 a `QComboBox` emits `highlighted` when its current item changes with the popup closed and closes on Escape without calling `hidePopup` (both probed in 13.19i), so `TypeFontPicker` and `BlendModePicker` preview only while the popup shows and end the preview on the popup window's `Hide` event, which every version sends on every close (on 6.10 a programmatic highlight had saved an original that a later close put back over typed text, and Escape had kept the preview). Tests follow the systems where only a message or a count differs (`GridSettingsSheetTests` sets an English default locale, since Qt 6.10's C locale groups no digits): libheif 1.23's longer messages, Qt 6.9's TIFF plugin logging libtiff's errors as criticals, fonts named rather than counted, the Type icon's letters in the system's own sans (Fedora's is Noto: the icon sheet compares them only under DejaVu Sans), and `QT_FORCE_STDERR_LOGGING` for the launched app, since a journald-built Qt logs to the journal when stderr is no console. The six starvation tests place their failure by Qt 6.4's own allocations and skip on any other Qt (Dither's since 13.19i, where Qt 6.10 converted on threads the limit starved first) (`placesStarvation` in `AddressSpaceLimit.h`); the limit itself holds there. `ProjectExportFailureTests` opens a panel and an alert once in `initTestCase`, before any limit, as the app's window has before any export: a snapshot that fails opens its alert while the limit holds, and on every system that alert was the process's first font lookup and the panel's first open, costs the app never meets there. In the NixOS shell, which reads fontconfig's whole `conf.d` without a cache, the lookup's failed allocation segfaulted inside fontconfig (`FcHashTableFind`, found under gdb); on the dev image a panel test run alone ran out inside the panel's first open. `theJPEGRenderTakesTheSnapshotWithoutACopy` holds the JPEG render's snapshot to a move under a 2 MB limit, as `thePanelOpensWithoutCopyingTheSnapshot` holds the PNG panel's. The flake leaves out `dev.sh`'s `build/`, which nixpkgs' CMake hook would take for its own build folder, and the `Compositor-Ref` spec, which a `path:` flake would copy whole.
|
||||
- Spot Healing (8.4): `HealPixels.c` compiles in place beside the other kernels. `SpotHealingMode`, `allSpotHealingModes` and `rawValue` (Swift's names) sit in `BrushStroke.h`, and `BrushSettings` gains `healing` and `healingMode`. While the stroke lasts its tiles show Swift's wash, gray 0.12 at 45% through the coverage, never erasing. `heal` takes the painted bounds from the kernel's `heal_coverage_bounds`, draws the source into a region about three spots wider, and hands the kernel the coverage packed row by row, as Swift's gray context holds it (the twin copies each tile's rows where Swift draws each coverage image); the seed is `QRandomGenerator::global()`, Swift's `UInt32.random`. Each touched tile is then its base with the healed region copied over, blended with the base through `PixelAdjust::blend` under a selection, where Swift clips the context. The kernel's failure is `ProjectError(tooLarge)`; pixels or packed coverage that cannot be allocated are `ExportError(render)`, as Swift's contexts. The session's `beginBrush` takes Spot Healing on pixels alone, never on a mask, as Swift's guard; `finishBrushImmediately` heals before the commit, one `Spot Healing` step; `spotHealingMode` is a getter and a setter that notifies; Tab steps the type. `isBrushTool` is Swift's four tools: the circle, the right-drag tip, the brackets, the digits and `BrushControls` serve each, and a press with Clone Stamp or the Smear begins nothing until 8.5 and 8.6 bring them. `ContentView` keeps one bar across the four, as Swift's single `isBrushTool` branch keeps its view; the bar titles itself by tool (Spot Healing, Clone Stamp, Smear, Eraser, Brush), shows Paint and Erase for the Brush alone and the three types for Spot Healing alone, and names opacity Strength for the Smear; the clone's Aligned and Sample arrive with 8.5, the Smear's modes with 8.6. Equivalent mutant: the healed tile starting from its context rather than its base, since the region holds the whole wash and the copy replaces it.
|
||||
- Clone Stamp (8.5): `Document/CloneStamp.h` holds `CloneSettings`, `CloneStamp.cpp` Swift's extension: `setCloneSource` (a point that is no number is refused; a new source restarts the alignment), `cloneStrokeOffset`, `cloneSamplePoint` and `cloneSample`, whose context that cannot be allocated logs on `omaphoto.app` where Swift's `try?` is silent. The session keeps `cloneSource`, `cloneSettings` (a setter that notifies), `cloneOffset` and `parkedBrushTips` by `tipFamily` (Clone Stamp 1, the Smear 2, the rest 0; the two parked tips start at Swift's 40, 0, 1). `selectTool` parks size, hardness and opacity when the family changes and reads the tip it restores with `at`: the session starts in family 0 and leaving a family parks it, so Swift's `if let` always finds one. `beginTransform` and Transform Selection set the Move tool directly, as Swift's do, and park nothing. `beginBrush` takes Clone Stamp on pixels alone, asks for a source first (`brushError`: "Alt-click where Clone Stamp should copy from first."), samples the document as the stroke starts and fixes the offset; Tab toggles the sample; the step is `Clone Stamp`. `BrushStroke::Clone` is Swift's tuple. `publish` makes each tile's view of the sample on the calling thread (`clonePixels`): under a scale or turn QPainter draws it bilinear, Swift's medium quality; a whole translation copies it; a fractional one is drawn at the floor and shifted by `BrushRaster::shiftedByFraction`, since QPainter snaps an unscaled image. `fillClone` then composites it source-over through coverage × opacity × selection, each byte rounded once, where Swift clips the context to the coverage. Swift's `!isMask || isBlur` holds since 8.6: a mask takes a clone only from Blur. The bar shows Aligned (a `QCheckBox` written on `clicked`, so the session's own changes write nothing back), This Layer and All Layers, and "Alt-click to set the source" in `PlaceholderText` while there is no source. On the canvas an Alt-press with Clone Stamp sets the source and paints nothing; Swift's cursor refresh there is dead (Alt is held, so the crosshair stays) and left out. With a source the pointer hides unless Alt or Space is held. `updateBrushCursor` gives the overlay the source crosshair in view points and, between strokes and without Alt, `clonePreview` (the source around the stamped point at screen resolution, at most 1024 pixels, kept under Swift's key; Swift's `.medium` there is overridden by `LayerRenderer`'s own quality and left out) with `cloneTip` (one click painted by the brush engine, kept by size and hardness). `BrushCursorOverlay` gains `marker`, `preview`, `previewOpacity` and `tip`, images compared by `cacheKey` as Swift's `!==`; under an antialiased ellipse clip at the brush's opacity it draws the preview and cuts it to the tip inside `AdjustmentSurface::draw`, Swift's transparency layer, so the tip applies at the drawing's resolution however far a capped preview is enlarged, and draws the crosshair white 3 under black 1 with round caps. A modifier change refreshes the brush cursor, as Swift's monitor does. Equivalent mutants: `displayedTransform` in `cloneSample` and `clonePreview` (it differs from the stored transform only in a transform edit, which leaves Clone Stamp for Move, or a filter edit, which refuses strokes; the preview would show it only with a filter sheet open over Clone Stamp).
|
||||
- The Smear (8.6): `SmudgeLiquify.h/.cpp` hold `BlurToolMode` and `WarpStroke`, Swift's float arithmetic to the letter (the positive guards of `weight` included) on a document-sized copy drawn through the layer's displayed transform; `image()` is that copy itself, where Swift snapshots it after each append, since the twin reads it only between appends. `beginWarp` and `finishWarp` twin the extension: a warp takes pixels alone (`brushError`: "Smudge and Liquify work on a layer's pixels, not its mask."), and the commit paints the copy along the stroke with a hard tip four pixels wider, `replacesWithClone` so clear pixels clear, one step named by the mode. `BlurTool.cpp` holds `blurSample`, in the stroke's own grid since 13.11 and in pieces since 13.16 (see those bullets). Core Image's Gaussian is `PixelAdjust::gaussianBlur`: separable, weights exp(−i²/2σ²) over three sigmas, normalised, in float on the stored premultiplied values (Swift's Core Image context is unmanaged), each byte rounded once, rows in parallel. Where Core Image approximates a large blur, the twin's is exact; it costs 20–110 ms for a 4K document on 32 cores (sigma 1.5 to 30), paid as a Blur stroke begins, since Swift's sample is taken whole. `BrushStroke` gains `isBlur` (a mask takes a clone only from Blur), `replacesWithClone` (a copy by coverage: `fillClone` keeps 1 − coverage of the old pixel) and `editName` (the step's name when set). `clonePixels` resamples every clone, a gray one too, into premultiplied colour, so a sample's edge keeps the share of the pixel the image covers, and `fillClone` composites that alpha into a mask as CoreGraphics draws a gray image's edge: a white mask half a pixel past the canvas stays white. The session keeps `blurMode` and `warpStroke`; `beginBrush` hands Liquify and Smudge to `beginWarp`; `continueBrush`, `cancelBrush` and `finishBrushImmediately` take the warp first; exactly Swift's six places read it: `canEditLayers`, `canUseHistory`, `canStartProjectOperation`, `selectLayer`, `selectTool`, `cycleToolMode` (`selectLayers` and `selectLayerTarget` read the brush stroke alone, as Swift's). Tab steps the Smear's modes. The bar shows the three modes with Swift's help; the status line says "Drag to soften", "Drag to smudge" or "Drag to push pixels" (`hint` takes the Smear's mode). On the canvas the warp's copy stands in for its layer across the canvas, through the layer's mask at 2048, its opacity and blend mode, and a step repaints the view (no dirty rect, as Swift's); drags, releases, Escape, wheels, pinches and the tip drag treat a warp as a stroke. Equivalent mutants: `displayedTransform` in `beginWarp` (painting refuses transform and filter edits), the radius rounded to nearest (pixels past its floor lie outside the brush), `u >= h` for `u > h` (weight 1 either way), a warp without dabs going on to commit (it appends nothing), copy mode weighing by coverage times opacity (a warp commits at full opacity), `fillClone`'s format guard (a clone is always sampled in colour), and the Gaussian's branch-free interior moved by a pixel (it reads one tap weighing under 1% of the centre).
|
||||
- The Smear (8.6): `SmudgeLiquify.h/.cpp` hold `BlurToolMode` and `WarpStroke`, Swift's float arithmetic to the letter (the positive guards of `weight` included) on a document-sized copy drawn through the layer's displayed transform; `image()` is that copy itself, where Swift snapshots it after each append, since the twin reads it only between appends. `beginWarp` and `finishWarp` twin the extension: a warp takes pixels alone (`brushError`: "Smudge and Liquify work on a layer's pixels, not its mask."), and the commit paints the copy along the stroke with a hard tip four pixels wider, `replacesWithClone` so clear pixels clear, one step named by the mode. `BlurTool.cpp` holds `blurSample`, in the stroke's own grid since 13.11 and in pieces since 13.16 (see those bullets). Core Image's Gaussian is `PixelAdjust::gaussianBlur`: separable, weights exp(−i²/2σ²) over three sigmas, normalised, in float on the stored premultiplied values (Swift's Core Image context is unmanaged), each byte rounded once, rows in parallel. Where Core Image approximates a large blur, the twin's is exact. `BrushStroke` gains `isBlur` (a mask takes a clone only from Blur), `replacesWithClone` (a copy by coverage: `fillClone` keeps 1 − coverage of the old pixel) and `editName` (the step's name when set). `clonePixels` resamples every clone, a gray one too, into premultiplied colour, so a sample's edge keeps the share of the pixel the image covers, and `fillClone` composites that alpha into a mask as CoreGraphics draws a gray image's edge: a white mask half a pixel past the canvas stays white. The session keeps `blurMode` and `warpStroke`; `beginBrush` hands Liquify and Smudge to `beginWarp`; `continueBrush`, `cancelBrush` and `finishBrushImmediately` take the warp first; exactly Swift's six places read it: `canEditLayers`, `canUseHistory`, `canStartProjectOperation`, `selectLayer`, `selectTool`, `cycleToolMode` (`selectLayers` and `selectLayerTarget` read the brush stroke alone, as Swift's). Tab steps the Smear's modes. The bar shows the three modes with Swift's help; the status line says "Drag to soften", "Drag to smudge" or "Drag to push pixels" (`hint` takes the Smear's mode). On the canvas the warp's copy stands in for its layer across the canvas, through the layer's mask at 2048, its opacity and blend mode, and a step repaints the view (no dirty rect, as Swift's); drags, releases, Escape, wheels, pinches and the tip drag treat a warp as a stroke. Equivalent mutants: `displayedTransform` in `beginWarp` (painting refuses transform and filter edits), the radius rounded to nearest (pixels past its floor lie outside the brush), `u >= h` for `u > h` (weight 1 either way), a warp without dabs going on to commit (it appends nothing), copy mode weighing by coverage times opacity (a warp commits at full opacity), `fillClone`'s format guard (a clone is always sampled in colour), and the Gaussian's branch-free interior moved by a pixel (it reads one tap weighing under 1% of the centre).
|
||||
- The Gradient (8.7): `Document/Gradient.cpp` twins Swift's extension. `GradientEdit` is a struct in a `std::optional`, where Swift's is a class; its raster is a `std::shared_ptr<BrushStroke>`, as a pixel move's, because the canvas draws it while the commit renders, and the raster's pointer stands for Swift's `gradientEdit === edit` (a new line on the same target keeps the raster, as Swift keeps the edit). `commitGradient` takes a completion callback, posted on every path; `resolveGradient` posts the commit, Swift's `Task`, so a switch of tool, layer or target applies it once the caller returns; `invertPixels` and `beginFilter` commit it first and call themselves again from its callback, as Swift awaits it. `fillGradient` fills the canvas through `paintCanvas` with a `QLinearGradient`, or a `QRadialGradient` centred on the start with the line as its radius; Qt's pad spread is CoreGraphics' `drawsBeforeStartLocation` and `drawsAfterEndLocation`, and two stops interpolate alike in both. `gradientColors` makes a mask's colours gray from the palette's red, where Swift makes `DeviceGray` colours. `undo` first discards a pending gradient and `canUndo` counts one, as Swift's. The palette's model came forward from 8.10 into `ColorPalette.cpp` (`PaletteColor`, `foregroundColor` with `setForegroundColor` through `setBrushSettings`, `backgroundColor`, `canEditPalette`, `paletteColor`, `setPaletteColor`, `swapPaletteColors`, `resetPaletteColors`), and `fillSelection` reads it; the Type bar's share of `setPaletteColor` came with 8.9a, the picker and the swatches came with 8.10a. On the canvas (`EditorCanvas+Gradient.cpp`) a press within ten points of the end, then the start, grabs it, else begins a line; Shift turns the dragged end to a multiple of 45° around the other; Escape cancels and Return or Enter applies, after the selection's keys; losing focus drops the drag. `TransformOverlay` draws the line in place of the handles while one is pending, as Swift's: a radial's dashed rim at the line's length, the line black 3 under white 1, each end a white disc with a black rim, a gray ring and its colour. A pending gradient on a folder's mask clips the folder's layers at once through `liveFolderMaskClip`, as a brush stroke does. `GradientControls` is the tool's `ToolHeaderBar`: the shapes as checkable `QToolButton`s in a `QButtonGroup`, `GradientSwatch` (white, gray checks of four points, the colours, clipped to a rounded rect, the rim unclipped as Swift's `strokeBorder` overlay), the style `QComboBox`, Reverse, the slider in thousandths from 1% and the percent field (a `SelectionAmountField`, whose own clamp stands for the binding's), the Mask note in `PlaceholderText`, and Cancel and Apply while pending. Equivalent mutants: the gray branch of `gradientColors` and of `fillSelection` (a mask's palette is black or white), and the swatch's rim clipped too (3/255 at its corner pixels, measured). A press that marks a drag without an edit was equivalent until 8.10b's Alt eyedropper read the drag; a test holds it now.
|
||||
- The Shape tool (8.8): `Document/ShapeTool.h/.cpp` twin Swift's file, `ShapeTool+Session.h` its session half. `ShapeKind`'s raw values, `shapeKind(text)` for the manifest and `path` stand for the enum and its `path(in:cornerRadius:)`; `LayerShapeStyle`, `LayerShape` and `ShapeDraft` keep Swift's fields, `ShapePreview` is Swift's tuple. A `LayerShape` holds its image's `ImageIdentity`, Swift's `===`, since `ImportedImage::image()` is never cached in a model type; `ImageLayer.shape` joins equality, and `liveShape()` compares identities, so any other change to the pixels leaves a shape that is no longer live. `addPixelLayer` takes the style and ties it to the asset it makes, where Swift passes a `LayerShape` made from the same image. `shapeKind`, `shapeCornerRadius` and `shapeLineWidth` are getters and setters that notify, `shapeDraft` a getter. `finishShape` truncates each side before multiplying, as Swift's `Int()`, in doubles; a Line click leaves a dot as wide as the line, since the box grows by the thickness, as in Swift. `strokedLine` gives a line's round-capped outline, filled on the layer and on the draft, because QPainter draws a pen a pixel wide through its thin-line path, whose diagonals cover less than CoreGraphics' stroke; a zero-length line is a disc, since CoreGraphics caps it as a dot (PDF's rule for round caps) where Qt draws nothing. `redrawShape` pins any mask where it shows (Swift's `placement == nil` test changes nothing: a placed mask's `maskTransform` is its placement) and logs on `omaphoto.app` where Swift's `try?` is silent; `shapeTransformPreview` is `const` with a mutable cache, reads the pixel size from the asset a live shape shares, and logs on `omaphoto.rendering`. Left out as dead or redundant: `path`'s `max(0, …)` (its `radius > 0` test sends a negative radius to the plain rectangle), `shapeLineEnds`'s kind test and the draft drawing's `guard let ends` (only a line's drag sets an end, and its box with it), `finishShape`'s zero-width fallback in `unit` (the box is a pixel wide by then), `redrawShape`'s `max(1, …)` (a valid transform is a pixel wide), and the canvas drag's `lastDragPoint == nil` (a pan never begins a draft). Hooks: `selectTool` cancels a draft, Tab steps the kind, `commitTransform` redraws each moved shape, the record carries a live shape's style (`hierarchyRecord`), `installProject` loads shapes and `applyDocumentSize` does not, as Swift's rebuild leaves them out after a crop or a resize; where Swift rebuilds a layer (a brush or raster commit, Invert, a filter, a floating merge) the twin drops the shape in place; the canvas resizer passes it on, the image resizer not; a duplicate or a copied layer keeps it. The manifest's `shape` key is Swift's `Codable`: the kind's raw value, the numbers, `lineWidth`, `start` and `end` only when set, points as two numbers; a wrong type or a missing key refuses the project. On the canvas (`EditorCanvas+Shape.cpp`) a press begins, a move drags (Shift squares or snaps a line, Alt grows from the centre), the release finishes, Escape cancels after the selection's keys, Shift-U steps the kind with the Shape tool and chooses it otherwise, losing focus cancels. The draft draws above the active layer, inside the live mask renderer's `drawOwn`, composed aside through `LayerRenderer::composite` so folder masks clip it; a line at its width times the zoom, a point at least, with round caps. Swift's draw reads the draft under AppKit's observation tracking; the twin's `synchronizeDisplay` compares `ShapeShown` (draft, colour, width, the layer it sits above) and redraws the view as that observation does, where the brush repaints its stroke's rect alone; `DisplayState` counts a blank layer while a draft sits on it, so moving or hiding the target redraws too. A rounded rectangle resized with the Move tool draws `shapeTransformPreview` in place of its pixels. `ShapeControls` is the tool's `ToolHeaderBar`: the kinds as checkable `QToolButton`s in a `QButtonGroup` (a choice drops the draft first), Width for lines (a slider of 1–100 showing at most 100, a `SelectionAmountField` of 1–5000, "px") and Radius for rectangles (0–200 and 0–5000, with Swift's help); the sliders show the session's number without writing it back; the Fill swatch came with 8.10a. The status hint follows the kind. Known difference: a Line layer's box follows the dragged point, so it can sit between pixels, and at 1:1 and in exports QPainter draws it on whole pixels, where CoreGraphics interpolates. Equivalent mutants: Qt's `addRoundedRect` adds a plain rectangle at radius 0, so `radius > 0` and `>= 0` agree; an undragged draft's box is its anchor, so `finishShape`'s `value_or` may take either; the draft drawing's empty-box test for a rectangle or ellipse only spares an empty surface, since a path of no area paints nothing.
|
||||
- The Type tool (8.9a): `Document/TypeTool.h/.cpp` twin Swift's file, `TypeTool+Session.h` its session half. `TextAlignment`'s raw values and `textAlignment(text)` serve the manifest; `LayerTextStyle`, `LayerText` and `TextDraft` keep Swift's fields. A `LayerText` holds its image's `ImageIdentity`, as a `LayerShape` does; `ImageLayer.text` joins equality and `liveText()` compares identities. TextKit has no Linux twin, so `Rendering/TextLayout` is Linux-only: `TextLines` lays a style out with `QTextLayout` as `textBoxSize` and `textImage` lay it out with TextKit. Lines have a fixed `lineHeight` with the baseline at their bottom, so extra leading sits above the letters (Swift's equal minimum and maximum line heights); they wrap at word boundaries, a word longer than the line anywhere (`byWordWrapping`); a line that would pass the container's bottom is not laid, nor anything after it (`overflows`); a final newline adds no line to a measure (its line holds the caret alone, 8.9b), and an empty paragraph lays one, the caret's room. Paragraphs part at Cocoa's separators, LF, CR, CRLF and U+2029, and Qt breaks a line at U+2028 by itself. Tabs stop every 28 points, as `NSParagraphStyle`'s twelve default stops do up to 336. Past the twelfth Cocoa has no stop and moves a tab down a line (a line of tabs wraps after 336 points in an `NSTextView`); here the stops go on every 28 points (known difference): moving such a tab down would lay the rest of its paragraph again for each one, quadratic in a run of tabs, and measure bidi lines by hand, while `QTextLine::setNumColumns` leaves the tab hanging on the line above. Faces go by PostScript name, as macOS names them: fontconfig lists each installed face's `FC_POSTSCRIPT_NAME` with its family and style (`availableFonts`, the bar's list). A name it does not list is Qt's match for that family, where Swift falls back to the system font; fontconfig's aliases put Helvetica, the default, on a metric twin where one is installed. The size is the style's in pixels, as a CoreGraphics context counts points, rounded: Qt draws a face in whole pixels (`QFontPrivate::engineForScript` rounds a point size's pixels too), so a fractional size draws at the nearest whole pixel where CoreText draws it exactly (known difference; the default is whole, and the bar's steps keep a whole size whole). Kerning is off, since Swift always sets `.kern`; tracking is absolute letter spacing after every letter, the last included, as CoreText kerns; hinting is off, so Qt lays out design advances by itself (`QFontEngineFT::shouldUseDesignMetrics`) and the layout sets no flag for them. Qt 6.4 scales absolute letter spacing by the device's dpi over its own in whole numbers, so on a 72-dpi image it vanishes (probed): lines are laid out without a device, where that scale is one. Letters differ from macOS's where the faces differ; the rules are the same. `Dockerfile.dev` installs `libfontconfig-dev`; CMake links `Fontconfig::Fontconfig`. In the session `textDraft` has a public setter, as Swift writes it freely, and `textDefaults` a getter. `applyText` takes its draft by value, as Swift's struct is passed: `finishText` hands it the session's own draft, which it clears. It clears the draft first (the gates read it) and puts it back on refusal, silently, and before an error is announced, so the error's signal sees the draft; blank new text and an unchanged edit close the draft, announced, with no step and no canvas focus request. `layerName` keeps 40 graphemes (`QTextBoundaryFinder`), Swift's `prefix(40)` of Characters; `simplified()` makes whitespace runs one space. `recolorText` logs a failed redraw where Swift's `try?` is silent. Left out as dead: the `isFinite` terms of `isValid` and `boxIsValid` (the ranges refuse NaN and infinities); the draft and document guards of `beginText`, `editActiveText` and `recolorText` (`canEditLayers` reads both); `textBoxSize`'s `max(16, …)` on both sides (the padding alone makes 24) and its caret line (an empty paragraph lays a line); `textImage`'s `width >= 1` terms; `recolorText`'s validity guard (`textImage` refuses an invalid style, and the refusal is logged); `setPaletteColor`'s Type-tool test (a draft lives only under the Type tool: every way in sets the tool, and a switch finishes text first); `fillSelection`'s `liveText` test (`recolorText` asks it); the store rule's folder term (text needs pixels, and `LayerHierarchy::validate` refuses a folder that has them). Hooks: the gates and `canStartProjectOperation` read `textDraft`; `selectLayer`, `selectLayers` and `selectTool` finish text first when the choice changes, and stop when that is refused; the foreground swatch colours an open draft; Fill recolours live text when neither a selection nor a mask is in play; `addPixelLayer` takes the style, as it takes a shape's; `installProject` loads text and `applyDocumentSize` does not; the record carries live text; every rebuild that drops a shape drops text; the canvas resizer passeLine truncated
|
||||
@@ -169,18 +169,18 @@ Platform adaptations, each forced by a missing Qt analog:
|
||||
- Grid Settings (13.5b, Swift 1.3.5: `1c819d0`, `db5eafa`): `LayoutGrid` is Swift's struct: spacing 2–4096 and subdivisions 1–64, never finer than a pixel, clamped as it is made, plain members where Swift has `let`, so it stays assignable (as `CanvasSizeDraft`); its lines are counted from the origin, so an uneven step stays on the majors. `GridAppearance` holds Photoshop's presets by Swift's raw values (`allGridPresets`, `rawValue`, `presetColor`, none for Custom), the styles (`allGridStyles`, `dashes` in screen points), Custom's colour and the majors' opacity (1% at least when drawn; subdivisions at 28/45 of it). Both are the person's: `ToolDefaults` gains `integer`, `text` (empty when nothing is stored) and their `set`s, and the session reads `LayoutGrid::stored()` and `GridAppearance::stored()` as its members are made, under Swift's keys (`gridSpacing`, `gridSubdivisions`, `gridColor`, `gridCustomColor` as hex, `gridStyle`, `gridOpacity`); a stored value that cannot be read is warned of on `omaphoto.app` and left at its default, where Swift falls back in silence. `setLayoutGrid` and `setGridAppearance` store and notify, silent when unchanged. Snap To Grid, the guide snapping and the overlay read the session's grid; the overlay draws the majors in the chosen colour, opacity and dashes (counted in pen widths for Qt) and the dotted subdivisions in that colour, and `GuidesShown` carries both, so a change repaints. `ProjectController::gridSettings` lives in `ProjectController+Resize.cpp` beside the other sheets, since the controller's own file would pass 500 lines: refused without a window or while a modal sheet is up (Swift's `attachedSheet`), it shows the grid, opens `GridSettingsSheet` in the window-modal `sheet` titled Grid, previews every change through the session, and on its answer puts back the grid's visibility and either keeps the settings or restores them; nothing is undone or saved, and the project is not busy. `UI/GridSettingsSheet` twins Swift's: the title, Color (a preset menu and the `DialogColorSwatch` "Grid Color"), Style, Opacity (a half-point scrub, a slider and a 48-point field with "%", stepped by arrows, clamped), a rule, "Gridline every" with "pixels" (a point's scrub) and Subdivisions (a fifth of a point's), the note (the step to two places, grouped as Swift's `formatted()`, or the limits in `BrightText`), Cancel, Restore Defaults (Custom's colour kept) and the default OK, resting while invalid; 360 wide, 24 in, 18 apart. A field takes any whole number, as Swift's binding, so OK rests until the grid is valid, and previews only valid grids. A picked colour becomes Custom's, remembering the preset it left so picking that colour again returns to it; a preset chosen from the menu ends that. A fix beyond Swift: the picker reports 8-bit colours, so Swift's comparisons miss presets that are no byte (Light Gray's 0.7): opening the picker on Light Gray turns the grid Custom at once. The twin compares both sides in the picker's 8 bits, since its Cancel hands back the exact original, so opening and Cancel both keep a preset. Left out as dead: Swift's reset of the pick in its return branch (returning to a preset ends the pick through the preset's own change, in Swift too) and `ToolDefaults::text`'s fallback (Swift's callers pass ""). Untested: the destructor's `releaseFocus` and picker close (without them the swatch's hide writes into members already gone; no sanitizer runs). Tests: `GuideGridTests` (Swift's four grid tests, the settings kept), `GridSettingsSheetTests`, the drawing in `GuideCanvasTests`, the flow in `ProjectResizeTests`, the entry in `ViewMenuTests` and `CompositorMenusTests`.
|
||||
- Typing's undo and font previews (13.6, Swift 1.3.5: `ee68ba9`, `1bd1df4`). Swift's first commit lets the text view answer Undo and Redo itself, since the window's history took them; the twin's editor has answered them since 8.9b (the keys win `ShortcutOverride`, the menus reach the focused canvas's editor), so only Swift's case is added as a test: typing in a new box and Ctrl+Z through the real menus clears it in one step. The session's `previewFont`, `keepFontPreview` and `endFontPreview` twin Swift's: open text only, each face tried from the style as it was before the first (`m_fontPreviewOriginal`, Swift's `@ObservationIgnored` member) on the draft's selection, refused when invalid or unchanged, kept on a choice, put back on a close without one. `TypeFontPicker` draws each face's name in that face through `Qt::FontRole`, which the combo's menu delegate honours, at the menu's pixel size; a face that cannot draw the letters of its own name (`QRawFont`, the face itself and not fontconfig's fallbacks) keeps the menu's font, as Swift's symbol fonts do. Which faces can is worked out once on a worker when the first picker is made (Swift's `prepareStyledNames`), joined when the menu loads, a name still missing worked out then. The picker takes Swift's preview closure at construction: a highlighted face shows (the `(Multiple)` row does not), and every close posts the revert to the event loop, since Qt reports a choice after `hidePopup`; a choice keeps the preview first, which empties the original, so the revert finds nothing. Swift's `chose` flag does the same work twice and is left out as dead. Equivalent mutants: each preview built from the draft rather than the original (the selection holds still while the menu is open), `previewFont`'s validity term, Swift's too (`setFont` keeps a valid style valid), the worker's start-once guard and its join when the menu loads (without either the same answers are worked out again, costing only time), and the letters-only test of a face's name (every installed name in the dev image is letters and hyphens DejaVu covers); untested in the dev image: a face that cannot draw its own name (only DejaVu is installed). Tests: `TypeFontPreviewTests`, the Ctrl+Z case in `InlineTextDrawTests`.
|
||||
- New Canvas presets and the Quick Look preview (13.7, Swift 1.3.6–1.3.7: `aaf3dc0`, `14aad18`, `4868465`): `NewCanvasSheet` twins `aaf3dc0`: the subtitle goes; beside "New canvas" a 28-point `QToolButton` (`presetSizes`, an instant popup) draws Swift's three 2.5-point dots in `WindowText`, flush with the fields' right edge, its own `paintEvent` drawing no menu arrow; Swift's tooltip and the accessible name "Preset sizes". `CanvasPreset` (in `NewCanvasSheet.h`, as Swift's file holds it) keeps Swift's `groups` and `all`; the menu is Custom, then each group after a separator, checkable `QAction`s in an exclusive `QActionGroup`, each holding its index in `all` (Custom −1). `checkPreset` checks the first preset whose sizes print as the fields' exact text, else Custom, on every edit of either field, as Swift's binding reads it; choosing a preset fills both fields; Custom fills nothing and checks the match again, since Qt checks a triggered action where Swift's picker sets nil and re-reads. Known difference: Swift's label is clickable ten points past the dots into the padding; the twin's button ends at the content's edge. The Quick Look preview twins `14aad18` and `4868465`: `ImageExporter::quickLookImages` returns nothing past 50 megapixels (logged as info), else renders the snapshot and `scaledJPEG`s it: the long side at most 1024, sides rounded, a pixel at least, `QImage::scaled` with `SmoothTransformation` (area averaging when shrinking) for CoreGraphics' high quality, drawn on white into `RGB888`, JPEG quality 80, 72 dpi as `CGImageDestination` writes; a render or scale that fails logs a warning on `omaphoto.io` and saves without one, Swift's `try?`. `QuickLookImages` (Swift's, in `ImageExporter.swift`) is declared in `ProjectStore.h`, since the exporter includes the store. `ProjectStore::save` takes it optionally: with one, the staged folder gains `QuickLook/Preview.jpg`, written and synced with its folder before the project's folder is synced and swapped in; without one the swapped-in project has none. Loading reads only the manifest and `images/`, so the folder is ignored, and `ProjectDigest` reads neither, so writing or deleting it is no external change (a test rewrites and deletes it under the digest). The controller's save worker makes the preview and hands it to the store. `docs/writing-comp-files.md` gains Swift's line, OmaPhoto's name. Equivalent mutant: the heading's stretch (the title label takes the room). Untested: the staged `QuickLook` folder's `mkdir` failure (a fresh staged folder; the write after it would fail with its own message), and the null checks after scaling and allocating the flattened image (an allocation failure); without them a null scale would save a white preview. Tests: `NewCanvasSheetTests` (the dots filled and never outlined, `presetsAreSwiftsGroups`, `aPresetFillsTheFieldsAndTheMatchIsChecked`, `theMoreButtonDrawsThreeDotsAndOpensTheMenu`), `QuickLookPreviewTests` (the store's folder and its absence, load ignoring it, the digest unchanged when the folder is rewritten or deleted, the JPEG byte for byte against smooth scaling on white at quality 80, sizes and rounding, the 50-megapixel bound, a failed render, a controller save), and the sync order in `ProjectReplaceTests`.
|
||||
- Tabs reorder and overflow (13.14, Swift `1faf7a0`): `UI/ProjectTabLayout.h/.cpp` twin Swift's file: `projectTabSpacing`, `ProjectTabSlot`, `ProjectTabPillSlot`, `ProjectTabOverflow` (`contentWidth()` for Swift's computed property), `projectTabOverflowLabel` and `projectTabOverflow`, widths a `std::map` read through `at` (every tab has one), the pill's width a `std::function`. Left out as dead: `span`'s empty guard (never asked of no tabs) and `contentWidth`'s pill fallback (a pill always has a tab after it). `ProjectWorkspace::moveTab` is Swift's, clamped, and emits `changed()` only when a tab moved. `ProjectTabStrip` is now a plain `QWidget` that takes the toolbar's free width (the spacer after it went; its size hint is every tab in a row, its minimum none) and places its children by hand from `projectTabOverflow` over its own width: the overflow pill at x 0 and the visible tabs at y 3, 28 high, each as wide as its button's size hint (so the unsaved dot's extra width counts, as before), hidden tabs hidden; it lays out again on `resizeEvent`, on the workspace's signal and on each tab's session signal (a title or a dot changes widths; a hidden button posts no layout request). The QScrollArea, its offset and `showFront` are gone, as Swift's scroller and reveal are; the selected tab is always shown by the pinning. `OverflowTabsPill` (a `QToolButton`, `projectTabsOverflow`) paints an inactive tab's capsule, the label "N more tabs" at 12 pixels medium and a drawn `chevron.down`, the label and chevron at half opacity while the workspace cannot switch (the capsule stays, as Swift's `.opacity` sits before its background); tooltip and accessible name are the label; its width is Swift's `projectTabOverflowPillWidth` (the label's ceiling plus 11, 4, 10, 11). Its press opens a `QMenu` (`projectTabsOverflowMenu`, deleted on close) four points below it, as `popUp(positioning:)` does, listing the hidden tabs in order, "• " before an unsaved one, a choice selecting; while the workspace cannot switch no menu opens. The reorder twins Swift's: `ProjectTabButton` watches its title button's left press, move and release in global coordinates (Swift's `.global` space) and reports `TabDragPhase::changed` once the press has moved three points and `ended` on the release; the strip's `Reorder` is `TabReorderState` (others, widths, compacted x, start, origin, translation, target), `nearestSlot`, `renderX`, `makeReorder` and `commitReorder` as Swift's (a neighbour closed mid-drag has no place, as Swift's `if let`s). A drag begins only while the workspace can switch and across at least three points, selects its tab first and raises it over the others (Swift's `zIndex`); it commits on release only if the workspace can still switch; the others ease to their places through a 150 ms `QPropertyAnimation` of `pos` (`OutQuad` for SwiftUI's `easeOut`), the dragged tab following the pointer at once, and every tab eases home when it ends. Qt can lose a release (a modal alert opened mid-drag, such as the Revert question `select` may raise, blocks the strip's window): Swift's `dragTimer` is `tabReleaseWatch`, a 100 ms `QTimer` running while a drag lasts, which ends the drag uncommitted once `QGuiApplication::mouseButtons()` holds no button, so the tabs ease home; a drag whose tab closes is dropped on the workspace's signal too. Swift's `guard reorder?.id == id` stays. Known difference: Swift's empty title bar beside the tabs drags the window (`TitleBarDragView`); Qt's toolbar is no title bar, so the strip's empty part does nothing. `NewTabDropSlot` has no twin, as before. Equivalent mutant: reporting `ended` on every release, a press that never moved three points included (with no drag begun, `ended` only lays the strip out again; Swift's `onEnded` fires once the gesture moved three points, begun or not, as the twin's does). Tests: `ProjectTabLayoutTests` (Swift's six, the bounds at exactly fitting and a point below, the pill's spacing included, a lone wide pinned tab, the pill's width asked by count), `ProjectWorkspaceTests::moveTabReordersWithoutTouchingSelectionOrDocuments` (Swift's, plus its signal), `ProjectTabDragTests` (following the pointer, clamping, the gap, the slide's duration, curve and end, stacking, landing left and right and in place, a small or upward move as a click, a busy project at the press and at the drop, a tab closed mid-drag, a release lost under a modal alert ending the drag while a held one lasts past the timer (the drags go through the window, so the application tracks the buttons), a three-point move and a move under another button, the overflow pill's label, place and width, the menu's entries, place and choice, pinning, the busy pill), and `ProjectWorkspaceViewTests` (overflow in the window; the strip ends before the zoom buttons). `ProjectTabStripTests::onlyANewFrontTabScrollsIntoView` went with the scrolling.
|
||||
- Tabs reorder and overflow (13.14, Swift `1faf7a0`): `UI/ProjectTabLayout.h/.cpp` twin Swift's file: `projectTabSpacing`, `ProjectTabSlot`, `ProjectTabPillSlot`, `ProjectTabOverflow` (`contentWidth()` for Swift's computed property), `projectTabOverflowLabel` and `projectTabOverflow`, widths a `std::map` read through `at` (every tab has one), the pill's width a `std::function`. Left out as dead: `span`'s empty guard (never asked of no tabs) and `contentWidth`'s pill fallback (a pill always has a tab after it). `ProjectWorkspace::moveTab` is Swift's, clamped, and emits `changed()` only when a tab moved. `ProjectTabStrip` is now a plain `QWidget` that takes the toolbar's free width (the spacer after it went; its size hint is every tab in a row, its minimum none) and places its children by hand from `projectTabOverflow` over its own width: the overflow pill at x 0 and the visible tabs at y 3, 28 high, each as wide as its button's size hint (so the unsaved dot's extra width counts, as before), hidden tabs hidden; it lays out again on `resizeEvent`, on the workspace's signal and on each tab's session signal (a title or a dot changes widths; a hidden button posts no layout request). The QScrollArea, its offset and `showFront` are gone, as Swift's scroller and reveal are; the selected tab is always shown by the pinning. `OverflowTabsPill` (a `QToolButton`, `projectTabsOverflow`) paints an inactive tab's capsule, the label "N more tabs" at 12 pixels medium and a drawn `chevron.down`, the label and chevron at half opacity while the workspace cannot switch (the capsule stays, as Swift's `.opacity` sits before its background); tooltip and accessible name are the label; its width is Swift's `projectTabOverflowPillWidth` (the label's ceiling plus 11, 4, 10, 11). Its press opens a `QMenu` (`projectTabsOverflowMenu`, deleted on close) four points below it, as `popUp(positioning:)` does, listing the hidden tabs in order, "• " before an unsaved one, a choice selecting; while the workspace cannot switch no menu opens. The reorder twins Swift's: `ProjectTabButton` watches its title button's left press, move and release in global coordinates (Swift's `.global` space) and reports `TabDragPhase::changed` once the press has moved three points and `ended` on the release; the strip's `Reorder` is `TabReorderState` (others, widths, compacted x, start, origin, translation, target), `nearestSlot`, `renderX`, `makeReorder` and `commitReorder` as Swift's (a neighbour closed mid-drag has no place, as Swift's `if let`s). A drag begins only while the workspace can switch and across at least three points, selects its tab first and raises it over the others (Swift's `zIndex`); it commits on release only if the workspace can still switch; the others ease to their places through a 150 ms `QPropertyAnimation` of `pos` (`OutQuad` for SwiftUI's `easeOut`), the dragged tab following the pointer at once, and every tab eases home when it ends. Qt can lose a release (a modal alert opened mid-drag, such as the Revert question `select` may raise, blocks the strip's window): Swift's `dragTimer` is `tabReleaseWatch`, a 100 ms `QTimer` running while a drag lasts, which ends the drag uncommitted once `QGuiApplication::mouseButtons()` holds no button, so the tabs ease home; a drag whose tab closes is dropped on the workspace's signal too. Swift's `guard reorder?.id == id` stays. Known difference: Swift's empty title bar beside the tabs drags the window (`TitleBarDragView`); Qt's toolbar is no title bar, so the strip's empty part does nothing. `NewTabDropSlot` has no twin, as before. Equivalent mutant: reporting `ended` on every release, a press that never moved three points included (with no drag begun, `ended` only lays the strip out again; Swift's `onEnded` fires once the gesture moved three points, begun or not, as the twin's does). Tests: `ProjectTabLayoutTests` (Swift's six, the bounds at exactly fitting and a point below, the pill's spacing included, a lone wide pinned tab, the pill's width asked by count), `ProjectWorkspaceTests::moveTabReordersWithoutTouchingSelectionOrDocuments` (Swift's, plus its signal), `ProjectTabDragTests` (following the pointer, clamping, the gap, the slide's duration, curve and end, stacking, landing left and right and in place, a small or upward move as a click, a busy project at the press and at the drop, a tab closed mid-drag, a release lost under a modal alert ending the drag while a held one lasts past the timer, and another tab pressed before the timer looks moving nothing (the drags go through the window, so the application tracks the buttons), a three-point move and a move under another button, the overflow pill's label, place and width, the menu's entries, place and choice, pinning, the busy pill), and `ProjectWorkspaceViewTests` (overflow in the window; the strip ends before the zoom buttons). `ProjectTabStripTests::onlyANewFrontTabScrollsIntoView` went with the scrolling.
|
||||
- Ungroup Layers and the mask pointer (13.15, Swift `1318f1e`, `6c3b9a5`, `6955a6f`): `EditorSession::canUngroupLayers` and `ungroupLayers` sit in `LayerGroups.cpp` (declared in `LayerGroups+Session.h`), as Swift's extension: the folder's direct children, their parent now the folder's own, take its place in the list in their order; `releaseDetachedClipping` then frees clips that no longer sit on their base; `finishOpacityEdit` ends a drag first; one `Ungroup Layers` step selects the children with the lowest active (none for an empty folder) and forgets the folder's collapse. Swift's `LayerHierarchy.validate` guard is dead and left out: unwrapping a folder only shortens parent chains, so nothing it refuses can appear; its `document` guard is `canEditLayers`'. The Layer menu gains Ungroup Layers (Ctrl+Shift+G) after Group Selected Layers, enabled by `canUngroupLayers`, and `ShortcutDefinition::all` Swift's "Ungroup Layers" entry (g, Cmd+Shift), so it can be remapped; the list's context menu shows it after Group Selected Layers for a right-clicked folder alone (Swift reads the clicked row, not the active layer), enabled by `canUngroupLayers`. `NativeLayerList::showMaskCursor` twins Swift's `showMaskCursor`: the duplicate pointer drawn over an eye in a 7.5 by 5.5 box at the hot spot plus (15, 18), haloed by sixteen white copies one point out, the image widened to hold it (29 by 32 at 1×), the hot spot the pointer's; Swift's `eye.fill` is drawn as paths (an almond of two quadratic curves, a ring cut round a filled pupil). Over a mask thumbnail with Alt, `cursorFor` shows it whatever `canEditLayers` says, as Swift's now does (13.12 brings the Alt-click that shows the mask alone). Equivalent mutants: the eye's black fill drawn after the arrows (it never meets an arrow pixel; the halo's order is pinned), and the context entry enabled by `canEditLayers` (the right-click makes the folder active, so `canUngroupLayers` says the same). Tests: `GroupSessionTests` (Swift's three ungroup tests; collapse forgotten, signals, a plain layer refused silently, a nested and an empty folder, an opacity drag ended, busy), `LayerContextMenuTests::aFoldersMenuOffersUngroup`, the menu entry and its gate in `CompositorMenusTests`, the shortcut count, Swift's chord and a remap of the entry in `KeyboardShortcutsTests`, the eye pointer's pixels, hot spot and the arrows over the eye in `LayerDragGestureTests`.
|
||||
- Compositor 1.4, part one (13.8: `8c0417b`, `fe7a83d`, `af3b568`, `3ccc125`, `d0135c8`, `dcf1c66`). A sharper canvas: `LayerRenderer::interpolation` takes Swift's `upright` (a layer whose `radians()` is 0, drawn within a thousandth of pixel for pixel, takes no filter), from `LayerRenderer::draw` and `TiledLayerRenderer`'s frames alike. The twin's adjustment surfaces already held device pixels (9.5b) and its adjustments already ran at the surface's scale (12.8c), so 1.4's surface and `adjustmentScale` changes were held; what was missing is ported: `AdjustmentSurface::draw` falls back to a pixel a painter unit when device pixels pass the budget (Swift's "falls back to points"), drawn back smoothly (Swift's `.high`), and nothing only when that passes too; `LayerAdjustment::apply` counts the noise origin per axis (`top × height / max(1, region height)`), where the twin used the width's scale for both. PSD (`IO/PSD`): Levels gamma in hundredths; `hue2` read as Swift's: 16 bytes at least, Colorize's own values or the Master's, then for each of the six ranges its band (degrees wrapped into 0–360) and values, 14 bytes each, until the data runs out; the reader keeps each mask's bounds and default byte (`PSDRecord::maskBounds`, `maskDefault`), and `PSDDocumentBuilder::maskOnLayerGrid` draws the stored patch, unfiltered, onto the layer's grid (its pixels, or the canvas for a layer without) at its place, the default round it; already the grid, or with no size, the patch is kept; a grid that cannot be allocated logs on `omaphoto.io` and takes the builder's existing "couldn't be converted" note, as Swift's nil does. `PSDAdjustments::levels` and `hue` are public, as Swift made them for its tests. Photoshop's Saturation: `HueSaturationFilter::adjustedSaturation`, Swift's to the letter. All cores: `kernels/LevelsPixels.c/.h` are Swift's file again (`cube_apply`); `BrushRaster::copy` (bytewise for the context's own format, drawn otherwise) and `BrushRaster::inBands` (one band under 250,000 pixels, else twice the ideal thread count, through `PoolMap`; a `bad_alloc` there is `ExportError(render)`, since the workers' callers catch that alone); `LevelsFilter::run` copies and runs `levels_apply` in bands; `HueSaturationFilter::run` copies and runs `cube_apply` in bands, where the twin had its own trilinear loop (the kernel's float order now: within a level of it, Swift's tests allow eight); `cube` keeps the last eight tables under a mutex, Swift's `cubes`. A blur's preview kept while the layer grows: `FilterEdit` gains `preparedTransform` and `pendingTransform`; a render carries the grown layer it was made from (`Filtered::placement`) and lands there, shown until the next replaces it; `displayedTransform` and `displayedMaskPlacement` read `preparedTransform`. Left out as dead in the twin: Swift's `current` terms (only a blur grows its grid, and only the automatic kinds, which never grow, refuse a stale preview or read `preparedSettings`), so the grid's version (`previewSourceVersion`, `Filtered::sourceVersion`) goes with nothing left to read it, and so does the twin's own remaking of a waiting job on growth (with Preview off nothing lands; with it on, the update makes a new job). The hierarchy kept: `LayerOrder` (`Document/LayerGroups.h`, its code in `LayerGroups+Order.cpp` with the document's hierarchy members, since `LayerGroups.cpp` would pass 500 lines): `Node`, `Result` (`order`, `visible`, `drawn`) and `resolve`, which keeps the last nodes and answer under a mutex; `CanvasDocument::hierarchy()` replaces `hierarchyEntries()`; `effectiveVisibleIDs`, `renderLayers` (a checked `std::map` index, after Swift's empty-order guard) and `effectiveOpacities` (a map of opacity and folder, no whole layers) read it; `groupSelectedLayers` reads `hierarchy().order`. `dcf1c66` was held: the canvas's `DisplayState` already works out the visible set once. Tests: `SharpCanvasTests` (the rule's edges; plain, masked and tiled layers crisp within the tolerance, filtered past it), `PSDAdjustmentTests` (Swift's three, plus the wrap, Colorize leaving the ranges, a cut record, the builder, a pixel layer's grid, a stretched layer, the patch kept, bounds or a layer of no height or width, the grid's bounds with a smaller patch, a patch the grid's size a pixel along), `PSDReaderTests` (the new layouts, the mask's bounds and default read and placed), `HueSaturationTests::positiveSaturationMatchesPhotoshop` (Swift's values, the clamps, a pixel), `AdjustmentBandsTests` (bands cover each pixel once, the copy's bytes, Levels and Hue/Saturation in bands against one pass of the kernels, cached tables), `HueSaturationFailureTests` (the filter now fails at its copy, the row list being gone), `FilterTests::growingABlurKeepsThePreviewUpUntilTheNextOne` (Swift's) and `aMaskKeepsItsPlaceUnderAPreview` (a covering mask under a preview that did not grow, and on a grown one the old bounds), `FilterSessionTests` and `FinishingFilterTests` (an older grid's preview shLine truncated
|
||||
- Compositor 1.4, part one (13.8: `8c0417b`, `fe7a83d`, `af3b568`, `3ccc125`, `d0135c8`, `dcf1c66`). A sharper canvas: `LayerRenderer::interpolation` takes Swift's `upright` (a layer whose `radians()` is 0, drawn within a thousandth of pixel for pixel, takes no filter), from `LayerRenderer::draw` and `TiledLayerRenderer`'s frames alike. The twin's adjustment surfaces already held device pixels (9.5b) and its adjustments already ran at the surface's scale (12.8c), so 1.4's surface and `adjustmentScale` changes were held; what was missing is ported: `AdjustmentSurface::draw` falls back to a pixel a painter unit when device pixels pass the budget (Swift's "falls back to points"), drawn back smoothly (Swift's `.high`), and nothing only when that passes too; `LayerAdjustment::apply` counts the noise origin per axis (`top × height / max(1, region height)`), where the twin used the width's scale for both. PSD (`IO/PSD`): Levels gamma in hundredths; `hue2` read as Swift's: 16 bytes at least, Colorize's own values or the Master's, then for each of the six ranges its band (degrees wrapped into 0–360) and values, 14 bytes each, until the data runs out; the reader keeps each mask's bounds and default byte (`PSDRecord::maskBounds`, `maskDefault`), and `PSDDocumentBuilder::maskOnLayerGrid` draws the stored patch, unfiltered, onto the layer's grid (its pixels, or the canvas for a layer without) at its place, the default round it; already the grid, or with no size, the patch is kept; a grid that cannot be allocated logs on `omaphoto.io` and takes the builder's existing "couldn't be converted" note, as Swift's nil does. `PSDAdjustments::levels` and `hue` are public, as Swift made them for its tests. Photoshop's Saturation: `HueSaturationFilter::adjustedSaturation`, Swift's to the letter. All cores: `kernels/LevelsPixels.c/.h` are Swift's file again (`cube_apply`); `BrushRaster::copy` (bytewise for the context's own format, drawn otherwise) and `BrushRaster::inBands` (one band under 250,000 pixels, else twice the ideal thread count, through `PoolMap`; a `bad_alloc` there is `ExportError(render)`, since the workers' callers catch that alone); `LevelsFilter::run` copies and runs `levels_apply` in bands; `HueSaturationFilter::run` copies and runs `cube_apply` in bands, where the twin had its own trilinear loop (the kernel's float order now: within a level of it, Swift's tests allow eight); `cube` keeps the last eight tables under a mutex, Swift's `cubes`. A blur's preview kept while the layer grows: `FilterEdit` gains `preparedTransform` and `pendingTransform`; a render carries the grown layer it was made from (`Filtered::placement`) and lands there, shown until the next replaces it; `displayedTransform` and `displayedMaskPlacement` read `preparedTransform`. Left out as dead in the twin: Swift's `current` terms (only a blur grows its grid, and only the automatic kinds, which never grow, refuse a stale preview or read `preparedSettings`), so the grid's version (`previewSourceVersion`, `Filtered::sourceVersion`) goes with nothing left to read it, and so does the twin's own remaking of a waiting job on growth (with Preview off nothing lands; with it on, the update makes a new job). The hierarchy kept: `LayerOrder` (`Document/LayerGroups.h`, its code in `LayerGroups+Order.cpp` with the document's hierarchy members, since `LayerGroups.cpp` would pass 500 lines): `Node`, `Result` (`order`, `visible`, `drawn`) and `resolve`, which keeps the last nodes and answer under a mutex; `CanvasDocument::hierarchy()` replaces `hierarchyEntries()`; `effectiveVisibleIDs`, `renderLayers` (a checked `std::map` index, after Swift's empty-order guard) and `effectiveOpacities` (a map of opacity and folder, no whole layers) read it; `groupSelectedLayers` reads `hierarchy().order`. `dcf1c66` was held: the canvas's `DisplayState` already works out the visible set once. Tests: `SharpCanvasTests` (the rule's edges; plain, masked and tiled layers crisp within the tolerance, filtered past it and when turned 2° at 1:1), `PSDAdjustmentTests` (Swift's three, plus the wrap, Colorize leaving the ranges, a cut record, the builder, a pixel layer's grid, a stretched layer, the patch kept, bounds or a layer of no height or width, the grid's bounds with a smaller patch, a patch the grid's size a pixel along), `PSDReaderTests` (the new layouts, the mask's bounds and default read and placed), `HueSaturationTests::positiveSaturationMatchesPhotoshop` (Swift's values, the clamps, a pixel), `AdjustmentBandsTests` (bands cover each pixel once, the copy's bytes, Levels and Hue/Saturation in bands against one pass of the kernels, cached tables), `HueSaturationFailureTests` (the filter now fails at its copy, the row list being gone), `FilterTests::growingABlurKeepsThePreviewUpUntilTheNextOne` (Swift's) and `aMaskKeepsItsPlaceUnderAPreview` (a covering mask under a preview that did not grow, and on a grown one the old bounds), `FilterSessionTests` and `FinishingFilterTests` Line truncated
|
||||
- Blending (13.9a: `6dc2219`, `8ab32c9`, `5a8f6ce`, `e6c964b`). Held, proven: clipping stacks and live-mask coverage at device resolution (the twin's `LiveMaskRenderer` has no `bounds`: its group, alpha and coverage surfaces are the painter's device since 4.x, so Swift's `resolution` and `pixelSize` have no twin); an adjustment in any mode, over the document and inside a stack, blended at full coverage, its alpha restored, then mixed through mask and opacity (`adjust`'s `blended` goes through `LayerRenderer::composite`, which hand-blends every mode QPainter lacks through `HslBlend`, so Swift's `SeparableBlend.blend` has no twin); a clipping stack composited in its base's mode in every mode (`drawComposite` hands `m_stackModes` to `LayerRenderer::composite`, the same path), on the canvas, in export and in Copy Merged alike. Ported: Soft Light by Photoshop's formula, as Core Image computes it (2bs + b²(1 − 2s) up to half, 2b(1 − s) + √b(2s − 1) above), in `SeparableBlend::channel`, and `needsSurface` names Soft Light, so `HslBlend` blends it by hand everywhere a layer, a stack or an adjustment is drawn; `LayerRenderer::compositionMode` loses its Soft Light case (dead now). Compared first: Qt's `CompositionMode_SoftLight` is the PDF's (W3C) formula, which equals Photoshop's below a source of half and above it wherever the backdrop passes 0.25; under that it takes the PDF's cubic for √b and runs up to 17 levels darker (backdrop 5/255, source 1: 19 where Photoshop gives 36). Swift's 0.9 over 0.5 gives 170 under either formula. Known difference: Swift's Core Image is "within 5 levels of Photoshop's"; the twin is Photoshop's own formula, so it may differ from Swift's by those few levels. Tests: `BlendingTests` (Swift's `clippingStacksBlendInTheirBasesMode` for Linear Dodge, Color Dodge and Multiply: Swift's numbers, Copy Merged equal to export, the canvas within a level; adjustments in Difference and Linear Light over the document and Vivid Light and Subtract inside a stack, by the numbers, at full and half opacity, in all three places; Swift's `softLightMatchesPhotoshop` plus a dark backdrop and the lower branch; Swift's `softEdgedLayersBlendTheSame` for Soft Light, Overlay, Multiply and Color Dodge: a radial soft layer over noise, Copy Merged equal to export, the canvas within a level), `BlendModeTests::everyBlendModeMatchesThePdfFormulas` (its Soft Light reference is Photoshop's now; its backdrop of 0.1 under sources past half catches the PDF's cubic (at 0.25 the cubic equals √0.25)), `ClippingStackTests::stacksAndCoverageTakeTheDevicesPixels` (a half-unit stripe stays sharp at a device scale of two, in a stack and through coverage from a source further down). Equivalent mutant: Soft Light's `source <= 0.5` for `< 0.5` (both branches give the backdrop at a half). Judgments: stacks and coverage at device resolution, adjustments in any mode and a stack in its base's mode were held (proven by the tests above); Soft Light ported. Mutants: 5 on Soft Light, 4 caught, one equivalent (above).
|
||||
- The Metal canvas (13.9b: `cdf8674`, `4b04323`, `5708ed3`, `93de9e7`, `54dd707`, `91cb0b1`, `f773f7b`, `4c5e1a6`, `d04f159`, `b1b7490`). OmaPhoto stays a CPU canvas (the port's decision): Swift's GPU canvas, its `GPUCanvas`, `GPUNoise`, `MetalWarp` and `CanvasLinesOverlay` and the GPU branches of `EditorCanvas`, have no twin; the twin's canvas is the Core Graphics canvas those commits compare against. Ported: Grain and Add Noise anchored to the document (`54dd707`): `LiveMaskRenderer::adjustmentRegion` (Swift's `adjustmentRegion`) maps what the painter shows into the document, and the canvas's `drawLayers` sets it from its centre mapping and zoom, so the smooth path counts noise in frame pixels from the document's corner and Grain in document pixels, as export does, and the crisp path's surface maps to document pixels, so a partial repaint keeps one field; the blur's scale still comes from the unmapped region. This retires 9.5b's and 12.8c's known differences (Grain and noise following the view, a partial repaint's own field); `CanvasDisplayTests::grainFollowsTheViewOnTheCanvas` is gone. Export and `drawLiveComposite` already draw in document pixels and set no region, as Swift's. Tests: `AdjustmentCanvasTests` (Swift's `matchesEveryAdjustment`: every kind through a ramp mask at 80% over a photo and a translucent layer, the canvas within a level of the export over its checkerboard; Swift's `patternsStayWithTheDocument` for Add Noise and Grain: equal to export at 100% and 200%, panned and not, and at 80% a whole-pixel pan moving the pattern with the image and a partial repaint showing the whole's pattern within two levels of resampling), `CanvasEditContractTests` (Swift's `aNewMaskRevealsTheWholeLayer`, upright and turned: a one-pixel mask on a scaled layer changes no covered pixel, the canvas as the export; `matchesWhileMovingPixels`, moving and duplicating on a masked layer at 60% under a soft selection: the preview equals the commit and the export outside the ants, the hole only for a move; `matchesWhileDraggingAGradient` in a selection at 70%: the pending gradient equals its commit outside the overlays, nothing outside the selection; `5708ed3`'s failed fill cancelling with `brushError`, no step, the document unchanged; `matchesALiveMaskOutsideAClippingStack`: a turned source with a layer between, the canvas as the export), `CanvasContractFixtures.h` (the scene, the export over the canvas's checkerboard, a gap that skips the overlays' bands, the ramp mask). Judgments, each Swift contract held unless named above: `cdf8674`: rotation, flips, scale, sharp successive reductions, premultiplied blending in every mode with layer and ancestor opacity, the checkerboard anchored to the document, the crisp composite at high zoom, sampling modes and rounded-up reduction extents, premultiplied blending in sRGB, the surround, shadow and border, placed own masks and multiplied folder masks on pixel layers, filter, Levels and Hue/Saturation previews in the layer's place: held; the CPU paths are the reference and are pinned by `LayerRendererTests` (placement, sampling rules, halvings, overhang), `DownsampleTests`, `BlendModeTests`, `CanvasDisplayTests` (checkerboard, shadow and border, crisp from 200%, the rich scene against the export), `FolderOpacityTests`, `FolderMaskClipTests`, `MaskPlacementTests`, `LevelsCanvasTests`, `HueSaturationCanvasTests`, `VignetteCanvasTests`. `4b04323`: a moved or duplicated selection's preview and commit: held and now proven on a masked, translucent layer (above); the rounded offset is pinned by a move of 5.6 landing at 6 (`EffectsCanvasTests::movingPixelsKeepTheEffects`). Swift's laziness (`PixelMove.applyOffset`, `holed`, `liftedTarget`) only spares the GPU canvas a rebuild per move; the twin rebuilds eagerly in `movePixels`, which realises the tiles before display and commit by construction, and a failure there cancels the move with `brushError` (`PixelMoveTests::aPixelMoveHoldsTheSessionAndAFailedMoveCancels`). `5708ed3`, `91cb0b1`: live paint, erase and mask paint, paint past the old bounds under the old mask (`TiledStrokeTests`, `BrushPreviewTests`, `MaskPaintAnywhereTests`), Smudge and Liquify previews through the mask, opacity and placement (`SmearCanvasTests`, `FolderOpacityTests`): held. `GradientEdit.Fill` and `applyFill` are the GPU's laziness; the twin fills in `refreshGradient`, before display and commit by construction, a failure cancelling with `brushError` (now tested), and the commit publishes what was filled. `MetalWarpTests.matchesTheCPU`: the twin's `WarpStroke` is the CPU reference (`SmudgeLiquifyTests`); nothing to port. `93de9e7`: a one-pixel white mask revealing its layer: held (QPainter's smooth draw clamps an image's edge, as Core Graphics draws it; now tested); the live paint grid's extent and edge sampling: held (`TiledStrokeTests`, `DownsampleTests`, `TiledLayerTests`). `clampedToExtent` is GPU-only. `54dd707`: every adjustment kind with alpha, masks and opacLine truncated
|
||||
- Shift on a pixel drag and Select All from the list (13.10): `CanvasView::moveSelectionTool` (`EditorCanvas+Selection.cpp`) twins Swift's `60bde4f`: with Shift held a Ctrl-drag of selected pixels zeroes the shorter axis of the offset, lengths compared (`std::abs`), a tie keeping across, as `dragSelection` already does for the outline; read from each move's own modifiers, as Swift's `event.modifierFlags`. `451281e`: Swift's table now hands Select All to the canvas (`session.selectAll()`, guarded on a document) instead of selecting every row, so the twin's `NativeLayerList::selectAllRows` (12.5b's round-3 fix) and the menu's `focusedList` branch are gone: a focused list falls through to `session().selectAll()`, which guards on the document itself. A rename's editor is a `QLineEdit`, so it keeps its own Select All first, as Swift's field editor. Tests: `SelectionCanvasTests::shiftKeepsMovedPixelsOnALine` (across, down, a tie, a long left beating a short down, without Shift, the release keeping the last offset), `SelectMenuTests::selectAllInAFieldIsTheFields` (a real Ctrl+A on the focused list selects the canvas, history "Select All", layers and the active one unchanged, the list keeping focus; Swift's `selectAllInTheLayersPanelSelectsTheCanvas`). Mutants: 5 on the Shift branch, all caught (the `abs`-less comparison caught after the left-beats-down step was added). No survivors.
|
||||
- Why a brush cannot paint (13.11, `133c34a`): `EditorSession::paintRefusal` (`EditorSession+Brush.cpp`, declared in `EditorSession+Brush.h`) twins Swift's `paintRefusal`: none while `canEditLayers` refuses, without an active layer or when `canPaint` holds; then several layers, a folder's pixels, a hidden layer or one in a hidden folder, a mask turned off, an adjustment's pixels, an empty selection, in Swift's order and words, with Ctrl+D for ⌘D and the curly quotes kept. `beginBrush` splits Swift's guard: a tool that cannot paint the target (Spot Healing or Clone Stamp on a mask, a tool that is no brush) returns silently, a refused target sets `brushError` to the refusal (none when busy, so a waiting error is cleared, as Swift's `brushError = paintRefusal`). `beginWarp` sets the mask's words or the refusal. Fix beyond Swift: Swift's gradient sets the refusal only past its first guard, which is reached with a refused target only while a gradient is pending, where `canEditLayers` refuses and the refusal is always nil; so Swift's gradient says nothing on an empty selection, which its commit message says it explains. The twin's `beginGradient` sets the refusal at the first guard (no pending gradient, `canPaint` refusing); Swift's second assignment, always nil there, is left silent. Like the brush, the gradient's refusal while the editor is busy is none, which clears a stale alert where Swift's first guard returns untouched. `invertSelection` leaves no selection when the inverse is empty (Select All then Inverse), one `Inverse` step, as Swift's. Tests: `PaintRefusalTests` (every refusal, and the order at each seam that two reasons can share: two layers before a folder, a folder before its hiding, hiding before a mask turned off, an adjustment before an empty selection, a folder's or adjustment's mask past the folder or adjustment; the mask-off and adjustment tests exclude each other, so their order is unreachable; a layer inside a hidden folder; the gradient and the Smear; a busy session clearing, another tool silent), `SelectionTests::inverseOfEverythingDeselects` (Swift's). Equivalent mutants: `paintRefusal`'s `canPaint()` term (when `canPaint` holds every later test is false) and the empty-selection test without `isEmpty` (reached only when `canPaint` refuses for no listed reason, which needs an active layer outside `selectedLayerIDs`, which no session call makes). Painting at the layer's own resolution (13.11, `d3170ab`): `BrushStroke::Clone` is Swift's tuple `{image, placed, inGrid}`: the image painted through the tip and where it sits, in document pixels or in the stroke's own grid. `clonePixels` maps tile pixels through the grid (and `pixelToDocument` unless `inGrid`) into `placed`, scaled to the image, so a translation alone still copies or shifts by the fraction as before. `BrushStroke::gridRect` (in `BrushStroke+Commit.cpp`, beside `transform`, as Swift's) carries a document offset into the grid through the inverse map's linear part (`CGSize.applying`), turned, scaled and flipped as the layer. `cloneSample` takes the stroke and the offset: the stroke layer's own pixels placed at `gridRect(sourceRect, offset)`, or, sampling all layers, the composite at document size placed `offset` away; `blurSample` takes the stroke: the layer's pixels or mask drawn nearest at the margin of a region `ceil(3σ)` round `sourceRect`, σ the bar's Radius (13.16; Swift's tenth of the brush, 1.5 to 30, at 13.11) divided by the grid's document size per pixel (`sqrt|det|`) and capped at half the longer side, a mask on its edge tone first, softened through `PixelAdjust::gaussianBlur` (a mask's edge repeated, pixels clear past theirs) at σ × fit, in the pieces the brush reaches since 13.16, where fit shrinks the sample to a budget of `min(maxSurfacePixels, max(16 M, four canvases))`; it returns the region as `placed`, `inGrid`. Swift's old mask sample (the placement's black box, `drawCoverage`) is gone with it. `beginBrush` makes the stroke first, then samples into it, as Swift's; a sample that fails returns without a stroke. The Smear's commit places its copy at document size. The brush and eraser: Swift's commit only changes its CPU fallback's stamp (`stampDiameter`), dead in the twin (8.1); the held judgment holds: the twin's coverage is rendered in the stroke's grid, so `NativeResolutionPaintTests` passes Swift's erase cases (scaled down, unequal, turned, and on the canvas scaled back up) and the blank layer's document resolution without any change to `BrushStroke::grid` or `BrushCoverage`. Tests: `NativeResolutionPaintTests` (Swift's seven, plus the offset carried through a flipped and a turned layer, pixel for pixel), `BlurToolTests` (`theSampleFollowsTheRadius`, `theSampleIsInTheLayersOwnPixels`: twice as fine, and a tiny layer's cap; `aHugeLayersSampleIsMadeCoarser`: 16 M and four canvases; `aMaskSampleKeepsItsEdgeTone`), the tests' document clones through `documentClone` (`BrushFixtures.h`). Cancel and Apply, and Line truncated
|
||||
- Why a brush cannot paint (13.11, `133c34a`): `EditorSession::paintRefusal` (`EditorSession+Brush.cpp`, declared in `EditorSession+Brush.h`) twins Swift's `paintRefusal`: none while `canEditLayers` refuses, without an active layer or when `canPaint` holds; then several layers, a folder's pixels, a hidden layer or one in a hidden folder, a mask turned off, an adjustment's pixels, an empty selection, in Swift's order and words, with Ctrl+D for ⌘D and the curly quotes kept. `beginBrush` splits Swift's guard: a tool that cannot paint the target (Spot Healing or Clone Stamp on a mask, a tool that is no brush) returns silently, a refused target sets `brushError` to the refusal (none when busy, so a waiting error is cleared, as Swift's `brushError = paintRefusal`). `beginWarp` sets the mask's words or the refusal. Fix beyond Swift: Swift's gradient sets the refusal only past its first guard, which is reached with a refused target only while a gradient is pending, where `canEditLayers` refuses and the refusal is always nil; so Swift's gradient says nothing on an empty selection, which its commit message says it explains. The twin's `beginGradient` sets the refusal at the first guard (no pending gradient, `canPaint` refusing); Swift's second assignment, always nil there, is left silent. Like the brush, the gradient's refusal while the editor is busy is none, which clears a stale alert where Swift's first guard returns untouched. `invertSelection` leaves no selection when the inverse is empty (Select All then Inverse), one `Inverse` step, as Swift's. Tests: `PaintRefusalTests` (every refusal, and the order at each seam that two reasons can share: two layers before a folder, a folder before its hiding, hiding before a mask turned off, an adjustment before an empty selection, a folder's or adjustment's mask past the folder or adjustment; the mask-off and adjustment tests exclude each other, so their order is unreachable; a layer inside a hidden folder; the gradient and the Smear; a busy session clearing, another tool silent), `SelectionTests::inverseOfEverythingDeselects` (Swift's). Equivalent mutants: `paintRefusal`'s `canPaint()` term (when `canPaint` holds every later test is false) and the empty-selection test without `isEmpty` (reached only when `canPaint` refuses for no listed reason, which needs an active layer outside `selectedLayerIDs`, which no session call makes). Painting at the layer's own resolution (13.11, `d3170ab`): `BrushStroke::Clone` is Swift's tuple `{image, placed, inGrid}`: the image painted through the tip and where it sits, in document pixels or in the stroke's own grid. `clonePixels` maps tile pixels through the grid (and `pixelToDocument` unless `inGrid`) into `placed`, scaled to the image, so a translation alone still copies or shifts by the fraction as before. `BrushStroke::gridRect` (in `BrushStroke+Commit.cpp`, beside `transform`, as Swift's) carries a document offset into the grid through the inverse map's linear part (`CGSize.applying`), turned, scaled and flipped as the layer. `cloneSample` takes the stroke and the offset: the stroke layer's own pixels placed at `gridRect(sourceRect, offset)`, or, sampling all layers, the composite at document size placed `offset` away; `blurSample` takes the stroke: the layer's pixels or mask drawn nearest at the margin of a region `ceil(3σ)` round `sourceRect`, σ the bar's Radius (13.16; Swift's tenth of the brush, 1.5 to 30, at 13.11) divided by the grid's document size per pixel (`sqrt|det|`) and capped at half the longer side, a mask on its edge tone first (Swift's `if let` on the mask and its `?? 0` for a missing document are dead, since the mask's asset is the sample and a stroke needs a document, and left out), softened through `PixelAdjust::gaussianBlur` (a mask's edge repeated, pixels clear past theirs) at σ × fit, in the pieces the brush reaches since 13.16, where fit shrinks the sample to a budget of `min(maxSurfacePixels, max(16 M, four canvases))`; it returns the region as `placed`, `inGrid`. Swift's old mask sample (the placement's black box, `drawCoverage`) is gone with it. `beginBrush` makes the stroke first, then samples into it, as Swift's; a sample that fails returns without a stroke. The Smear's commit places its copy at document size. The brush and eraser: Swift's commit only changes its CPU fallback's stamp (`stampDiameter`), dead in the twin (8.1); the held judgment holds: the twin's coverage is rendered in the stroke's grid, so `NativeResolutionPaintTests` passes Swift's erase cases (scaled down, unequal, turned, and on the canvas scaled back up) and the blank layer's document resolution without any change to `BrushStroke::grid` or `BrushCoverage`. Tests: `NativeResolutionPaintTests` (Swift's seven, plus the offset carried through a flipped and a turned layer, pixel for pixel), `BlurToolTests` (`theSampleFollowsTheRadius`, `theSampleIsInTheLayersOwnPixels`: twice as fine, and a tiny layer's cap; `aHugeLayersSampleIsMadeLine truncated
|
||||
- Masks as Photoshop's (13.12, `b3419ab`): `addMask` with a selection now reveals it (white inside, black outside, the coverage as drawn) and, `revealing` false, hides it (the coverage inverted), one `Reveal Selection` or `Hide Selection` step; the row menu's Reveal All and Hide All call it as before, so Hide All with a selection hides the selection. `LayerMaskMenu` reads Alt from `QGuiApplication::keyboardModifiers()` when clicked, Swift's `NSApp.currentEvent`, so Alt-click adds the opposite, with Swift's help in Alt's words. The session keeps `viewsMaskAlone` (a getter and a setter that notifies on a change, the badge's write; `EditorSession.h`, defined in `EditorSession.cpp` beside Swift's `didSet`) and `maskAloneLayer()` (Swift's computed property: the view asked, the mask targeted, the active layer with a mask); `isMaskSelected` gains Swift's `didSet` as a private `setIsMaskSelected` (declared in `LayerMask+Session.h`, since `EditorSession.h` sits at 499 lines; defined in `EditorSession.cpp`), which every former write of `m_isMaskSelected` now calls, so targeting the pixels, another layer, a deleted mask or a load ends the view. `maskAloneLayer` and `toggleMaskAlone` live in `LayerMask+Alone.cpp`, since `LayerMask.cpp` already held 495 lines. `toggleMaskAlone` targets the mask through `selectLayerTarget` and shows it unless it already showed; where that refuses and leaves another target, so does the toggle, but with the project busy and the same mask already targeted the refusal is silent and the view still flips, as Swift's does. The canvas's `DisplayState` gains `maskAlone` (the mask asset's `ImageIdentity`, whether or not enabled, since the composite may skip it), and `drawLayers` hands off to `drawMaskAlone` (`EditorCanvas+Masks.cpp`, beside `liveFolderMaskClip`, which moved there to keep `EditorCanvas.cpp` under 500 lines): the canvas filled with the mask's edge tone, then a brush stroke or gradient laid into that mask through `LayerRenderer::drawBrushPreview` (the painted mask's own raster when it has one), else the mask at its displayed placement or the layer's transform, gray where it shows; the crisp zoom path draws through `drawLayers` too. The list's mask thumbnail: Alt's release without a drag calls `toggleMaskAlone`, only inside the thumbnail after a move under `startDragDistance` (4.7's rule; Swift's `dragMaskCopy` toggles on any left-up before a 3-point drag) (Shift no longer toggles there, as Swift's), the tooltip names Alt-click, and the targeted ring is white while that mask shows alone (`setTargeted`'s `alone`; Swift's `maskAloneLayer?.id == layerID` is left out as dead: the ring shows only on the active row, whose layer is the one shown alone). `LayerListFocusTests` and `LayerDragGestureTests` expected Alt-Shift to toggle the mask; they now expect Swift's view. `MaskAloneBadge` (in `UI/LayerMaskMenu`, Swift's file) is 26 points tall, 75% black with a 14% white rim, radius 13: the mask glyph at 11, "Layer Mask" 12 px semibold, the layer's name 12 px at 60% white, elided within 220 points, and an `xmark` button (a new `LayerIcon`, Swift's bold `xmark` as two round-capped strokes) with Swift's tooltip in Alt's words and accessible name, which ends the view. `ContentView` keeps one badge, shown while `maskAloneLayer` holds, in a layout nested in the canvas slot (it starts hidden through `synchronize`, which the constructor runs) (bottom, centred, 14 points up), so the room beside and below it stays the canvas's; Qt child widgets take their own clicks, so Swift's AppKit hosting has no twin. Swift's GPU fix (a mask stroke's grid starting at the mask's background) is the twin's behaviour already: `allocateTile` fills a mask tile with `maskBackground`. Tests: `MaskAloneTests` (Swift's three, plus another layer ending the view and the setter's signal, a stroke and a gradient shown as committed, a disabled and a placed mask, the crisp zoom, the badge's words, place, elision and clicks, the list's Alt-click, Shift ignored and the white ring; the view across undo and redo and when the shown mask is targeted again; a pending pixel gradient on the layer and another layer's pending mask gradient kept out of the view while their commits are posted), `SelectionEditTests` (Swift's renamed two and the scaled layer's hiding mask), `LayersPanelTests::theMaskButtonUsesTheSelection` (plain and Alt clicks with and without a selection, the tooltips, the row's Hide All). Mutants: the session 10 + 1 rerun (the active-layer term of `toggleMaskAlone` pinned by a busy refusal with another layer's mask targeted), equivalent: `maskAloneLayer`'s `m_isMaskSelected` and `layer->mask` terms (every path that clears either clears the view through `setIsMaskSelected`; Swift's guards, kept); `drawMaskAlone` 6 + 3 reruns (the placement pinned off the old box), the stroke's `isMask` and layer terms are live, not equivalent: `resolveGradient` only posts the commit, so a pending pixel gradient, or another layer's mask gradieLine truncated
|
||||
- Quit mid-edit and Scanlines (13.17, Swift 1.4.4). Quit (`1aad384`): `ProjectWorkspace::settlePendingEdits` twins Swift's: on the tab on screen a pending gradient is applied (`commitGradient`), then a pixel move (`finishPixelMove`), then a filter, Hue/Saturation, Levels, Color Range, the Expand/Contract/Feather panel (`setSelectionAmountOperation(nullopt)`) and the colour picker are cancelled (their Cancel, so nothing un-OK'd lands). It takes a completion callback (Swift's `async`), run from the event loop once both commits have landed, and only while the workspace lives (`QPointer`), the tab kept alive in the callbacks as every workspace flow keeps it. `confirmQuit` refuses at once while the workspace manages (Swift's guard moved there from `applicationShouldTerminate`; the twin's window close reaches `confirmQuit` directly, so this guard is what stops a second close mid-quit), applies open text, settles, and only then asks `canSwitch`; a refusal there (a busy project, a commit still running) is a warning on `omaphoto.app` where Swift beeps. Swift's `gradientEdit != nil` and `pixelMove != nil` tests before awaiting are left out: both twins return (posted) when there is nothing to commit. Swift's `finishAdjustmentEditing(commit: false)` is left out as dead: `cancelFilter`, `cancelHueSaturation` and `cancelLevels`, each called before it, call it first, and an adjustment's editor is always one of those three (its request and original are set and cleared with them; while the editor still renders, `finishAdjustmentEditing` does nothing in Swift either, and `canSwitch` refuses the quit). Tests: `QuitPendingEditsTests` (the tab on screen settled and another left as it is; a quit refused while an adjustment's editor is asked for and not yet rendered, then cancelled once open; Swift's `quittingAppliesAPendingGradient` and `quittingCancelsAnOpenDialog`; a pixel move applied as one `Move Pixels` step; Color Range putting the selection back, the selection-amount panel, the colour picker not taking its colour; an adjustment's editor putting the settings back; a workspace gone mid-settle calling nothing; closing the window applying the gradient before the Save question; a busy project refused with the warning, nothing asked or applied; a second quit while the first asks refused unsettled). Scanlines (`9c99853`, `cd2f998`): `DitherStyle::scanlines` ("Scanlines (CRT)") joins the fourth group; `usesPixelSize` (false for ASCII and Scanlines: no chunky pixels, no Pixel Size or Pixel Shape rows) and `drawsMarks` without Scanlines, as Swift's. `DitherSettings` gains `lineSpacing` (2–32, rounded, 4), `glow` (0–100, 35), `dots` (0–100, 0) and `wobble` (0–64 px, unrounded, 0), normalized as Swift's; the kernel's cell is the line spacing for Scanlines. `kernels/DitherPixels.c/.h` are cd2f998's, with one adaptation: Swift's kernel threads through GCD (`dispatch_apply`) and Apple blocks, which GCC cannot compile. `in_bands` keeps Swift's split (one band under 64 items, else 32) but takes a C function and a context; the three block bodies (the tone pass, the scanlines, the glow) are moved word for word into static functions with context structs (`tone_job`, `scan_job`, `glow_job`), and `__block int failed` is a C11 `atomic_int`. The bands run through `dither_bands`, a C hook defined in `Document/Dither.cpp` on `PoolMap::blocking` (QtConcurrent, so a filter worker lends its pool place). The arithmetic is unchanged; this is a forced difference (GCC has no blocks or GCD), agreed with the coordinator. `bandsDrawAsOneBandDoes` holds 32 bands against one: the top rows of a 300-row picture equal a 62-row picture's, which runs as one band in both passes. `glowing` twins Swift's: sigma `lineSpacing × 3 + 3`, shrunk by `max(1, floor(sigma / 4))`, blurred at `sigma / shrink`, scaled back and added through `dither_glow` at `glow / 100 × 2.5`. Core Image clamps to the extent before it shrinks, so the twin pads the image by the blur's reach (three sigmas, a whole number of shrink steps) with its edges repeated, the far sides filled to a whole number of steps so the shrink and the enlargement are both exactly the shrink (`theGlowScalesBackExactlyOffTheStep`), shrinks that with `QImage::scaled`'s smooth filter (an area average, where Core Image samples bilinearly), blurs with the edge repeated (`PixelAdjust::gaussianBlur`), scales back bilinearly and crops the middle; it stays within three levels of light of Swift's first commit's full-size blur (`theGlowIsTheBlurredLightAtItsAmount`, both axes). The sheet adds Line Spacing (px), Glow (%), Dots (%) and Wobble (px) with Swift's help under Scanlines, and Pixel Size and Pixel Shape follow `usesPixelSize`. Tests: `ScanlinesTests` (Swift's four `DitherTests`; the beam's rows for white, 0.35 gray and a striped average; the style's flags and that pixel size, shape and cell size change nothing; the four settings' clamps, the rows' units and ranges read from the sliders, rounding and defaults; TwLine truncated
|
||||
- Quit mid-edit and Scanlines (13.17, Swift 1.4.4). Quit (`1aad384`): `ProjectWorkspace::settlePendingEdits` twins Swift's: on the tab on screen a pending gradient is applied (`commitGradient`), then a pixel move (`finishPixelMove`), then a filter, Hue/Saturation, Levels, Color Range, the Expand/Contract/Feather panel (`setSelectionAmountOperation(nullopt)`) and the colour picker are cancelled (their Cancel, so nothing un-OK'd lands). It takes a completion callback (Swift's `async`), run from the event loop once both commits have landed, and only while the workspace lives (`QPointer`), the tab kept alive in the callbacks as every workspace flow keeps it. `confirmQuit` refuses at once while the workspace manages (Swift's guard moved there from `applicationShouldTerminate`; the twin's window close reaches `confirmQuit` directly, so this guard is what stops a second close mid-quit), applies open text, settles, and only then asks `canSwitch`; a refusal there (a busy project, a commit still running) is a warning on `omaphoto.app` where Swift beeps. Swift's `gradientEdit != nil` and `pixelMove != nil` tests before awaiting are left out: both twins return (posted) when there is nothing to commit. Swift's `finishAdjustmentEditing(commit: false)` is left out as dead: `cancelFilter`, `cancelHueSaturation` and `cancelLevels`, each called before it, call it first, and an adjustment's editor is always one of those three (its request and original are set and cleared with them; while the editor still renders, `finishAdjustmentEditing` does nothing in Swift either, and `canSwitch` refuses the quit). Tests: `QuitPendingEditsTests` (the tab on screen settled and another left as it is; a quit refused while an adjustment's editor is asked for and not yet rendered, then cancelled once open; Swift's `quittingAppliesAPendingGradient` and `quittingCancelsAnOpenDialog`; a pixel move applied as one `Move Pixels` step; Color Range putting the selection back, the selection-amount panel, the colour picker not taking its colour; an adjustment's editor putting the settings back; a workspace gone mid-settle calling nothing; closing the window applying the gradient before the Save question; a busy project refused with the warning, nothing asked or applied; a second quit while the first asks refused unsettled). Scanlines (`9c99853`, `cd2f998`): `DitherStyle::scanlines` ("Scanlines (CRT)") joins the fourth group; `usesPixelSize` (false for ASCII and Scanlines: no chunky pixels, no Pixel Size or Pixel Shape rows) and `drawsMarks` without Scanlines, as Swift's. `DitherSettings` gains `lineSpacing` (2–32, rounded, 4), `glow` (0–100, 35), `dots` (0–100, 0) and `wobble` (0–64 px, unrounded, 0), normalized as Swift's; the kernel's cell is the line spacing for Scanlines. `kernels/DitherPixels.c/.h` are cd2f998's, with one adaptation: Swift's kernel threads through GCD (`dispatch_apply`) and Apple blocks, which GCC cannot compile. `in_bands` keeps Swift's split (one band under 64 items, else 32) but takes a C function and a context; the three block bodies (the tone pass, the scanlines, the glow) are moved word for word into static functions with context structs (`tone_job`, `scan_job`, `glow_job`), and `__block int failed` is a C11 `atomic_int`. The bands run through `dither_bands`, a C hook defined in `Document/Dither.cpp` on `PoolMap::blocking` (QtConcurrent, so a filter worker lends its pool place). The arithmetic is unchanged; this is a forced difference (GCC has no blocks or GCD), agreed with the coordinator. `bandsDrawAsOneBandDoes` holds 32 bands against one: the top rows of a 300-row picture equal a 62-row picture's, which runs as one band in both passes. `glowing` twins Swift's: sigma `lineSpacing × 3 + 3`, shrunk by `max(1, floor(sigma / 4))`, blurred at `sigma / shrink`, scaled back and added through `dither_glow` at `glow / 100 × 2.5`. Core Image clamps to the extent before it shrinks, so the twin pads the image by the blur's reach (three sigmas, a whole number of shrink steps) with its edges repeated, the far sides filled to a whole number of steps so the shrink and the enlargement are both exactly the shrink (`theGlowScalesBackExactlyOffTheStep`), shrinks that with `QImage::scaled`'s smooth filter (an area average, where Core Image samples bilinearly), blurs with the edge repeated (`PixelAdjust::gaussianBlur`), scales back bilinearly and crops the middle; it stays within three levels of light of Swift's first commit's full-size blur (`theGlowIsTheBlurredLightAtItsAmount`, both axes). The sheet adds Line Spacing (px), Glow (%), Dots (%) and Wobble (px) with Swift's help under Scanlines, and Pixel Size and Pixel Shape follow `usesPixelSize`. Tests: `ScanlinesTests` (Swift's four `DitherTests`; the beam's rows for white, 0.35 gray and a striped average; the style's flags and that pixel size, shape and cell size change nothing; the four settings' clamps, the rows' units and ranges read from the sliders, rounding and defaults; TwLine truncated
|
||||
- Camera Raw curves as Photoshop's (13.18, Swift 1.4.5: `60d9117`): `kernels/AdjustPixels.c/.h` are 60d9117's: the tone curve runs on red, green and blue alike (`toneLut`, Swift's rename of `lumaLut`), and Refine Saturation means what Swift's now means: 0 the curve per channel, below 0 easing toward the colour scaled to the curved brightness (−100 brightness alone), above 0 pushing the curved colour from its luminance by 1 + the amount. `CameraRawCurveSettings::parametric` twins Swift's: unchanged with all four amounts at 0; otherwise 33 anchors, each `bend` of `bend` (shadows and highlights past the outer dividers, then darks and lights either side of the middle one, gamma curves of strength 1.66), run through the same curve as Image › Curves (`point`), so the regions meet without a corner. `bend` is a private static, as Swift's; `lumaTable` is `toneTable`. The twin's normalization of the dividers (5–90, +2 apart, 98 at most) still clamps what a drag writes. The graph's gestures (`UI/CameraRawColorControls+Curve.cpp`, beside the controls' file) are Swift's single `DragGesture`: a left press picks once (`parametricDrag`: within 18 points of the bottom the nearest divider, the first of equals; elsewhere the region whose tone range holds the press, a tone on a divider joining the region above; `pointDrag`: the point nearest by distance within 0.055, chosen; else a new point there, if fewer than 16, inside x 0.01–0.99 and over a hundredth from every point's x, sorted in, stored and chosen), then `continueDrag` runs at the press and on every left-button move: a point's output follows the pointer, an inner point's x stays a hundredth inside its neighbours, an end keeps its x; a divider follows, shadow below dark − 2 and dark below light − 2; a region's amount is its start minus the drag's height over the graph's times 200, within ±100, rounded. Left out as dead, since normalizing does each (`CameraRawCurveSettings::normalized`: amounts, dividers 5–90, +2 apart, 98 at most, and the repair's 0–1 outputs): Swift's 2–98 clamp of a divider, dark's `shadow + 2` floor and light's `dark + 2` floor, and the 0–1 clamps of a dragged or new point's output (a press inside the graph is inside 0–1 anyway). The new point's `x > 0.01` and `x < 0.99` are dead too: the ends sit at 0 and 1, and a point within a hundredth of any x is refused. `bend`'s `lower > 0` and `upper < 1` are dead (no tone lies below 0 or above 1). The release lets go. Qt can lose a release, so every press picks afresh. A double click is Qt's second press: it picks and drags as a press (Swift's drag sees it too), then on the point page removes the nearest inner point by x within 0.04 and drops the choice, and lets go of the drag (Swift removes at the tap's end, which ends the drag). Swift re-picks on each move while a press picked nothing; with the same start and points it picks nothing again, so the twin leaves that out. The chosen point (Swift's `selected`) draws in `Highlight`, the accent, and the readout shows only while it exists, following the drag; another channel drops the choice and the drag (Swift's `onChange`). The graph's help and Refine Saturation's are Swift's new words. Swift's `CameraRawMixerControls` gains the same `Drag` and `selected` state but never reads it: dead, left out. A fix beyond Swift: Swift holds an inner point exactly a hundredth from its neighbours, where the curve's repair (`x > kept.x + 0.01`) drops it (or drops the next point), and the drag's index then names another point; the twin holds it a billionth further inside, so the repair keeps it and the drag stays on it (`aPointIsPickedByDistanceAndKept`, `endPointsStayAndARealDoubleClickRemoves`, both failing before the fix; `CameraRawColorTests` pins the repair's strict `>` at exactly a hundredth, which the fix rests on). A fix beyond Swift: a preset's points drop the choice (TASKS asks for it; Swift's `applyPreset` keeps the index, which then lights whatever point holds it); Custom changes nothing and keeps it. Tests: `CameraRawCurveTests` (Swift's `parametricCurveIsSmooth`, `parametricCurveMatchesPhotoshop`, `curveDeepensColorLikePhotoshop`; each anchor against the bend written apart, and the smooth curve between; each region bending only its range, dividers at the ends bending nothing; the tone table through the point curve; Refine Saturation at 0 per channel through the table, −100 brightness with the hue kept, −50 halfway, +50 half again from luminance), `CameraRawCurveGraphTests` (a double click's 0.04 reach by x, and one in the divider strip moving the divider; regions lifted and lowered from their start, clamped and rounded, picked once by tone; dividers in the strip, nearest and first of equals, kept ordered and within the settings' limits; points by distance, kept through the drag, a new point added and dragged by the same press, ends moving their outputs alone; refusals near an edge, a point's x, at sixteen; the chosen point lit and read Line truncated
|
||||
- Held keys, field values and resize snapping in the Move tool (13.13: `bca8f13`, `03d692c`, `686d8c7`, `c459f88`): `UI/HeldModifiers` twins Swift's class, a `QObject` singleton (`shared()`) with one signal, `changed()`. An application event filter reads key presses and releases and left-button presses and releases, Swift's `flagsChanged`, `keyDown`, `leftMouseDown` and `leftMouseUp`; a modifier key's own event sets or clears its bit, since Qt's event may not count it yet. Ctrl, Shift, Alt and Meta count (Swift's Command, Shift, Option, Control). Typing counts as none: Swift's `NSText` first responder is a focus widget with `Qt::WA_InputMethodEnabled`, so a `QLineEdit` and the canvas holding open text alike. `applicationStateChanged` stands for the two activation notifications (inactive clears; active reads `queryKeyboardModifiers`), and a `QMenu`'s `Hide` for `NSMenu.didEndTracking`. `TransformInspector` shows Auto Select as `transformAutoSelect != Ctrl` and the lock as `locksTransformRatio != Shift`, and a click while held writes the other way, as Swift's bindings; it synchronizes on `HeldModifiers::changed` too. Tooltips carry Swift's new words, Ctrl for Command. `transformPressLayer` follows Swift's: `autoSelect = transformAutoSelect != Ctrl`; Ctrl picks the layer under the pointer only with Auto Select off or with Shift (Ctrl+Shift adds either way). `TransformEdit.fromFields` sits last; `beginTransform(persistent, fromFields)` sets it, where Swift writes `transformEdit?.fromFields` in place (the twin's edit is read-only from outside). The bar's `change` opens a non-persistent `fromFields` edit; `finish` commits it, one step, when a field's scrub ends (`NumericScrub`'s `onEnd`) or the field loses focus. A focus borrowed by a menu, a popup or another window in front (`ActiveWindowFocusReason`, new: AppKit keeps the first responder when the app goes to the back) finishes nothing and keeps the typing. Escape in a field throws a `fromFields` edit away before handing the canvas the keys. The Swift path assumed: AppKit sends the Cancel button's Escape key equivalent (`configuredNativeShortcut(.escape)`) before the field editor, the only way `686d8c7`'s "Escape still throws the change away" can hold, since the field's own `onExitCommand` would end the focus and so apply the value. That path would also cancel a Ctrl+T edit from a field (and Return apply it); the twin keeps 6.1's reading there, a Ctrl+T edit waiting for the canvas's keys, a known difference held from 6.1. Flip H, Flip V and Sampling open a `fromFields` edit with no finish of their own, as Swift's do: it applies with the next field's finish, a canvas drag or anything that commits. `beginTransformDrag` commits a `fromFields` edit first, after `transformPressLayer` (so it picks nothing, as Swift's `picks`), so the two stay separate steps. Qt moves the focus before a press arrives, where SwiftUI's focus changes after `mouseDown`: a field left for a mouse press (`MouseFocusReason`) finishes from the event loop (a zero `QTimer`), so a typed value then a press over another layer drags the active layer under Auto Select, as in Swift (review 2's finding; `MoveBarPressTests`). `snappedResizePoint` lives in `Document/Crop.cpp` with Swift's: the edges each axis moves snap on their own to `transformSnapTargets` (the file's `nearest`, the first of ties), the nearer alone when proportional, the pointer nudged by one pixel's measured step; an upright layer only; guides set, or cleared when snapping is off, the drag is no resize or the layer turned. `dragTransform` snaps a resize unless Ctrl is held, proportional as `locksTransformRatio != Shift`. Dead or equivalent: `beginDistort` keeps `fromFields` where Swift's rebuild drops it, but a `fromFields` edit never reaches it (the canvas commits it before any handle drag). `snappedResizePoint`'s `before` read from `update(result)` or `update(point)` is equivalent (unlocked axes are independent, and proportional leaves one snap). The edge's tie (`<=`, the low edge) is reachable (the right handle half a pixel from its anchor, a one-pixel box) and held by `aTieTakesTheLowEdge`; the dragged handle's carried place by a drag past the anchor (`aLongDragSnapsTheEdgeItCarries`); Alt's centre resize by `altResizesFromTheCentreAndSnaps`. `QRectF::normalized` was dropped as dead (a resize keeps sizes positive and flips instead). Untested paths: the menu `Hide` and the activation's `queryKeyboardModifiers` (offscreen holds no real keyboard state). Tests: `MoveBarPressTests` (a typed value then a real press on another layer drags the active layer, two steps; Ctrl with a folder active and Auto Select on drags the folder past its box), `MovePressFixtures.h` (the canvas fixture the three press files share), `TransformPressTests` (Swift's `commandFlipsAutoSelectWhileHeld` both ways and `commandShiftClickAddsALayerWithAutoSelectOn`, Ctrl outside the active layer, a field edit applied before a canvas drag; the old "resizing never snapLine truncated
|
||||
- The Smear's 1.4.2–1.4.3 fixes (13.16, part one: `7164dd4`, `ad9ad7c`, `504129d`, and `095da2f`'s commit half): Liquify is Swift's new GPU stroke on the CPU, as the twin has no Metal: `WarpStroke` keeps the layer as it found it (`m_original`, a copy made in the constructor) and a source offset per pixel (`m_offsets`, two floats each, zero at first); each dab copies the offsets under it to `m_scratch`, reads them bilinearly from behind the brush's travel, less the travel times the weight, writes them back, and draws the pixel afresh from the untouched layer, bilinear, held to its edges, each byte rounded once: `warp_push` of `MetalWarp.swift`, float for float (bytes over 255, mixed, times 255). Swift allocates the two textures on the first push; the twin allocates them with the stroke, before any dab (nothing changes the copy between), so a failure is `ExportError(render)` where `beginWarp` catches it, where Swift's guard returns in silence; Smudge's carried colour, allocated at the first dab inside `beginWarp`, fails the same way, and a dab's scratch that finds no memory skips that dab with a warning on `compositor.rendering`, Swift's guard on its scratch texture (review 2: it ran outside any catch). The colour reads keep the shader's `size - 2` as they are: the offsets' read above needs two columns and rows of the dab's area (`ix`, `iy`), which a canvas a pixel wide or tall lacks, so no read leaves the image; the clamps first written here for such canvases were dead and are removed (review 2). Smudge is `ad9ad7c` in both of Swift's paths: dabs every 0.005 of the width (a pixel at least), each dab lays what it carries at weight × strength, and carries what it just left, nothing older. `BrushSettings.blurRadius` (5) is the Blur's own Radius: the sample's sigma follows the Radius (see part two for the merged formula). `BrushControls` shows Radius for the Blur mode alone, after Strength: a scrubbable label (a tenth a point, 0.5–50), a 100-point slider over 0.5–20 in hundredths (past 20 Qt rests it at its end, so Swift's `min(20, …)` is left out), and a 42-point `PickerField` with "px": a readable number applies on Return or leaving, clamped, a number that is not finite takes 5 (Swift's binding), other text goes back, arrows step one (Shift ten) from the session's value, clamped; it prints Swift's `fractionLength(0...1)`, never grouped. `BrushStroke::maxDiameter` is 2100, so `finishWarp`'s tip four wider than a 2000 brush is no longer refused; `finishWarp` appends a dab centre only every twentieth of the brush (the last always), as Swift's; the thinning is `WarpStroke::committedPoints`, so the test reads it directly (`aCommitKeepsATwentiethAndTheLastPoint`). Part two (`095da2f`'s Blur half, on 13.11's grid sampling, cc9bf95 merged into port-d): `BrushStroke::Clone` is 13.11's `(image, placed, inGrid)` plus `render`, a function that makes a part of `image` (Swift's `cloneRender`; Swift keeps it beside `clone`, the twin inside it, so one assignment sets both), and `clone` is private behind `clone()` and `setClone()`, which drops the pieces cut so far (Swift's two `didSet`s). `clonePixels(key, tile)` is Swift's `clonePiece`: the tile mapped into sample pixels through 13.11's chain (grid, `pixelToDocument` unless `inGrid`, then `placed` to the image's pixels, Swift's `scaleX` and `scaleY`), two pixels round, made whole outward (`toAlignedRect`, Swift's `integral`), held to the image; an empty part paints nothing on that tile (the fill is skipped, as Swift's `if let piece`); otherwise the piece is `render(part)` or a copy, cut once per tile key and kept in `m_clonePieces`, and the tile's sample is drawn from it through the same transform shifted by the piece's corner, so every path reads the pixels the whole image would give. A piece that cannot be allocated is `ExportError(render)`, thrown on the calling thread with `publish`'s other copies, where Swift's `cropping` returning nil paints nothing. `blurSample(stroke)` returns the sharp sample in the stroke's grid (13.11's `region`, `fit` and budget unchanged) with `render` blurring a part at `sigma × fit`, padded by the Gaussian's reach (`ceil(3σ)`) and cut back, clear past the sample for pixels (`QImage::copy` fills outside with zeros), its edges repeated for a mask (Swift's `clampedToExtent`), so a piece equals that part of the whole byte for byte (Swift allows one level). The Radius sigma is Swift's `min(min(50, max(0.5, blurRadius)) / perPixel, sidePixels / 2)`. Merge: port-c's direct `clone =` writes became `setClone` (`beginBrush`, `finishWarp`, `cloneSample`'s callers, the tests and `documentClone`), every `Clone` initialiser names `render` (GCC's `-Wmissing-field-initializers`), and port-c's Blur sample tests compare the sharp sample (`framed`) and its softening through `render` (`soft`), with each brush size's old sigma now set as the Radius. Equivalent mutants and untested paths for part two: a piece, a padded copy or a cut-back blur that cannoLine truncated
|
||||
- Held keys, field values and resize snapping in the Move tool (13.13: `bca8f13`, `03d692c`, `686d8c7`, `c459f88`): `UI/HeldModifiers` twins Swift's class, a `QObject` singleton (`shared()`) with one signal, `changed()`. An application event filter reads key presses and releases and left-button presses and releases, Swift's `flagsChanged`, `keyDown`, `leftMouseDown` and `leftMouseUp`; a modifier key's own event sets or clears its bit, since Qt's event may not count it yet. Ctrl, Shift, Alt and Meta count (Swift's Command, Shift, Option, Control). Typing counts as none: Swift's `NSText` first responder is a focus widget with `Qt::WA_InputMethodEnabled`, so a `QLineEdit` and the canvas holding open text alike. `applicationStateChanged` stands for the two activation notifications (inactive clears; active reads `queryKeyboardModifiers`), and a `QMenu`'s `Hide` for `NSMenu.didEndTracking`. `TransformInspector` shows Auto Select as `transformAutoSelect != Ctrl` and the lock as `locksTransformRatio != Shift`, and a click while held writes the other way, as Swift's bindings; it synchronizes on `HeldModifiers::changed` too. Tooltips carry Swift's new words, Ctrl for Command. `transformPressLayer` follows Swift's: `autoSelect = transformAutoSelect != Ctrl`; Ctrl picks the layer under the pointer only with Auto Select off or with Shift (Ctrl+Shift adds either way). `TransformEdit.fromFields` sits last; `beginTransform(persistent, fromFields)` sets it, where Swift writes `transformEdit?.fromFields` in place (the twin's edit is read-only from outside). The bar's `change` opens a non-persistent `fromFields` edit; `finish` commits it, one step, when a field's scrub ends (`NumericScrub`'s `onEnd`) or the field loses focus. A focus borrowed by a menu, a popup or another window in front (`ActiveWindowFocusReason`, new: AppKit keeps the first responder when the app goes to the back) finishes nothing and keeps the typing. Escape in a field throws a `fromFields` edit away before handing the canvas the keys. The Swift path assumed: AppKit sends the Cancel button's Escape key equivalent (`configuredNativeShortcut(.escape)`) before the field editor, the only way `686d8c7`'s "Escape still throws the change away" can hold, since the field's own `onExitCommand` would end the focus and so apply the value. That path would also cancel a Ctrl+T edit from a field (and Return apply it); the twin keeps 6.1's reading there, a Ctrl+T edit waiting for the canvas's keys, a known difference held from 6.1. Flip H, Flip V and Sampling open a `fromFields` edit with no finish of their own, as Swift's do: it applies with the next field's finish, a canvas drag or anything that commits. `beginTransformDrag` commits a `fromFields` edit first, after `transformPressLayer` (so it picks nothing, as Swift's `picks`), so the two stay separate steps. Qt moves the focus before a press arrives, where SwiftUI's focus changes after `mouseDown`: a field left for a mouse press (`MouseFocusReason`) finishes from the event loop (a zero `QTimer`), so a typed value then a press over another layer drags the active layer under Auto Select, as in Swift (review 2's finding; `MoveBarPressTests`). `snappedResizePoint` lives in `Document/Crop.cpp` with Swift's: the edges each axis moves snap on their own to `transformSnapTargets` (the file's `nearest`, the first of ties), the nearer alone when proportional, the pointer nudged by one pixel's measured step; an upright layer only; guides set, or cleared when snapping is off, the drag is no resize or the layer turned. `dragTransform` snaps a resize unless Ctrl is held, proportional as `locksTransformRatio != Shift`. Dead or equivalent: `beginDistort` keeps `fromFields` where Swift's rebuild drops it, but a `fromFields` edit never reaches it (the canvas commits it before any handle drag). `snappedResizePoint`'s `before` read from `update(result)` or `update(point)` is equivalent (unlocked axes are independent, and proportional leaves one snap). The edge's tie (`<=`, the low edge) is reachable (the right handle half a pixel from its anchor, a one-pixel box) and held by `aTieTakesTheLowEdge`; the dragged handle's carried place by a drag past the anchor (`aLongDragSnapsTheEdgeItCarries`); Alt's centre resize by `altResizesFromTheCentreAndSnaps`. `QRectF::normalized` was dropped as dead (a resize keeps sizes positive and flips instead). Untested paths: the menu `Hide` and the activation's `queryKeyboardModifiers` (offscreen holds no real keyboard state). Tests: `MoveBarPressTests` (a typed value then a real press on another layer drags the active layer, two steps; Ctrl with a folder active and Auto Select on drags the folder past its box; a value left by a click in another field applies alone, one step), `MovePressFixtures.h` (the canvas fixture the three press files share), `TransformPressTests` (Swift's `commandFlipsAutoSelectWhileHeld` both ways and `commandShiftClickAddsALayerWithAutoSelectOn`, Ctrl outside the active layer, a fieLine truncated
|
||||
- The Smear's 1.4.2–1.4.3 fixes (13.16, part one: `7164dd4`, `ad9ad7c`, `504129d`, and `095da2f`'s commit half): Liquify is Swift's new GPU stroke on the CPU, as the twin has no Metal: `WarpStroke` keeps the layer as it found it (`m_original`, a copy made in the constructor) and a source offset per pixel (`m_offsets`, two floats each, zero at first); each dab copies the offsets under it to `m_scratch`, reads them bilinearly from behind the brush's travel, less the travel times the weight, writes them back, and draws the pixel afresh from the untouched layer, bilinear, held to its edges, each byte rounded once: `warp_push` of `MetalWarp.swift`, float for float (bytes over 255, mixed, times 255). Swift allocates the two textures on the first push; the twin allocates them with the stroke, before any dab (nothing changes the copy between), so a failure is `ExportError(render)` where `beginWarp` catches it, where Swift's guard returns in silence; Smudge's carried colour, allocated at the first dab inside `beginWarp`, fails the same way, and a dab's scratch that finds no memory skips that dab with a warning on `omaphoto.rendering`, Swift's guard on its scratch texture (review 2: it ran outside any catch). The colour reads keep the shader's `size - 2` as they are: the offsets' read above needs two columns and rows of the dab's area (`ix`, `iy`), which a canvas a pixel wide or tall lacks, so no read leaves the image; the clamps first written here for such canvases were dead and are removed (review 2). Smudge is `ad9ad7c` in both of Swift's paths: dabs every 0.005 of the width (a pixel at least), each dab lays what it carries at weight × strength, and carries what it just left, nothing older. `BrushSettings.blurRadius` (5) is the Blur's own Radius: the sample's sigma follows the Radius (see part two for the merged formula). `BrushControls` shows Radius for the Blur mode alone, after Strength: a scrubbable label (a tenth a point, 0.5–50), a 100-point slider over 0.5–20 in hundredths (past 20 Qt rests it at its end, so Swift's `min(20, …)` is left out), and a 42-point `PickerField` with "px": a readable number applies on Return or leaving, clamped, a number that is not finite takes 5 (Swift's binding), other text goes back, arrows step one (Shift ten) from the session's value, clamped; it prints Swift's `fractionLength(0...1)`, never grouped. `BrushStroke::maxDiameter` is 2100, so `finishWarp`'s tip four wider than a 2000 brush is no longer refused; `finishWarp` appends a dab centre only every twentieth of the brush (the last always), as Swift's; the thinning is `WarpStroke::committedPoints`, so the test reads it directly (`aCommitKeepsATwentiethAndTheLastPoint`). Part two (`095da2f`'s Blur half, on 13.11's grid sampling, cc9bf95 merged into port-d): `BrushStroke::Clone` is 13.11's `(image, placed, inGrid)` plus `render`, a function that makes a part of `image` (Swift's `cloneRender`; Swift keeps it beside `clone`, the twin inside it, so one assignment sets both), and `clone` is private behind `clone()` and `setClone()`, which drops the pieces cut so far (Swift's two `didSet`s). `clonePixels(key, tile)` is Swift's `clonePiece`: the tile mapped into sample pixels through 13.11's chain (grid, `pixelToDocument` unless `inGrid`, then `placed` to the image's pixels, Swift's `scaleX` and `scaleY`), two pixels round, made whole outward (`toAlignedRect`, Swift's `integral`), held to the image; an empty part paints nothing on that tile (the fill is skipped, as Swift's `if let piece`); otherwise the piece is `render(part)` or a copy, cut once per tile key and kept in `m_clonePieces`, and the tile's sample is drawn from it through the same transform shifted by the piece's corner, so every path reads the pixels the whole image would give. A piece that cannot be allocated is `ExportError(render)`, thrown on the calling thread with `publish`'s other copies, where Swift's `cropping` returning nil paints nothing. `blurSample(stroke)` returns the sharp sample in the stroke's grid (13.11's `region`, `fit` and budget unchanged) with `render` blurring a part at `sigma × fit`, padded by the Gaussian's reach (`ceil(3σ)`) and cut back, clear past the sample for pixels (`QImage::copy` fills outside with zeros), its edges repeated for a mask (Swift's `clampedToExtent`), so a piece equals that part of the whole byte for byte (Swift allows one level). The Radius sigma is Swift's `min(min(50, max(0.5, blurRadius)) / perPixel, sidePixels / 2)`. Merge: port-c's direct `clone =` writes became `setClone` (`beginBrush`, `finishWarp`, `cloneSample`'s callers, the tests and `documentClone`), every `Clone` initialiser names `render` (GCC's `-Wmissing-field-initializers`), and port-c's Blur sample tests compare the sharp sample (`framed`) and its softening through `render` (`soft`), with each brush size's old sigma now set as the Radius. Equivalent mutants and untested paths for part two: a piece, a padded copy or a cut-back blur that cannot Line truncated
|
||||
- Drops between projects: `ProjectWorkspace::draggedLayerSource` finds the tab whose document holds the dragged id (Swift reads the drag pasteboard; the twin reads the drag's `QMimeData`, which every drop target has), `canReceiveDrag(data, destination)` refuses only a layer's own tab, and `receiveProviders` copies several ids one after another, as Swift awaits each provider, so a two-row drop on the New button opens two tabs as Swift's does. `ContentView` takes such a drop over its whole area (`setWorkspace` hands it the workspace; `acceptsDrop` keeps Swift's guards: busy, the sheet, the importer, a rename; `levels` arrives with 9.x), shows the 3-point accent ring inside the canvas while targeted and hands the drop's document point on when it fell on the canvas. `ProjectTabButton` takes drops for its tab (accent fill and rim, "Add to <title>"), and `NewCanvasButton`, the toolbar's New canvas button with the action as its default, for a fresh tab ("Open in a new project tab"), both refusing an Alt drag, which duplicates in the panel; Swift's transient `NewTabDropSlot` in the strip has no twin, the New canvas button is `NewProjectDropTarget` already. Files and pictures arrived with 10.4.
|
||||
- `CanvasThumbnail` draws a layer or a mask inside the canvas's box at `backingScale` 2 (the panel's pixmaps carry that ratio); a mask's ground is `LayerMask::background`, white or black by its edge's majority, as the canvas treats it (Swift's `edgeTone` mean went with 12.12b). `LayerIcons` draws the panel's SF Symbols as paths, in one palette colour, like `ToolIcons`. `BlendModePicker` is a `QComboBox` whose popup previews the highlighted mode through `previewBlendMode` for the layer it opened on (Qt calls `hidePopup` before `activated`, so the preview, the target and the highlight are cleared from the event loop, after a choice had its chance) and refuses a choice once another layer is active. `LayerAppearanceControls` is Swift's blend and opacity row: the slider's press and release are one opacity drag (the release is watched application-wide while the slider is down, so a popup opened mid-drag cannot keep the step open), the percent field applies once through its `FocusOut`, which Return and Escape cause (Swift's `releasesFocusOnCommit`), and steps with Up and Down (Swift's `isFinite` test and the steps' clamp are left out: `setLayerOpacity` refuses a value that is no finite number and clamps the rest), and another active layer makes the controls anew, as Swift's `.id` does.
|
||||
- `ProjectWorkspaceView` is the `QMainWindow`: the front tab's `ContentView` as its central widget, made anew when another tab comes to the front, as SwiftUI's `.id` rebuilds it, and disabled while the workspace manages; the window holds the shown tab (`std::shared_ptr`) until the old editor is deleted, as Swift's views hold their session, so a replaced or closed tab's session never ends under its editor (`ProjectWorkspace::tab` is public for this); a `QToolBar` with the New canvas action, the `ProjectTabStrip` (which takes the toolbar's free width) and the four zoom actions, since SwiftUI's `.toolbar` modifier lives in `ContentView` but the toolbar belongs to the window. Its actions follow the front session's `changed()`, and on that signal the window syncs every tab's button as well, because a busy front tab dims the other tabs' buttons, which their own sessions' signals do not reach; the strip syncs its buttons on the workspace's signal, each button on its own session's. The window's title is the front tab's, with Qt's `[*]` placeholder, so `setWindowModified` can show the mark that `isDocumentEdited` shows; `setWindowFilePath` carries `representedURL`. The editor's own minimum size is cleared inside the window, which owns the 800 × 520 minimum for the whole, toolbar included. Closing the window ignores the event and asks the workspace (`closeWindow`), which confirms tab by tab and then closes the window again with the property `closeConfirmed` set, since the workspace may not include `UI/` headers; a confirmed close is accepted and the mark cleared, so a window shown again asks again. `ProjectTabStrip` is a plain `QWidget` whose buttons are kept for the tabs that stay, made for new tabs and deleted for tabs that went, and placed by hand from `projectTabOverflow` (13.14): every button at its own size hint, so no title is squeezed below Swift's 35 points, laid out again when the strip is resized, the workspace changes or any tab's session changes; it fills no background, so the toolbar shows through (a stylesheet would do the same but freezes the widgets' palette, so a theme switch would pass them by); the unsaved dot is a character before the title. Files named on the command line go to `ProjectWorkspace::receive`, as Finder's Open With reaches the delegate. Layer drops on tabs and the New canvas button are 4.7's; file and picture drops arrived with 10.4.
|
||||
@@ -202,7 +202,7 @@ Deliberate name breaks: `MetalBrushCoverage` → `BrushCoverage`, `MetalLayerEff
|
||||
- Omarchy theme: `src/UI/OmarchyTheme` reads `~/.local/state/omarchy/current/theme/colors.toml` (Omarchy 4.x: flat `key = "value"` lines, `mode` dark or light, the twenty-two stock themes' keys required, `orange` optional and `yellow` its stand-in) into `OmarchyColors`, applies them as the application palette (Window and Text from `background` and `foreground`, Base from `darker_background`, Button from `lighter_background`, Highlight and Link from `accent` with the background as highlighted text, PlaceholderText from `dark_foreground`, BrightText from `orange` or `yellow`, Mid from `muted`, the disabled roles from `muted`) and sets the Fusion style, which follows a palette on every desktop where a platform style does not; no stylesheet is needed. Keys and values read in double or single quotes. A missing key, or a recognised key whose value is bare or half-quoted or no `#rrggbb`, refuses the file with the key's name; a file that exists but cannot be opened, or sits behind a folder that cannot be searched (`stat` fails other than `ENOENT`), is refused too; either way the app keeps the palette it has and logs a warning, where an absent file means the built-in dark, Swift's grays, installed before the first load. `omarchy-theme-set` removes `current/theme`, moves `next-theme` in and writes `theme.name`, so the watcher holds `current/`, `current/theme` and the file, adds them back after each load (a removed path leaves a `QFileSystemWatcher`) and renews the file's watch every load (it follows the inode, which an atomic replacement swaps), watches the nearest ancestor the watcher accepts while `current/` is missing or barred, letting it go once the directory is watched, and loads once 100 ms after the last event. A read that stops short (an error, or fewer bytes than the file holds) is refused like a malformed file. Each load logs the theme's name and mode on `omaphoto.app`. `main` makes the theme before the window. Widgets take colours from the palette, never from literals; the canvas keeps Swift's document grays. The UI font stays Qt's default: `omarchy font current` is not followed.
|
||||
- No updater. Distro packages own updates.
|
||||
- Custom cursors (`QCursor` pixmaps) come out garbled on the hardware cursor path with NVIDIA and Hyprland at a fractional scale; theme cursors render correctly (issue #9, hyprwm/Hyprland#16413). README gives the software-cursor setting; the app keeps its cursors and does not guess at drivers (the user's decision, 13.1).
|
||||
- Distribution (11.4b): releases live on GitHub under fixed asset names (`omaphoto-noble_amd64.deb`, `omaphoto-resolute_amd64.deb`, `omaphoto-fc43.x86_64.rpm`, `omaphoto-fc44.x86_64.rpm`, `omaphoto-x86_64.pkg.tar.zst`; 1.0.0 had one DEB, `omaphoto_amd64.deb`, and 1.0.0 to 1.2.3 one RPM, `omaphoto.x86_64.rpm`) with `SHA256SUMS`, so `releases/latest/download/<name>` always reaches the newest. `scripts/install/arch.sh` reads `/etc/os-release` (`ID` or `ID_LIKE`; Omarchy says `ID_LIKE=arch`), `fedora.sh` its `ID` or `ID_LIKE` and `VERSION_ID`, taking the RPM of release 43 or 44 and refusing any other, since each names its release's LibRaw (`libraw_r.so.23` on 43, `.25` on 44; found in 12.16, when 1.2.3's single RPM from Fedora 43 would not install on 44), and `ubuntu.sh` its `UBUNTU_CODENAME`, which Ubuntu's derivatives set to their base: each DEB names its release's Qt libraries (24.04's carry a `t64` suffix that 26.04's drop, and Debian 13 has neither), so the release carries one DEB per LTS, built on it (`Dockerfile.dev` takes the base as `BASE`), and the script takes the one whose codename matches, `noble` or `resolute`, refusing any other. Each refuses another system or another machine than x86_64, verify the package against the sums and install it with apt, dnf or pacman under sudo, so the package manager resolves dependencies; apt reads the file as its own user, so the download folder is opened to it. Fedora's script names RPM Fusion's `libheif-freeworld` when it is missing, since Fedora's libheif decodes no HEVC, and adds no repository itself. `nixos.sh` installs the flake at the newest release's tag, which GitHub's `releases/latest` redirect names, into the user's profile (`nix profile install`, the name every Nix still takes), so no user builds unreleased work from `main`. The README runs each script after downloading it, so the package manager's questions read the terminal and fish runs it too. `release.yml` builds each package with the command the distro checks use, the DEBs on the dev image over each base, the RPMs on Fedora 43 and 44 (`scripts/distro/fedora/Dockerfile` takes the release as `RELEASE`, 43 by default), the Arch package through `makepkg` as a user; the version is CMake's `project` version, the PKGBUILD's and the flake's, kept equal by hand, and the workflow's first job refuses a tag that names another.
|
||||
- Distribution (11.4b): releases live on Gitea (git.zacharyzhang.com) under fixed asset names (`omaphoto-noble_amd64.deb`, `omaphoto-resolute_amd64.deb`, `omaphoto-fc43.x86_64.rpm`, `omaphoto-fc44.x86_64.rpm`, `omaphoto-x86_64.pkg.tar.zst`, `omaphoto-x86_64.AppImage` since 1.4.5; 1.0.0 had one DEB, `omaphoto_amd64.deb`, and 1.0.0 to 1.2.3 one RPM, `omaphoto.x86_64.rpm`) with `SHA256SUMS`. Gitea has no `releases/latest/download`, so each script asks the API for the newest release's tag (`/api/v1/repos/ZacharyZhang-NY/OmaPhoto/releases/latest`) and downloads from `releases/download/<tag>/<name>`. `scripts/install/arch.sh` reads `/etc/os-release` (`ID` or `ID_LIKE`; Omarchy says `ID_LIKE=arch`), `fedora.sh` its `ID` or `ID_LIKE` and `VERSION_ID`, taking the RPM of release 43 or 44 and refusing any other, since each names its release's LibRaw (`libraw_r.so.23` on 43, `.25` on 44; found in 12.16, when 1.2.3's single RPM from Fedora 43 would not install on 44), and `ubuntu.sh` its `UBUNTU_CODENAME`, which Ubuntu's derivatives set to their base: each DEB names its release's Qt libraries (24.04's carry a `t64` suffix that 26.04's drop, and Debian 13 has neither), so the release carries one DEB per LTS, built on it (`Dockerfile.dev` takes the base as `BASE`), and the script takes the one whose codename matches, `noble` or `resolute`, refusing any other. Each refuses another system or another machine than x86_64, verify the package against the sums and install it with apt, dnf or pacman under sudo, so the package manager resolves dependencies; apt reads the file as its own user, so the download folder is opened to it. Fedora's script names RPM Fusion's `libheif-freeworld` when it is missing, since Fedora's libheif decodes no HEVC, and adds no repository itself. `nixos.sh` installs the flake at the newest release's tag (`git+https://…?ref=refs/tags/<tag>`) into the user's profile (`nix profile install`, the name every Nix still takes), so no user builds unreleased work from `main`. The README runs each script after downloading it, so the package manager's questions read the terminal and fish runs it too. `scripts/release.sh vX.Y.Z` (with `GITEA_TOKEN` set, the tag already pushed) builds each package from `git archive` of the tag with the command the distro checks use, the DEBs on the dev image over each base, the RPMs on Fedora 43 and 44 (`scripts/distro/fedora/Dockerfile` takes the release as `RELEASE`, 43 by default), the Arch package through `makepkg` as a user, the AppImage on the noble dev image (`scripts/distro/appimage`, linuxdeploy and its Qt plugin pinned by checksum; `scripts/appimage.sh` adds Qt's Wayland shell, decoration and graphics plugins and libheif's HEVC plugin, and `packaging/appimage/omaphoto.sh`, an AppRun hook, puts the AppImage's `usr/share` first on `XDG_DATA_DIRS` so the model is found, and sets `LIBHEIF_PLUGIN_PATH`), then writes `SHA256SUMS`, creates the release and uploads every file; the version is CMake's `project` version, the PKGBUILD's and the flake's, kept equal by hand, and the script refuses a tag that names another.
|
||||
- Remove Background runs an open-licensed model on ONNX Runtime.
|
||||
- A `.comp` project is a directory on Linux; its layout matches the macOS package.
|
||||
- Shortcuts map ⌘ to Ctrl and ⌥ to Alt.
|
||||
|
||||
@@ -293,7 +293,7 @@ set(CPACK_PACKAGE_NAME omaphoto)
|
||||
set(CPACK_PACKAGE_VENDOR "ZacharyZhang-NY")
|
||||
set(CPACK_PACKAGE_CONTACT "ZacharyZhang-NY")
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Layered image editing for Linux, a port of Compositor")
|
||||
set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/ZacharyZhang-NY/OmaPhoto")
|
||||
set(CPACK_PACKAGE_HOMEPAGE_URL "https://git.zacharyzhang.com/ZacharyZhang-NY/OmaPhoto")
|
||||
set(CPACK_PACKAGING_INSTALL_PREFIX /usr)
|
||||
set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)
|
||||
set(CPACK_DEBIAN_PACKAGE_SECTION graphics)
|
||||
|
||||
@@ -35,13 +35,13 @@ Each script installs the newest release. The Arch, Ubuntu and Fedora scripts dow
|
||||
Arch and Omarchy:
|
||||
|
||||
```sh
|
||||
curl -fsSLO https://raw.githubusercontent.com/ZacharyZhang-NY/OmaPhoto/main/scripts/install/arch.sh && bash arch.sh
|
||||
curl -fsSLO https://git.zacharyzhang.com/ZacharyZhang-NY/OmaPhoto/raw/branch/main/scripts/install/arch.sh && bash arch.sh
|
||||
```
|
||||
|
||||
Ubuntu 24.04 or 26.04 LTS and systems built on them (Linux Mint 22, Pop!_OS 24.04):
|
||||
|
||||
```sh
|
||||
curl -fsSLO https://raw.githubusercontent.com/ZacharyZhang-NY/OmaPhoto/main/scripts/install/ubuntu.sh && bash ubuntu.sh
|
||||
curl -fsSLO https://git.zacharyzhang.com/ZacharyZhang-NY/OmaPhoto/raw/branch/main/scripts/install/ubuntu.sh && bash ubuntu.sh
|
||||
```
|
||||
|
||||
Each DEB names its Ubuntu release's libraries, so other Ubuntu releases and Debian build from source (below).
|
||||
@@ -49,7 +49,7 @@ Each DEB names its Ubuntu release's libraries, so other Ubuntu releases and Debi
|
||||
Fedora 43 or 44:
|
||||
|
||||
```sh
|
||||
curl -fsSLO https://raw.githubusercontent.com/ZacharyZhang-NY/OmaPhoto/main/scripts/install/fedora.sh && bash fedora.sh
|
||||
curl -fsSLO https://git.zacharyzhang.com/ZacharyZhang-NY/OmaPhoto/raw/branch/main/scripts/install/fedora.sh && bash fedora.sh
|
||||
```
|
||||
|
||||
Fedora's own libheif decodes no HEVC. For HEIC import, add [RPM Fusion](https://rpmfusion.org/Configuration) and install `libheif-freeworld`; the script reminds you.
|
||||
@@ -57,12 +57,12 @@ Fedora's own libheif decodes no HEVC. For HEIC import, add [RPM Fusion](https://
|
||||
NixOS installs the release's flake into your profile:
|
||||
|
||||
```sh
|
||||
curl -fsSLO https://raw.githubusercontent.com/ZacharyZhang-NY/OmaPhoto/main/scripts/install/nixos.sh && bash nixos.sh
|
||||
curl -fsSLO https://git.zacharyzhang.com/ZacharyZhang-NY/OmaPhoto/raw/branch/main/scripts/install/nixos.sh && bash nixos.sh
|
||||
```
|
||||
|
||||
Or add `github:ZacharyZhang-NY/OmaPhoto/<tag>`, a release tag, as a flake input and put its `packages.x86_64-linux.default` in your configuration.
|
||||
Or add `git+https://git.zacharyzhang.com/ZacharyZhang-NY/OmaPhoto?ref=refs/tags/<tag>`, a release tag, as a flake input and put its `packages.x86_64-linux.default` in your configuration.
|
||||
|
||||
The packages themselves sit on the [releases page](https://github.com/ZacharyZhang-NY/OmaPhoto/releases).
|
||||
The packages themselves sit on the [releases page](https://git.zacharyzhang.com/ZacharyZhang-NY/OmaPhoto/releases). Any other x86_64 system can run the AppImage there, `omaphoto-x86_64.AppImage`: download it, `chmod +x` it and start it.
|
||||
|
||||
### Garbled cursors on NVIDIA with Hyprland
|
||||
|
||||
|
||||
@@ -459,7 +459,7 @@ Reviews for this section ran on codex `gpt-6.1-sol` at `max` (agent `codex-sol`)
|
||||
- 13.18 port (agent): the fitted parametric curve, the tone curve per channel, Refine Saturation's new meaning and words; the graph's one drag (`CameraRawColorControls+Curve.cpp`); fixes beyond Swift: a preset drops the chosen point, a point dragged onto its neighbour stays and stays dragged; tests in `CameraRawCurveTests` and `CameraRawCurveGraphTests`. Survivor recorded: the all-zero shortcut. No review yet.
|
||||
- [ ] 13.19 Release OmaPhoto 1.4.5: version, change log, README, AGENTS.md, the acceptance run, distro checks, packages, live installs, the acceptance checklist.
|
||||
- Status 2026-10-02, stopped for a system reinstall. Main is 19d8737 plus this note, pushed; there are no other branches or worktrees. Items 13.2–13.18 are ported and merged; 13.19 is open. Nothing outside the repository survives the reinstall (`~/.cache/omaphoto-review`, `~/.cache/omaphoto-port`, the `omaphoto-dev` image, `../Compositor-spec`), so this note carries everything.
|
||||
- Setup after the reinstall: clone https://github.com/robbietilton/Compositor into `../Compositor-spec` and check out tag `v1.4.5`; `scripts/dev.sh build` rebuilds the `omaphoto-dev` image from `Dockerfile.dev`.
|
||||
- Setup after the reinstall: clone https://github.com/robbietilton/Compositor into `Compositor-Ref` (ignored) and check out tag `v1.4.5`; `scripts/dev.sh build` rebuilds the `omaphoto-dev` image from `Dockerfile.dev`.
|
||||
- Reviews: two of the ten the user allowed are used. Review 1 (13.7, 13.8, 13.9a, 13.9b, 13.14, 13.15) passed 13.8 and failed the rest on test gaps and stale AGENTS lines; review 2 (13.10–13.13, 13.16–13.18) failed on the same kinds. No crash or wrong output was found. Fixed and tested: all of review 1's, and review 2's for 13.17 and 13.18.
|
||||
- Committed but neither built nor tested (stopped mid-work; two leftover mutants were reverted from it):
|
||||
- 13.8: `SharpCanvasTests` pins `LayerRenderer::draw`'s `upright` term (a turned layer near 1:1 must filter) (`63e42ac`).
|
||||
@@ -467,6 +467,45 @@ Reviews for this section ran on codex `gpt-6.1-sol` at `max` (agent `codex-sol`)
|
||||
- 13.13 and 13.16 (`70318de`): a typed Move-bar value then a real canvas press (the field finishes from the event loop on `MouseFocusReason`; `MoveBarPressTests`), the folder case, Alt-centre and long-drag resize snapping and the edge tie (`ResizeSnapTests`, `ResizeSnapCanvasTests`, fixture `MovePressFixtures.h`), the dead one-pixel Liquify "fix" removed, a Liquify dab's scratch allocation caught (skips the dab with a warning), the Radius field's `inf`, `WarpStroke::committedPoints` with its test, `softened`'s mask flag removed, and AGENTS and TASKS lines.
|
||||
- Known failures: at 81894f7 the full suite under `ctest -j16` failed `ColorRangeTests`, `GuideGridTests`, `GridSettingsSheetTests`, `TypeFontPreviewTests` and `GuideCanvasTests`, each of which passes alone: some state is shared between test processes (suspect `QSettings` or `ToolDefaults` keys). Find and isolate it; never loosen a check.
|
||||
- Next, in order: build; run the commits above and fix them; run the full suite and fix the parallel failures; review 3 over every fix since 81894f7 (13.8 included); then this item: acceptance run, distro checks (arch, fedora, fedora44, nixos, resolute), the `v1.4.5` tag and release, live installs, and the acceptance checklist. The 1.4.5 version, change log, README and acceptance table (results pending) are already in.
|
||||
- Resumed 2026-10-03 after the reinstall. The user's rule of that day replaces the ten-review allowance: every step below is reviewed by codex (GPT-6.1-Sol, max effort until 13.19g, high from then at the user's word) in a herdr pane before the next, at most three rounds a step. Steps, in order:
|
||||
- [x] 13.19a The spec checkout is `Compositor-Ref` inside the repository (ignored by git, left out of the flake's source), at `v1.4.5`; AGENTS.md and TASKS.md say so.
|
||||
- 13.19a review: round 1 FAIL (the flake copied the spec; no step for review 3's scope; the budget unstated; the status said done), fixed; the Docker context finding answered (no Dockerfile copies from it). Round 2 PASS.
|
||||
- [x] 13.19b Build main in a fresh `omaphoto-dev` image.
|
||||
- 13.19b review: round 1 PASS.
|
||||
- [x] 13.19c `63e42ac` (13.8's `upright` pin) built, run, its mutant caught.
|
||||
- 13.19c work: `SharpCanvasTests` passes; `transform.radians() == 0` set to `true` in `LayerRenderer::draw` and in `TiledLayerRenderer`, each caught by the turned rows (dropping `upright` inside `interpolation` leaves the parameter unused, which `-Werror` refuses).
|
||||
- 13.19c review: round 1 PASS.
|
||||
- [x] 13.19d `2190a1b` (13.10–13.12 tests) built and run; its open items closed: the 12.5b, 13.11 and 8.6 bullets, `sizeLabel`'s tie claim, 13.12's pending pixel gradient.
|
||||
- 13.19d work: `MaskAloneTests`, `PaintRefusalTests` and `SelectionCanvasTests` pass. Mutants: the three reachable `paintRefusal` seams swapped, caught (mask off and adjustment exclude each other, an equivalent swap); the Shift axis test without either `abs`, without both, and `>`, caught; `drawMaskAlone` without its `isMask` or its layer term, caught; `setIsMaskSelected` keeping the view, caught. The 12.5b, 8.6 and 13.11 lines match the code. `sizeLabel`'s tie claim was false (1062.5 over 1000 pixels is exactly 106.25%): ties to even are now tested both ways (ICU's default rounding, which Swift's `.formatted` uses), `round` and `floor(x + 0.5)` caught.
|
||||
- 13.19d review: round 1 FAIL: the 8.6 bullet's whole-sample blur timing, the 13.11 bullet's typed values as persistent, `->` on optionals in `MaskAloneTests`. Fixed; the same `->` in `CanvasEditContractTests`, `ImageFileDropTests`, `RawDevelopTests` and `SessionRecord.h` went too. Their run found `SelectionSignalTests` stale since 13.11 (Inverse of everything deselects, so the `deselect` after it is silent): the test now says so.
|
||||
- 13.19d round 2: FAIL: other tests still read optionals through `->` and `*`, through aliases a text scan missed. Found by the compiler: in a throwaway container `std::optional`'s `operator->` and `operator*` were marked deprecated and every target built (`-O0`); 271 sites in 30 test files and headers, each now `.value()`, and the rerun finds none in `tests/` with every unit compiled. The full suite at `-j8` then failed `FilterSessionTests` and `SelectionFeatherTests` alone too: both still called `addMask(false)` to reveal a selection, the meaning 13.12 flipped (`0b0d36a`); now `addMask(true)`. 329 of 329 at `-j8`.
|
||||
- 13.19d round 3: PASS.
|
||||
- [x] 13.19e `70318de` (13.13 and 13.16 fixes and tests) built and run.
|
||||
- 13.19e work: `70318de`'s tests pass. Mutants: the field's deferred finish on a mouse press, both ways, caught; `committedPoints` at twice the spacing, without its last-point term, without `kept`, caught, and its `<=` and its one-pixel floor survived until rows for exactly the spacing and a small brush were added, now caught. `WarpFailureTests` (new, a binary of its own) starves a Liquify dab's scratch (skipped with its warning), Smudge's carried colour and Liquify's offsets (each `ExportError(render)`); each guard's removal caught; the untouched copy's null check is equivalent under starvation (the offsets after it are twice its size). `blurSample` drops Swift's dead `if let` on the mask and `?? 0` for the document. The 13.16 line named `compositor.rendering`; it is `omaphoto.rendering`. 330 of 330 at `-j8`.
|
||||
- 13.19e review: round 1 FAIL: the starvation tests took any `ExportError` kind; no test made the Move bar's deferred finish run by itself; AGENTS still called allocating Liquify's buffers for every mode equivalent. Fixed: both tests compare the kind (`encode` and `tooLarge` mutants caught), `aValueLeftByMouseForAnotherFieldApplies` clicks Y with no canvas press (dropping the deferred finish caught), the AGENTS line says caught.
|
||||
- 13.19e round 2: PASS.
|
||||
- [x] 13.19f The fixes since `81894f7` already tested (`382c9c2` for 13.9a and 13.9b, `6735aad` for 13.7, 13.14 and 13.15, `5c8e18c` for 13.17 and 13.18) reviewed: review 3's scope.
|
||||
- 13.19f work: the three commits' tests pass. Mutants on their code: the tab strip's release watch (its button test, its start, its ending, its other-tab guard) and the glow's whole steps. The other-tab guard (Swift's `guard reorder?.id == id`) survived; `anotherTabPressedBeforeTheWatchMovesNothing` now catches it. The glow's rounded-up small sides are equivalent (the padded sides are whole steps).
|
||||
- 13.19f review: round 1 FAIL: `aDoubleClickInTheStripMovesADivider` pressed twice at one place, so a double click that skipped the divider passed. Now the first click and the double click land apart; that mutant is caught.
|
||||
- 13.19f round 2: PASS.
|
||||
- [x] 13.19g The full suite under `ctest -j16`; the shared state behind the five parallel failures found and isolated.
|
||||
- 13.19g work: eight full runs at `-j16` and `-j32` on 32 cores passed 330 of 330; the five failures of `81894f7` did not come back, alone or with the nineteen suites that share `QStandardPaths`' test folder, so their cause is not known (the old runs had a 12-core cap and bwrap). Under a 4-CPU cap at `-j16` a new one failed three of three: `AcceptanceTests::paintingTools`' rectangle made no layer. Diagnostics showed the gradient edit still pending when the drag began, with the project free: `finishRasterCommit` freed the project, then posted the continuation that clears the gradient, so for one turn of the event loop the edit refused every press (Swift's caller resumes from `await` in the same job). The continuation now runs where the commit ends, for the gradient, the pixel move and fills; their callers' callbacks stay posted. Round 1 of review found the same gap one level up, through posted callbacks that carry work: the floating selection installed after the clear, and a filter, Levels, Hue/Saturation or Invert begun after a pending gradient read whatever layer was active by then. With the continuation inline, both run where the commit ends; only early paths post. `CommitContinuationTests` posts a check as the project frees: the gradient gone, the move gone, the floating edit ready, a tool chosen then staying chosen, and each chained command keeping its layer; the two first were red before the fix, posting the continuation again is caught, and posting the gradient's or the fill's continuation is caught by the chained and floating rows. Then 331 of 331 at `-j16` and three of three under the 4-CPU cap.
|
||||
- 13.19g stress past that: 2 CPUs at `-j32`, sixteen processes a core, failed six and eight suites, every one a time limit (waits of 5 to 20 s, QtTest's 300 s watchdog on `LargeCanvasBrushTests` and `LayerContextMenuEdgeTests`) but `SubjectRemovalFailureTests::aModelRunThatFindsNoMemoryIsARenderError`, whose 512 KB limit then found room; it passes alone at 2 CPUs three of three and under the 4-CPU load, and its cause under that stress is not established. `dev.sh test` and the distro checks run the suite one test at a time.
|
||||
- 13.19g review: round 1 FAIL (the floating selection and the commands chained after a gradient still had a gap); round 2 PASS.
|
||||
- [x] 13.19h The acceptance run and its shots.
|
||||
- 13.19h work: the acceptance run checked none of the seventeen rows new in 1.4.5, though the README says it checks each feature. `AcceptanceNewTests` (Color Range, Grid Settings, snapping; presets, Quick Look, Ungroup, tabs), `AcceptanceEditTests` (fonts and their preview, painting at a layer's resolution, a hidden layer's refusal, Blur's Radius, Liquify, Smudge, masks; Move's held keys and typed width, Soft Light and a Linear Dodge stack on the canvas against the export) and `AcceptanceFinishTests` (Camera Raw's curves, Dither's ASCII and Scanlines, the JPEG preview's keys, Quit with a gradient pending and with Levels open) drive the app's window for each. All six acceptance binaries pass, twice in parallel; the shots are taken again, two of them new (`17-tabs`, `18-mask-alone`); the table says what each new row's run checks, and every row but the distro and package rows reads pass.
|
||||
- 13.19h review: round 1 FAIL: the font scenario emitted the menu's signals itself, Dither and Blur's Radius were set past their controls, the ASCII check took blocks for letters, the mask-alone view was not looked at, and seven rows said more than their scenarios (my rewrite of the table had not landed). Fixed: the font popup opened, hovered and clicked (`popupRow`, `choose`); Dither's style, characters and text size through its sheet and OK, Camera Raw through OK, the Radius typed in the bar, Ctrl+Shift+G and Ctrl+Z as keys, Color Range's OK, Save As from the menu; ASCII of \"@\" must keep holes (inked share under three quarters) and grow about twice at 28; the mask-alone canvas checked black and white; each row says what its scenario does. The reviewer's mutants (no popup, no style handler, blocks for letters, no mask-alone drawing) and a Radius field that writes nothing are each caught.
|
||||
- 13.19h round 2: FAIL: the committed Camera Raw shot showed the zero-exposure preview, since the scenario waited for any preview. It now waits for the preview whose ground has brightened; the shot is retaken.
|
||||
- 13.19h round 3: PASS.
|
||||
- [x] 13.19i Distro checks: arch, fedora, fedora44, nixos, resolute.
|
||||
- 13.19i work: first run failed on every newer Qt. Arch (6.11), Fedora 43 and 44, Ubuntu 26.04 (6.10) and NixOS (6.11) found two real bugs in the pickers: Qt 6.10 emits `highlighted` when a closed combo box follows its value, so the font menu started a preview as the caret moved and a later close put back text typed since; and it closes the popup on Escape without `hidePopup`, so Escape kept a font or blend preview. Fixed by previewing only while the popup shows and ending on the popup window's `Hide`, tested on both Qts with mutants caught. Two test fixes: `GridSettingsSheetTests` sets an English default locale (6.10's C locale groups nothing), and Dither's starvation test skips off Qt 6.4 as the other five do.
|
||||
- 13.19i second run: all five pass, 334 of 334 each; the full suite passes on the dev image.
|
||||
- 13.19i review: round 1 PASS (the Qt behaviour probed on 6.4.2, 6.10.2 and 6.11.2, six mutants caught).
|
||||
- 13.19j work: `versionupdate.md` gains 13.19i's blend menu fix; `v1.4.5` tagged on main and pushed; the workflow's run is checked below.
|
||||
- [ ] 13.19j Tag `v1.4.5`; the release workflow publishes every package.
|
||||
- 2026-10-11: GitHub suspended the account; the project moved to Gitea (git.zacharyzhang.com), the workflow became `scripts/release.sh`, and releases gain an AppImage.
|
||||
- [ ] 13.19k Live installs from Gitea in fresh containers.
|
||||
- [ ] 13.19l The acceptance checklist.
|
||||
|
||||
## Skills by phase
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
# OmaPhoto 1.4.5 acceptance
|
||||
|
||||
The acceptance table for OmaPhoto 1.4.5, the Linux port of Compositor 1.4.5. Each row is a feature from the README. The rows under "New in 1.4.5" cover what changed since 1.3.3. A "pending" result waits for the 1.4.5 run.
|
||||
The acceptance table for OmaPhoto 1.4.5, the Linux port of Compositor 1.4.5. Each row is a feature from the README. The rows under "New in 1.4.5" cover what changed since 1.3.3. A "pending" result waits for the release.
|
||||
|
||||
The acceptance run drives the app's own window, the way a person uses it. It chooses menu entries, drags on the canvas, types into sheets and answers the real file panels. Then it checks concrete results: pixels, layers, sizes and files on disk. The run is three test programs: `AcceptanceTests`, `AcceptanceColorTests` and `AcceptanceProjectTests`. They take the screenshots below when `ACCEPTANCE_SHOTS` names a folder.
|
||||
The acceptance run drives the app's own window, the way a person uses it. It chooses menu entries, drags on the canvas, types into sheets and answers the real file panels. Then it checks concrete results: pixels, layers, sizes and files on disk. The run is six test programs: `AcceptanceTests`, `AcceptanceColorTests` and `AcceptanceProjectTests` for the table, `AcceptanceNewTests`, `AcceptanceEditTests` and `AcceptanceFinishTests` for the rows new in 1.4.5. They take the screenshots below when `ACCEPTANCE_SHOTS` names a folder.
|
||||
|
||||
```sh
|
||||
docker run --rm -u "$(id -u):$(id -g)" -e HOME=/tmp -e QT_QPA_PLATFORM=offscreen -v "$PWD:$PWD" -w "$PWD" omaphoto-dev \
|
||||
sh -c 'cmake -S . -B build && cmake --build build --target AcceptanceTests AcceptanceColorTests AcceptanceProjectTests &&
|
||||
for t in AcceptanceTests AcceptanceColorTests AcceptanceProjectTests; do ACCEPTANCE_SHOTS=$PWD/docs/acceptance build/$t || exit 1; done'
|
||||
sh -c 'cmake -S . -B build && cmake --build build --target AcceptanceTests AcceptanceColorTests AcceptanceProjectTests AcceptanceNewTests AcceptanceEditTests AcceptanceFinishTests &&
|
||||
for t in AcceptanceTests AcceptanceColorTests AcceptanceProjectTests AcceptanceNewTests AcceptanceEditTests AcceptanceFinishTests; do ACCEPTANCE_SHOTS=$PWD/docs/acceptance build/$t || exit 1; done'
|
||||
```
|
||||
|
||||
The screenshots come from Qt's offscreen platform, so floating panels appear without the window manager's title bars. The run uses the built-in dark theme, except for the last row.
|
||||
@@ -16,45 +16,45 @@ The screenshots come from Qt's offscreen platform, so floating panels appear wit
|
||||
|
||||
| Feature | What the run does and checks | Screenshot | Suites that hold the details | Result |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| Layers, folders, masks, clipping masks, blend modes, opacity | Imports a photo and paints a layer. Clips it to the photo and sets Multiply at 60%. Masks the photo and groups both in a folder. Undo takes a step back. | [01](acceptance/01-layers.png) | `GroupTests`, `LayerMaskTests`, `LiveMaskTests`, `LayerAppearanceTests`, `LayerRendererTests`, `HistoryTests` | pending |
|
||||
| Selections | Drags a marquee to within 2 px. The wand takes the flat ground. Select › Subject finds the red disc with the U²-Net model. | [02](acceptance/02-selections.png) | `SelectionTests`, `MagicWandTests`, `SelectSubjectTests`, `SelectionEditTests`, `ObjectSelectionTests`, `SelectionFeatherTests` | pending |
|
||||
| Painting tools | Drags a gradient that fades to clear, a rectangle shape and a soft white brush stroke. Types "Hello OmaPhoto" on the canvas and colours "Hello" red. That leaves one colour run, committed with Ctrl+Return. | [03](acceptance/03-painting.png) | `BrushTests`, `GradientTests`, `ShapeToolTests`, `TypeToolTests`, `TextColorRunsTests`, `SpotHealingTests`, `CloneStampTests`, `SmudgeLiquifyTests` | pending |
|
||||
| Move, transform, distort; rulers, guides, grid | Drags the layer with the Move tool. Transform Layer halves it, and Return applies. Rulers, a guide and the grid are shown. | [04](acceptance/04-transform-guides-grid.png) | `TransformSessionTests`, `DistortTests`, `GuideTests`, `FloatingSelectionTests` | pending |
|
||||
| Adjustments as edits and as layers | Hue/Saturation turns the red disc green. An Invert layer inverts the view and leaves the pixels alone. A Curves layer opens its editor. | [05](acceptance/05-adjustments.png) | `HueSaturationTests`, `LevelsTests`, `CurvesControlsTests`, `AdjustmentLayerTests`, `AdjustmentEditorTests`, `ImageAdjustmentTests` | pending |
|
||||
| Camera Raw Filter, docked | Opens in the dock beside the canvas. One stop of exposure previews, commits and brightens the ground. | [06](acceptance/06-camera-raw.png) | `CameraRawTests`, `CameraRawSessionTests`, `CameraRawPanelTests`, `CameraRawCanvasTests` | pending |
|
||||
| Layer effects | A 12 px red stroke rings a shape outside its edge, and a drop shadow's sheet shows. The shape keeps its fill. | [07](acceptance/07-effects.png) | `LayerEffectsTests`, `LayerEffectsKernelTests`, `EffectsPanelTests`, `EffectsCanvasTests`, `InnerGlowTests` | pending |
|
||||
| Filters | Dither leaves only black and white dots. Remove Background masks the photo around its subject: the centre stays opaque and a corner turns clear. | [08](acceptance/08-filters-dither.png), [09](acceptance/09-remove-background.png) | `DitherTests`, `FilterTests`, `FinishingFilterTests`, `SubjectRemovalTests`, `RemoveBackgroundTests` | pending |
|
||||
| Crop, trim, canvas size, image size; PNG and JPEG export | Crops to 1000 × 600. Canvas Size widens it to 1400. Trim finds the photo's own 1200 again. Image Size halves it. Exports a PNG through the save panel and a JPEG through its sheet and panel, then reads both back at 600 × 300. | [10](acceptance/10-canvas-size.png), [11](acceptance/11-export-jpeg.png) | `CropTests`, `ImageTrimTests`, `ProjectResizeTests`, `ProjectExportTests`, `JPEGExportTests` | pending |
|
||||
| Imports | Takes JPEG, PNG, TIFF, HEIC, SVG, a layered Photoshop file (it arrives as a folder) and a camera RAW file, which asks how to develop it. That makes eight layers with no import error. | [12](acceptance/12-raw-develop.png), [13](acceptance/13-imports.png) | `ImageImportTests`, `PSDImportTests`, `RawImporterTests`, `RawDevelopTests`, `SVGImportTests` | pending |
|
||||
| Open Recent; Keyboard Shortcuts window | Saves a project, and Open Recent lists it. The shortcuts window opens over the editor. | [15](acceptance/15-shortcuts.png) | `OpenRecentTests`, `RecentProjectsCoreTests`, `KeyboardShortcutsTests`, `KeyboardShortcutsSheetTests` | pending |
|
||||
| Scrub a number by its label | Dragging the Opacity title 40 points left lowers the layer's opacity. | [14](acceptance/14-scrub.png) | `NumericScrubTests`, `ScrubbableLabelsTests`, `ScrubbableSheetsTests` | pending |
|
||||
| Keep working while a project saves | Another layer is added while a save runs. The file holds the state the save began with. | — | `ProjectSaveWhileEditingTests` | pending |
|
||||
| Reload a project changed on disk | With unsaved edits open, another program renames a layer on disk. The app's alert asks, Revert is chosen, and the saved state shows with the new name. | [15](acceptance/15-shortcuts.png) | `ExternalChangeTests` | pending |
|
||||
| Follows the Omarchy theme | Starts in the built-in dark. A Catppuccin Latte `colors.toml` written while the app runs retints the window. | [16](acceptance/16-omarchy-light.png) | `OmarchyThemeTests` | pending |
|
||||
| Builds and tests on each system | The full suite runs on Ubuntu 24.04 (Qt 6.4.2), Ubuntu 26.04, Arch, Fedora 43 and 44, and NixOS. Warnings count as errors. | — | `scripts/distro-check.sh` | pending |
|
||||
| Packages and install scripts | Each install script runs from GitHub in a fresh container. On Ubuntu 24.04 and 26.04, Fedora 43 and 44 and Arch, it checks its package against `SHA256SUMS`, installs it and starts 1.4.5. On NixOS, `nixos.sh` resolves `v1.4.5`, builds its flake and starts 1.4.5. Debian 13 is refused, as intended. | — | `DesktopIntegrationTests`, `.github/workflows/release.yml` | pending |
|
||||
| Layers, folders, masks, clipping masks, blend modes, opacity | Imports a photo and paints a layer. Clips it to the photo and sets Multiply at 60%. Masks the photo and groups both in a folder. Undo takes a step back. | [01](acceptance/01-layers.png) | `GroupTests`, `LayerMaskTests`, `LiveMaskTests`, `LayerAppearanceTests`, `LayerRendererTests`, `HistoryTests` | pass |
|
||||
| Selections | Drags a marquee to within 2 px. The wand takes the flat ground. Select › Subject finds the red disc with the U²-Net model. | [02](acceptance/02-selections.png) | `SelectionTests`, `MagicWandTests`, `SelectSubjectTests`, `SelectionEditTests`, `ObjectSelectionTests`, `SelectionFeatherTests` | pass |
|
||||
| Painting tools | Drags a gradient that fades to clear, a rectangle shape and a soft white brush stroke. Types "Hello OmaPhoto" on the canvas and colours "Hello" red. That leaves one colour run, committed with Ctrl+Return. | [03](acceptance/03-painting.png) | `BrushTests`, `GradientTests`, `ShapeToolTests`, `TypeToolTests`, `TextColorRunsTests`, `SpotHealingTests`, `CloneStampTests`, `SmudgeLiquifyTests` | pass |
|
||||
| Move, transform, distort; rulers, guides, grid | Drags the layer with the Move tool. Transform Layer halves it, and Return applies. Rulers, a guide and the grid are shown. | [04](acceptance/04-transform-guides-grid.png) | `TransformSessionTests`, `DistortTests`, `GuideTests`, `FloatingSelectionTests` | pass |
|
||||
| Adjustments as edits and as layers | Hue/Saturation turns the red disc green. An Invert layer inverts the view and leaves the pixels alone. A Curves layer opens its editor. | [05](acceptance/05-adjustments.png) | `HueSaturationTests`, `LevelsTests`, `CurvesControlsTests`, `AdjustmentLayerTests`, `AdjustmentEditorTests`, `ImageAdjustmentTests` | pass |
|
||||
| Camera Raw Filter, docked | Opens in the dock beside the canvas. One stop of exposure previews, commits and brightens the ground. | [06](acceptance/06-camera-raw.png) | `CameraRawTests`, `CameraRawSessionTests`, `CameraRawPanelTests`, `CameraRawCanvasTests` | pass |
|
||||
| Layer effects | A 12 px red stroke rings a shape outside its edge, and a drop shadow's sheet shows. The shape keeps its fill. | [07](acceptance/07-effects.png) | `LayerEffectsTests`, `LayerEffectsKernelTests`, `EffectsPanelTests`, `EffectsCanvasTests`, `InnerGlowTests` | pass |
|
||||
| Filters | Dither leaves only black and white dots. Remove Background masks the photo around its subject: the centre stays opaque and a corner turns clear. | [08](acceptance/08-filters-dither.png), [09](acceptance/09-remove-background.png) | `DitherTests`, `FilterTests`, `FinishingFilterTests`, `SubjectRemovalTests`, `RemoveBackgroundTests` | pass |
|
||||
| Crop, trim, canvas size, image size; PNG and JPEG export | Crops to 1000 × 600. Canvas Size widens it to 1400. Trim finds the photo's own 1200 again. Image Size halves it. Exports a PNG through the save panel and a JPEG through its sheet and panel, then reads both back at 600 × 300. | [10](acceptance/10-canvas-size.png), [11](acceptance/11-export-jpeg.png) | `CropTests`, `ImageTrimTests`, `ProjectResizeTests`, `ProjectExportTests`, `JPEGExportTests` | pass |
|
||||
| Imports | Takes JPEG, PNG, TIFF, HEIC, SVG, a layered Photoshop file (it arrives as a folder) and a camera RAW file, which asks how to develop it. That makes eight layers with no import error. | [12](acceptance/12-raw-develop.png), [13](acceptance/13-imports.png) | `ImageImportTests`, `PSDImportTests`, `RawImporterTests`, `RawDevelopTests`, `SVGImportTests` | pass |
|
||||
| Open Recent; Keyboard Shortcuts window | Saves a project, and Open Recent lists it. The shortcuts window opens over the editor. | [15](acceptance/15-shortcuts.png) | `OpenRecentTests`, `RecentProjectsCoreTests`, `KeyboardShortcutsTests`, `KeyboardShortcutsSheetTests` | pass |
|
||||
| Scrub a number by its label | Dragging the Opacity title 40 points left lowers the layer's opacity. | [14](acceptance/14-scrub.png) | `NumericScrubTests`, `ScrubbableLabelsTests`, `ScrubbableSheetsTests` | pass |
|
||||
| Keep working while a project saves | Another layer is added while a save runs. The file holds the state the save began with. | — | `ProjectSaveWhileEditingTests` | pass |
|
||||
| Reload a project changed on disk | With unsaved edits open, another program renames a layer on disk. The app's alert asks, Revert is chosen, and the saved state shows with the new name. | [15](acceptance/15-shortcuts.png) | `ExternalChangeTests` | pass |
|
||||
| Follows the Omarchy theme | Starts in the built-in dark. A Catppuccin Latte `colors.toml` written while the app runs retints the window. | [16](acceptance/16-omarchy-light.png) | `OmarchyThemeTests` | pass |
|
||||
| Builds and tests on each system | The full suite, 334 binaries, passes on Ubuntu 24.04 (Qt 6.4.2), Ubuntu 26.04 (6.10.2), Arch (6.11.2), Fedora 43 and 44, and NixOS (6.11.2). Warnings count as errors. | — | `scripts/distro-check.sh` | pass |
|
||||
| Packages and install scripts | Each install script runs from Gitea in a fresh container. On Ubuntu 24.04 and 26.04, Fedora 43 and 44 and Arch, it checks its package against `SHA256SUMS`, installs it and starts 1.4.5. On NixOS, `nixos.sh` resolves `v1.4.5`, builds its flake and starts 1.4.5. Debian 13 is refused, as intended. | — | `DesktopIntegrationTests`, `scripts/release.sh` | pending |
|
||||
|
||||
## New in 1.4.5
|
||||
|
||||
| Feature | What the run checks | Screenshot | Suites that hold the details | Result |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| Select › Color Range | Samples the red disc; the selection covers the disc and leaves the ground. | — | `ColorRangeTests`, `ColorRangeSheetTests`, `ColorRangeCanvasTests` | pending |
|
||||
| View › Grid Settings | Sets spacing, subdivisions, colour and style; the grid redraws; Restore Defaults puts them back. | — | `GridSettingsSheetTests`, `GuideGridTests` | pending |
|
||||
| Snapping for selections and shapes | A marquee and a rectangle shape drawn near a guide land on it; with Ctrl they do not. | — | `SnapDrawingCanvasTests`, `TransformSnapTests` | pending |
|
||||
| New Canvas presets | Chooses 1080p and Instagram Story from the ⋮ menu; the fields and the check follow. | — | `NewCanvasSheetTests` | pending |
|
||||
| Quick Look preview | A saved project holds `QuickLook/Preview.jpg`, 1024 px on the long side, and reopens unchanged. | — | `QuickLookPreviewTests` | pending |
|
||||
| Ungroup Layers | Ctrl+Shift+G on a folder puts its layers in its place; Undo brings the folder back. | — | `GroupSessionTests`, `LayerContextMenuTests` | pending |
|
||||
| Project tabs reorder and overflow | Drags a tab past its neighbour; with many tabs, the "more tabs" menu switches to a hidden one. | — | `ProjectTabDragTests`, `ProjectTabLayoutTests` | pending |
|
||||
| Fonts on selected letters and previews | Changes the face of one word; hovering a face in the menu previews it; Ctrl+Z takes back typing. | — | `TextFontRunsTests`, `TypeFontPreviewTests`, `InlineTextDrawTests` | pending |
|
||||
| Painting at the layer's resolution | Paints on a scaled-down layer; the stroke is smooth at the layer's own pixels. A hidden layer says why it cannot paint. | — | `NativeResolutionPaintTests`, `PaintRefusalTests` | pending |
|
||||
| Liquify, Smudge and Blur | Liquify keeps edges sharp; Smudge leaves no copies; the Blur brush's Radius applies. | — | `SmudgeLiquifyTests`, `BlurToolTests` | pending |
|
||||
| Masks as Photoshop's | The mask button reveals the selection, Alt hides it; Alt-click on a mask thumbnail shows the mask alone. | — | `MaskAloneTests`, `SelectionEditTests` | pending |
|
||||
| Move tool keys and values | Held Ctrl flips Auto Select; a typed width applies as one step; a resize handle snaps. | — | `TransformInspectorTests`, `TransformSnapTests` | pending |
|
||||
| Blending and a sharper canvas | Soft Light, clipping stacks and adjustment layers draw as the export does. | — | `SharpCanvasTests`, `BlendModeTests`, `ClippingStackTests` | pending |
|
||||
| Camera Raw curves | Drags a region of the parametric curve and a point on a channel's curve; the image follows. | — | `CameraRawCurveMixerTests`, `CameraRawTests` | pending |
|
||||
| Dither ASCII and Scanlines | ASCII draws letters at the chosen size; Scanlines (CRT) applies. | — | `DitherTests`, `ScanlinesTests` | pending |
|
||||
| Export JPEG preview | Zooms the preview to 100% and back to Fit; the View menu's zoom keys work on it. | — | `JPEGPreviewTests`, `JPEGExportSheetTests` | pending |
|
||||
| Quit mid-edit | Quits with a gradient pending and a dialog open; the app asks once and closes. | — | `QuitPendingEditsTests`, `WindowTeardownTests` | pending |
|
||||
| Select › Color Range | Samples the red disc on the canvas; the selection covers the disc, 400 pixels across, and leaves the ground. | — | `ColorRangeTests`, `ColorRangeSheetTests`, `ColorRangeCanvasTests` | pass |
|
||||
| View › Grid Settings | Types a spacing of 100 in the sheet; Restore Defaults puts the grid back. | — | `GridSettingsSheetTests`, `GuideGridTests` | pass |
|
||||
| Snapping for selections and shapes | A marquee and a rectangle shape drawn near a guide land on it; with Ctrl they do not. | — | `SnapDrawingCanvasTests`, `TransformSnapTests` | pass |
|
||||
| New Canvas presets | Chooses Instagram Story from the ⋮ menu; the fields and the check follow, and Create makes 1080 × 1920. | — | `NewCanvasSheetTests` | pass |
|
||||
| Quick Look preview | A saved project holds `QuickLook/Preview.jpg`, 576 × 1024, and its manifest keeps its four layers. | — | `QuickLookPreviewTests` | pass |
|
||||
| Ungroup Layers | Ctrl+Shift+G on a folder leaves its layers where the folder stood, in order; Ctrl+Z brings the folder back. | — | `GroupSessionTests`, `LayerContextMenuTests` | pass |
|
||||
| Project tabs reorder and overflow | Drags a tab past its neighbour; with many tabs, the "more tabs" menu switches to a hidden one. | [17](acceptance/17-tabs.png) | `ProjectTabDragTests`, `ProjectTabLayoutTests` | pass |
|
||||
| Fonts on selected letters and previews | In the open font menu, the pointer over a face previews it on the selected word and Escape puts it back; a click gives the word that face; Ctrl+Z takes back typing. | — | `TextFontRunsTests`, `TypeFontPreviewTests`, `InlineTextDrawTests` | pass |
|
||||
| Painting at the layer's resolution | Paints on a layer scaled to 25%: its pixels stay 800 wide and the stroke is 80 of them across. A hidden layer says why it cannot paint. | — | `NativeResolutionPaintTests`, `PaintRefusalTests` | pass |
|
||||
| Liquify, Smudge and Blur | Liquify moves stripes and leaves few grays; Smudge leaves one fading trail; a Radius of 20 typed in the bar softens wider than 2. | — | `SmudgeLiquifyTests`, `WarpStrokeTests`, `BlurToolTests` | pass |
|
||||
| Masks as Photoshop's | The mask button reveals the selection, Alt hides it; Alt-click on the mask thumbnail shows the mask alone on the canvas, black where it hides and white past it. | [18](acceptance/18-mask-alone.png) | `MaskAloneTests`, `SelectionEditTests` | pass |
|
||||
| Move tool keys and values | Held Ctrl flips Auto Select; a typed width applies as one step. | — | `TransformInspectorTests`, `ResizeSnapCanvasTests` | pass |
|
||||
| Blending and a sharper canvas | Soft Light and a clipping stack in Linear Dodge show on the canvas as exported. | — | `SharpCanvasTests`, `BlendingTests`, `ClippingStackTests` | pass |
|
||||
| Camera Raw curves | Lifts a region of the parametric curve and adds a point on the point curve, then OK; the ground brightens. | — | `CameraRawCurveTests`, `CameraRawCurveGraphTests` | pass |
|
||||
| Dither ASCII and Scanlines | In the Dither sheet, ASCII of "@" draws that letter, holes and all, about twice as tall at a text size of 28; Scanlines draws dark gaps between rows. | — | `DitherTests`, `ScanlinesTests` | pass |
|
||||
| Export JPEG preview | The View keys zoom the preview to 100%, in, and back to Fit. | — | `JPEGPreviewTests`, `JPEGExportSheetTests` | pass |
|
||||
| Quit mid-edit | Quits with a gradient pending: it is applied before the one question. With Levels open, Levels closes and the window goes. | — | `QuitPendingEditsTests`, `WindowTeardownTests` | pass |
|
||||
|
||||
## Known differences from Compositor
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 57 KiB |
|
Before Width: | Height: | Size: 77 KiB After Width: | Height: | Size: 76 KiB |
|
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 66 KiB |
|
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 80 KiB |
|
Before Width: | Height: | Size: 382 KiB After Width: | Height: | Size: 381 KiB |
|
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 58 KiB |
|
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 71 KiB |
|
Before Width: | Height: | Size: 71 KiB After Width: | Height: | Size: 69 KiB |
|
Before Width: | Height: | Size: 73 KiB After Width: | Height: | Size: 71 KiB |
|
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 56 KiB |
|
Before Width: | Height: | Size: 93 KiB After Width: | Height: | Size: 92 KiB |
|
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 51 KiB |
|
After Width: | Height: | Size: 63 KiB |
|
After Width: | Height: | Size: 61 KiB |
@@ -7,7 +7,7 @@ An OmaPhoto project (`.comp`) is a folder of PNG layer images plus a `manifest.j
|
||||
1. Open a project in OmaPhoto 1.3 or later (save a new canvas somewhere, e.g. `~/Pictures/demo.comp`), and keep it open.
|
||||
2. Ask an AI agent that can edit files on your computer (Claude Code, Codex and the like):
|
||||
|
||||
> Read docs/writing-comp-files.md in github.com/ZacharyZhang-NY/OmaPhoto, then design a moody night scene in ~/Pictures/demo.comp. Work in steps, one or two layers at a time.
|
||||
> Read docs/writing-comp-files.md in git.zacharyzhang.com/ZacharyZhang-NY/OmaPhoto, then design a moody night scene in ~/Pictures/demo.comp. Work in steps, one or two layers at a time.
|
||||
|
||||
3. Watch the canvas. Each time the agent writes the project, OmaPhoto reloads it, usually within half a second.
|
||||
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
packages.x86_64-linux.default = pkgs.stdenv.mkDerivation {
|
||||
pname = "omaphoto";
|
||||
version = "1.4.5";
|
||||
# dev.sh builds in ./build; the package starts clean.
|
||||
# dev.sh's build and the Swift spec stay out.
|
||||
src = pkgs.lib.cleanSourceWith {
|
||||
src = self;
|
||||
filter = path: type: path != "${toString self}/build";
|
||||
filter = path: type: !(builtins.elem path [ "${toString self}/build" "${toString self}/Compositor-Ref" ]);
|
||||
};
|
||||
nativeBuildInputs = with pkgs; [ cmake ninja pkg-config qt6.wrapQtAppsHook ];
|
||||
buildInputs = with pkgs; [ qt6.qtbase qt6.qtsvg qt6.qtimageformats libheif libde265 libraw fontconfig onnxruntime ];
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
# The AppImage's model, MIME data and HEVC decoder come first.
|
||||
export XDG_DATA_DIRS="$APPDIR/usr/share:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}"
|
||||
export LIBHEIF_PLUGIN_PATH="$APPDIR/usr/lib/libheif"
|
||||
@@ -4,7 +4,7 @@ pkgver=1.4.5
|
||||
pkgrel=1
|
||||
pkgdesc='Layered image editing for Linux, a port of Compositor'
|
||||
arch=('x86_64')
|
||||
url='https://github.com/ZacharyZhang-NY/OmaPhoto'
|
||||
url='https://git.zacharyzhang.com/ZacharyZhang-NY/OmaPhoto'
|
||||
license=('MIT')
|
||||
depends=('qt6-base' 'qt6-svg' 'qt6-imageformats' 'libheif' 'libraw' 'libde265' 'fontconfig' 'hicolor-icon-theme' 'shared-mime-info')
|
||||
makedepends=('cmake' 'ninja')
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
# Builds omaphoto-x86_64.AppImage inside the AppImage image.
|
||||
set -euo pipefail
|
||||
id=io.github.ZacharyZhang_NY.OmaPhoto
|
||||
cmake -S . -B build-appimage -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr \
|
||||
-DOMAPHOTO_BUNDLE_ORT=ON -DOMAPHOTO_MODEL=/usr/local/share/omaphoto/u2net.onnx
|
||||
cmake --build build-appimage --target omaphoto
|
||||
rm -rf AppDir
|
||||
DESTDIR="$PWD/AppDir" cmake --install build-appimage
|
||||
# libheif loads its HEVC decoder as a plugin.
|
||||
mkdir -p AppDir/usr/lib/libheif AppDir/apprun-hooks
|
||||
cp /usr/lib/x86_64-linux-gnu/libheif/plugins/libheif-libde265.so AppDir/usr/lib/libheif/
|
||||
cp packaging/appimage/omaphoto.sh AppDir/apprun-hooks/
|
||||
# Qt's Wayland client needs its shell and decoration plugins.
|
||||
qtplugins=/usr/lib/x86_64-linux-gnu/qt6/plugins
|
||||
mkdir -p AppDir/usr/plugins
|
||||
for dir in wayland-shell-integration wayland-decoration-client wayland-graphics-integration-client; do
|
||||
cp -r "$qtplugins/$dir" AppDir/usr/plugins/
|
||||
done
|
||||
export QMAKE=/usr/lib/qt6/bin/qmake6 APPIMAGE_EXTRACT_AND_RUN=1 OUTPUT=omaphoto-x86_64.AppImage
|
||||
export EXTRA_PLATFORM_PLUGINS="libqwayland-egl.so;libqwayland-generic.so" EXTRA_QT_MODULES=svg
|
||||
linuxdeploy --appdir AppDir --plugin qt --output appimage \
|
||||
--desktop-file "AppDir/usr/share/applications/$id.desktop" \
|
||||
--icon-file "AppDir/usr/share/icons/hicolor/512x512/apps/$id.png" \
|
||||
--deploy-deps-only AppDir/usr/lib/libheif \
|
||||
--deploy-deps-only AppDir/usr/plugins/wayland-shell-integration \
|
||||
--deploy-deps-only AppDir/usr/plugins/wayland-decoration-client \
|
||||
--deploy-deps-only AppDir/usr/plugins/wayland-graphics-integration-client
|
||||
@@ -0,0 +1,10 @@
|
||||
# The dev image plus linuxdeploy, pinned by checksum.
|
||||
ARG DEV=omaphoto-dev
|
||||
FROM $DEV
|
||||
RUN curl -fsSL -o /usr/local/bin/linuxdeploy \
|
||||
https://github.com/linuxdeploy/linuxdeploy/releases/download/1-alpha-20251107-1/linuxdeploy-x86_64.AppImage \
|
||||
&& curl -fsSL -o /usr/local/bin/linuxdeploy-plugin-qt \
|
||||
https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/1-alpha-20250213-1/linuxdeploy-plugin-qt-x86_64.AppImage \
|
||||
&& echo "c20cd71e3a4e3b80c3483cef793cda3f4e990aca14014d23c544ca3ce1270b4d /usr/local/bin/linuxdeploy" | sha256sum -c - \
|
||||
&& echo "15106be885c1c48a021198e7e1e9a48ce9d02a86dd0a1848f00bdbf3c1c92724 /usr/local/bin/linuxdeploy-plugin-qt" | sha256sum -c - \
|
||||
&& chmod +x /usr/local/bin/linuxdeploy /usr/local/bin/linuxdeploy-plugin-qt
|
||||
@@ -1,7 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
# Installs OmaPhoto's latest package on Arch and Omarchy.
|
||||
# Installs OmaPhoto's newest package on Arch and Omarchy.
|
||||
set -euo pipefail
|
||||
base=https://github.com/ZacharyZhang-NY/OmaPhoto/releases/latest/download
|
||||
repo=https://git.zacharyzhang.com/ZacharyZhang-NY/OmaPhoto
|
||||
# The newest release's tag, from Gitea's API.
|
||||
tag=$(curl -fsSL --proto '=https' https://git.zacharyzhang.com/api/v1/repos/ZacharyZhang-NY/OmaPhoto/releases/latest | grep -o '"tag_name":"v[^"]*"' | cut -d'"' -f4) || tag=
|
||||
if [ -z "$tag" ]; then
|
||||
echo "No release found at $repo/releases." >&2
|
||||
exit 1
|
||||
fi
|
||||
base=$repo/releases/download/$tag
|
||||
package=omaphoto-x86_64.pkg.tar.zst
|
||||
. /etc/os-release
|
||||
case " ${ID:-} ${ID_LIKE:-} " in
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
# Installs OmaPhoto's latest RPM on Fedora 43 or 44.
|
||||
# Installs OmaPhoto's newest RPM on Fedora 43 or 44.
|
||||
set -euo pipefail
|
||||
base=https://github.com/ZacharyZhang-NY/OmaPhoto/releases/latest/download
|
||||
repo=https://git.zacharyzhang.com/ZacharyZhang-NY/OmaPhoto
|
||||
# The newest release's tag, from Gitea's API.
|
||||
tag=$(curl -fsSL --proto '=https' https://git.zacharyzhang.com/api/v1/repos/ZacharyZhang-NY/OmaPhoto/releases/latest | grep -o '"tag_name":"v[^"]*"' | cut -d'"' -f4) || tag=
|
||||
if [ -z "$tag" ]; then
|
||||
echo "No release found at $repo/releases." >&2
|
||||
exit 1
|
||||
fi
|
||||
base=$repo/releases/download/$tag
|
||||
. /etc/os-release
|
||||
release=
|
||||
case " ${ID:-} ${ID_LIKE:-} " in
|
||||
|
||||
@@ -9,14 +9,11 @@ if [ "$(uname -m)" != x86_64 ]; then
|
||||
echo "OmaPhoto's flake builds for x86_64 alone." >&2
|
||||
exit 1
|
||||
fi
|
||||
# The newest release's tag, as GitHub redirects to it.
|
||||
latest=$(curl -fsSLI --proto '=https' -o /dev/null -w '%{url_effective}' https://github.com/ZacharyZhang-NY/OmaPhoto/releases/latest)
|
||||
tag=${latest##*/}
|
||||
case "$tag" in
|
||||
v[0-9]*) ;;
|
||||
*)
|
||||
echo "No release found at $latest." >&2
|
||||
repo=https://git.zacharyzhang.com/ZacharyZhang-NY/OmaPhoto
|
||||
# The newest release's tag, from Gitea's API.
|
||||
tag=$(curl -fsSL --proto '=https' https://git.zacharyzhang.com/api/v1/repos/ZacharyZhang-NY/OmaPhoto/releases/latest | grep -o '"tag_name":"v[^"]*"' | cut -d'"' -f4) || tag=
|
||||
if [ -z "$tag" ]; then
|
||||
echo "No release found at $repo/releases." >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
nix --extra-experimental-features "nix-command flakes" profile install "github:ZacharyZhang-NY/OmaPhoto/$tag"
|
||||
fi
|
||||
nix --extra-experimental-features "nix-command flakes" profile install "git+$repo?ref=refs/tags/$tag"
|
||||
@@ -1,7 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
# Installs OmaPhoto's latest DEB on Ubuntu LTS and derivatives.
|
||||
# Installs OmaPhoto's newest DEB on Ubuntu LTS and derivatives.
|
||||
set -euo pipefail
|
||||
base=https://github.com/ZacharyZhang-NY/OmaPhoto/releases/latest/download
|
||||
repo=https://git.zacharyzhang.com/ZacharyZhang-NY/OmaPhoto
|
||||
# The newest release's tag, from Gitea's API.
|
||||
tag=$(curl -fsSL --proto '=https' https://git.zacharyzhang.com/api/v1/repos/ZacharyZhang-NY/OmaPhoto/releases/latest | grep -o '"tag_name":"v[^"]*"' | cut -d'"' -f4) || tag=
|
||||
if [ -z "$tag" ]; then
|
||||
echo "No release found at $repo/releases." >&2
|
||||
exit 1
|
||||
fi
|
||||
base=$repo/releases/download/$tag
|
||||
. /etc/os-release
|
||||
# Each DEB names its LTS's libraries; derivatives name their base.
|
||||
case "${UBUNTU_CODENAME:-}" in
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
#!/usr/bin/env bash
|
||||
# Builds a tag's packages and publishes a Gitea release.
|
||||
set -euo pipefail
|
||||
tag=${1:?"usage: GITEA_TOKEN=... scripts/release.sh vX.Y.Z"}
|
||||
token=${GITEA_TOKEN:?"GITEA_TOKEN must hold a Gitea access token"}
|
||||
api=https://git.zacharyzhang.com/api/v1/repos/ZacharyZhang-NY/OmaPhoto
|
||||
repo=$(cd "$(dirname "$0")/.." && pwd)
|
||||
cd "$repo"
|
||||
version=${tag#v}
|
||||
# The tag must name the version each build file carries.
|
||||
if ! git show "$tag:CMakeLists.txt" | grep -qF "project(omaphoto VERSION $version "; then
|
||||
echo "CMakeLists.txt at $tag is not $version" >&2
|
||||
exit 1
|
||||
fi
|
||||
if ! git show "$tag:packaging/arch/PKGBUILD" | grep -qxF "pkgver=$version"; then
|
||||
echo "The PKGBUILD at $tag is not $version" >&2
|
||||
exit 1
|
||||
fi
|
||||
if ! git show "$tag:flake.nix" | grep -qF "version = \"$version\";"; then
|
||||
echo "flake.nix at $tag is not $version" >&2
|
||||
exit 1
|
||||
fi
|
||||
out=$repo/release/$tag
|
||||
rm -rf "$out"
|
||||
mkdir -p "$out"
|
||||
work=$(mktemp -d)
|
||||
trap 'rm -rf "$work"' EXIT
|
||||
user="$(id -u):$(id -g)"
|
||||
configure="cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DOMAPHOTO_BUNDLE_ORT=ON -DOMAPHOTO_MODEL=/usr/local/share/omaphoto/u2net.onnx && cmake --build build --target omaphoto"
|
||||
# Each package builds from a fresh copy of the tag.
|
||||
fresh() {
|
||||
rm -rf "$work/src"
|
||||
mkdir "$work/src"
|
||||
git archive "$tag" | tar -x -C "$work/src"
|
||||
}
|
||||
build() {
|
||||
docker run --rm -u "$user" -e HOME=/tmp -v "$work/src:/src" -w /src "$1" sh -c "$2"
|
||||
}
|
||||
# One DEB per Ubuntu LTS: each names its own libraries.
|
||||
docker build -t omaphoto-dev --build-arg BASE=ubuntu:24.04 -f Dockerfile.dev .
|
||||
docker build -t omaphoto-resolute --build-arg BASE=ubuntu:26.04 -f Dockerfile.dev .
|
||||
for pair in noble:omaphoto-dev resolute:omaphoto-resolute; do
|
||||
fresh
|
||||
build "${pair#*:}" "$configure && cd build && cpack -G DEB"
|
||||
mv "$work"/src/build/omaphoto_*.deb "$out/omaphoto-${pair%%:*}_amd64.deb"
|
||||
done
|
||||
# One RPM per Fedora release: each names its own LibRaw.
|
||||
docker build -t omaphoto-fedora --build-arg RELEASE=43 scripts/distro/fedora
|
||||
docker build -t omaphoto-fedora44 --build-arg RELEASE=44 scripts/distro/fedora
|
||||
for pair in 43:omaphoto-fedora 44:omaphoto-fedora44; do
|
||||
fresh
|
||||
build "${pair#*:}" "$configure && cd build && cpack -G RPM"
|
||||
mv "$work"/src/build/omaphoto-*.x86_64.rpm "$out/omaphoto-fc${pair%%:*}.x86_64.rpm"
|
||||
done
|
||||
# makepkg refuses root; a user of our id builds.
|
||||
docker build --pull -t omaphoto-arch scripts/distro/arch
|
||||
fresh
|
||||
docker run --rm -v "$work/src:/src" omaphoto-arch sh -c "useradd -u $(id -u) builder && chown -R builder /src && su builder -c 'cd /src/packaging/arch && makepkg -f'"
|
||||
mv "$work"/src/packaging/arch/omaphoto-[0-9]*-x86_64.pkg.tar.zst "$out/omaphoto-x86_64.pkg.tar.zst"
|
||||
# The AppImage builds on Ubuntu 24.04, the oldest glibc here.
|
||||
docker build -t omaphoto-appimage --build-arg DEV=omaphoto-dev scripts/distro/appimage
|
||||
fresh
|
||||
build omaphoto-appimage scripts/appimage.sh
|
||||
mv "$work/src/omaphoto-x86_64.AppImage" "$out/"
|
||||
names="omaphoto-noble_amd64.deb omaphoto-resolute_amd64.deb omaphoto-fc43.x86_64.rpm omaphoto-fc44.x86_64.rpm omaphoto-x86_64.pkg.tar.zst omaphoto-x86_64.AppImage"
|
||||
(cd "$out" && sha256sum $names > SHA256SUMS)
|
||||
# The tag must already be on Gitea.
|
||||
notes="Install with the script for your system, or run the AppImage: see the README's Install section."
|
||||
body=$(printf '{"tag_name":"%s","name":"OmaPhoto %s","body":"%s"}' "$tag" "$version" "$notes")
|
||||
release=$(curl -fsS -X POST -H "Authorization: token $token" -H "Content-Type: application/json" -d "$body" "$api/releases")
|
||||
id=$(echo "$release" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
|
||||
for name in $names SHA256SUMS; do
|
||||
echo "Uploading $name"
|
||||
curl -fsS -o /dev/null -X POST -H "Authorization: token $token" -F "attachment=@$out/$name" "$api/releases/$id/assets?name=$name"
|
||||
done
|
||||
echo "Published https://git.zacharyzhang.com/ZacharyZhang-NY/OmaPhoto/releases/tag/$tag"
|
||||
@@ -55,7 +55,7 @@ std::optional<BrushStroke::Clone> EditorSession::blurSample(const BrushStroke &s
|
||||
const double margin = std::ceil(3 * sigma);
|
||||
const QRectF region = stroke.sourceRect.adjusted(-margin, -margin, margin, margin);
|
||||
// A huge layer's sample is made coarser, within several canvases.
|
||||
const qint64 canvas = m_document ? qint64(m_document->width) * m_document->height : 0;
|
||||
const qint64 canvas = qint64(m_document.value().width) * m_document.value().height;
|
||||
const double budget = double(std::min(DocumentLimits::maxSurfacePixels, std::max<qint64>(16'000'000, 4 * canvas)));
|
||||
const double fit = std::min(1.0, std::sqrt(budget / (region.width() * region.height())));
|
||||
const int width = std::max(1, int(std::ceil(region.width() * fit))), height = std::max(1, int(std::ceil(region.height() * fit)));
|
||||
@@ -63,8 +63,8 @@ std::optional<BrushStroke::Clone> EditorSession::blurSample(const BrushStroke &s
|
||||
try {
|
||||
QImage context = BrushRaster::context(width, height, stroke.isMask);
|
||||
// Past its pixels a mask keeps its edge tone.
|
||||
if (stroke.isMask && layer.mask)
|
||||
context.fill(int(std::round(LayerMask::background(layer.mask->asset.thumbnail) * 255)));
|
||||
if (stroke.isMask)
|
||||
context.fill(int(std::round(LayerMask::background(asset->thumbnail) * 255)));
|
||||
QPainter painter(&context);
|
||||
// A painted asset flattens here; the catch covers it too.
|
||||
BrushRaster::draw(asset->image(), placed, painter);
|
||||
|
||||
@@ -300,14 +300,10 @@ void EditorSession::commitPaintSnapshot(const BrushStroke &stroke)
|
||||
// A raster edit assembled off the UI thread; one step.
|
||||
void EditorSession::commitRasterEdit(std::shared_ptr<const BrushStroke> stroke, const QString &name, std::function<void()> alsoApply, std::function<void()> done)
|
||||
{
|
||||
// The caller resumes from the event loop, like await.
|
||||
const auto finish = [this, done] {
|
||||
if (done)
|
||||
QMetaObject::invokeMethod(this, done, Qt::QueuedConnection);
|
||||
};
|
||||
if (!stroke->committedTransform().isValid()) {
|
||||
setBrushError(QString::fromUtf8(ProjectError(ProjectError::Kind::tooLarge).what()));
|
||||
finish();
|
||||
if (done)
|
||||
done();
|
||||
return;
|
||||
}
|
||||
setIsProjectBusy(true);
|
||||
@@ -331,8 +327,9 @@ void EditorSession::finishRasterCommit()
|
||||
setIsProjectBusy(false);
|
||||
++m_brushRevision;
|
||||
notify();
|
||||
// Swift's caller resumes in the same job, nothing between.
|
||||
if (pending.done)
|
||||
QMetaObject::invokeMethod(this, pending.done, Qt::QueuedConnection);
|
||||
pending.done();
|
||||
};
|
||||
if (made.failure) {
|
||||
setBrushError(made.failure);
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#include "UI/BlendModePicker.h"
|
||||
#include <QAbstractItemView>
|
||||
#include <QEvent>
|
||||
|
||||
BlendModePicker::BlendModePicker(EditorSession &session, QWidget *parent) : QComboBox(parent), m_session(session)
|
||||
{
|
||||
@@ -13,6 +15,8 @@ BlendModePicker::BlendModePicker(EditorSession &session, QWidget *parent) : QCom
|
||||
connect(this, &QComboBox::highlighted, this, &BlendModePicker::highlight);
|
||||
connect(this, &QComboBox::activated, this, &BlendModePicker::choose);
|
||||
connect(&m_session, &EditorSession::changed, this, &BlendModePicker::synchronize);
|
||||
// Qt 6.10 closes on Escape without calling hidePopup.
|
||||
view()->window()->installEventFilter(this);
|
||||
synchronize();
|
||||
}
|
||||
|
||||
@@ -24,9 +28,10 @@ void BlendModePicker::showPopup()
|
||||
QComboBox::showPopup();
|
||||
}
|
||||
|
||||
void BlendModePicker::hidePopup()
|
||||
bool BlendModePicker::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
QComboBox::hidePopup();
|
||||
if (watched != view()->window() || event->type() != QEvent::Hide)
|
||||
return QComboBox::eventFilter(watched, event);
|
||||
m_tracking = false;
|
||||
// A click closes the menu, then chooses: clear after.
|
||||
QMetaObject::invokeMethod(this, [this] {
|
||||
@@ -34,6 +39,7 @@ void BlendModePicker::hidePopup()
|
||||
m_layerID = std::nullopt;
|
||||
m_highlighted = std::nullopt;
|
||||
}, Qt::QueuedConnection);
|
||||
return false;
|
||||
}
|
||||
|
||||
void BlendModePicker::synchronize()
|
||||
@@ -47,6 +53,9 @@ void BlendModePicker::synchronize()
|
||||
|
||||
void BlendModePicker::highlight(int index)
|
||||
{
|
||||
// Qt 6.10 signals too, as the closed menu follows.
|
||||
if (!m_tracking)
|
||||
return;
|
||||
const std::optional<LayerBlendMode> mode = layerBlendMode(itemText(index));
|
||||
if (mode)
|
||||
m_highlighted = mode;
|
||||
|
||||
@@ -9,7 +9,10 @@ public:
|
||||
explicit BlendModePicker(EditorSession &session, QWidget *parent = nullptr);
|
||||
|
||||
void showPopup() override;
|
||||
void hidePopup() override;
|
||||
|
||||
protected:
|
||||
// The popup closed, however Qt closed it.
|
||||
bool eventFilter(QObject *watched, QEvent *event) override;
|
||||
|
||||
private:
|
||||
void synchronize();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "UI/TypeControls.h"
|
||||
#include <QAbstractItemView>
|
||||
#include <QEvent>
|
||||
#include <QFontInfo>
|
||||
#include <QRawFont>
|
||||
#include <QtConcurrent>
|
||||
@@ -147,18 +148,22 @@ TypeFontPicker::TypeFontPicker(std::function<void(PreviewStep, const QString &)>
|
||||
{
|
||||
setAccessibleName(QStringLiteral("Font"));
|
||||
prepareOwnNames();
|
||||
// Only a face previews; (Multiple) leaves the last one showing.
|
||||
// An open menu's face previews; Qt 6.10 signals closed too.
|
||||
connect(this, &QComboBox::highlighted, this, [this](int index) {
|
||||
if (!isMultiple(index))
|
||||
if (view()->isVisible() && !isMultiple(index))
|
||||
m_preview(PreviewStep::show, itemText(index));
|
||||
});
|
||||
// Qt 6.10 closes on Escape without calling hidePopup.
|
||||
view()->window()->installEventFilter(this);
|
||||
}
|
||||
|
||||
// Qt reports a choice after the close: the revert waits.
|
||||
void TypeFontPicker::hidePopup()
|
||||
bool TypeFontPicker::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
QComboBox::hidePopup();
|
||||
if (watched != view()->window() || event->type() != QEvent::Hide)
|
||||
return QComboBox::eventFilter(watched, event);
|
||||
QMetaObject::invokeMethod(this, [this] { m_preview(PreviewStep::revert, QString()); }, Qt::QueuedConnection);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TypeFontPicker::isMultiple(int index) const
|
||||
|
||||
@@ -45,14 +45,14 @@ public:
|
||||
// Shows `name`, or (Multiple) when empty; an open menu stays.
|
||||
void sync(const QString &name);
|
||||
void showPopup() override;
|
||||
// Closed, the text goes back; a choice already kept it.
|
||||
void hidePopup() override;
|
||||
// Swift's isMultiple: the top item that is no font.
|
||||
bool isMultiple(int index) const;
|
||||
|
||||
protected:
|
||||
// A long name is cut short, never widening the control.
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
// Closed, the text goes back; a choice already kept it.
|
||||
bool eventFilter(QObject *watched, QEvent *event) override;
|
||||
|
||||
private:
|
||||
void showMultiple();
|
||||
|
||||
@@ -65,7 +65,12 @@ void AcceptanceColorTests::cameraRawDocked()
|
||||
FilterSettings settings = app.session().filterSettings();
|
||||
settings.cameraRaw.exposure = 1;
|
||||
app.session().updateFilter(settings, true);
|
||||
QTRY_VERIFY_WITH_TIMEOUT(app.session().filterEdit().value().previewImage(layer), 30000);
|
||||
// The shot waits for the brightened preview.
|
||||
const auto brightened = [&app, layer] {
|
||||
const std::optional<QImage> preview = app.session().filterEdit().value().previewImage(layer);
|
||||
return preview && preview.value().pixelColor(preview.value().width() / 2, preview.value().height() * 7 / 8).green() > 170;
|
||||
};
|
||||
QTRY_VERIFY_WITH_TIMEOUT(brightened(), 30000);
|
||||
app.shot(QStringLiteral("06-camera-raw"));
|
||||
bool done = false;
|
||||
app.session().commitFilter([&done] { done = true; });
|
||||
|
||||
@@ -0,0 +1,239 @@
|
||||
#include "AcceptanceFixtures.h"
|
||||
#include "Document/LayerAppearance.h"
|
||||
#include "Document/SmudgeLiquify.h"
|
||||
#include "UI/NativeLayerList.h"
|
||||
#include "UI/TransformInspector.h"
|
||||
#include "UI/TypeControls.h"
|
||||
#include <QCheckBox>
|
||||
#include <QLineEdit>
|
||||
|
||||
// The acceptance run, part five: 1.4.5's editing.
|
||||
class AcceptanceEditTests : public QObject {
|
||||
Q_OBJECT
|
||||
private slots:
|
||||
void initTestCase() { QStandardPaths::setTestModeEnabled(true); }
|
||||
void textPaintingSmearAndMasks();
|
||||
void moveKeysAndBlending();
|
||||
};
|
||||
|
||||
namespace {
|
||||
QImage filled(int width, int height, QColor color)
|
||||
{
|
||||
QImage image = BrushRaster::context(width, height, false);
|
||||
image.fill(color);
|
||||
return image;
|
||||
}
|
||||
|
||||
QUuid add(App &app, const QImage &image, const QString &name, QPointF centre)
|
||||
{
|
||||
app.session().insert(ImportedImage(image, image, name), centre);
|
||||
return app.session().activeLayerID().value();
|
||||
}
|
||||
|
||||
int red(App &app, QUuid id, int x, int y)
|
||||
{
|
||||
for (const ImageLayer &layer : app.session().document().value().layers)
|
||||
if (layer.id == id)
|
||||
return qRed(layer.asset.value().image().pixel(x, y));
|
||||
throw std::runtime_error("no such layer");
|
||||
}
|
||||
|
||||
// The canvas's pixel at a document point, at 100%.
|
||||
QColor onCanvas(App &app, QPointF point)
|
||||
{
|
||||
const QPointF view = app.session().viewport.viewPoint(point + QPointF(0.5, 0.5), app.session().document().value().size());
|
||||
return app.canvas().grab().toImage().pixelColor(int(std::floor(view.x())), int(std::floor(view.y())));
|
||||
}
|
||||
|
||||
bool near(QColor a, QColor b)
|
||||
{
|
||||
return qAbs(a.red() - b.red()) <= 2 && qAbs(a.green() - b.green()) <= 2 && qAbs(a.blue() - b.blue()) <= 2;
|
||||
}
|
||||
}
|
||||
|
||||
void AcceptanceEditTests::textPaintingSmearAndMasks()
|
||||
{
|
||||
App app;
|
||||
app.session().createDocument(1200, 800, true);
|
||||
// A face for the selected word, a preview, and Undo.
|
||||
app.session().selectTool(NavigationTool::type);
|
||||
app.press(QPointF(100, 200));
|
||||
app.release(QPointF(100, 200));
|
||||
QTRY_VERIFY(app.session().textDraft());
|
||||
QTest::keyClicks(&app.canvas(), QStringLiteral("Hello World"));
|
||||
for (int letter = 0; letter < 5; ++letter)
|
||||
QTest::keyClick(&app.canvas(), Qt::Key_Left, Qt::ShiftModifier);
|
||||
auto *faces = app.window.findChild<TypeFontPicker *>(QStringLiteral("typeFont"));
|
||||
QVERIFY(faces);
|
||||
const QString mono = QStringLiteral("DejaVuSansMono");
|
||||
// Pointing at a face previews it; Escape puts it back.
|
||||
QTest::mouseMove(faces->view()->viewport(), popupRow(*faces, mono));
|
||||
QTRY_COMPARE(app.session().textDraft().value().style.fontNameAt(6), mono);
|
||||
QTest::keyClick(faces->view()->window()->windowHandle(), Qt::Key_Escape);
|
||||
QTRY_VERIFY(app.session().textDraft().value().style.fontNameAt(6) != mono);
|
||||
choose(*faces, mono);
|
||||
QTRY_COMPARE(app.session().textDraft().value().style.fontRuns.value(), (std::vector<LayerTextFontRun>{{6, 5, mono}}));
|
||||
app.window.activateWindow();
|
||||
QVERIFY(QTest::qWaitForWindowActive(&app.window));
|
||||
app.canvas().setFocus();
|
||||
QTRY_VERIFY(app.canvas().hasFocus());
|
||||
QTest::keyClick(&app.canvas(), Qt::Key_End);
|
||||
QTest::keyClicks(&app.canvas(), QStringLiteral("!!"));
|
||||
QTest::keyClick(&app.canvas(), Qt::Key_Z, Qt::ControlModifier);
|
||||
QCOMPARE(app.session().textDraft().value().style.content, QStringLiteral("Hello World"));
|
||||
QTest::keyClick(&app.canvas(), Qt::Key_Return, Qt::ControlModifier);
|
||||
QVERIFY(!app.session().textDraft());
|
||||
// A brush paints in a scaled-down layer's own pixels.
|
||||
const QUuid half = add(app, filled(800, 800, Qt::black), QStringLiteral("Half"), QPointF(600, 400));
|
||||
app.session().beginTransform();
|
||||
LayerTransform quarter = app.session().activeLayer().value().transform;
|
||||
quarter.origin = QPointF(500, 300);
|
||||
quarter.size = QSizeF(200, 200);
|
||||
app.session().previewTransform(quarter);
|
||||
app.session().commitTransform();
|
||||
app.session().selectTool(NavigationTool::brush);
|
||||
app.session().setBrushSettings({.diameter = 20, .hardness = 1, .red = 1, .green = 1, .blue = 1});
|
||||
app.drag(QPointF(600, 330), QPointF(600, 470));
|
||||
app.settle();
|
||||
QCOMPARE(app.session().activeLayer().value().asset.value().size(), QSize(800, 800));
|
||||
int painted = 0;
|
||||
for (int x = 0; x < 800; ++x)
|
||||
painted += red(app, half, x, 400) > 128;
|
||||
QVERIFY2(painted >= 76 && painted <= 84, qPrintable(QString::number(painted)));
|
||||
// A hidden layer says why it cannot paint.
|
||||
app.session().toggleLayerVisibility(half);
|
||||
app.press(QPointF(560, 400));
|
||||
app.release(QPointF(560, 400));
|
||||
QVERIFY(app.session().brushError().value().contains(QStringLiteral("is hidden")));
|
||||
app.session().setBrushError(std::nullopt);
|
||||
app.session().toggleLayerVisibility(half);
|
||||
// The Blur brush's Radius sets how far it softens.
|
||||
QImage step = filled(400, 200, Qt::black);
|
||||
QPainter(&step).fillRect(200, 0, 200, 200, Qt::white);
|
||||
const QUuid edge = add(app, step, QStringLiteral("Edge"), QPointF(200, 600));
|
||||
const auto softened = [&](const QString &radius) {
|
||||
app.session().selectTool(NavigationTool::blur);
|
||||
app.session().setBlurMode(BlurToolMode::blur);
|
||||
app.session().setBrushSettings({.diameter = 120, .hardness = 1, .opacity = 1});
|
||||
// The bar's own Radius field.
|
||||
auto *field = app.window.findChild<QLineEdit *>(QStringLiteral("blurRadius"));
|
||||
field->setFocus();
|
||||
field->selectAll();
|
||||
QTest::keyClicks(field, radius);
|
||||
QTest::keyClick(field, Qt::Key_Return);
|
||||
app.drag(QPointF(200, 520), QPointF(200, 680));
|
||||
app.settle();
|
||||
int soft = 0;
|
||||
for (int x = 100; x < 300; ++x)
|
||||
soft += red(app, edge, x, 100) > 10 && red(app, edge, x, 100) < 245;
|
||||
app.action("undo").trigger();
|
||||
return soft;
|
||||
};
|
||||
const int narrow = softened(QStringLiteral("2")), wide = softened(QStringLiteral("20"));
|
||||
QVERIFY2(narrow < 16 && wide > 40, qPrintable(QString("%1 %2").arg(narrow).arg(wide)));
|
||||
// Liquify keeps the stripes sharp as it pushes them.
|
||||
QImage stripes = filled(400, 200, Qt::black);
|
||||
for (int x = 0; x < 400; x += 20)
|
||||
QPainter(&stripes).fillRect(x, 0, 10, 200, Qt::white);
|
||||
const QUuid striped = add(app, stripes, QStringLiteral("Stripes"), QPointF(800, 600));
|
||||
app.session().selectTool(NavigationTool::blur);
|
||||
app.session().setBlurMode(BlurToolMode::liquify);
|
||||
app.session().setBrushSettings({.diameter = 80, .hardness = 0.5, .opacity = 0.7});
|
||||
app.drag(QPointF(720, 600), QPointF(840, 600));
|
||||
app.settle();
|
||||
int moved = 0, grey = 0;
|
||||
for (int x = 0; x < 400; ++x) {
|
||||
const int value = red(app, striped, x, 100);
|
||||
moved += value != qRed(stripes.pixel(x, 100));
|
||||
grey += value > 40 && value < 215;
|
||||
}
|
||||
QVERIFY2(moved > 20 && grey * 5 < moved, qPrintable(QString("%1 %2").arg(moved).arg(grey)));
|
||||
// Smudge leaves one fading trail, no copies along it.
|
||||
QImage block = filled(400, 200, Qt::white);
|
||||
QPainter(&block).fillRect(0, 0, 100, 200, Qt::red);
|
||||
const QUuid smeared = add(app, block, QStringLiteral("Block"), QPointF(200, 200));
|
||||
app.session().setBlurMode(BlurToolMode::smudge);
|
||||
app.session().setBrushSettings({.diameter = 60, .hardness = 0.5, .opacity = 0.8});
|
||||
app.drag(QPointF(50, 200), QPointF(300, 200));
|
||||
app.settle();
|
||||
const auto green = [&](int x) {
|
||||
for (const ImageLayer &layer : app.session().document().value().layers)
|
||||
if (layer.id == smeared)
|
||||
return qGreen(layer.asset.value().image().pixel(x, 100));
|
||||
throw std::runtime_error("no such layer");
|
||||
};
|
||||
QVERIFY2(green(110) < 200, qPrintable(QString::number(green(110))));
|
||||
for (int x = 110; x < 300; x += 10)
|
||||
QVERIFY2(green(x + 10) >= green(x) - 3, qPrintable(QString("%1: %2 then %3").arg(x).arg(green(x)).arg(green(x + 10))));
|
||||
app.session().selectLayer(striped);
|
||||
// The mask button reveals; Alt hides; Alt-click shows alone.
|
||||
app.session().selectTool(NavigationTool::marquee);
|
||||
app.drag(QPointF(650, 520), QPointF(750, 680));
|
||||
auto *mask = app.window.findChild<QToolButton *>(QStringLiteral("addLayerMask"));
|
||||
QTest::mouseClick(mask, Qt::LeftButton);
|
||||
QImage shown = app.session().activeLayer().value().mask.value().asset.image();
|
||||
QCOMPARE(qGray(shown.pixel(100, 100)), 255);
|
||||
QCOMPARE(qGray(shown.pixel(5, 100)), 0);
|
||||
app.action("undo").trigger();
|
||||
QTest::mouseClick(mask, Qt::LeftButton, Qt::AltModifier);
|
||||
shown = app.session().activeLayer().value().mask.value().asset.image();
|
||||
QVERIFY(qGray(shown.pixel(100, 100)) == 0 && qGray(shown.pixel(5, 100)) == 255);
|
||||
LayerThumbnailButton *thumbnail = nullptr;
|
||||
for (LayerCell *cell : app.window.findChild<NativeLayerList *>()->cells())
|
||||
if (cell->layerID() == striped)
|
||||
thumbnail = cell->findChild<LayerThumbnailButton *>("maskThumbnail");
|
||||
QVERIFY(thumbnail);
|
||||
QTest::mouseClick(thumbnail, Qt::LeftButton, Qt::AltModifier, thumbnail->rect().center());
|
||||
QCOMPARE(app.session().maskAloneLayer().value().id, striped);
|
||||
QTRY_VERIFY(app.window.findChild<QWidget *>(QStringLiteral("maskAloneBadge"))->isVisible());
|
||||
// The canvas shows the mask: black where hidden, white past.
|
||||
QTRY_COMPARE(onCanvas(app, QPointF(700, 600)), QColor(Qt::black));
|
||||
QCOMPARE(onCanvas(app, QPointF(620, 600)), QColor(Qt::white));
|
||||
QCOMPARE(onCanvas(app, QPointF(50, 150)), QColor(Qt::white));
|
||||
app.shot(QStringLiteral("18-mask-alone"));
|
||||
}
|
||||
|
||||
void AcceptanceEditTests::moveKeysAndBlending()
|
||||
{
|
||||
App app;
|
||||
QVERIFY(scene(1200, 800).save(app.path("photo.png")));
|
||||
app.session().createDocument(1200, 800);
|
||||
app.importFile(app.path("photo.png"));
|
||||
// Held Ctrl flips Auto Select in the bar.
|
||||
app.session().selectTool(NavigationTool::move);
|
||||
auto *autoSelect = app.window.findChild<QCheckBox *>(QStringLiteral("transformAutoSelect"));
|
||||
QVERIFY(autoSelect);
|
||||
const bool before = autoSelect->isChecked();
|
||||
QTest::keyPress(&app.canvas(), Qt::Key_Control, Qt::ControlModifier);
|
||||
QCOMPARE(autoSelect->isChecked(), !before);
|
||||
QTest::keyRelease(&app.canvas(), Qt::Key_Control, Qt::NoModifier);
|
||||
QCOMPARE(autoSelect->isChecked(), before);
|
||||
// A typed width applies as one step on leaving.
|
||||
auto *width = app.window.findChild<QLineEdit *>(QStringLiteral("transformW"));
|
||||
QVERIFY(width);
|
||||
const int steps = app.session().history.undoCount();
|
||||
width->setFocus();
|
||||
QTRY_VERIFY(width->hasFocus());
|
||||
width->selectAll();
|
||||
QTest::keyClicks(width, QStringLiteral("600"));
|
||||
app.canvas().setFocus();
|
||||
QTRY_COMPARE(app.session().activeLayer().value().transform.size.width(), 600.0);
|
||||
QCOMPARE(app.session().history.undoCount(), steps + 1);
|
||||
app.action("undo").trigger();
|
||||
// Soft Light and a Linear Dodge stack show as exported.
|
||||
app.session().zoom(1);
|
||||
const QUuid grey = add(app, filled(1200, 800, QColor(77, 77, 77)), QStringLiteral("Grey"), QPointF(600, 400));
|
||||
app.session().setLayerBlendMode(LayerBlendMode::softLight);
|
||||
const QList<QPointF> points{QPointF(600, 400), QPointF(300, 100), QPointF(900, 700)};
|
||||
for (const QPointF point : points)
|
||||
QTRY_VERIFY2(near(onCanvas(app, point), app.shown(int(point.x()), int(point.y()))), qPrintable(onCanvas(app, point).name()));
|
||||
add(app, filled(1200, 800, QColor(0, 0, 160, 160)), QStringLiteral("Clipped"), QPointF(600, 400));
|
||||
app.session().toggleClippingMask(app.session().activeLayerID().value());
|
||||
app.session().selectLayer(grey);
|
||||
app.session().setLayerBlendMode(LayerBlendMode::linearDodge);
|
||||
for (const QPointF point : points)
|
||||
QTRY_VERIFY2(near(onCanvas(app, point), app.shown(int(point.x()), int(point.y()))), qPrintable(onCanvas(app, point).name()));
|
||||
}
|
||||
|
||||
QTEST_MAIN(AcceptanceEditTests)
|
||||
#include "AcceptanceEditTests.moc"
|
||||
@@ -0,0 +1,203 @@
|
||||
#include "AcceptanceFixtures.h"
|
||||
#include "DialogDesk.h"
|
||||
#include "UI/JPEGExportSheet.h"
|
||||
#include <QComboBox>
|
||||
#include <map>
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
#include <QToolButton>
|
||||
|
||||
// The acceptance run, part six: 1.4.5's filters, export, Quit.
|
||||
class AcceptanceFinishTests : public QObject {
|
||||
Q_OBJECT
|
||||
private slots:
|
||||
void initTestCase() { QStandardPaths::setTestModeEnabled(true); }
|
||||
void cameraRawCurvesAndDither();
|
||||
void jpegPreviewAndQuitMidEdit();
|
||||
};
|
||||
|
||||
namespace {
|
||||
QUuid photo(App &app)
|
||||
{
|
||||
if (!scene(1200, 800).save(app.path("photo.png")))
|
||||
throw std::runtime_error("the photo could not be written");
|
||||
app.session().createDocument(1200, 800);
|
||||
app.importFile(app.path("photo.png"));
|
||||
return app.session().activeLayerID().value();
|
||||
}
|
||||
|
||||
void drag(QWidget *widget, QPoint from, QPoint to)
|
||||
{
|
||||
QTest::mousePress(widget, Qt::LeftButton, Qt::NoModifier, from);
|
||||
for (int step = 1; step <= 4; ++step) {
|
||||
const QPointF at = from + (to - from) * (step / 4.0);
|
||||
QMouseEvent event(QEvent::MouseMove, at, widget->mapToGlobal(at), Qt::NoButton, Qt::LeftButton, Qt::NoModifier);
|
||||
QApplication::sendEvent(widget, &event);
|
||||
}
|
||||
QTest::mouseRelease(widget, Qt::LeftButton, Qt::NoModifier, to);
|
||||
}
|
||||
|
||||
// A shown widget of that name, once its panel shows.
|
||||
template <typename Widget> Widget &shownChild(App &app, const char *name)
|
||||
{
|
||||
Widget *shown = nullptr;
|
||||
static_cast<void>(QTest::qWaitFor([&] {
|
||||
for (Widget *each : app.window.findChildren<Widget *>(QString::fromLatin1(name)))
|
||||
if (each->isVisible())
|
||||
shown = each;
|
||||
return shown != nullptr;
|
||||
}, 5000));
|
||||
if (!shown)
|
||||
throw std::runtime_error(std::string("no shown ") + name);
|
||||
return *shown;
|
||||
}
|
||||
|
||||
// The filter panel's OK, then the commit's landing.
|
||||
bool committed(App &app)
|
||||
{
|
||||
shownChild<QPushButton>(app, "filterOK").click();
|
||||
return QTest::qWaitFor([&app] { return !app.session().filterEdit() && !app.session().isProjectBusy(); }, 30000);
|
||||
}
|
||||
|
||||
void typeInto(App &app, const char *name, const QString &text, bool submit)
|
||||
{
|
||||
auto &field = shownChild<QLineEdit>(app, name);
|
||||
field.setFocus();
|
||||
field.selectAll();
|
||||
QTest::keyClicks(&field, text);
|
||||
if (submit)
|
||||
QTest::keyClick(&field, Qt::Key_Return);
|
||||
}
|
||||
|
||||
// The first glyph in the ground: its box, inked share.
|
||||
std::pair<QRect, double> glyph(const QImage &image)
|
||||
{
|
||||
const QRect ground(400, 640, 400, 120);
|
||||
std::map<QRgb, int> counts;
|
||||
for (int y = ground.top(); y < ground.bottom(); ++y)
|
||||
for (int x = ground.left(); x < ground.right(); ++x)
|
||||
++counts[image.pixel(x, y)];
|
||||
const int paper = qGray(std::max_element(counts.begin(), counts.end(), [](auto a, auto b) { return a.second < b.second; })->first);
|
||||
// Ink lies past halfway from the paper's gray.
|
||||
const auto inked = [&image, paper](QPoint at) { return std::abs(qGray(image.pixel(at)) - paper) > 127; };
|
||||
std::vector<bool> seen(size_t(image.width()) * size_t(image.height()));
|
||||
const auto index = [&image](QPoint at) { return size_t(at.y()) * size_t(image.width()) + size_t(at.x()); };
|
||||
for (int y = ground.top() + 20; y < ground.bottom() - 40; ++y)
|
||||
for (int x = ground.left(); x < ground.right(); ++x) {
|
||||
if (!inked(QPoint(x, y)))
|
||||
continue;
|
||||
QRect box(x, y, 1, 1);
|
||||
int count = 0;
|
||||
std::vector<QPoint> stack{QPoint(x, y)};
|
||||
while (!stack.empty()) {
|
||||
const QPoint at = stack.back();
|
||||
stack.pop_back();
|
||||
if (!image.rect().contains(at) || !inked(at) || seen[index(at)])
|
||||
continue;
|
||||
seen[index(at)] = true;
|
||||
++count;
|
||||
box |= QRect(at, QSize(1, 1));
|
||||
for (const QPoint step : {QPoint(1, 0), QPoint(-1, 0), QPoint(0, 1), QPoint(0, -1), QPoint(1, 1), QPoint(-1, -1), QPoint(1, -1), QPoint(-1, 1)})
|
||||
stack.push_back(at + step);
|
||||
}
|
||||
return {box, double(count) / (box.width() * box.height())};
|
||||
}
|
||||
throw std::runtime_error("no glyph in the ground");
|
||||
}
|
||||
}
|
||||
|
||||
void AcceptanceFinishTests::cameraRawCurvesAndDither()
|
||||
{
|
||||
App app;
|
||||
const QUuid layer = photo(app);
|
||||
const int before = pixel(app.session(), layer, 600, 700).green();
|
||||
// Camera Raw: a curve region lifted, a point dragged.
|
||||
app.action("cameraRawFilter").trigger();
|
||||
QTRY_VERIFY(app.window.findChild<QToolButton *>(QStringLiteral("CurveSection")));
|
||||
app.window.findChild<QToolButton *>(QStringLiteral("CurveSection"))->click();
|
||||
QWidget *graph = app.window.findChild<QWidget *>(QStringLiteral("cameraRawCurveGraph"));
|
||||
QTRY_VERIFY(graph && graph->isVisible());
|
||||
const int w = graph->width(), h = graph->height();
|
||||
drag(graph, QPoint(int(w * 0.6), h / 2), QPoint(int(w * 0.6), h / 2 - h / 4));
|
||||
QVERIFY2(app.session().filterEdit().value().settings.cameraRaw.curve.lights > 20,
|
||||
qPrintable(QString::number(app.session().filterEdit().value().settings.cameraRaw.curve.lights)));
|
||||
app.window.findChild<QToolButton *>(QStringLiteral("curvePage1"))->click();
|
||||
const size_t points = app.session().filterEdit().value().settings.cameraRaw.curve.rgb.size();
|
||||
drag(graph, QPoint(w / 4, h * 3 / 4), QPoint(w / 4, h / 2));
|
||||
QCOMPARE(app.session().filterEdit().value().settings.cameraRaw.curve.rgb.size(), points + 1);
|
||||
QVERIFY(committed(app));
|
||||
QVERIFY2(pixel(app.session(), layer, 600, 700).green() > before + 10, qPrintable(pixel(app.session(), layer, 600, 700).name()));
|
||||
app.action("undo").trigger();
|
||||
// ASCII of "@" draws that letter, holes and all.
|
||||
app.action("dither").trigger();
|
||||
choose(shownChild<QComboBox>(app, "ditherStyle"), QStringLiteral("ASCII"));
|
||||
typeInto(app, "ditherCharacters", QStringLiteral("@"), false);
|
||||
QVERIFY(committed(app));
|
||||
const QImage small = app.session().activeLayer().value().asset.value().image();
|
||||
const auto [letter, inked] = glyph(small);
|
||||
QVERIFY2(inked < 0.75 && letter.height() >= 6, qPrintable(QString("%1 %2").arg(inked).arg(letter.height())));
|
||||
app.action("undo").trigger();
|
||||
app.action("dither").trigger();
|
||||
QCOMPARE(shownChild<QComboBox>(app, "ditherStyle").currentText(), QStringLiteral("ASCII"));
|
||||
typeInto(app, "textSizeField", QStringLiteral("28"), true);
|
||||
QTRY_VERIFY(!app.session().filterEdit() && !app.session().isProjectBusy());
|
||||
const auto [large, inkedLarge] = glyph(app.session().activeLayer().value().asset.value().image());
|
||||
const double grown = double(large.height()) / letter.height();
|
||||
QVERIFY2(grown > 1.6 && grown < 2.4 && inkedLarge < 0.75, qPrintable(QString::number(grown)));
|
||||
app.action("undo").trigger();
|
||||
// Scanlines: dark gaps between the beam's rows across the sky.
|
||||
app.action("dither").trigger();
|
||||
choose(shownChild<QComboBox>(app, "ditherStyle"), QStringLiteral("Scanlines (CRT)"));
|
||||
QVERIFY(committed(app));
|
||||
const QImage lines = app.session().activeLayer().value().asset.value().image();
|
||||
int darkest = 255, brightest = 0;
|
||||
for (int y = 100; y < 110; ++y) {
|
||||
darkest = std::min(darkest, qGray(lines.pixel(600, y)));
|
||||
brightest = std::max(brightest, qGray(lines.pixel(600, y)));
|
||||
}
|
||||
QVERIFY2(brightest - darkest > 40, qPrintable(QString("%1 %2").arg(darkest).arg(brightest)));
|
||||
}
|
||||
|
||||
void AcceptanceFinishTests::jpegPreviewAndQuitMidEdit()
|
||||
{
|
||||
App app;
|
||||
photo(app);
|
||||
// Export JPEG: View keys zoom to 100% and back.
|
||||
bool done = false;
|
||||
app.workspace.current().controller.exportJPEG([&done] { done = true; });
|
||||
QTRY_VERIFY(app.window.findChild<JPEGExportSheet *>());
|
||||
auto *preview = app.window.findChild<JPEGPreview *>();
|
||||
QVERIFY(preview && !preview->zoom());
|
||||
JPEGExportSheet *sheet = app.window.findChild<JPEGExportSheet *>();
|
||||
QTest::keyClick(sheet, Qt::Key_1, Qt::ControlModifier);
|
||||
QCOMPARE(preview->zoom(), std::optional<double>(1));
|
||||
QTest::keyClick(sheet, Qt::Key_Equal, Qt::ControlModifier);
|
||||
QVERIFY(preview->zoom().value() > 1);
|
||||
QTest::keyClick(sheet, Qt::Key_0, Qt::ControlModifier);
|
||||
QVERIFY(!preview->zoom());
|
||||
QTest::keyClick(sheet, Qt::Key_Escape);
|
||||
QTRY_VERIFY(done);
|
||||
// Quit with a gradient pending: applied before the one question.
|
||||
app.session().selectTool(NavigationTool::gradient);
|
||||
app.drag(QPointF(0, 400), QPointF(1200, 400));
|
||||
QVERIFY(app.session().gradientEdit());
|
||||
DialogDesk desk;
|
||||
desk.replies = {"Cancel"};
|
||||
desk.note = [&] { return QStringLiteral("pending=%1 levels=%2").arg(app.session().gradientEdit().has_value()).arg(app.session().levels().has_value()); };
|
||||
app.window.close();
|
||||
QTRY_COMPARE(desk.seen.size(), 1);
|
||||
QVERIFY2(desk.seen[0].endsWith("|pending=0 levels=0"), qPrintable(desk.seen[0]));
|
||||
QTRY_VERIFY(!app.workspace.isManaging());
|
||||
QVERIFY(app.window.isVisible());
|
||||
// With Levels open: cancelled, one question, then the window goes.
|
||||
app.action("levels").trigger();
|
||||
QVERIFY(app.session().levels());
|
||||
desk.replies = {"Don’t Save"};
|
||||
app.window.close();
|
||||
QTRY_COMPARE(desk.seen.size(), 2);
|
||||
QVERIFY2(desk.seen[1].endsWith("|pending=0 levels=0"), qPrintable(desk.seen[1]));
|
||||
QTRY_VERIFY(!app.window.isVisible());
|
||||
}
|
||||
|
||||
QTEST_MAIN(AcceptanceFinishTests)
|
||||
#include "AcceptanceFinishTests.moc"
|
||||
@@ -5,6 +5,8 @@
|
||||
#include "UI/CompositorMenus.h"
|
||||
#include "UI/OmarchyTheme.h"
|
||||
#include "UI/ProjectWorkspaceView.h"
|
||||
#include <QAbstractItemView>
|
||||
#include <QComboBox>
|
||||
#include <QDir>
|
||||
#include <QPainter>
|
||||
#include <QTemporaryDir>
|
||||
@@ -88,6 +90,25 @@ struct App {
|
||||
}
|
||||
};
|
||||
|
||||
// A combo box popup row, where the pointer finds it.
|
||||
inline QPoint popupRow(QComboBox &box, const QString &text)
|
||||
{
|
||||
box.showPopup();
|
||||
if (!QTest::qWaitFor([&box] { return box.view()->isVisible(); }, 2000))
|
||||
throw std::runtime_error("the menu never opened");
|
||||
const int row = box.findText(text);
|
||||
if (row < 0)
|
||||
throw std::runtime_error("no such entry");
|
||||
return box.view()->visualRect(box.model()->index(row, 0)).center();
|
||||
}
|
||||
|
||||
// Chooses an entry with a click in its popup.
|
||||
inline void choose(QComboBox &box, const QString &text)
|
||||
{
|
||||
const QPoint row = popupRow(box, text);
|
||||
QTest::mouseClick(box.view()->viewport(), Qt::LeftButton, Qt::NoModifier, row);
|
||||
}
|
||||
|
||||
// A photograph's stand-in: sky, ground and a red disc.
|
||||
inline QImage scene(int width, int height)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,195 @@
|
||||
#include "AcceptanceFixtures.h"
|
||||
#include "DialogDesk.h"
|
||||
#include "Document/Guides.h"
|
||||
#include "Document/ShapeTool.h"
|
||||
#include "IO/ProjectStore.h"
|
||||
#include "UI/ColorPickerSheet.h"
|
||||
#include "UI/ColorRangeSheet.h"
|
||||
#include "UI/GridSettingsSheet.h"
|
||||
#include "UI/ProjectTabs.h"
|
||||
#include <QMenu>
|
||||
|
||||
// The acceptance run, part four: 1.4.5's selections, grid, canvases, tabs.
|
||||
class AcceptanceNewTests : public QObject {
|
||||
Q_OBJECT
|
||||
private slots:
|
||||
void initTestCase() { QStandardPaths::setTestModeEnabled(true); }
|
||||
void colorRangeGridAndSnapping();
|
||||
void presetsQuickLookUngroupAndTabs();
|
||||
};
|
||||
|
||||
namespace {
|
||||
// A drag with keys held at every step.
|
||||
void drag(App &app, QPointF from, QPointF to, Qt::KeyboardModifiers keys)
|
||||
{
|
||||
app.press(from, keys);
|
||||
for (int step = 1; step <= 8; ++step) {
|
||||
const QPointF view = app.at(from + (to - from) * (step / 8.0));
|
||||
QMouseEvent event(QEvent::MouseMove, view, view, app.canvas().mapToGlobal(view.toPoint()), Qt::NoButton, Qt::LeftButton, keys);
|
||||
QApplication::sendEvent(&app.canvas(), &event);
|
||||
}
|
||||
QTest::mouseRelease(&app.canvas(), Qt::LeftButton, keys, app.at(to));
|
||||
}
|
||||
|
||||
void typeInSheet(App &app, const char *name, const QString &text)
|
||||
{
|
||||
auto *field = app.window.findChild<GridSettingsSheet *>()->findChild<PickerField *>(QString::fromLatin1(name));
|
||||
QVERIFY(field);
|
||||
field->setFocus();
|
||||
field->selectAll();
|
||||
QTest::keyClicks(field, text);
|
||||
QTest::keyClick(field, Qt::Key_Return);
|
||||
}
|
||||
|
||||
ProjectTabButton &tabButton(App &app, const QString &title)
|
||||
{
|
||||
for (ProjectTabButton *button : app.window.tabs()->buttons())
|
||||
if (button->tab->title() == title)
|
||||
return *button;
|
||||
throw std::runtime_error("no such tab");
|
||||
}
|
||||
}
|
||||
|
||||
void AcceptanceNewTests::colorRangeGridAndSnapping()
|
||||
{
|
||||
App app;
|
||||
QVERIFY(scene(1200, 800).save(app.path("photo.png")));
|
||||
app.session().createDocument(1200, 800);
|
||||
app.importFile(app.path("photo.png"));
|
||||
// Color Range samples the red disc on the canvas.
|
||||
app.action("colorRange").trigger();
|
||||
QVERIFY(app.session().colorRange());
|
||||
app.press(QPointF(600, 400));
|
||||
app.release(QPointF(600, 400));
|
||||
QTRY_VERIFY(app.session().selection().has_value());
|
||||
// The panel's OK applies it.
|
||||
QPushButton *ok = nullptr;
|
||||
for (QPushButton *button : app.window.findChild<ColorRangeSheet *>()->findChildren<QPushButton *>())
|
||||
if (button->text() == QStringLiteral("OK"))
|
||||
ok = button;
|
||||
QVERIFY(ok);
|
||||
ok->click();
|
||||
QVERIFY(!app.session().colorRange());
|
||||
const QRectF disc = app.session().selection().value().path.boundingRect();
|
||||
QVERIFY2(qAbs(disc.center().x() - 600) < 4 && qAbs(disc.width() - 400) < 12 && qAbs(disc.height() - 400) < 12,
|
||||
qPrintable(QString("%1 %2").arg(disc.width()).arg(disc.height())));
|
||||
app.action("deselect").trigger();
|
||||
// Grid Settings: typed spacing applies; Restore Defaults undoes it.
|
||||
ProjectController &controller = app.workspace.current().controller;
|
||||
bool done = false;
|
||||
controller.gridSettings([&done] { done = true; });
|
||||
QTRY_VERIFY(app.window.findChild<GridSettingsSheet *>());
|
||||
typeInSheet(app, "gridSpacing", QStringLiteral("100"));
|
||||
QTRY_VERIFY(done);
|
||||
QVERIFY(app.session().layoutGrid() == LayoutGrid(100, 8));
|
||||
done = false;
|
||||
controller.gridSettings([&done] { done = true; });
|
||||
QTRY_VERIFY(app.window.findChild<GridSettingsSheet *>());
|
||||
app.window.findChild<GridSettingsSheet *>()->findChild<QPushButton *>(QStringLiteral("gridDefaults"))->click();
|
||||
app.window.findChild<GridSettingsSheet *>()->findChild<QPushButton *>(QStringLiteral("gridOK"))->click();
|
||||
QTRY_VERIFY(done);
|
||||
QVERIFY(app.session().layoutGrid() == LayoutGrid());
|
||||
// Marquee and rectangle land on a guide, unless Ctrl.
|
||||
app.session().setShowsGuides(true);
|
||||
app.session().addGuide({.id = QUuid::createUuid(), .axis = CanvasGuide::Axis::vertical, .position = 300});
|
||||
app.session().selectTool(NavigationTool::marquee);
|
||||
drag(app, QPointF(296, 100), QPointF(500, 300), Qt::NoModifier);
|
||||
QCOMPARE(app.session().selection().value().path.boundingRect().left(), 300.0);
|
||||
app.action("deselect").trigger();
|
||||
drag(app, QPointF(296, 100), QPointF(500, 300), Qt::ControlModifier);
|
||||
QVERIFY(qAbs(app.session().selection().value().path.boundingRect().left() - 296) <= 2);
|
||||
app.action("deselect").trigger();
|
||||
app.session().selectTool(NavigationTool::shape);
|
||||
app.session().setShapeKind(ShapeKind::rectangle);
|
||||
drag(app, QPointF(296, 500), QPointF(450, 650), Qt::NoModifier);
|
||||
QCOMPARE(app.session().activeLayer().value().transform.origin.x(), 300.0);
|
||||
drag(app, QPointF(296, 100), QPointF(450, 250), Qt::ControlModifier);
|
||||
QVERIFY(qAbs(app.session().activeLayer().value().transform.origin.x() - 296) <= 2);
|
||||
}
|
||||
|
||||
void AcceptanceNewTests::presetsQuickLookUngroupAndTabs()
|
||||
{
|
||||
App app;
|
||||
// A preset fills the fields and checks the match.
|
||||
auto *more = app.window.findChild<QToolButton *>(QStringLiteral("presetSizes"));
|
||||
QVERIFY(more && more->menu());
|
||||
QAction *story = nullptr;
|
||||
for (QAction *entry : more->menu()->actions())
|
||||
if (entry->text() == QStringLiteral("Instagram Story"))
|
||||
story = entry;
|
||||
QVERIFY(story);
|
||||
story->trigger();
|
||||
QVERIFY(story->isChecked());
|
||||
QCOMPARE(app.window.findChild<QLineEdit *>(QStringLiteral("heightInput"))->text(), QStringLiteral("1920"));
|
||||
app.window.findChild<QPushButton *>(QStringLiteral("createCanvas"))->click();
|
||||
QCOMPARE(QSize(int(app.session().document().value().width), int(app.session().document().value().height)), QSize(1080, 1920));
|
||||
// Ungroup: the layers take the folder's place; undo returns.
|
||||
app.action("newBlankLayer").trigger();
|
||||
const QUuid first = app.session().activeLayerID().value();
|
||||
app.action("newBlankLayer").trigger();
|
||||
const QUuid second = app.session().activeLayerID().value();
|
||||
app.session().selectLayers({first, second}, second);
|
||||
app.session().groupSelectedLayers();
|
||||
const QUuid folder = app.session().activeLayerID().value();
|
||||
const auto order = [&app] {
|
||||
QList<QUuid> ids;
|
||||
for (const ImageLayer &layer : app.session().document().value().layers)
|
||||
ids << layer.id;
|
||||
return ids;
|
||||
};
|
||||
const QList<QUuid> grouped = order();
|
||||
app.canvas().setFocus();
|
||||
QTest::keyClick(&app.canvas(), Qt::Key_G, Qt::ControlModifier | Qt::ShiftModifier);
|
||||
// The two layers stand where the folder stood, in order.
|
||||
QList<QUuid> expected = grouped;
|
||||
expected.removeAll(folder);
|
||||
QCOMPARE(order(), expected);
|
||||
QCOMPARE(int(order().indexOf(first)) + 1, int(order().indexOf(second)));
|
||||
for (const ImageLayer &layer : app.session().document().value().layers)
|
||||
QVERIFY(!layer.isGroup && !layer.parentID);
|
||||
QTest::keyClick(&app.canvas(), Qt::Key_Z, Qt::ControlModifier);
|
||||
QCOMPARE(order(), grouped);
|
||||
// A save writes the Quick Look preview, 1024 long.
|
||||
const QString project = app.path("Story.comp");
|
||||
DialogDesk desk;
|
||||
desk.replies = {project};
|
||||
app.action("saveAs").trigger();
|
||||
QTRY_VERIFY_WITH_TIMEOUT(QFileInfo(project).isDir() && !app.session().isModified(), 30000);
|
||||
const QImage preview(QDir(project).filePath(QStringLiteral("QuickLook/Preview.jpg")));
|
||||
QCOMPARE(preview.size(), QSize(576, 1024));
|
||||
QCOMPARE(int(ProjectStore::load(project).manifest.layers.size()), 4);
|
||||
// A tab dragged past its neighbour; the rest gather.
|
||||
app.workspace.newCanvas();
|
||||
app.workspace.newCanvas();
|
||||
QStringList before;
|
||||
for (const std::shared_ptr<ProjectTab> &tab : app.workspace.tabs())
|
||||
before << tab->title();
|
||||
const int from = int(before.indexOf(QStringLiteral("Story")));
|
||||
QVERIFY(from >= 0 && from + 1 < before.size());
|
||||
QWindow *window = app.window.windowHandle();
|
||||
ProjectTabButton &dragged = tabButton(app, QStringLiteral("Story"));
|
||||
const QPoint start = dragged.mapTo(&app.window, QPoint(20, 14));
|
||||
QTest::mousePress(window, Qt::LeftButton, {}, start);
|
||||
QTest::mouseMove(window, start + QPoint(10, 0));
|
||||
QTest::mouseMove(window, start + QPoint(dragged.width() + 40, 0));
|
||||
QTest::mouseRelease(window, Qt::LeftButton, {}, start + QPoint(dragged.width() + 40, 0));
|
||||
QCOMPARE(app.workspace.tabs()[from]->title(), before[from + 1]);
|
||||
QCOMPARE(app.workspace.tabs()[from + 1]->title(), QStringLiteral("Story"));
|
||||
for (int tab = 0; tab < 12; ++tab)
|
||||
app.workspace.newCanvas();
|
||||
OverflowTabsPill &pill = *app.window.tabs()->pill();
|
||||
QTRY_VERIFY(pill.isVisible());
|
||||
QTest::mousePress(&pill, Qt::LeftButton);
|
||||
auto *menu = pill.findChild<QMenu *>(QStringLiteral("projectTabsOverflowMenu"));
|
||||
QVERIFY(menu && menu->isVisible());
|
||||
app.shot(QStringLiteral("17-tabs"));
|
||||
QAction *hidden = menu->actions().front();
|
||||
const QString chosen = hidden->text();
|
||||
hidden->trigger();
|
||||
menu->close();
|
||||
QTest::mouseRelease(&pill, Qt::LeftButton);
|
||||
QCOMPARE(app.workspace.current().title(), chosen);
|
||||
}
|
||||
|
||||
QTEST_MAIN(AcceptanceNewTests)
|
||||
#include "AcceptanceNewTests.moc"
|
||||
@@ -20,6 +20,7 @@ private slots:
|
||||
void hoveringTriesAModeOnAndChoosingKeepsIt();
|
||||
void aMenuClosedWithoutAChoiceLeavesTheLayerAlone();
|
||||
void theMaskButtonAddsAWhiteMaskOnce();
|
||||
void escapeAndAClosedHighlightLeaveNoPreview();
|
||||
};
|
||||
|
||||
void BlendModePickerTests::theMenuListsEveryModeAndFollowsTheActiveLayer()
|
||||
@@ -165,5 +166,31 @@ void BlendModePickerTests::theMaskButtonAddsAWhiteMaskOnce()
|
||||
QVERIFY(button.isEnabled());
|
||||
}
|
||||
|
||||
void BlendModePickerTests::escapeAndAClosedHighlightLeaveNoPreview()
|
||||
{
|
||||
EditorSession session;
|
||||
session.createDocument(4, 4);
|
||||
session.insert(white());
|
||||
BlendModePicker picker(session);
|
||||
picker.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&picker));
|
||||
// Qt 6.10 signals as the closed menu follows the layer.
|
||||
emit picker.highlighted(3);
|
||||
QVERIFY(!session.blendPreview().has_value());
|
||||
// So a key choice when closed keeps its mode.
|
||||
emit picker.activated(8);
|
||||
QCOMPARE(session.activeLayer().value().blendMode, LayerBlendMode::screen);
|
||||
session.undo();
|
||||
// Escape closes without hidePopup on Qt 6.10: the preview goes.
|
||||
picker.showPopup();
|
||||
QTRY_VERIFY(picker.view()->isVisible());
|
||||
emit picker.highlighted(3);
|
||||
QVERIFY(session.blendPreview().has_value());
|
||||
QTest::keyClick(picker.view(), Qt::Key_Escape);
|
||||
QVERIFY(!picker.view()->isVisible());
|
||||
QTRY_VERIFY(!session.blendPreview().has_value());
|
||||
QCOMPARE(session.activeLayer().value().blendMode, LayerBlendMode::normal);
|
||||
}
|
||||
|
||||
QTEST_MAIN(BlendModePickerTests)
|
||||
#include "BlendModePickerTests.moc"
|
||||
@@ -191,14 +191,14 @@ void BlurNoiseAdjustmentTests::theStoreTakesTheKindsFromVersion9()
|
||||
QCOMPARE(stored(snapshot), std::optional(ProjectError::Kind::invalid));
|
||||
// Invalid settings refuse it at any version.
|
||||
snapshot.manifest.version = 9;
|
||||
snapshot.manifest.layers[1].adjustment->setGaussianRadius(300);
|
||||
snapshot.manifest.layers[1].adjustment.value().setGaussianRadius(300);
|
||||
QCOMPARE(stored(snapshot), std::optional(ProjectError::Kind::invalid));
|
||||
}
|
||||
// The rule reads the kind: older kinds may carry keys.
|
||||
ProjectSnapshot older = twoLayers();
|
||||
older.manifest.version = 7;
|
||||
older.manifest.layers[1].adjustment = LayerAdjustment{AdjustmentKind::levels};
|
||||
older.manifest.layers[1].adjustment->setGaussianRadius(5);
|
||||
older.manifest.layers[1].adjustment.value().setGaussianRadius(5);
|
||||
QCOMPARE(stored(older), std::nullopt);
|
||||
}
|
||||
|
||||
@@ -211,7 +211,7 @@ void BlurNoiseAdjustmentTests::eachNoiseLayerRollsItsOwnSeed()
|
||||
session.setAdjustmentEditingID(std::nullopt);
|
||||
session.addAdjustment(AdjustmentKind::addNoise);
|
||||
const LayerAdjustment second = session.activeLayer().value().adjustment.value();
|
||||
QVERIFY(first.noiseSeed && second.noiseSeed && *first.noiseSeed != *second.noiseSeed);
|
||||
QVERIFY(first.noiseSeed && second.noiseSeed && first.noiseSeed.value() != second.noiseSeed.value());
|
||||
// Only noise rolls one; the rest keep their defaults.
|
||||
session.setAdjustmentEditingID(std::nullopt);
|
||||
session.addAdjustment(AdjustmentKind::gaussianBlur);
|
||||
|
||||
@@ -28,11 +28,11 @@ inline QImage preview(const BrushStroke &stroke, QSizeF canvas)
|
||||
QPainter painter(&context);
|
||||
const ImageLayer &layer = stroke.layer;
|
||||
const std::optional<ImportedImage> &asset = layer.asset;
|
||||
const QImage image = asset && !asset->raster ? asset->image() : QImage();
|
||||
const QImage image = asset && !asset.value().raster ? asset.value().image() : QImage();
|
||||
LayerRenderer::drawBrushPreview(image, stroke.paintTransform, stroke.paintTransform.center(), painter,
|
||||
{.opacity = layer.opacity, .blendMode = layer.blendMode, .mask = layer.mask ? layer.mask->enabledImage().value_or(QImage()) : QImage()},
|
||||
{.opacity = layer.opacity, .blendMode = layer.blendMode, .mask = layer.mask ? layer.mask.value().enabledImage().value_or(QImage()) : QImage()},
|
||||
{.patches = stroke.patches(), .pixelWidth = stroke.width, .pixelHeight = stroke.height, .paintingMask = stroke.isMask,
|
||||
.sourceRect = stroke.sourceRect, .raster = asset ? asset->raster : nullptr});
|
||||
.sourceRect = stroke.sourceRect, .raster = asset ? asset.value().raster : nullptr});
|
||||
painter.end();
|
||||
return context;
|
||||
}
|
||||
|
||||
@@ -377,8 +377,12 @@ void CameraRawCurveGraphTests::aDoubleClickInTheStripMovesADivider()
|
||||
Graph graph;
|
||||
const int w = graph.graph->width(), h = graph.graph->height();
|
||||
graph.set([](CameraRawCurveSettings &curve) { curve.rgb = {{0, 0}, {0.5, 0.5}, {1, 1}}; });
|
||||
// Both presses take the nearest divider there; no point goes.
|
||||
QTest::mouseDClick(graph.graph->window()->windowHandle(), Qt::LeftButton, {}, graph.graph->mapTo(graph.graph->window(), QPoint(int(0.3 * w), h - 5)));
|
||||
// The first press moves the divider; no point goes.
|
||||
graph.press(QPoint(int(0.25 * w), h - 5));
|
||||
graph.release(QPoint(int(0.25 * w), h - 5));
|
||||
QVERIFY(std::abs(graph.curve().shadowSplit - 25) < 0.5);
|
||||
// The second press, elsewhere, moves it again.
|
||||
QTest::mouseDClick(graph.graph, Qt::LeftButton, {}, QPoint(int(0.3 * w), h - 5));
|
||||
QVERIFY(std::abs(graph.curve().shadowSplit - 30) < 0.5);
|
||||
QVERIFY(graph.curve().darkSplit == 50 && graph.curve().lightSplit == 75);
|
||||
QCOMPARE(graph.curve().rgb.size(), size_t(3));
|
||||
|
||||
@@ -151,7 +151,7 @@ void CanvasEditContractTests::aGradientThatCannotFillCancels()
|
||||
scene.session.selectTool(NavigationTool::gradient);
|
||||
scene.session.beginGradient(QPointF(10, 30));
|
||||
QVERIFY(scene.session.gradientEdit());
|
||||
scene.session.gradientEdit()->raster->pixelLimit = 100;
|
||||
scene.session.gradientEdit().value().raster->pixelLimit = 100;
|
||||
scene.session.moveGradient(std::nullopt, QPointF(70, 30));
|
||||
QVERIFY(!scene.session.gradientEdit() && scene.session.brushError().has_value());
|
||||
QCOMPARE(scene.session.history.undoCount(), count);
|
||||
|
||||
@@ -19,7 +19,7 @@ struct Shown {
|
||||
explicit Shown(std::optional<QSize> document = QSize(100, 100), QSize size = QSize(400, 300)) : canvas(new CanvasView(session, &window))
|
||||
{
|
||||
if (document)
|
||||
session.createDocument(document->width(), document->height());
|
||||
session.createDocument(document.value().width(), document.value().height());
|
||||
window.resize(size);
|
||||
canvas->setGeometry(QRect(QPoint(0, 0), size));
|
||||
window.show();
|
||||
|
||||
@@ -0,0 +1,173 @@
|
||||
#include "BrushFixtures.h"
|
||||
#include "Document/EditorSession.h"
|
||||
#include "SelectionFixtures.h"
|
||||
|
||||
// Swift resumes after await in one job: nothing lands between.
|
||||
namespace {
|
||||
std::unique_ptr<EditorSession> halves()
|
||||
{
|
||||
auto session = std::make_unique<EditorSession>();
|
||||
session->createDocument(100, 40, true);
|
||||
QImage image = BrushRaster::context(100, 40, false);
|
||||
QPainter painter(&image);
|
||||
painter.fillRect(QRect(0, 0, 50, 40), Qt::red);
|
||||
painter.fillRect(QRect(50, 0, 50, 40), Qt::blue);
|
||||
painter.end();
|
||||
session->insert(ImportedImage(image, image, "Halves"));
|
||||
session->deleteLayer(session->document().value().layers[0].id);
|
||||
return session;
|
||||
}
|
||||
|
||||
// Runs `look` at the first event after the project frees.
|
||||
void atTheNextEvent(EditorSession &session, std::function<void()> look)
|
||||
{
|
||||
auto busy = std::make_shared<bool>(false), armed = std::make_shared<bool>(false);
|
||||
QObject::connect(&session, &EditorSession::changed, &session, [&session, busy, armed, look] {
|
||||
if (session.isProjectBusy())
|
||||
*busy = true;
|
||||
if (!*busy || session.isProjectBusy() || *armed)
|
||||
return;
|
||||
*armed = true;
|
||||
QTimer::singleShot(0, &session, look);
|
||||
});
|
||||
}
|
||||
|
||||
void pendingGradient(EditorSession &session)
|
||||
{
|
||||
session.selectTool(NavigationTool::gradient);
|
||||
session.beginGradient(QPointF(0.5, 2));
|
||||
session.moveGradient(std::nullopt, QPointF(99.5, 2));
|
||||
session.endGradientDrag();
|
||||
}
|
||||
|
||||
bool done(const std::function<void(std::function<void()>)> &call)
|
||||
{
|
||||
bool finished = false;
|
||||
call([&] { finished = true; });
|
||||
return QTest::qWaitFor([&] { return finished; }, 10000);
|
||||
}
|
||||
}
|
||||
|
||||
class CommitContinuationTests : public QObject {
|
||||
Q_OBJECT
|
||||
private slots:
|
||||
void theProjectFreesWithTheGradientGone();
|
||||
void theProjectFreesWithTheMoveGone();
|
||||
void theFloatingEditIsReadyAtTheNextEvent();
|
||||
void aToolChosenAfterTheLiftStaysChosen();
|
||||
void aChainedEditKeepsItsLayer_data();
|
||||
void aChainedEditKeepsItsLayer();
|
||||
};
|
||||
|
||||
void CommitContinuationTests::theProjectFreesWithTheGradientGone()
|
||||
{
|
||||
const auto session = halves();
|
||||
pendingGradient(*session);
|
||||
std::optional<bool> pending, editable;
|
||||
atTheNextEvent(*session, [&] {
|
||||
pending = session->gradientEdit().has_value();
|
||||
editable = session->canEditLayers();
|
||||
});
|
||||
QVERIFY(done([&](auto finished) { session->commitGradient(finished); }));
|
||||
QTRY_VERIFY(pending.has_value());
|
||||
QCOMPARE(pending.value(), false);
|
||||
QCOMPARE(editable.value(), true);
|
||||
}
|
||||
|
||||
void CommitContinuationTests::theProjectFreesWithTheMoveGone()
|
||||
{
|
||||
const auto session = halves();
|
||||
session->applySelection(rectPath(QRectF(0, 0, 50, 40)), SelectionMode::replace, "Select");
|
||||
QVERIFY(session->beginPixelMove(false));
|
||||
session->movePixels(QSizeF(10, 0));
|
||||
std::optional<bool> moving, editable;
|
||||
atTheNextEvent(*session, [&] {
|
||||
moving = session->pixelMove() != nullptr;
|
||||
editable = session->canEditLayers();
|
||||
});
|
||||
QVERIFY(done([&](auto finished) { session->finishPixelMove(finished); }));
|
||||
QTRY_VERIFY(moving.has_value());
|
||||
QCOMPARE(moving.value(), false);
|
||||
QCOMPARE(editable.value(), true);
|
||||
}
|
||||
|
||||
void CommitContinuationTests::theFloatingEditIsReadyAtTheNextEvent()
|
||||
{
|
||||
const auto session = halves();
|
||||
session->applySelection(rectPath(QRectF(10, 10, 10, 10)), SelectionMode::replace, "Select");
|
||||
std::optional<bool> floating, editable;
|
||||
atTheNextEvent(*session, [&] {
|
||||
floating = session->transformEdit().has_value();
|
||||
editable = session->canEditLayers();
|
||||
});
|
||||
QVERIFY(done([&](auto finished) { session->beginSelectionTransform(finished); }));
|
||||
QTRY_VERIFY(floating.has_value());
|
||||
QCOMPARE(floating.value(), true);
|
||||
QCOMPARE(editable.value(), false);
|
||||
}
|
||||
|
||||
void CommitContinuationTests::aToolChosenAfterTheLiftStaysChosen()
|
||||
{
|
||||
const auto session = halves();
|
||||
session->applySelection(rectPath(QRectF(10, 10, 10, 10)), SelectionMode::replace, "Select");
|
||||
bool chosen = false;
|
||||
atTheNextEvent(*session, [&] {
|
||||
session->selectTool(NavigationTool::brush);
|
||||
chosen = true;
|
||||
});
|
||||
QVERIFY(done([&](auto finished) { session->beginSelectionTransform(finished); }));
|
||||
QTRY_VERIFY(chosen);
|
||||
// The choice applied the floating edit and stayed.
|
||||
QCOMPARE(session->tool(), NavigationTool::brush);
|
||||
QVERIFY(!session->transformEdit().has_value());
|
||||
}
|
||||
|
||||
void CommitContinuationTests::aChainedEditKeepsItsLayer_data()
|
||||
{
|
||||
QTest::addColumn<int>("command");
|
||||
QTest::newRow("filter") << 0;
|
||||
QTest::newRow("levels") << 1;
|
||||
QTest::newRow("hue") << 2;
|
||||
QTest::newRow("invert") << 3;
|
||||
}
|
||||
|
||||
void CommitContinuationTests::aChainedEditKeepsItsLayer()
|
||||
{
|
||||
QFETCH(int, command);
|
||||
const auto session = halves();
|
||||
const QUuid target = session->activeLayerID().value();
|
||||
QImage green = BrushRaster::context(100, 40, false);
|
||||
green.fill(QColor(0, 255, 0));
|
||||
session->insert(ImportedImage(green, green, "Other"));
|
||||
const QUuid other = session->activeLayerID().value();
|
||||
session->selectLayer(target);
|
||||
pendingGradient(*session);
|
||||
// Another layer chosen once the gradient lands, if allowed.
|
||||
atTheNextEvent(*session, [&] {
|
||||
if (session->canEditLayers())
|
||||
session->selectLayer(other);
|
||||
});
|
||||
if (command == 0) {
|
||||
session->beginFilter(FilterKind::gaussianBlur);
|
||||
QTRY_VERIFY(session->filterEdit().has_value());
|
||||
QCOMPARE(session->filterEdit().value().layerID, target);
|
||||
} else if (command == 1) {
|
||||
session->beginLevels();
|
||||
QTRY_VERIFY(session->levels().has_value());
|
||||
QCOMPARE(session->levels().value().layerID, target);
|
||||
} else if (command == 2) {
|
||||
session->beginHueSaturation();
|
||||
QTRY_VERIFY(session->hueSaturation().has_value());
|
||||
QCOMPARE(session->hueSaturation().value().layerID, target);
|
||||
} else {
|
||||
QVERIFY(done([&](auto finished) { session->invertPixels(finished); }));
|
||||
QCOMPARE(session->history.undoName(), QString("Invert"));
|
||||
QCOMPARE(session->activeLayerID().value(), target);
|
||||
const ImageLayer kept = session->document().value().layers.back();
|
||||
QCOMPARE(kept.id, other);
|
||||
QCOMPARE(kept.asset.value().image().pixelColor(5, 5), QColor(0, 255, 0));
|
||||
}
|
||||
}
|
||||
|
||||
QTEST_GUILESS_MAIN(CommitContinuationTests)
|
||||
#include "CommitContinuationTests.moc"
|
||||
@@ -253,8 +253,8 @@ void EffectsCanvasTests::aSurfaceIsMadeAnewForOtherSettings()
|
||||
QVERIFY(session.finishBrushImmediately());
|
||||
// A canvas alone follows nothing: the old surface stays.
|
||||
LayerEffects cyan = outline(2);
|
||||
cyan.stroke->red = 0;
|
||||
cyan.stroke->blue = 1;
|
||||
cyan.stroke.value().red = 0;
|
||||
cyan.stroke.value().blue = 1;
|
||||
session.setEffects(cyan);
|
||||
session.beginBrush(QPointF(45, 32));
|
||||
session.continueBrush(QPointF(55, 32));
|
||||
|
||||
@@ -146,56 +146,56 @@ void EffectsPanelTests::theSheetEditsItsEffect()
|
||||
auto &slider = find<QSlider>(sheet, "sizeSlider");
|
||||
QCOMPARE(size.text(), QString("4"));
|
||||
type(size, "12");
|
||||
QCOMPARE(editor.effects().stroke->size, 12.0);
|
||||
QCOMPARE(editor.effects().stroke.value().size, 12.0);
|
||||
// The slider spans 0 to 20; typing reaches 500.
|
||||
QCOMPARE(slider.value(), 600);
|
||||
// No finite number changes nothing; the field goes back.
|
||||
type(size, "abc");
|
||||
QVERIFY(editor.effects().stroke->size == 12 && size.text() == "12");
|
||||
QVERIFY(editor.effects().stroke.value().size == 12 && size.text() == "12");
|
||||
type(size, "inf");
|
||||
QVERIFY(editor.effects().stroke->size == 12 && size.text() == "12");
|
||||
QVERIFY(editor.effects().stroke.value().size == 12 && size.text() == "12");
|
||||
// Up steps one, Shift ten; past the range, clamped.
|
||||
QTest::keyClick(&size, Qt::Key_Up);
|
||||
QCOMPARE(editor.effects().stroke->size, 13.0);
|
||||
QCOMPARE(editor.effects().stroke.value().size, 13.0);
|
||||
QTest::keyClick(&size, Qt::Key_Up, Qt::ShiftModifier);
|
||||
QCOMPARE(editor.effects().stroke->size, 23.0);
|
||||
QCOMPARE(editor.effects().stroke.value().size, 23.0);
|
||||
// Past its end the thumb rests there, writing nothing back.
|
||||
QCOMPARE(slider.value(), 1000);
|
||||
// A step replaces pending typing, even where it clamps.
|
||||
typing(size, "12");
|
||||
QTest::keyClick(&size, Qt::Key_Up);
|
||||
QVERIFY(editor.effects().stroke->size == 24 && size.text() == "24" && !size.isModified());
|
||||
QVERIFY(editor.effects().stroke.value().size == 24 && size.text() == "24" && !size.isModified());
|
||||
size.clearFocus();
|
||||
QCOMPARE(editor.effects().stroke->size, 24.0);
|
||||
QCOMPARE(editor.effects().stroke.value().size, 24.0);
|
||||
type(size, "900");
|
||||
QVERIFY(editor.effects().stroke->size == 500 && size.text() == "500");
|
||||
QVERIFY(editor.effects().stroke.value().size == 500 && size.text() == "500");
|
||||
typing(size, "12");
|
||||
QTest::keyClick(&size, Qt::Key_Up);
|
||||
QVERIFY(editor.effects().stroke->size == 500 && size.text() == "500" && !size.isModified());
|
||||
QVERIFY(editor.effects().stroke.value().size == 500 && size.text() == "500" && !size.isModified());
|
||||
size.clearFocus();
|
||||
QCOMPARE(editor.effects().stroke->size, 500.0);
|
||||
QCOMPARE(editor.effects().stroke.value().size, 500.0);
|
||||
// The slider sets any value; the field rounds, ties even.
|
||||
slider.setValue(525);
|
||||
QVERIFY(editor.effects().stroke->size == 10.5 && size.text() == "10");
|
||||
QVERIFY(editor.effects().stroke.value().size == 10.5 && size.text() == "10");
|
||||
// Leaving an untouched field keeps the exact value.
|
||||
size.setFocus();
|
||||
size.clearFocus();
|
||||
QCOMPARE(editor.effects().stroke->size, 10.5);
|
||||
QCOMPARE(editor.effects().stroke.value().size, 10.5);
|
||||
// Typing waits while other changes arrive.
|
||||
auto &opacity = find<QLineEdit>(sheet, "opacityField");
|
||||
QCOMPARE(opacity.text(), QString("100"));
|
||||
typing(size, "3");
|
||||
find<QSlider>(sheet, "opacitySlider").setValue(500);
|
||||
QVERIFY(editor.effects().stroke->opacity == 0.5 && opacity.text() == "50" && size.text() == "3");
|
||||
QVERIFY(editor.effects().stroke.value().opacity == 0.5 && opacity.text() == "50" && size.text() == "3");
|
||||
size.clearFocus();
|
||||
QCOMPARE(editor.effects().stroke->size, 3.0);
|
||||
QCOMPARE(editor.effects().stroke.value().size, 3.0);
|
||||
// Inside or Outside, as Swift's segments, following an undo.
|
||||
const QList<QToolButton *> position = find<QWidget>(sheet, "strokePosition").findChildren<QToolButton *>();
|
||||
QVERIFY(position.size() == 2 && position[0]->text() == "Outside" && position[1]->text() == "Inside" && position[0]->isChecked());
|
||||
position[1]->click();
|
||||
QVERIFY(editor.effects().stroke->inside && position[1]->isChecked());
|
||||
QVERIFY(editor.effects().stroke.value().inside && position[1]->isChecked());
|
||||
editor.session.undo();
|
||||
QVERIFY(!editor.effects().stroke->inside && position[0]->isChecked());
|
||||
QVERIFY(!editor.effects().stroke.value().inside && position[0]->isChecked());
|
||||
position[1]->click();
|
||||
// The swatch opens the picker, whose colour shows at once.
|
||||
auto &swatch = find<QAbstractButton>(sheet, "effectColor");
|
||||
@@ -207,7 +207,7 @@ void EffectsPanelTests::theSheetEditsItsEffect()
|
||||
Painted counter(paints);
|
||||
swatch.installEventFilter(&counter);
|
||||
editor.session.setColorPickerHSB(PickerHSB(PaletteColor{1, 0, 0}));
|
||||
QCOMPARE(editor.effects().stroke->color(), (PaletteColor{1, 0, 0}));
|
||||
QCOMPARE(editor.effects().stroke.value().color(), (PaletteColor{1, 0, 0}));
|
||||
QTRY_VERIFY(paints > 0);
|
||||
// A black rim, a white ring inside, then the colour.
|
||||
const QImage shot = swatch.grab().toImage();
|
||||
@@ -218,7 +218,7 @@ void EffectsPanelTests::theSheetEditsItsEffect()
|
||||
// Return commits, then goes on to OK, keeping everything.
|
||||
typing(size, "7");
|
||||
QTest::keyClick(&size, Qt::Key_Return);
|
||||
QVERIFY(!editor.session.effectsEditing() && editor.effects().stroke->size == 7 && editor.effects().stroke->inside);
|
||||
QVERIFY(!editor.session.effectsEditing() && editor.effects().stroke.value().size == 7 && editor.effects().stroke.value().inside);
|
||||
QTRY_VERIFY(!editor.sheet());
|
||||
}
|
||||
|
||||
@@ -236,11 +236,11 @@ void EffectsPanelTests::aWheelOnTheSliderReplacesTheTyping()
|
||||
Qt::NoScrollPhase, false);
|
||||
QApplication::sendEvent(&slider, &wheel);
|
||||
const double wheeled = 20.0 * (200 - QApplication::wheelScrollLines()) / 1000;
|
||||
QCOMPARE(editor.effects().stroke->size, wheeled);
|
||||
QCOMPARE(editor.effects().stroke.value().size, wheeled);
|
||||
QVERIFY(size.hasFocus() && size.text() == QString::number(std::lround(wheeled)) && !size.isModified());
|
||||
// Return then keeps the slider's value, going on to OK.
|
||||
QTest::keyClick(&size, Qt::Key_Return);
|
||||
QVERIFY(!editor.session.effectsEditing() && editor.effects().stroke->size == wheeled);
|
||||
QVERIFY(!editor.session.effectsEditing() && editor.effects().stroke.value().size == wheeled);
|
||||
}
|
||||
|
||||
void EffectsPanelTests::theSheetKeepsSwiftsMeasures()
|
||||
@@ -355,14 +355,14 @@ void EffectsPanelTests::cancelAndEscapePutTheEffectBack()
|
||||
auto &cancel = find<QPushButton>(*editor.sheet(), "effectsCancel");
|
||||
cancel.setFocus();
|
||||
QTest::keyClick(&cancel, Qt::Key_Return);
|
||||
QVERIFY(editor.effects().shadow->angle == -45 && !editor.session.effectsEditing());
|
||||
QVERIFY(editor.effects().shadow.value().angle == -45 && !editor.session.effectsEditing());
|
||||
// An existing shadow: Cancel puts it back as it was.
|
||||
editor.session.selectEffect(LayerEffectKind::shadow, editor.layer, true);
|
||||
QCOMPARE(find<QLineEdit>(*editor.sheet(), "distanceField").text(), QString("20"));
|
||||
find<QSlider>(*editor.sheet(), "distanceSlider").setValue(400);
|
||||
QCOMPARE(editor.effects().shadow->distance, 40.0);
|
||||
QCOMPARE(editor.effects().shadow.value().distance, 40.0);
|
||||
find<QPushButton>(*editor.sheet(), "effectsCancel").click();
|
||||
QVERIFY(editor.effects().shadow->distance == 20 && !editor.session.effectsEditing());
|
||||
QVERIFY(editor.effects().shadow.value().distance == 20 && !editor.session.effectsEditing());
|
||||
// A new overlay's panel: Escape takes the overlay away again.
|
||||
editor.session.addEffect(LayerEffectKind::colorOverlay);
|
||||
QVERIFY(editor.effects().colorOverlay);
|
||||
|
||||
@@ -92,7 +92,7 @@ void EffectsPreviewCacheTests::aPreviewLandsAfterItsDelayAsTheRendererDrawsIt()
|
||||
QCOMPARE(*landings.count, 1);
|
||||
// No effects, or none shown: nothing, and the entry goes.
|
||||
ImageLayer hidden = layer;
|
||||
hidden.effects->stroke->enabled = false;
|
||||
hidden.effects.value().stroke.value().enabled = false;
|
||||
QVERIFY(!ask(cache, hidden, landings) && !cache.rendered(layer.id));
|
||||
QTest::qWait(150);
|
||||
QVERIFY(!cache.rendered(layer.id));
|
||||
@@ -110,7 +110,7 @@ void EffectsPreviewCacheTests::movingTheLayerKeepsThePreviewUnlessAMaskIsPlaced(
|
||||
EffectsPreviewCache cache;
|
||||
ImageLayer layer = layerOf(filled(20, 10, QColor(0, 0, 255)), outline(3));
|
||||
layer.mask = LayerMask(LayerMask::assetFrom(gray(20, 10, 255)));
|
||||
const QImage mask = layer.mask->enabledImage().value();
|
||||
const QImage mask = layer.mask.value().enabledImage().value();
|
||||
const Landings landings;
|
||||
ask(cache, layer, landings, mask);
|
||||
const qint64 first = landed(cache, layer, landings, 1).image.cacheKey();
|
||||
@@ -149,7 +149,7 @@ void EffectsPreviewCacheTests::settingsKeepTheLastPreviewButNewPixelsDropIt()
|
||||
const EffectsPreviewCache::Result second = landed(cache, layer, landings, 2);
|
||||
QCOMPARE(second.inset, 7.0);
|
||||
// Another kind shown or hidden: the last preview stands.
|
||||
layer.effects->colorOverlay = ColorOverlayEffect();
|
||||
layer.effects.value().colorOverlay = ColorOverlayEffect();
|
||||
QCOMPARE(ask(cache, layer, landings).value().image.cacheKey(), second.image.cacheKey());
|
||||
landed(cache, layer, landings, 3);
|
||||
// New pixels drop it.
|
||||
@@ -158,10 +158,10 @@ void EffectsPreviewCacheTests::settingsKeepTheLastPreviewButNewPixelsDropIt()
|
||||
const qint64 red = landed(cache, layer, landings, 4).image.cacheKey();
|
||||
// A mask added or removed on those pixels keeps it.
|
||||
layer.mask = LayerMask(LayerMask::assetFrom(gray(20, 10, 255)));
|
||||
QCOMPARE(ask(cache, layer, landings, layer.mask->enabledImage()).value().image.cacheKey(), red);
|
||||
QCOMPARE(ask(cache, layer, landings, layer.mask.value().enabledImage()).value().image.cacheKey(), red);
|
||||
QVERIFY(landed(cache, layer, landings, 5).image.cacheKey() != red);
|
||||
// Switched off again, the unmasked effects are known: no render.
|
||||
layer.mask->isEnabled = false;
|
||||
layer.mask.value().isEnabled = false;
|
||||
QCOMPARE(ask(cache, layer, landings).value().image.cacheKey(), red);
|
||||
QTest::qWait(200);
|
||||
QCOMPARE(*landings.count, 5);
|
||||
@@ -325,7 +325,7 @@ void EffectsPreviewCacheTests::preparingDropsLayersWithoutEffectsAndSharesTheBud
|
||||
ask(cache, small, landings);
|
||||
landed(cache, small, landings, 5);
|
||||
ImageLayer off = small;
|
||||
off.effects->stroke->enabled = false;
|
||||
off.effects.value().stroke.value().enabled = false;
|
||||
cache.seed(wide.id, filled(4, 4, Qt::green), placedAt(QPointF(0, 0), QSizeF(4, 4)));
|
||||
cache.prepare({off});
|
||||
QVERIFY(!cache.rendered(small.id) && !cache.rendered(wide.id));
|
||||
@@ -374,7 +374,7 @@ void EffectsPreviewCacheTests::aMaskHidesPixelsInTheReducedPreview()
|
||||
}
|
||||
QVERIFY(low == 125 && high == 129);
|
||||
layer.mask = LayerMask(LayerMask::assetFrom(stripes.scaled(6000, 100)));
|
||||
ask(cache, layer, landings, layer.mask->enabledImage());
|
||||
ask(cache, layer, landings, layer.mask.value().enabledImage());
|
||||
QVERIFY(landed(cache, layer, landings, 4).image == row);
|
||||
}
|
||||
|
||||
@@ -397,13 +397,13 @@ void EffectsPreviewCacheTests::aReducedPreviewScalesEveryLength()
|
||||
// The renderer on the reduced pixels, every length reduced alike.
|
||||
const double factor = 1528.0 / (6000 + 2 * LayerEffectsRenderer::margin(effects));
|
||||
const QImage reduced = image.scaled(1518, 25, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
||||
effects.stroke->size *= factor;
|
||||
effects.shadow->distance *= factor;
|
||||
effects.shadow->blur *= factor;
|
||||
effects.innerShadow->distance *= factor;
|
||||
effects.innerShadow->blur *= factor;
|
||||
effects.outerGlow->size *= factor;
|
||||
effects.innerGlow->size *= factor;
|
||||
effects.stroke.value().size *= factor;
|
||||
effects.shadow.value().distance *= factor;
|
||||
effects.shadow.value().blur *= factor;
|
||||
effects.innerShadow.value().distance *= factor;
|
||||
effects.innerShadow.value().blur *= factor;
|
||||
effects.outerGlow.value().size *= factor;
|
||||
effects.innerGlow.value().size *= factor;
|
||||
QVERIFY(result.image == LayerEffectsRenderer::render(reduced, std::nullopt, effects).image);
|
||||
}
|
||||
|
||||
|
||||
@@ -47,6 +47,9 @@ void FilterFailureTests::aTrimThatFindsNoMemoryIsARenderError()
|
||||
|
||||
void FilterFailureTests::aDitherThatFindsNoMemoryIsARenderError()
|
||||
{
|
||||
// Qt 6.10 converts on threads the limit starves first.
|
||||
if (!placesStarvation())
|
||||
QSKIP("the failure point is placed for Qt 6.4's allocations");
|
||||
DitherSettings dither;
|
||||
dither.pixelSize = 1;
|
||||
// Another format: its conversion finds no memory.
|
||||
|
||||
@@ -260,7 +260,7 @@ void FilterSessionTests::aCoveringMaskStaysPutUnderABlur()
|
||||
session->insert(ImportedImage(image, image, QStringLiteral("Quarter")));
|
||||
const QUuid id = session->activeLayerID().value();
|
||||
session->applySelection(rectPath(QRectF(0, 0, 20, 20)), SelectionMode::replace, "Select");
|
||||
session->addMask(false);
|
||||
session->addMask(true);
|
||||
session->selectLayerTarget(id, false);
|
||||
session->beginFilter(FilterKind::gaussianBlur);
|
||||
QVERIFY(committed(*session));
|
||||
|
||||
@@ -276,11 +276,11 @@ void FinishingFilterTests::aPreviewForAnOlderGridShowsOnThatGrid()
|
||||
int older = 0;
|
||||
QObject::connect(&session, &EditorSession::changed, &session, [&] {
|
||||
const std::optional<FilterEdit> &edit = session.filterEdit();
|
||||
if (!edit || !edit->preparedPreview)
|
||||
if (!edit || !edit.value().preparedPreview)
|
||||
return;
|
||||
if (QSizeF(edit->preparedPreview->size()) != edit->preparedTransform.value().size)
|
||||
if (QSizeF(edit.value().preparedPreview.value().size()) != edit.value().preparedTransform.value().size)
|
||||
mismatched = true;
|
||||
older += edit->preparedPreview->size() != edit->previewSource.size();
|
||||
older += edit.value().preparedPreview.value().size() != edit.value().previewSource.size();
|
||||
});
|
||||
session.updateFilter(FilterSettings{.bloomRadius = 5}, true);
|
||||
const LayerTransform grid = session.filterEdit().value().grownTransform.value();
|
||||
@@ -289,7 +289,7 @@ void FinishingFilterTests::aPreviewForAnOlderGridShowsOnThatGrid()
|
||||
QVERIFY(session.filterEdit().value().grownTransform.value().size.width() > grid.size.width());
|
||||
QTRY_VERIFY(session.filterEdit().value().preparedPreview && !session.filterEdit().value().preparing);
|
||||
QVERIFY(!mismatched && older > 0);
|
||||
QCOMPARE(session.filterEdit().value().preparedPreview->size(), session.filterEdit().value().previewSource.size());
|
||||
QCOMPARE(session.filterEdit().value().preparedPreview.value().size(), session.filterEdit().value().previewSource.size());
|
||||
QCOMPARE(session.filterEdit().value().preparedTransform, session.filterEdit().value().grownTransform);
|
||||
// Preview off: nothing waits; the stale render ends it.
|
||||
session.updateFilter(FilterSettings{.bloomRadius = 5}, true);
|
||||
@@ -313,7 +313,7 @@ void FinishingFilterTests::aJobWaitingBehindAnotherEditShowsOnItsGrid()
|
||||
bool mismatched = false, armed = true;
|
||||
QObject::connect(&session, &EditorSession::changed, &session, [&] {
|
||||
const std::optional<FilterEdit> &edit = session.filterEdit();
|
||||
if (edit && edit->preparedPreview && QSizeF(edit->preparedPreview->size()) != edit->preparedTransform.value().size)
|
||||
if (edit && edit.value().preparedPreview && QSizeF(edit.value().preparedPreview.value().size()) != edit.value().preparedTransform.value().size)
|
||||
mismatched = true;
|
||||
// The waiting job starts: Preview comes back next turn.
|
||||
if (std::exchange(armed, false))
|
||||
@@ -322,7 +322,7 @@ void FinishingFilterTests::aJobWaitingBehindAnotherEditShowsOnItsGrid()
|
||||
QTRY_VERIFY(!armed);
|
||||
QTRY_VERIFY(session.filterEdit().value().preparedPreview && !session.filterEdit().value().preparing);
|
||||
QVERIFY(!mismatched);
|
||||
QCOMPARE(session.filterEdit().value().preparedPreview->size(), session.filterEdit().value().previewSource.size());
|
||||
QCOMPARE(session.filterEdit().value().preparedPreview.value().size(), session.filterEdit().value().previewSource.size());
|
||||
}
|
||||
|
||||
void FinishingFilterTests::theVignettePickerPreviewsAndPutsBack()
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
class GridSettingsSheetTests : public QObject {
|
||||
Q_OBJECT
|
||||
private slots:
|
||||
// A user's English locale: Qt 6.10's C locale groups nothing.
|
||||
void initTestCase() { QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedStates)); }
|
||||
void theSheetLaysOutAsSwifts();
|
||||
void eachChangePreviewsTheGrid();
|
||||
void aPickedColourBecomesCustom();
|
||||
|
||||
@@ -48,8 +48,8 @@ void HistoryTests::undoAndRedoReturnTheRecordedSnapshots()
|
||||
DocumentHistory history;
|
||||
const std::optional<CanvasDocument> before = documentNamed("Before");
|
||||
std::optional<CanvasDocument> after = before;
|
||||
after->layers[0].name = "After";
|
||||
const QUuid selection = before->layers[0].id;
|
||||
after.value().layers[0].name = "After";
|
||||
const QUuid selection = before.value().layers[0].id;
|
||||
history.begin("Rename Layer", before, std::nullopt);
|
||||
history.end(after, selection);
|
||||
QCOMPARE(history.undoCount(), 1);
|
||||
@@ -96,9 +96,9 @@ void HistoryTests::nestedTransactionsRecordOneEntry()
|
||||
history.redo();
|
||||
history.begin("Layer Setup", start, std::nullopt);
|
||||
QVERIFY(!history.canUndo());
|
||||
edited->layers[0].name = "B";
|
||||
edited.value().layers[0].name = "B";
|
||||
history.begin("Inner", edited, std::nullopt);
|
||||
edited->layers[0].name = "C";
|
||||
edited.value().layers[0].name = "C";
|
||||
history.end(edited, std::nullopt);
|
||||
QCOMPARE(history.undoCount(), 1);
|
||||
QVERIFY(!history.canUndo());
|
||||
@@ -114,12 +114,12 @@ void HistoryTests::noOpEditsPreserveRedo()
|
||||
DocumentHistory history;
|
||||
const std::optional<CanvasDocument> start = documentNamed("A");
|
||||
std::optional<CanvasDocument> renamed = start;
|
||||
renamed->layers[0].name = "B";
|
||||
renamed.value().layers[0].name = "B";
|
||||
history.begin("Rename Layer", start, std::nullopt);
|
||||
history.end(renamed, std::nullopt);
|
||||
history.undo();
|
||||
history.begin("Rename Layer", start, std::nullopt);
|
||||
history.end(start, start->layers[0].id);
|
||||
history.end(start, start.value().layers[0].id);
|
||||
QCOMPARE(history.undoCount(), 0);
|
||||
QVERIFY(history.canRedo());
|
||||
QVERIFY(!history.isModified());
|
||||
@@ -203,16 +203,16 @@ void HistoryTests::historyBoundsEntriesAndUniqueRetainedPixels()
|
||||
{
|
||||
DocumentHistory history(2, 0);
|
||||
std::optional<CanvasDocument> doc = CanvasDocument(64, 32);
|
||||
doc->layers.push_back(ImageLayer(asset(64, 32, "fixture"), QPointF(0, 0)));
|
||||
doc.value().layers.push_back(ImageLayer(asset(64, 32, "fixture"), QPointF(0, 0)));
|
||||
for (const QString name : {"A", "B", "C"}) {
|
||||
history.begin("Rename", doc, doc->layers[0].id);
|
||||
doc->layers[0].name = name;
|
||||
history.end(doc, doc->layers[0].id);
|
||||
history.begin("Rename", doc, doc.value().layers[0].id);
|
||||
doc.value().layers[0].name = name;
|
||||
history.end(doc, doc.value().layers[0].id);
|
||||
}
|
||||
QCOMPARE(history.undoCount(), 2);
|
||||
QCOMPARE(history.retainedBytes(doc), 0);
|
||||
history.begin("Delete", doc, doc->layers[0].id);
|
||||
doc->layers.clear();
|
||||
history.begin("Delete", doc, doc.value().layers[0].id);
|
||||
doc.value().layers.clear();
|
||||
history.end(doc, std::nullopt);
|
||||
QCOMPARE(history.undoCount(), 0);
|
||||
QCOMPARE(history.retainedBytes(doc), 0);
|
||||
@@ -222,15 +222,15 @@ void HistoryTests::retainedBytesCountEachHistoryOnlyImageOnce()
|
||||
{
|
||||
DocumentHistory history;
|
||||
std::optional<CanvasDocument> doc = CanvasDocument(64, 32);
|
||||
doc->layers.push_back(ImageLayer(asset(10, 10, "old"), QPointF(0, 0)));
|
||||
doc.value().layers.push_back(ImageLayer(asset(10, 10, "old"), QPointF(0, 0)));
|
||||
for (const QString name : {"A", "B"}) {
|
||||
history.begin("Rename", doc, std::nullopt);
|
||||
doc->layers[0].name = name;
|
||||
doc.value().layers[0].name = name;
|
||||
history.end(doc, std::nullopt);
|
||||
}
|
||||
QCOMPARE(history.retainedBytes(doc), 0);
|
||||
history.begin("Replace", doc, std::nullopt);
|
||||
doc->layers[0].asset = asset(20, 10, "new");
|
||||
doc.value().layers[0].asset = asset(20, 10, "new");
|
||||
history.end(doc, std::nullopt);
|
||||
const qint64 oldBytes = 10 * 10 * 4 + 8 * 8 * 4;
|
||||
QCOMPARE(history.retainedBytes(doc), oldBytes);
|
||||
@@ -242,13 +242,13 @@ void HistoryTests::byteLimitDropsTheOldestPastEntryFirst()
|
||||
const qint64 small = 10 * 10 * 4 + 8 * 8 * 4;
|
||||
DocumentHistory history(100, small);
|
||||
std::optional<CanvasDocument> doc = CanvasDocument(64, 32);
|
||||
doc->layers.push_back(ImageLayer(asset(10, 10, "x"), QPointF(0, 0)));
|
||||
doc.value().layers.push_back(ImageLayer(asset(10, 10, "x"), QPointF(0, 0)));
|
||||
history.begin("First", doc, std::nullopt);
|
||||
doc->layers[0].asset = asset(10, 10, "y");
|
||||
doc.value().layers[0].asset = asset(10, 10, "y");
|
||||
history.end(doc, std::nullopt);
|
||||
QCOMPARE(history.undoCount(), 1);
|
||||
history.begin("Second", doc, std::nullopt);
|
||||
doc->layers[0].asset = asset(10, 10, "z");
|
||||
doc.value().layers[0].asset = asset(10, 10, "z");
|
||||
history.end(doc, std::nullopt);
|
||||
QCOMPARE(history.undoCount(), 1);
|
||||
QCOMPARE(history.undoName(), QString("Second"));
|
||||
@@ -260,10 +260,10 @@ void HistoryTests::undoTrimsRedoWhenItsPixelsExceedTheLimit()
|
||||
const qint64 small = 10 * 10 * 4 + 8 * 8 * 4;
|
||||
DocumentHistory history(100, small);
|
||||
std::optional<CanvasDocument> doc = CanvasDocument(64, 32);
|
||||
doc->layers.push_back(ImageLayer(asset(10, 10, "small"), QPointF(0, 0)));
|
||||
doc.value().layers.push_back(ImageLayer(asset(10, 10, "small"), QPointF(0, 0)));
|
||||
const std::optional<CanvasDocument> before = doc;
|
||||
history.begin("Enlarge", doc, std::nullopt);
|
||||
doc->layers[0].asset = asset(40, 40, "large");
|
||||
doc.value().layers[0].asset = asset(40, 40, "large");
|
||||
history.end(doc, std::nullopt);
|
||||
QCOMPARE(history.undoCount(), 1);
|
||||
const DocumentHistory::Snapshot undone = history.undo().value();
|
||||
@@ -277,12 +277,12 @@ void HistoryTests::undoTrimsThePastBeforeTheRedoStack()
|
||||
const qint64 small = 10 * 10 * 4 + 8 * 8 * 4;
|
||||
DocumentHistory history(100, 2 * small);
|
||||
std::optional<CanvasDocument> doc = CanvasDocument(64, 32);
|
||||
doc->layers.push_back(ImageLayer(asset(10, 10, "a"), QPointF(0, 0)));
|
||||
doc.value().layers.push_back(ImageLayer(asset(10, 10, "a"), QPointF(0, 0)));
|
||||
history.begin("First", doc, std::nullopt);
|
||||
doc->layers[0].asset = asset(10, 10, "b");
|
||||
doc.value().layers[0].asset = asset(10, 10, "b");
|
||||
history.end(doc, std::nullopt);
|
||||
history.begin("Second", doc, std::nullopt);
|
||||
doc->layers[0].asset = asset(15, 15, "c");
|
||||
doc.value().layers[0].asset = asset(15, 15, "c");
|
||||
history.end(doc, std::nullopt);
|
||||
QCOMPARE(history.undoCount(), 2);
|
||||
history.undo();
|
||||
|
||||
@@ -244,7 +244,7 @@ void ImageAdjustmentTests::newAdjustmentLayersStartFromThePaletteRenderAndEditIn
|
||||
session.setAdjustmentEditingID(std::nullopt);
|
||||
session.addAdjustment(AdjustmentKind::grain);
|
||||
const std::vector<ImageLayer> &layers = session.document().value().layers;
|
||||
QCOMPARE(std::count_if(layers.begin(), layers.end(), [](const ImageLayer &layer) { return layer.adjustment && layer.adjustment->kind == AdjustmentKind::grain; }), 2);
|
||||
QCOMPARE(std::count_if(layers.begin(), layers.end(), [](const ImageLayer &layer) { return layer.adjustment && layer.adjustment.value().kind == AdjustmentKind::grain; }), 2);
|
||||
QVERIFY2(session.activeLayer().value().adjustment.value().grain().seed != first, "each Grain layer gets its own pattern");
|
||||
QVERIFY(std::find(allAdjustmentKinds.begin(), allAdjustmentKinds.end(), AdjustmentKind::exposure) != allAdjustmentKinds.end()
|
||||
&& filterKind(AdjustmentKind::exposure) == FilterKind::exposure);
|
||||
|
||||
@@ -135,7 +135,7 @@ void ImageFileDropTests::aPictureIsCopiedToAFileFirst()
|
||||
sky.image = PSDFixture::colorImage(4, 2, 0, 0, 1);
|
||||
sky.bounds = QRectF(0, 0, 4, 2);
|
||||
QMimeData photoshop;
|
||||
photoshop.setData("image/vnd.adobe.photoshop", PSDFixture::data(PSDDocument{4, 2, 72, {sky}}, *sky.image));
|
||||
photoshop.setData("image/vnd.adobe.photoshop", PSDFixture::data(PSDDocument{4, 2, 72, {sky}}, sky.image.value()));
|
||||
photoshop.setData("application/x-other", "ignored");
|
||||
QCOMPARE(ImageFileDrop::providers(photoshop).front()->formats(), QStringList{"image/vnd.adobe.photoshop"});
|
||||
photoshop.setData("image/tiff", "tiff first");
|
||||
@@ -165,7 +165,7 @@ void ImageFileDropTests::aPictureIsCopiedToAFileFirst()
|
||||
done = false;
|
||||
ImageFileDrop::importProviders(raw, developed, std::nullopt, nullptr, std::nullopt, [&done] { done = true; });
|
||||
QTRY_VERIFY(developed.rawDevelop());
|
||||
developed.finishRawDevelop(developed.rawDevelop()->settings);
|
||||
developed.finishRawDevelop(developed.rawDevelop().value().settings);
|
||||
QTRY_VERIFY(done);
|
||||
QCOMPARE(names(developed), QStringList{"Dropped"});
|
||||
QCOMPARE(takeCopy(before), QString("Dropped.dng"));
|
||||
|
||||
@@ -222,7 +222,7 @@ void ImageTrimTests::theSheetSaysSwiftsWordsAndReturnsItsChoice()
|
||||
ok.click();
|
||||
QVERIFY(answer.value() == edges(TrimBasedOn::bottomRightPixelColor, false, true, false, false));
|
||||
sheet.findChild<QPushButton *>("trimCancel")->click();
|
||||
QVERIFY(answer && !answer->has_value());
|
||||
QVERIFY(answer && !answer.value().has_value());
|
||||
}
|
||||
|
||||
void ImageTrimTests::theControllerTrimsThroughTheSheetAsOneStep()
|
||||
|
||||
@@ -77,7 +77,7 @@ void InnerGlowTests::innerGlowCodableRoundTrip()
|
||||
QCOMPARE(ManifestJson::effects(encoded), original);
|
||||
// Absent `enabled` stays absent, read as shown.
|
||||
LayerEffects shown = original;
|
||||
shown.innerGlow->enabled = std::nullopt;
|
||||
shown.innerGlow.value().enabled = std::nullopt;
|
||||
QVERIFY(!ManifestJson::encoded(shown).value("innerGlow").toObject().contains("enabled"));
|
||||
QCOMPARE(ManifestJson::effects(ManifestJson::encoded(shown)), shown);
|
||||
// A key of the wrong type, or missing, refuses it.
|
||||
@@ -165,10 +165,10 @@ void InnerGlowTests::itSitsOverTheOverlayAndUnderTheInnerShadow()
|
||||
const LayerEffectsRenderer::Rendered shadowed = LayerEffectsRenderer::render(square(40, Qt::black), std::nullopt, effects);
|
||||
QCOMPARE(at(shadowed, 0, 20), at(covered, 0, 20));
|
||||
// A sideways shadow covers the glow on one edge.
|
||||
effects.innerShadow->distance = 4;
|
||||
const int x = effects.innerShadow->offset().width() > 0 ? 0 : 39;
|
||||
effects.innerShadow.value().distance = 4;
|
||||
const int x = effects.innerShadow.value().offset().width() > 0 ? 0 : 39;
|
||||
const QColor edge = at(LayerEffectsRenderer::render(square(40, Qt::black), std::nullopt, effects), x, 20);
|
||||
QVERIFY(std::abs(effects.innerShadow->offset().width()) > 3.9);
|
||||
QVERIFY(std::abs(effects.innerShadow.value().offset().width()) > 3.9);
|
||||
QVERIFY(edge.redF() > 0.9 && edge.greenF() < 0.1);
|
||||
}
|
||||
|
||||
@@ -195,11 +195,11 @@ void InnerGlowTests::theSessionAddsCopiesAndCancelsIt()
|
||||
session.addEffect(LayerEffectKind::innerGlow);
|
||||
QCOMPARE(session.history.undoName(), QString("Add Inner Glow"));
|
||||
QVERIFY(session.activeEffects().innerGlow == InnerGlowEffect());
|
||||
session.changeEffects([](LayerEffects &effects) { effects.innerGlow->size = 44; });
|
||||
session.changeEffects([](LayerEffects &effects) { effects.innerGlow.value().size = 44; });
|
||||
session.finishEffectsEditing(false);
|
||||
QVERIFY(!session.activeEffects().innerGlow);
|
||||
session.addEffect(LayerEffectKind::innerGlow);
|
||||
session.changeEffects([](LayerEffects &effects) { effects.innerGlow->size = 44; });
|
||||
session.changeEffects([](LayerEffects &effects) { effects.innerGlow.value().size = 44; });
|
||||
session.finishEffectsEditing(true);
|
||||
// Adding it again keeps the glow it has.
|
||||
session.addEffect(LayerEffectKind::innerGlow);
|
||||
|
||||
@@ -132,14 +132,14 @@ void LayerAdjustmentTests::validityFollowsSwiftsBounds()
|
||||
QCOMPARE((LayerAdjustment{.kind = AdjustmentKind::hsv, .hue = hue, .saturation = saturation, .lightness = lightness}.isValid()), valid);
|
||||
// Each range's values too, and every band's handles finite.
|
||||
LayerAdjustment ranged = full();
|
||||
ranged.hsvSettings->adjustments[ColorRange::blues] = {0, 0, 101};
|
||||
ranged.hsvSettings.value().adjustments[ColorRange::blues] = {0, 0, 101};
|
||||
QVERIFY(!ranged.isValid());
|
||||
ranged = full();
|
||||
ranged.hsvSettings->bands[ColorRange::cyans].falloffEnd = std::numeric_limits<double>::infinity();
|
||||
ranged.hsvSettings.value().bands[ColorRange::cyans].falloffEnd = std::numeric_limits<double>::infinity();
|
||||
QVERIFY(!ranged.isValid());
|
||||
// The legacy fields count only when no range settings exist.
|
||||
ranged = full();
|
||||
ranged.hsvSettings->adjustments[ColorRange::reds] = {-360, -100, -100};
|
||||
ranged.hsvSettings.value().adjustments[ColorRange::reds] = {-360, -100, -100};
|
||||
QVERIFY(ranged.isValid());
|
||||
// Levels as normalized, then every kind's own rules.
|
||||
LayerAdjustment levels{AdjustmentKind::hsv};
|
||||
@@ -308,7 +308,7 @@ void LayerAdjustmentTests::theStoreKeepsAdjustmentsToVersion7WithoutPixels()
|
||||
blank.isGroup = true;
|
||||
QCOMPARE(stored(snapshot), ProjectError::Kind::invalid);
|
||||
blank.isGroup = std::nullopt;
|
||||
blank.adjustment->hue = 400;
|
||||
blank.adjustment.value().hue = 400;
|
||||
QCOMPARE(stored(snapshot), ProjectError::Kind::invalid);
|
||||
}
|
||||
|
||||
@@ -440,7 +440,7 @@ void LayerAdjustmentTests::adjustmentsTravelWithTheirLayers()
|
||||
session->duplicateActiveLayer();
|
||||
QVERIFY(session->activeLayer().value().adjustment == full());
|
||||
ImageLayer changed = session->activeLayer().value();
|
||||
changed.adjustment->hue = 11;
|
||||
changed.adjustment.value().hue = 11;
|
||||
QVERIFY(!(changed == session->activeLayer().value()));
|
||||
}
|
||||
|
||||
|
||||
@@ -237,15 +237,15 @@ void LayerEffectRowTests::theEyeShowsOrHidesItsEffect()
|
||||
LayerEffectRow &stroke = *listed.effects(0)[0];
|
||||
// One step each way; the choice stays as it was.
|
||||
listed.click(listed.eye(stroke), QPoint(10, 11));
|
||||
QVERIFY(!layerWith(listed.session, top).effects->stroke->isEnabled() && listed.session.history.undoName() == "Hide Stroke");
|
||||
QVERIFY(!layerWith(listed.session, top).effects.value().stroke.value().isEnabled() && listed.session.history.undoName() == "Hide Stroke");
|
||||
QVERIFY(!listed.chosen() && listed.eye(stroke).accessibleName() == "Show Stroke");
|
||||
listed.click(listed.eye(stroke), QPoint(10, 11));
|
||||
QVERIFY(layerWith(listed.session, top).effects->stroke->isEnabled() && listed.session.history.undoName() == "Show Stroke");
|
||||
QVERIFY(layerWith(listed.session, top).effects.value().stroke.value().isEnabled() && listed.session.history.undoName() == "Show Stroke");
|
||||
// It rests while layers cannot be edited.
|
||||
listed.session.setIsProjectBusy(true);
|
||||
QVERIFY(!listed.eye(stroke).isEnabled());
|
||||
listed.click(listed.eye(stroke), QPoint(10, 11));
|
||||
QVERIFY(layerWith(listed.session, top).effects->stroke->isEnabled() && !listed.chosen());
|
||||
QVERIFY(layerWith(listed.session, top).effects.value().stroke.value().isEnabled() && !listed.chosen());
|
||||
listed.session.setIsProjectBusy(false);
|
||||
QVERIFY(listed.eye(stroke).isEnabled());
|
||||
}
|
||||
@@ -270,14 +270,14 @@ void LayerEffectRowTests::pressesFollowSwiftsOrder()
|
||||
listed.session.dropEffectSelection();
|
||||
listed.press(listed.eye(shadow), QPoint(10, 5), Qt::AltModifier);
|
||||
listed.release(listed.eye(shadow), QPoint(10, 5), Qt::AltModifier);
|
||||
QVERIFY(layerWith(listed.session, top).effects->shadow->isEnabled() && listed.chosen() == (LayerEffectSelection{top, LayerEffectKind::shadow}));
|
||||
QVERIFY(layerWith(listed.session, top).effects.value().shadow.value().isEnabled() && listed.chosen() == (LayerEffectSelection{top, LayerEffectKind::shadow}));
|
||||
// An Alt double click on the eye hides nothing either.
|
||||
listed.session.dropEffectSelection();
|
||||
QTest::mouseDClick(listed.list.windowHandle(), Qt::LeftButton, Qt::AltModifier, listed.at(listed.eye(shadow), QPoint(12, 5)));
|
||||
QVERIFY(layerWith(listed.session, top).effects->shadow->isEnabled() && listed.chosen() == (LayerEffectSelection{top, LayerEffectKind::shadow}));
|
||||
QVERIFY(layerWith(listed.session, top).effects.value().shadow.value().isEnabled() && listed.chosen() == (LayerEffectSelection{top, LayerEffectKind::shadow}));
|
||||
// On the strip, the eye's Alt press clips too.
|
||||
listed.click(listed.eye(shadow), QPoint(10, 20), Qt::AltModifier);
|
||||
QVERIFY(!layerWith(listed.session, top).maskSourceID && !listed.chosen() && layerWith(listed.session, top).effects->shadow->isEnabled());
|
||||
QVERIFY(!layerWith(listed.session, top).maskSourceID && !listed.chosen() && layerWith(listed.session, top).effects.value().shadow.value().isEnabled());
|
||||
// Its own row's press lets go, keeping the layer.
|
||||
listed.session.selectEffect(LayerEffectKind::stroke, top);
|
||||
listed.click(listed.cell(0), QPoint(listed.cell(0).width() - 20, 20));
|
||||
@@ -295,7 +295,7 @@ void LayerEffectRowTests::pressesFollowSwiftsOrder()
|
||||
QVERIFY(listed.chosen() == (LayerEffectSelection{top, LayerEffectKind::shadow}));
|
||||
listed.release(shadow, QPoint(150, 5), Qt::AltModifier | Qt::ControlModifier);
|
||||
listed.click(listed.eye(shadow), QPoint(10, 5), Qt::AltModifier | Qt::ControlModifier);
|
||||
QVERIFY(!layerWith(listed.session, top).effects->shadow->isEnabled());
|
||||
QVERIFY(!layerWith(listed.session, top).effects.value().shadow.value().isEnabled());
|
||||
// A plain press on another effect chooses it at once.
|
||||
listed.press(stroke, QPoint(150, 12));
|
||||
QVERIFY(listed.chosen() == (LayerEffectSelection{top, LayerEffectKind::stroke}));
|
||||
@@ -412,7 +412,7 @@ void LayerEffectRowTests::effectDropsLandOnTheRowUnderThePointer()
|
||||
const std::unique_ptr<QMimeData> probe(effectDrag(listed.list, payload));
|
||||
QCOMPARE(listed.list.dropTarget(*probe, Qt::CopyAction, onMiddle).value(), (LayerDropTarget{.row = 1, .onRow = true, .atBottom = false, .copying = true}));
|
||||
QVERIFY(listed.drop(effectDrag(listed.list, payload), onMiddle));
|
||||
QVERIFY(listed.lastAction == Qt::CopyAction && layerWith(listed.session, middle).effects->stroke->size == 12);
|
||||
QVERIFY(listed.lastAction == Qt::CopyAction && layerWith(listed.session, middle).effects.value().stroke.value().size == 12);
|
||||
QVERIFY(listed.session.history.undoName() == "Copy Stroke" && listed.chosen() == (LayerEffectSelection{middle, LayerEffectKind::stroke}));
|
||||
// Refused: its own row, a missing kind, strangers, bad words.
|
||||
QVERIFY(!listed.drop(effectDrag(listed.list, payload), onTop));
|
||||
@@ -448,7 +448,7 @@ void LayerEffectRowTests::aRowRebuiltUnderItsOwnPressLivesOn()
|
||||
QTest::mouseDClick(shadow.data(), Qt::LeftButton, Qt::NoModifier, QPoint(150, 12));
|
||||
QVERIFY(shadow && !shadow->isVisible());
|
||||
QVERIFY(listed.session.effectsEditing() == (LayerEffectSelection{top, LayerEffectKind::shadow}) && listed.list.hasFocus());
|
||||
QVERIFY(!layerWith(listed.session, top).effects->stroke && listed.effects(0).size() == 1);
|
||||
QVERIFY(!layerWith(listed.session, top).effects.value().stroke && listed.effects(0).size() == 1);
|
||||
QTRY_VERIFY(!shadow);
|
||||
}
|
||||
|
||||
|
||||
@@ -86,32 +86,32 @@ QImage replayed(const QImage &pixels, const LayerEffects &effects)
|
||||
for (int x = 0; x < pixels.width(); ++x)
|
||||
shader.shape.push_back(float(pixels.constScanLine(y)[x * 4 + 3]) / 255.f);
|
||||
}
|
||||
const auto on = [](const auto &effect) { return effect && effect->isEnabled() && effect->opacity > 0; };
|
||||
const bool stroke = on(effects.stroke) && effects.stroke->size > 0;
|
||||
const auto on = [](const auto &effect) { return effect && effect.value().isEnabled() && effect.value().opacity > 0; };
|
||||
const bool stroke = on(effects.stroke) && effects.stroke.value().size > 0;
|
||||
std::vector<float> ring(shader.shape.size()), cast(shader.shape.size()), inner(shader.shape.size()), glow(shader.shape.size()),
|
||||
innerGlow(shader.shape.size());
|
||||
if (stroke) {
|
||||
const int reach = std::max(1, int(std::lround(effects.stroke->size)));
|
||||
const std::vector<float> moved = shader.spread(shader.spread(shader.shape, reach, effects.stroke->inside, true), reach, effects.stroke->inside, false);
|
||||
const int reach = std::max(1, int(std::lround(effects.stroke.value().size)));
|
||||
const std::vector<float> moved = shader.spread(shader.spread(shader.shape, reach, effects.stroke.value().inside, true), reach, effects.stroke.value().inside, false);
|
||||
for (size_t index = 0; index < ring.size(); ++index)
|
||||
ring[index] = std::clamp(effects.stroke->inside ? shader.shape[index] - moved[index] : moved[index] - shader.shape[index], 0.f, 1.f);
|
||||
ring[index] = std::clamp(effects.stroke.value().inside ? shader.shape[index] - moved[index] : moved[index] - shader.shape[index], 0.f, 1.f);
|
||||
}
|
||||
if (on(effects.shadow))
|
||||
cast = shader.softened(shader.shift(shader.shape, float(effects.shadow->offset().width()), float(effects.shadow->offset().height())),
|
||||
float(effects.shadow->blur / 2));
|
||||
const bool glowing = on(effects.outerGlow) && effects.outerGlow->size > 0;
|
||||
cast = shader.softened(shader.shift(shader.shape, float(effects.shadow.value().offset().width()), float(effects.shadow.value().offset().height())),
|
||||
float(effects.shadow.value().blur / 2));
|
||||
const bool glowing = on(effects.outerGlow) && effects.outerGlow.value().size > 0;
|
||||
if (glowing)
|
||||
glow = shader.softened(shader.shape, float(effects.outerGlow->size / 2));
|
||||
const bool glowingInside = on(effects.innerGlow) && effects.innerGlow->size > 0;
|
||||
glow = shader.softened(shader.shape, float(effects.outerGlow.value().size / 2));
|
||||
const bool glowingInside = on(effects.innerGlow) && effects.innerGlow.value().size > 0;
|
||||
if (glowingInside) {
|
||||
const std::vector<float> softened = shader.softened(shader.shape, float(effects.innerGlow->size / 2));
|
||||
const std::vector<float> softened = shader.softened(shader.shape, float(effects.innerGlow.value().size / 2));
|
||||
for (size_t index = 0; index < innerGlow.size(); ++index)
|
||||
innerGlow[index] = std::clamp(shader.shape[index] * (1.f - softened[index]), 0.f, 1.f);
|
||||
}
|
||||
if (on(effects.innerShadow)) {
|
||||
const std::vector<float> moved = shader.softened(shader.shift(shader.shape, float(effects.innerShadow->offset().width()),
|
||||
float(effects.innerShadow->offset().height())),
|
||||
float(effects.innerShadow->blur / 2));
|
||||
const std::vector<float> moved = shader.softened(shader.shift(shader.shape, float(effects.innerShadow.value().offset().width()),
|
||||
float(effects.innerShadow.value().offset().height())),
|
||||
float(effects.innerShadow.value().blur / 2));
|
||||
for (size_t index = 0; index < inner.size(); ++index)
|
||||
inner[index] = std::clamp(shader.shape[index] * (1.f - moved[index]), 0.f, 1.f);
|
||||
}
|
||||
@@ -127,25 +127,25 @@ QImage replayed(const QImage &pixels, const LayerEffects &effects)
|
||||
alpha = coverage + alpha * (1.f - coverage);
|
||||
};
|
||||
if (on(effects.shadow))
|
||||
blend(effects.shadow->color(), std::clamp(cast[index] * float(effects.shadow->opacity), 0.f, 1.f));
|
||||
blend(effects.shadow.value().color(), std::clamp(cast[index] * float(effects.shadow.value().opacity), 0.f, 1.f));
|
||||
if (glowing)
|
||||
blend(effects.outerGlow->color(), std::clamp(glow[index] * (1.f - shader.shape[index]) * float(effects.outerGlow->opacity), 0.f, 1.f));
|
||||
const float strokeCoverage = stroke ? std::clamp(ring[index] * float(effects.stroke->opacity), 0.f, 1.f) : 0.f;
|
||||
if (stroke && !effects.stroke->inside)
|
||||
blend(effects.stroke->color(), strokeCoverage);
|
||||
blend(effects.outerGlow.value().color(), std::clamp(glow[index] * (1.f - shader.shape[index]) * float(effects.outerGlow.value().opacity), 0.f, 1.f));
|
||||
const float strokeCoverage = stroke ? std::clamp(ring[index] * float(effects.stroke.value().opacity), 0.f, 1.f) : 0.f;
|
||||
if (stroke && !effects.stroke.value().inside)
|
||||
blend(effects.stroke.value().color(), strokeCoverage);
|
||||
const uchar *source = pixels.constScanLine(y) + x * 4;
|
||||
const float sourceAlpha = float(source[3]) / 255.f;
|
||||
for (int channel = 0; channel < 3; ++channel)
|
||||
colour[channel] = float(source[channel]) / 255.f + colour[channel] * (1.f - sourceAlpha);
|
||||
alpha = sourceAlpha + alpha * (1.f - sourceAlpha);
|
||||
if (on(effects.colorOverlay))
|
||||
blend(effects.colorOverlay->color(), std::clamp(shader.shape[index] * float(effects.colorOverlay->opacity), 0.f, 1.f));
|
||||
blend(effects.colorOverlay.value().color(), std::clamp(shader.shape[index] * float(effects.colorOverlay.value().opacity), 0.f, 1.f));
|
||||
if (glowingInside)
|
||||
blend(effects.innerGlow->color(), std::clamp(innerGlow[index] * float(effects.innerGlow->opacity), 0.f, 1.f));
|
||||
blend(effects.innerGlow.value().color(), std::clamp(innerGlow[index] * float(effects.innerGlow.value().opacity), 0.f, 1.f));
|
||||
if (on(effects.innerShadow))
|
||||
blend(effects.innerShadow->color(), std::clamp(inner[index] * float(effects.innerShadow->opacity), 0.f, 1.f));
|
||||
if (stroke && effects.stroke->inside)
|
||||
blend(effects.stroke->color(), strokeCoverage);
|
||||
blend(effects.innerShadow.value().color(), std::clamp(inner[index] * float(effects.innerShadow.value().opacity), 0.f, 1.f));
|
||||
if (stroke && effects.stroke.value().inside)
|
||||
blend(effects.stroke.value().color(), strokeCoverage);
|
||||
uchar *out = result.scanLine(y) + x * 4;
|
||||
for (int channel = 0; channel < 3; ++channel)
|
||||
out[channel] = uchar(std::clamp(colour[channel], 0.f, 1.f) * 255.f + 0.5f);
|
||||
@@ -219,7 +219,7 @@ void LayerEffectsKernelTests::everyEffectMatchesTheShader_data()
|
||||
all.innerShadow = inner.innerShadow;
|
||||
all.outerGlow = glow.outerGlow;
|
||||
all.innerGlow = innerGlow.innerGlow;
|
||||
all.shadow->blur = 0;
|
||||
all.shadow.value().blur = 0;
|
||||
wide.stroke = StrokeEffect{.size = 9, .red = 1, .opacity = 1};
|
||||
wide.shadow = ShadowEffect{.angle = 200, .distance = 0.5, .blur = 0.01, .opacity = 1};
|
||||
QTest::newRow("outside stroke") << outside;
|
||||
|
||||
@@ -60,11 +60,11 @@ void LayerEffectsRendererTests::theMarginHoldsWhatReachesOut()
|
||||
LayerEffects cast = stroke(10);
|
||||
cast.shadow = ShadowEffect{.distance = 5, .blur = 2.5};
|
||||
QCOMPARE(LayerEffectsRenderer::margin(cast), 15.0);
|
||||
cast.shadow->blur = 4;
|
||||
cast.shadow.value().blur = 4;
|
||||
QCOMPARE(LayerEffectsRenderer::margin(cast), 19.0);
|
||||
// Switched off, it takes no room.
|
||||
cast.shadow->enabled = false;
|
||||
cast.stroke->enabled = false;
|
||||
cast.shadow.value().enabled = false;
|
||||
cast.stroke.value().enabled = false;
|
||||
QCOMPARE(LayerEffectsRenderer::margin(cast), 2.0);
|
||||
}
|
||||
|
||||
@@ -113,11 +113,11 @@ void LayerEffectsRendererTests::renderingPadsMasksThenRunsTheKernel()
|
||||
QVERIFY(pixel(soft, 2, 10)[3] == 0 && pixel(soft, 65, 10)[3] == 255);
|
||||
// Switched-off effects are none; invalid or vast ones refuse.
|
||||
LayerEffects hidden = stroke(3);
|
||||
hidden.stroke->enabled = false;
|
||||
hidden.stroke.value().enabled = false;
|
||||
QCOMPARE(LayerEffectsRenderer::render(image, std::nullopt, hidden).image.size(), QSize(24, 14));
|
||||
// A switched-off effect is not judged.
|
||||
LayerEffects wild = stroke(600);
|
||||
wild.stroke->enabled = false;
|
||||
wild.stroke.value().enabled = false;
|
||||
QVERIFY(LayerEffectsRenderer::render(image, std::nullopt, wild).image == LayerEffectsRenderer::render(image, std::nullopt, hidden).image);
|
||||
try {
|
||||
LayerEffectsRenderer::render(image, std::nullopt, stroke(501));
|
||||
@@ -142,7 +142,7 @@ void LayerEffectsRendererTests::theCacheKeepsEightWithinItsBudget()
|
||||
QVERIFY(!LayerEffectsRenderer::cached(image, std::nullopt, std::nullopt));
|
||||
QVERIFY(!LayerEffectsRenderer::cached(image, std::nullopt, LayerEffects()));
|
||||
LayerEffects hidden = stroke(2);
|
||||
hidden.stroke->enabled = false;
|
||||
hidden.stroke.value().enabled = false;
|
||||
QVERIFY(!LayerEffectsRenderer::cached(image, std::nullopt, hidden));
|
||||
QVERIFY(!LayerEffectsRenderer::cached(image, std::nullopt, stroke(600)));
|
||||
// The same pixels, mask and effects: the same result.
|
||||
|
||||
@@ -83,7 +83,7 @@ void LayerEffectsSessionTests::addingAnEffectTakesItsDefaultsAndOpensItsPanel()
|
||||
present.shadow = ShadowEffect{.distance = 33};
|
||||
session.setEffects(present);
|
||||
session.addEffect(LayerEffectKind::shadow);
|
||||
QVERIFY(two.effects(two.top).value().shadow->distance == 33);
|
||||
QVERIFY(two.effects(two.top).value().shadow.value().distance == 33);
|
||||
session.finishEffectsEditing(true);
|
||||
const int kept = session.history.undoCount();
|
||||
session.addEffect(LayerEffectKind::colorOverlay);
|
||||
@@ -128,15 +128,15 @@ void LayerEffectsSessionTests::cancelPutsBackThisPanelsEffectAlone()
|
||||
session.setEffects(start);
|
||||
session.selectEffect(LayerEffectKind::stroke, two.top, true);
|
||||
QVERIFY(session.effectsEditingOriginal() == start);
|
||||
session.changeEffects([](LayerEffects &effects) { effects.stroke->size = 9; });
|
||||
session.changeEffects([](LayerEffects &effects) { effects.stroke.value().size = 9; });
|
||||
QCOMPARE(session.history.undoName(), QString("Edit Stroke"));
|
||||
// Another effect changed meanwhile keeps its change.
|
||||
LayerEffects other = two.effects(two.top).value();
|
||||
other.shadow->distance = 30;
|
||||
other.shadow.value().distance = 30;
|
||||
session.setEffects(other);
|
||||
session.finishEffectsEditing(false);
|
||||
const LayerEffects after = two.effects(two.top).value();
|
||||
QVERIFY(after.stroke->size == 3 && after.shadow->distance == 30);
|
||||
QVERIFY(after.stroke.value().size == 3 && after.shadow.value().distance == 30);
|
||||
QCOMPARE(session.history.undoName(), QString("Cancel Stroke"));
|
||||
QVERIFY(!session.effectsEditing() && !session.effectsEditingOriginal());
|
||||
// The chosen effect stays chosen while its layer shows it.
|
||||
@@ -147,26 +147,26 @@ void LayerEffectsSessionTests::cancelPutsBackThisPanelsEffectAlone()
|
||||
QVERIFY(!two.effects(two.top).value().innerShadow);
|
||||
QVERIFY(!session.effectSelection());
|
||||
session.selectEffect(LayerEffectKind::shadow, two.top, true);
|
||||
session.changeEffects([](LayerEffects &effects) { effects.shadow->blur = 2; });
|
||||
session.changeEffects([](LayerEffects &effects) { effects.shadow.value().blur = 2; });
|
||||
const int steps = session.history.undoCount();
|
||||
session.finishEffectsEditing(true);
|
||||
QVERIFY(session.history.undoCount() == steps && two.effects(two.top).value().shadow->blur == 2);
|
||||
QVERIFY(session.history.undoCount() == steps && two.effects(two.top).value().shadow.value().blur == 2);
|
||||
// Nothing open, nothing to finish.
|
||||
session.finishEffectsEditing(false);
|
||||
QCOMPARE(session.history.undoCount(), steps);
|
||||
// Opening another panel cancels the open one's changes.
|
||||
session.selectEffect(LayerEffectKind::stroke, two.top, true);
|
||||
session.changeEffects([](LayerEffects &effects) { effects.stroke->size = 40; });
|
||||
session.changeEffects([](LayerEffects &effects) { effects.stroke.value().size = 40; });
|
||||
session.selectEffect(LayerEffectKind::shadow, two.top, true);
|
||||
QVERIFY(two.effects(two.top).value().stroke->size == 3 && session.history.undoName() == QString("Cancel Stroke"));
|
||||
QVERIFY(two.effects(two.top).value().stroke.value().size == 3 && session.history.undoName() == QString("Cancel Stroke"));
|
||||
session.finishEffectsEditing(true);
|
||||
// An overlay's Cancel puts back the overlay alone.
|
||||
session.addEffect(LayerEffectKind::colorOverlay);
|
||||
session.finishEffectsEditing(true);
|
||||
session.selectEffect(LayerEffectKind::colorOverlay, two.top, true);
|
||||
session.changeEffects([](LayerEffects &effects) { effects.colorOverlay->opacity = 0.25; });
|
||||
session.changeEffects([](LayerEffects &effects) { effects.colorOverlay.value().opacity = 0.25; });
|
||||
session.finishEffectsEditing(false);
|
||||
QCOMPARE(two.effects(two.top).value().colorOverlay->opacity, 1.0);
|
||||
QCOMPARE(two.effects(two.top).value().colorOverlay.value().opacity, 1.0);
|
||||
// Its layer's effects all gone, Cancel has nothing to restore.
|
||||
session.selectEffect(LayerEffectKind::shadow, two.top, true);
|
||||
session.setEffects(LayerEffects(), two.top);
|
||||
@@ -195,7 +195,7 @@ void LayerEffectsSessionTests::setEffectsIsOneStepOnAValidChange()
|
||||
// The same again, an invalid one, a missing layer: nothing.
|
||||
session.setEffects(effects, two.bottom);
|
||||
LayerEffects wild = effects;
|
||||
wild.stroke->size = 501;
|
||||
wild.stroke.value().size = 501;
|
||||
session.setEffects(wild, two.bottom);
|
||||
session.setEffects(effects, QUuid::createUuid());
|
||||
QCOMPARE(session.history.undoCount(), steps + 1);
|
||||
@@ -220,18 +220,18 @@ void LayerEffectsSessionTests::panelEditsStayWithTheirLayer()
|
||||
EditorSession &session = two.session;
|
||||
session.addEffect(LayerEffectKind::stroke);
|
||||
session.selectLayer(two.bottom);
|
||||
session.changeEffects([](LayerEffects &effects) { effects.stroke->size = 12; });
|
||||
QVERIFY(two.effects(two.top).value().stroke->size == 12 && !two.effects(two.bottom));
|
||||
session.changeEffects([](LayerEffects &effects) { effects.stroke.value().size = 12; });
|
||||
QVERIFY(two.effects(two.top).value().stroke.value().size == 12 && !two.effects(two.bottom));
|
||||
// Once its effect is gone, edits have nowhere to go.
|
||||
LayerEffects without = two.effects(two.top).value();
|
||||
without.stroke.reset();
|
||||
without.shadow = ShadowEffect();
|
||||
session.setEffects(without, two.top);
|
||||
const int steps = session.history.undoCount();
|
||||
session.changeEffects([](LayerEffects &effects) { effects.shadow->blur = 1; });
|
||||
session.changeEffects([](LayerEffects &effects) { effects.shadow.value().blur = 1; });
|
||||
QCOMPARE(session.history.undoCount(), steps);
|
||||
session.finishEffectsEditing(true);
|
||||
session.changeEffects([](LayerEffects &effects) { effects.shadow->blur = 1; });
|
||||
session.changeEffects([](LayerEffects &effects) { effects.shadow.value().blur = 1; });
|
||||
QCOMPARE(session.history.undoCount(), steps);
|
||||
}
|
||||
|
||||
@@ -251,7 +251,7 @@ void LayerEffectsSessionTests::copyingAnEffectClosesTheTargetsPanelFirst()
|
||||
target.stroke = StrokeEffect();
|
||||
session.setEffects(target, two.bottom);
|
||||
session.selectEffect(LayerEffectKind::shadow, two.bottom, true);
|
||||
session.changeEffects([](LayerEffects &effects) { effects.shadow->blur = 7; });
|
||||
session.changeEffects([](LayerEffects &effects) { effects.shadow.value().blur = 7; });
|
||||
session.copyEffect(LayerEffectKind::shadow, two.top, two.bottom);
|
||||
QCOMPARE(session.history.undoName(), QString("Copy Drop Shadow"));
|
||||
QVERIFY(!session.effectsEditing() && two.effects(two.bottom).value().shadow == source.shadow);
|
||||
@@ -259,7 +259,7 @@ void LayerEffectsSessionTests::copyingAnEffectClosesTheTargetsPanelFirst()
|
||||
QVERIFY(session.effectSelection() == (LayerEffectSelection{two.bottom, LayerEffectKind::shadow}) && session.activeLayerID() == two.bottom);
|
||||
// The open edit was kept: one undo brings it back.
|
||||
session.undo();
|
||||
QVERIFY(two.effects(two.bottom).value().shadow->blur == 7);
|
||||
QVERIFY(two.effects(two.bottom).value().shadow.value().blur == 7);
|
||||
session.redo();
|
||||
// No source, a blank or folder target, busy: no copy.
|
||||
QVERIFY(!session.canCopyEffect(LayerEffectKind::shadow, QUuid::createUuid(), two.bottom));
|
||||
@@ -278,9 +278,9 @@ void LayerEffectsSessionTests::togglingAndRemovingAnEffect()
|
||||
session.addEffect(LayerEffectKind::stroke);
|
||||
session.finishEffectsEditing(true);
|
||||
session.toggleEffect(LayerEffectKind::stroke, two.top);
|
||||
QVERIFY(two.effects(two.top).value().stroke->enabled == false && session.history.undoName() == QString("Hide Stroke"));
|
||||
QVERIFY(two.effects(two.top).value().stroke.value().enabled == false && session.history.undoName() == QString("Hide Stroke"));
|
||||
session.toggleEffect(LayerEffectKind::stroke, two.top);
|
||||
QVERIFY(two.effects(two.top).value().stroke->enabled == true && session.history.undoName() == QString("Show Stroke"));
|
||||
QVERIFY(two.effects(two.top).value().stroke.value().enabled == true && session.history.undoName() == QString("Show Stroke"));
|
||||
// Toggling a missing effect, or none at all, does nothing.
|
||||
const int steps = session.history.undoCount();
|
||||
session.toggleEffect(LayerEffectKind::shadow, two.top);
|
||||
@@ -381,7 +381,7 @@ void LayerEffectsSessionTests::thePickerEditsTheOpenEffect()
|
||||
QVERIFY(session.colorPicker());
|
||||
const int steps = session.history.undoCount();
|
||||
session.previewEffectColor();
|
||||
QVERIFY(session.history.undoCount() == steps && two.effects(two.top).value().stroke->red == 1);
|
||||
QVERIFY(session.history.undoCount() == steps && two.effects(two.top).value().stroke.value().red == 1);
|
||||
session.openEffectColorPicker(LayerEffectKind::shadow);
|
||||
QVERIFY(session.colorPicker().value().target.kind == ColorPickerTarget::Kind::palette);
|
||||
session.closeColorPicker(false);
|
||||
@@ -408,7 +408,7 @@ void LayerEffectsSessionTests::thePickerEditsTheOpenEffect()
|
||||
session.setColorPickerHSB(PickerHSB(PaletteColor{1, 1, 0}));
|
||||
session.previewEffectColor();
|
||||
session.addEffect(LayerEffectKind::stroke);
|
||||
QVERIFY(!session.colorPicker() && two.effects(two.top).value().shadow->color() == PaletteColor::black());
|
||||
QVERIFY(!session.colorPicker() && two.effects(two.top).value().shadow.value().color() == PaletteColor::black());
|
||||
}
|
||||
|
||||
void LayerEffectsSessionTests::everyChangeIsAnnouncedLast()
|
||||
@@ -424,7 +424,7 @@ void LayerEffectsSessionTests::everyChangeIsAnnouncedLast()
|
||||
return seen == left ? QString() : seen.join("; ") + " != " + left.join("; ");
|
||||
};
|
||||
QCOMPARE(stale([&] { session.addEffect(LayerEffectKind::stroke); }), QString());
|
||||
QCOMPARE(stale([&] { session.changeEffects([](LayerEffects &effects) { effects.stroke->size = 6; }); }), QString());
|
||||
QCOMPARE(stale([&] { session.changeEffects([](LayerEffects &effects) { effects.stroke.value().size = 6; }); }), QString());
|
||||
QCOMPARE(stale([&] { session.openEffectColorPicker(LayerEffectKind::stroke); }), QString());
|
||||
QCOMPARE(stale([&] { session.setColorPickerHSB(PickerHSB(PaletteColor{1, 0, 0})); }), QString());
|
||||
QCOMPARE(stale([&] { session.previewEffectColor(); }), QString());
|
||||
|
||||
@@ -118,16 +118,16 @@ void LayerEffectsTests::validityFollowsSwiftsBounds()
|
||||
QVERIFY(!InnerShadowEffect{.angle = -360.5}.isValid() && !InnerShadowEffect{.distance = -1}.isValid() && !InnerShadowEffect{.blur = notANumber}.isValid());
|
||||
// One bad effect spoils the set.
|
||||
LayerEffects effects = every();
|
||||
effects.innerShadow->blur = infinity;
|
||||
effects.innerShadow.value().blur = infinity;
|
||||
QVERIFY(!effects.isValid());
|
||||
effects = every();
|
||||
effects.stroke->size = 501;
|
||||
effects.stroke.value().size = 501;
|
||||
QVERIFY(!effects.isValid());
|
||||
effects = every();
|
||||
effects.shadow->distance = -1;
|
||||
effects.shadow.value().distance = -1;
|
||||
QVERIFY(!effects.isValid());
|
||||
effects = every();
|
||||
effects.colorOverlay->opacity = 2;
|
||||
effects.colorOverlay.value().opacity = 2;
|
||||
QVERIFY(!effects.isValid());
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ void LayerEffectsTests::theHelpersReadAndWriteOneKind()
|
||||
effects.setEnabled(true, LayerEffectKind::stroke);
|
||||
effects.setEnabled(false, LayerEffectKind::innerShadow);
|
||||
effects.setEnabled(true, LayerEffectKind::shadow);
|
||||
QVERIFY(effects.stroke->enabled == true && effects.innerShadow->enabled == false && !effects.shadow);
|
||||
QVERIFY(effects.stroke.value().enabled == true && effects.innerShadow.value().enabled == false && !effects.shadow);
|
||||
// Visible keeps what is switched on.
|
||||
const LayerEffects shown = effects.visible();
|
||||
QVERIFY(shown.stroke == effects.stroke && !shown.innerShadow && !shown.shadow && !shown.colorOverlay);
|
||||
|
||||
@@ -351,8 +351,8 @@ void LayerMaskTests::maskTransformPrefersThePlacement()
|
||||
QCOMPARE(layer.maskTransform(), layer.transform);
|
||||
layer.mask = wideMask();
|
||||
QCOMPARE(layer.maskTransform(), layer.transform);
|
||||
layer.mask->placement = LayerTransform{.origin = {5, 6}, .size = {7, 8}};
|
||||
QCOMPARE(layer.maskTransform(), *layer.mask->placement);
|
||||
layer.mask.value().placement = LayerTransform{.origin = {5, 6}, .size = {7, 8}};
|
||||
QCOMPARE(layer.maskTransform(), layer.mask.value().placement.value());
|
||||
}
|
||||
|
||||
void LayerMaskTests::layersCompareAndRecordTheirMasks()
|
||||
@@ -370,7 +370,7 @@ void LayerMaskTests::layersCompareAndRecordTheirMasks()
|
||||
QVERIFY(!(masked == layer));
|
||||
QCOMPARE(masked, ImageLayer(masked));
|
||||
ImageLayer disabled = masked;
|
||||
disabled.mask->isEnabled = false;
|
||||
disabled.mask.value().isEnabled = false;
|
||||
QVERIFY(!(disabled == masked));
|
||||
const ProjectLayerRecord hidden = disabled.hierarchyRecord();
|
||||
QCOMPARE(hidden.maskEnabled, std::optional<bool>(false));
|
||||
@@ -382,12 +382,12 @@ void LayerMaskTests::layersCompareAndRecordTheirMasks()
|
||||
QCOMPARE(record.maskPlacement, std::nullopt);
|
||||
QCOMPARE(record.maskLinked, std::optional<bool>(true));
|
||||
ImageLayer unlinked = masked;
|
||||
unlinked.mask->isLinked = false;
|
||||
unlinked.mask->placement = LayerTransform{.origin = {5, 6}, .size = {7, 8}};
|
||||
unlinked.mask.value().isLinked = false;
|
||||
unlinked.mask.value().placement = LayerTransform{.origin = {5, 6}, .size = {7, 8}};
|
||||
const ProjectLayerRecord moved = unlinked.hierarchyRecord();
|
||||
QCOMPARE(moved.maskEnabled, std::optional<bool>(true));
|
||||
QCOMPARE(moved.maskLinked, std::optional<bool>(false));
|
||||
QCOMPARE(moved.maskPlacement, unlinked.mask->placement);
|
||||
QCOMPARE(moved.maskPlacement, unlinked.mask.value().placement);
|
||||
}
|
||||
|
||||
void LayerMaskTests::historyCountsMaskPixels()
|
||||
@@ -395,18 +395,18 @@ void LayerMaskTests::historyCountsMaskPixels()
|
||||
DocumentHistory history;
|
||||
std::optional<CanvasDocument> document = CanvasDocument(40, 20);
|
||||
const ImportedImage pixels(BrushRaster::context(40, 20, false), QImage(), "Photo");
|
||||
document->layers.push_back(ImageLayer(pixels, QPointF(0, 0)));
|
||||
document->layers[0].mask = LayerMask(LayerMask::assetFrom(gray(200, 100, 255)));
|
||||
const qint64 maskBytes = document->layers[0].mask->asset.byteCount()
|
||||
+ document->layers[0].mask->asset.thumbnail.sizeInBytes();
|
||||
document.value().layers.push_back(ImageLayer(pixels, QPointF(0, 0)));
|
||||
document.value().layers[0].mask = LayerMask(LayerMask::assetFrom(gray(200, 100, 255)));
|
||||
const qint64 maskBytes = document.value().layers[0].mask.value().asset.byteCount()
|
||||
+ document.value().layers[0].mask.value().asset.thumbnail.sizeInBytes();
|
||||
QCOMPARE(maskBytes, qint64(200 * 100 + 96 * 48));
|
||||
history.begin("Disable Layer Mask", document, std::nullopt);
|
||||
document->layers[0].mask->isEnabled = false;
|
||||
document.value().layers[0].mask.value().isEnabled = false;
|
||||
history.end(document, std::nullopt);
|
||||
QCOMPARE(history.undoCount(), 1);
|
||||
QCOMPARE(history.retainedBytes(document), 0);
|
||||
history.begin("Delete Layer Mask", document, std::nullopt);
|
||||
document->layers[0].mask.reset();
|
||||
document.value().layers[0].mask.reset();
|
||||
history.end(document, std::nullopt);
|
||||
QCOMPARE(history.retainedBytes(document), maskBytes);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ void LayerTests::importedLayerTakesItsSizeAndNameFromTheAsset()
|
||||
QCOMPARE(layer.name, QString("Photo"));
|
||||
QCOMPARE(layer.origin(), QPointF(40, -10));
|
||||
QCOMPARE(layer.size(), QSizeF(320, 200));
|
||||
QCOMPARE(layer.asset->image().size(), QSize(320, 200));
|
||||
QCOMPARE(layer.asset.value().image().size(), QSize(320, 200));
|
||||
QVERIFY(layer.isVisible);
|
||||
QCOMPARE(layer.opacity, 1.0);
|
||||
QCOMPARE(layer.blendMode, LayerBlendMode::normal);
|
||||
|
||||
@@ -326,7 +326,7 @@ void MaskAloneTests::aPendingGradientElsewhereStaysOutOfTheView()
|
||||
session.selectLayerTarget(shown.id, false);
|
||||
session.beginGradient(QPointF(0, 80));
|
||||
session.moveGradient(std::nullopt, QPointF(200, 80));
|
||||
QVERIFY(session.gradientEdit().has_value() && !session.gradientEdit()->raster->isMask);
|
||||
QVERIFY(session.gradientEdit().has_value() && !session.gradientEdit().value().raster->isMask);
|
||||
session.toggleMaskAlone(shown.id);
|
||||
// The commit is posted: the pixels' raster lingers, unshown.
|
||||
QVERIFY(session.maskAloneLayer().has_value() && session.gradientEdit().has_value());
|
||||
@@ -338,7 +338,7 @@ void MaskAloneTests::aPendingGradientElsewhereStaysOutOfTheView()
|
||||
session.addLayerMask();
|
||||
session.beginGradient(QPointF(0, 80));
|
||||
session.moveGradient(std::nullopt, QPointF(200, 80));
|
||||
QVERIFY(session.gradientEdit().has_value() && session.gradientEdit()->raster->isMask && session.gradientEdit()->raster->layer.id == other);
|
||||
QVERIFY(session.gradientEdit().has_value() && session.gradientEdit().value().raster->isMask && session.gradientEdit().value().raster->layer.id == other);
|
||||
session.toggleMaskAlone(shown.id);
|
||||
QCOMPARE(session.maskAloneLayer().value().id, shown.id);
|
||||
QVERIFY(session.gradientEdit().has_value());
|
||||
|
||||
@@ -8,6 +8,7 @@ class MoveBarPressTests : public QObject {
|
||||
private slots:
|
||||
void aTypedValueThenAPressDragsTheActiveLayer();
|
||||
void ctrlKeepsAFolderAsAutoSelectPicksElsewhere();
|
||||
void aValueLeftByMouseForAnotherFieldApplies();
|
||||
};
|
||||
|
||||
// Swift picks before focus moves: the active layer drags.
|
||||
@@ -69,5 +70,33 @@ void MoveBarPressTests::ctrlKeepsAFolderAsAutoSelectPicksElsewhere()
|
||||
QCOMPARE(session.activeLayerID(), std::optional(blue));
|
||||
}
|
||||
|
||||
// No canvas press: the deferred finish alone applies the value.
|
||||
void MoveBarPressTests::aValueLeftByMouseForAnotherFieldApplies()
|
||||
{
|
||||
Canvas shown;
|
||||
EditorSession &session = shown.session;
|
||||
// Wide enough that Y shows beside X.
|
||||
shown.window.resize(1000, 350);
|
||||
TransformInspector bar(session, &shown.window);
|
||||
bar.setGeometry(0, 300, 1000, 42);
|
||||
bar.show();
|
||||
QLineEdit *x = bar.findChild<QLineEdit *>(QStringLiteral("transformX"));
|
||||
QLineEdit *y = bar.findChild<QLineEdit *>(QStringLiteral("transformY"));
|
||||
QVERIFY(x && y);
|
||||
x->setFocus();
|
||||
QTRY_VERIFY(x->hasFocus());
|
||||
x->selectAll();
|
||||
QTest::keyClicks(x, "12");
|
||||
QVERIFY(session.transformEdit().value().fromFields);
|
||||
const int steps = session.history.undoCount();
|
||||
QWindow *window = shown.window.windowHandle();
|
||||
const QPoint inY = y->mapTo(&shown.window, y->rect().center());
|
||||
QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, inY);
|
||||
QTRY_VERIFY(y->hasFocus());
|
||||
QTRY_VERIFY(!session.transformEdit().has_value());
|
||||
QCOMPARE(shown.origin(), QPointF(12, 100));
|
||||
QCOMPARE(session.history.undoCount(), steps + 1);
|
||||
}
|
||||
|
||||
QTEST_MAIN(MoveBarPressTests)
|
||||
#include "MoveBarPressTests.moc"
|
||||
@@ -284,6 +284,11 @@ void NativeResolutionPaintTests::layersPanelSaysHowFarALayerIsScaled()
|
||||
QCOMPARE(sizeLabel(layer), QString("500 × 300 px · 50%"));
|
||||
layer.transform.size = QSizeF(2333, 2000);
|
||||
QCOMPARE(sizeLabel(layer), QString("2333 × 2000 px · 233.3%"));
|
||||
// Exact ties go to the even tenth.
|
||||
layer.transform.size = QSizeF(1062.5, 300);
|
||||
QCOMPARE(sizeLabel(layer), QString("1063 × 300 px · 106.2%"));
|
||||
layer.transform.size = QSizeF(1187.5, 300);
|
||||
QCOMPARE(sizeLabel(layer), QString("1188 × 300 px · 118.8%"));
|
||||
// A blank layer has no pixels to measure against.
|
||||
QCOMPARE(sizeLabel(ImageLayer(QStringLiteral("Blank"), QSizeF(30, 20))), QString("30 × 20 px"));
|
||||
// The row shows it.
|
||||
|
||||
@@ -80,7 +80,7 @@ void OuterGlowTests::outerGlowCodableRoundTrip()
|
||||
QCOMPARE(ManifestJson::effects(encoded), original);
|
||||
// Absent `enabled` stays absent, read as shown.
|
||||
LayerEffects shown = original;
|
||||
shown.outerGlow->enabled = std::nullopt;
|
||||
shown.outerGlow.value().enabled = std::nullopt;
|
||||
QVERIFY(!ManifestJson::encoded(shown).value("outerGlow").toObject().contains("enabled"));
|
||||
QCOMPARE(ManifestJson::effects(ManifestJson::encoded(shown)), shown);
|
||||
// A key of the wrong type, or missing, refuses it.
|
||||
@@ -104,7 +104,7 @@ void OuterGlowTests::layerEffectsIntegration()
|
||||
QVERIFY(effects.color(LayerEffectKind::outerGlow) == (PaletteColor{1, 0, 0}));
|
||||
QVERIFY((effects.kinds() == std::vector{LayerEffectKind::outerGlow}));
|
||||
effects.setColor(PaletteColor{0, 1, 0}, LayerEffectKind::outerGlow);
|
||||
QVERIFY(effects.outerGlow->green == 1 && effects.outerGlow->red == 0);
|
||||
QVERIFY(effects.outerGlow.value().green == 1 && effects.outerGlow.value().red == 0);
|
||||
effects.setEnabled(false, LayerEffectKind::outerGlow);
|
||||
QVERIFY(!effects.isEnabled(LayerEffectKind::outerGlow) && !effects.visible().outerGlow);
|
||||
effects.remove(LayerEffectKind::outerGlow);
|
||||
@@ -202,7 +202,7 @@ void OuterGlowTests::theGlowWidensTheMargin()
|
||||
{
|
||||
LayerEffects effects = glowing(7.2, 1, 1, 1, 1);
|
||||
QCOMPARE(LayerEffectsRenderer::margin(effects), 24.0);
|
||||
effects.outerGlow->enabled = false;
|
||||
effects.outerGlow.value().enabled = false;
|
||||
QCOMPARE(LayerEffectsRenderer::margin(effects), 2.0);
|
||||
}
|
||||
|
||||
@@ -215,11 +215,11 @@ void OuterGlowTests::theSessionAddsCopiesAndCancelsIt()
|
||||
session.addEffect(LayerEffectKind::outerGlow);
|
||||
QCOMPARE(session.history.undoName(), QString("Add Outer Glow"));
|
||||
QVERIFY(session.activeEffects().outerGlow == OuterGlowEffect());
|
||||
session.changeEffects([](LayerEffects &effects) { effects.outerGlow->size = 44; });
|
||||
session.changeEffects([](LayerEffects &effects) { effects.outerGlow.value().size = 44; });
|
||||
session.finishEffectsEditing(false);
|
||||
QVERIFY(!session.activeEffects().outerGlow);
|
||||
session.addEffect(LayerEffectKind::outerGlow);
|
||||
session.changeEffects([](LayerEffects &effects) { effects.outerGlow->size = 44; });
|
||||
session.changeEffects([](LayerEffects &effects) { effects.outerGlow.value().size = 44; });
|
||||
session.finishEffectsEditing(true);
|
||||
session.insert(ImportedImage(square(), QImage(), QStringLiteral("Two")));
|
||||
const QUuid second = session.activeLayerID().value();
|
||||
|
||||
@@ -149,7 +149,7 @@ inline QByteArray engine(const TypeBlock &block)
|
||||
return "<<\n/EngineDict\n<<\n/Editor\n<<\n/Text " + parenthesized(block.engineText.value_or(block.text)) + "\n>>\n/ParagraphRun\n<<\n/RunArray\n[\n<<\n"
|
||||
+ "/ParagraphSheet\n<<\n/Properties\n<<\n/Justification " + block.justification + "\n>>\n>>\n>>\n]\n>>\n"
|
||||
+ "/StyleRun\n<<\n/RunArray\n[\n" + runs + "\n]\n>>\n>>\n/ResourceDict\n<<\n/FontSet\n[\n<<\n/Name " + parenthesized(block.font)
|
||||
+ "\n>>\n" + (block.secondFont ? "<<\n/Name " + parenthesized(*block.secondFont) + "\n>>\n" : QByteArray()) + "]\n>>\n>>";
|
||||
+ "\n>>\n" + (block.secondFont ? "<<\n/Name " + parenthesized(block.secondFont.value()) + "\n>>\n" : QByteArray()) + "]\n>>\n>>";
|
||||
}
|
||||
|
||||
inline QByteArray tySh(const TypeBlock &block)
|
||||
@@ -164,9 +164,9 @@ inline QByteArray tySh(const TypeBlock &block)
|
||||
items.emplace_back(block.wordsKey, textItem(block.text));
|
||||
items.emplace_back("Ornt", enumItem("Ornt", block.vertical ? "Vrtc" : "Hrzn"));
|
||||
if (block.bounds)
|
||||
items.emplace_back("bounds", rectItem(*block.bounds));
|
||||
items.emplace_back("bounds", rectItem(block.bounds.value()));
|
||||
if (block.glyphBounds)
|
||||
items.emplace_back("boundingBox", rectItem(*block.glyphBounds));
|
||||
items.emplace_back("boundingBox", rectItem(block.glyphBounds.value()));
|
||||
if (block.withEngine)
|
||||
items.emplace_back("EngineData", rawItem(engine(block)));
|
||||
descriptor(data, "TxLr", items);
|
||||
|
||||
@@ -128,27 +128,27 @@ inline std::vector<Channel> emptyChannels()
|
||||
|
||||
inline Prepared layer(const PSDRecord &record, bool large = false)
|
||||
{
|
||||
const int width = record.image ? record.image->width() : 0, height = record.image ? record.image->height() : 0;
|
||||
const int width = record.image ? record.image.value().width() : 0, height = record.image ? record.image.value().height() : 0;
|
||||
const int left = int(std::round(record.bounds.left())), top = int(std::round(record.bounds.top()));
|
||||
Prepared prepared;
|
||||
prepared.record = record;
|
||||
if (record.image && width > 0 && height > 0) {
|
||||
const Planes split = planes(*record.image);
|
||||
const Planes split = planes(record.image.value());
|
||||
for (const auto &[id, plane] : {std::pair<qint16, const std::vector<uchar> &>(-1, split.alpha), {0, split.red}, {1, split.green}, {2, split.blue}})
|
||||
prepared.channels.push_back({id, channelPayload(plane, width, height, large)});
|
||||
} else {
|
||||
prepared.channels = emptyChannels();
|
||||
}
|
||||
if (record.mask)
|
||||
prepared.channels.push_back({-2, channelPayload(grayPlane(*record.mask), record.mask->width(), record.mask->height(), large)});
|
||||
prepared.channels.push_back({-2, channelPayload(grayPlane(record.mask.value()), record.mask.value().width(), record.mask.value().height(), large)});
|
||||
prepared.top = top;
|
||||
prepared.left = left;
|
||||
prepared.bottom = top + height;
|
||||
prepared.right = left + width;
|
||||
prepared.maskTop = top;
|
||||
prepared.maskLeft = left;
|
||||
prepared.maskBottom = top + (record.mask ? record.mask->height() : 0);
|
||||
prepared.maskRight = left + (record.mask ? record.mask->width() : 0);
|
||||
prepared.maskBottom = top + (record.mask ? record.mask.value().height() : 0);
|
||||
prepared.maskRight = left + (record.mask ? record.mask.value().width() : 0);
|
||||
return prepared;
|
||||
}
|
||||
|
||||
@@ -170,9 +170,9 @@ inline Prepared emptyLayer(const QString &name, const QString &blendKey, int sec
|
||||
prepared.isDivider = section == 3;
|
||||
prepared.channels = emptyChannels();
|
||||
if (record.mask) {
|
||||
prepared.channels.push_back({-2, channelPayload(grayPlane(*record.mask), record.mask->width(), record.mask->height(), large)});
|
||||
prepared.maskBottom = record.mask->height();
|
||||
prepared.maskRight = record.mask->width();
|
||||
prepared.channels.push_back({-2, channelPayload(grayPlane(record.mask.value()), record.mask.value().width(), record.mask.value().height(), large)});
|
||||
prepared.maskBottom = record.mask.value().height();
|
||||
prepared.maskRight = record.mask.value().width();
|
||||
}
|
||||
return prepared;
|
||||
}
|
||||
|
||||
@@ -78,10 +78,10 @@ inline QByteArray file(const std::vector<Record> &records, const QByteArray &res
|
||||
PSDFixture::Buffer extra;
|
||||
if (record.mask) {
|
||||
extra.u32(20);
|
||||
extra.i32(record.mask->top());
|
||||
extra.i32(record.mask->left());
|
||||
extra.i32(record.mask->top() + record.mask->height());
|
||||
extra.i32(record.mask->left() + record.mask->width());
|
||||
extra.i32(record.mask.value().top());
|
||||
extra.i32(record.mask.value().left());
|
||||
extra.i32(record.mask.value().top() + record.mask.value().height());
|
||||
extra.i32(record.mask.value().left() + record.mask.value().width());
|
||||
extra.u8(record.maskDefault);
|
||||
extra.u8(record.maskFlags);
|
||||
extra.u16(0);
|
||||
|
||||
@@ -71,6 +71,7 @@ private slots:
|
||||
void aBusyProjectHoldsTheOrder();
|
||||
void aTabClosedMidDragEndsIt();
|
||||
void aLostReleaseGivesWayToTheNextDrag();
|
||||
void anotherTabPressedBeforeTheWatchMovesNothing();
|
||||
void tabsThatDoNotFitGatherInAMenu();
|
||||
void theMenuSwitchesAndPinsTheChosenTab();
|
||||
void aBusyProjectOpensNoMenu();
|
||||
@@ -238,6 +239,30 @@ void ProjectTabDragTests::aLostReleaseGivesWayToTheNextDrag()
|
||||
QCOMPARE(titles(fixture.workspace), (QStringList{"Untitled 3", "Untitled", "Untitled 2"}));
|
||||
}
|
||||
|
||||
void ProjectTabDragTests::anotherTabPressedBeforeTheWatchMovesNothing()
|
||||
{
|
||||
Strip fixture;
|
||||
const QPoint first = fixture.press("Untitled");
|
||||
fixture.move(first + QPoint(5000, 0));
|
||||
const int held = button(fixture.strip, "Untitled").x();
|
||||
QVERIFY(held > 100);
|
||||
QDialog alert;
|
||||
alert.setModal(true);
|
||||
alert.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&alert));
|
||||
fixture.release("Untitled", first + QPoint(5000, 0));
|
||||
alert.close();
|
||||
// Pressed before the watch looks: the first drag holds.
|
||||
const QPoint next = fixture.press("Untitled 2");
|
||||
fixture.move(next - QPoint(5000, 0));
|
||||
QCOMPARE(button(fixture.strip, "Untitled").x(), held);
|
||||
// Its release ends the first drag, which moved nothing.
|
||||
fixture.release("Untitled 2", next - QPoint(5000, 0));
|
||||
QTRY_VERIFY(settled(fixture.strip));
|
||||
QCOMPARE(button(fixture.strip, "Untitled").x(), 0);
|
||||
QCOMPARE(titles(fixture.workspace), (QStringList{"Untitled", "Untitled 2", "Untitled 3"}));
|
||||
}
|
||||
|
||||
void ProjectTabDragTests::tabsThatDoNotFitGatherInAMenu()
|
||||
{
|
||||
Strip fixture(12, 400);
|
||||
|
||||
@@ -437,15 +437,15 @@ void RasterSnapshotTests::historyBudgetNeverFlattensPaintedTiles()
|
||||
const auto raster = std::make_shared<const RasterSnapshot>(40, 30, QImage(), QRectF(), std::vector<BrushPatch>());
|
||||
DocumentHistory history;
|
||||
std::optional<CanvasDocument> document = CanvasDocument(40, 30);
|
||||
document->layers.push_back(ImageLayer(painted(raster), QPointF(0, 0)));
|
||||
QVERIFY(document->layers[0] == ImageLayer(document->layers[0]));
|
||||
document.value().layers.push_back(ImageLayer(painted(raster), QPointF(0, 0)));
|
||||
QVERIFY(document.value().layers[0] == ImageLayer(document.value().layers[0]));
|
||||
history.begin("Select Layer", document, std::nullopt);
|
||||
history.end(document, document->layers[0].id);
|
||||
history.end(document, document.value().layers[0].id);
|
||||
QCOMPARE(history.undoCount(), 0);
|
||||
QVERIFY(!raster->hasMaterializedPixels());
|
||||
history.begin("Delete Layer", document, std::nullopt);
|
||||
const qint64 thumbnailBytes = document->layers[0].asset->thumbnail.sizeInBytes();
|
||||
document->layers.clear();
|
||||
const qint64 thumbnailBytes = document.value().layers[0].asset.value().thumbnail.sizeInBytes();
|
||||
document.value().layers.clear();
|
||||
history.end(document, std::nullopt);
|
||||
QCOMPARE(history.retainedBytes(document), qint64(40 * 30 * 4) + thumbnailBytes);
|
||||
QVERIFY(!raster->hasMaterializedPixels());
|
||||
|
||||
@@ -72,10 +72,10 @@ void RawDevelopTests::theSheetsSettingsDevelopTheLayer()
|
||||
bool done = false;
|
||||
session.importImages({raw, png(folder)}, std::nullopt, [&done] { done = true; });
|
||||
QTRY_VERIFY(session.rawDevelop());
|
||||
QCOMPARE(session.rawDevelop()->path, raw.toLocalFile());
|
||||
QVERIFY(session.rawDevelop()->settings == RawImporter::asShot(raw.toLocalFile()).value());
|
||||
QCOMPARE(session.rawDevelop().value().path, raw.toLocalFile());
|
||||
QVERIFY(session.rawDevelop().value().settings == RawImporter::asShot(raw.toLocalFile()).value());
|
||||
QVERIFY(session.isImporting() && !session.document());
|
||||
RawDevelopSettings settings = session.rawDevelop()->settings;
|
||||
RawDevelopSettings settings = session.rawDevelop().value().settings;
|
||||
settings.boost = 0;
|
||||
settings.exposure = 1;
|
||||
// The sheet hears at once that it has gone.
|
||||
@@ -139,7 +139,7 @@ void RawDevelopTests::whatCannotBeDevelopedIsReported()
|
||||
QFile broken(gray.toLocalFile());
|
||||
QVERIFY(broken.open(QIODevice::WriteOnly) && broken.write("gone") == 4);
|
||||
broken.close();
|
||||
session.finishRawDevelop(session.rawDevelop()->settings);
|
||||
session.finishRawDevelop(session.rawDevelop().value().settings);
|
||||
QTRY_VERIFY(done);
|
||||
QCOMPARE(session.importError().value(), "Gray.dng: " + unreadable);
|
||||
QCOMPARE(names(session), QStringList{"Plain"});
|
||||
@@ -149,7 +149,7 @@ void RawDevelopTests::whatCannotBeDevelopedIsReported()
|
||||
const QUrl warm = dng(folder, "Warm.dng");
|
||||
session.importImages({warm}, std::nullopt, [&done] { done = true; });
|
||||
QTRY_VERIFY(session.rawDevelop());
|
||||
RawDevelopSettings candle = session.rawDevelop()->settings;
|
||||
RawDevelopSettings candle = session.rawDevelop().value().settings;
|
||||
candle.temperature = 2000;
|
||||
session.finishRawDevelop(candle);
|
||||
QTRY_VERIFY(done);
|
||||
@@ -240,7 +240,7 @@ void RawDevelopTests::theSheetPreviewsAndAnswers()
|
||||
QTest::qWait(50);
|
||||
QCOMPARE(preview->grab().toImage().pixelColor(200, 170), QColor(139, 139, 139));
|
||||
QVERIFY(!spinner->isHidden());
|
||||
RawDevelopSettings dimmer = session.rawDevelop()->settings;
|
||||
RawDevelopSettings dimmer = session.rawDevelop().value().settings;
|
||||
dimmer.exposure = -1;
|
||||
wait->start();
|
||||
QTRY_COMPARE_WITH_TIMEOUT(preview->grab().toImage().pixelColor(200, 170), centre(RawImporter::develop(path, dimmer)), 1000);
|
||||
@@ -249,7 +249,7 @@ void RawDevelopTests::theSheetPreviewsAndAnswers()
|
||||
exposure->setValue(100);
|
||||
QCOMPARE(label(sheet, "rawExposureValue"), QString("1.00 EV"));
|
||||
QVERIFY(reset->isEnabled());
|
||||
RawDevelopSettings brighter = session.rawDevelop()->settings;
|
||||
RawDevelopSettings brighter = session.rawDevelop().value().settings;
|
||||
brighter.exposure = 1;
|
||||
const QColor expected = centre(RawImporter::develop(path, brighter));
|
||||
QTRY_COMPARE(preview->grab().toImage().pixelColor(200, 170), expected);
|
||||
|
||||
@@ -75,12 +75,12 @@ void RemoveBackgroundTests::thePreviewClearsTheBackgroundAndTheCommitMasksIt()
|
||||
const FilterEdit &edit = session->filterEdit().value();
|
||||
QVERIFY(edit.previewSource.size() == QSize(400, 300) && !edit.previewError);
|
||||
const QImage preview = edit.previewImage(id).value();
|
||||
QVERIFY(preview.pixelColor(0, 0).alpha() == 0 && preview.pixelColor(200, 150) == before.asset->image().pixelColor(200, 150));
|
||||
QVERIFY(preview.pixelColor(0, 0).alpha() == 0 && preview.pixelColor(200, 150) == before.asset.value().image().pixelColor(200, 150));
|
||||
const int steps = session->history.undoCount();
|
||||
QVERIFY(committed(*session));
|
||||
// The pixels stay; a mask hides the background instead.
|
||||
const ImageLayer after = layerWith(*session, id);
|
||||
QVERIFY(after.asset->identity() == before.asset->identity() && after.transform == before.transform);
|
||||
QVERIFY(after.asset.value().identity() == before.asset.value().identity() && after.transform == before.transform);
|
||||
const LayerMask &mask = after.mask.value();
|
||||
QVERIFY(mask.isEnabled && !mask.placement && mask.isLinked);
|
||||
QVERIFY(mask.asset.image().format() == QImage::Format_Grayscale8 && mask.asset.size() == QSize(400, 300));
|
||||
|
||||
@@ -176,7 +176,7 @@ void SelectionFeatherTests::aMaskFromAFeatheredSelectionFades()
|
||||
EditorSession session;
|
||||
session.createDocument(60, 20, true);
|
||||
session.setSelection(DocumentSelection{rectPath(QRectF(20, 0, 20, 20)), true, 6}, "probe");
|
||||
session.addMask(false);
|
||||
session.addMask(true);
|
||||
const QImage mask = session.activeLayer().value().mask.value().asset.image();
|
||||
QCOMPARE(mask, session.document().value().layers.back().mask.value().asset.image());
|
||||
QVERIFY2(fading(mask, 10, 0, 1) >= 4, "the mask has a hard edge");
|
||||
|
||||
@@ -53,7 +53,11 @@ void SelectionSignalTests::selectionCallsAnnounceAndRefuseInSilence()
|
||||
QVERIFY(session->selection().has_value());
|
||||
QVERIFY(announced([&] { session->selectAll(); }));
|
||||
QVERIFY(!announced([&] { session->selectAll(); }));
|
||||
// Inverse of everything leaves nothing to deselect.
|
||||
QVERIFY(announced([&] { session->invertSelection(); }));
|
||||
QVERIFY(!session->selection().has_value());
|
||||
QVERIFY(!announced([&] { session->deselect(); }));
|
||||
QVERIFY(announced([&] { session->selectAll(); }));
|
||||
QVERIFY(announced([&] { session->deselect(); }));
|
||||
QVERIFY(announced([&] { session->toggleMarqueeKind(); }));
|
||||
QVERIFY(announced([&] { session->toggleLassoKind(); }));
|
||||
|
||||
@@ -27,10 +27,10 @@ inline QStringList described(const EditorSession &session)
|
||||
"tool error " + session.brushError().value_or(QStringLiteral("none")),
|
||||
"renaming " + text(session.renamingLayerID()),
|
||||
"adjusting " + text(session.adjustmentEditingID()) + (session.adjustmentOriginal().has_value() ? " open" : ""),
|
||||
"effects " + (session.effectsEditing() ? text(session.effectsEditing()->layerID) + " " + rawValue(session.effectsEditing()->kind) : QStringLiteral("closed"))
|
||||
+ (session.effectsEditingOriginal() ? " " + QJsonDocument(ManifestJson::encoded(*session.effectsEditingOriginal())).toJson(QJsonDocument::Compact) : QString())
|
||||
+ " chosen " + (session.effectSelection() ? text(session.effectSelection()->layerID) + " " + rawValue(session.effectSelection()->kind) : QStringLiteral("none")),
|
||||
"picker " + (session.colorPicker() ? session.colorPicker()->target.title() + " " + session.colorPicker()->color().hex() : QStringLiteral("closed")),
|
||||
"effects " + (session.effectsEditing() ? text(session.effectsEditing().value().layerID) + " " + rawValue(session.effectsEditing().value().kind) : QStringLiteral("closed"))
|
||||
+ (session.effectsEditingOriginal() ? " " + QJsonDocument(ManifestJson::encoded(session.effectsEditingOriginal().value())).toJson(QJsonDocument::Compact) : QString())
|
||||
+ " chosen " + (session.effectSelection() ? text(session.effectSelection().value().layerID) + " " + rawValue(session.effectSelection().value().kind) : QStringLiteral("none")),
|
||||
"picker " + (session.colorPicker() ? session.colorPicker().value().target.title() + " " + session.colorPicker().value().color().hex() : QStringLiteral("closed")),
|
||||
QStringLiteral("mask target %1").arg(int(session.isMaskSelected())),
|
||||
QStringLiteral("history %1%2").arg(int(session.canUndo())).arg(int(session.canRedo())),
|
||||
QStringLiteral("names %1/%2").arg(session.history.undoName(), session.history.redoName()),
|
||||
|
||||
@@ -320,7 +320,7 @@ void ShapeLayerTests::aProjectKeepsLiveShapesOnly()
|
||||
// Swift's keys; a rectangle writes no line fields.
|
||||
QCOMPARE(firstShape(snapshot, 1).keys(), (QStringList{"blue", "cornerRadius", "green", "kind", "red"}));
|
||||
QCOMPARE(firstShape(snapshot, 1).value("kind").toString(), QString("Rectangle"));
|
||||
QCOMPARE(firstShape(snapshot, 2).value("start").toArray(), (QJsonArray{line.start->x(), line.start->y()}));
|
||||
QCOMPARE(firstShape(snapshot, 2).value("start").toArray(), (QJsonArray{line.start.value().x(), line.start.value().y()}));
|
||||
QCOMPARE(firstShape(snapshot, 2).value("lineWidth").toDouble(), 3.0);
|
||||
const ProjectManifest decoded = ProjectManifest::decoded(snapshot.manifest.encoded());
|
||||
QCOMPARE(decoded.layers[1].shape, snapshot.manifest.layers[1].shape);
|
||||
|
||||
@@ -126,7 +126,7 @@ struct Oracle {
|
||||
pickUp(point);
|
||||
return;
|
||||
}
|
||||
const QPointF from = *last;
|
||||
const QPointF from = last.value();
|
||||
const double distance = std::hypot(point.x() - from.x(), point.y() - from.y());
|
||||
const double spacing = std::max(1.0, diameter * (smudging ? 0.005 : 0.025));
|
||||
if (distance < spacing)
|
||||
|
||||
@@ -42,6 +42,8 @@ compositor_test(CloneStampTests)
|
||||
compositor_test(CloneStampCanvasTests)
|
||||
compositor_test(SmudgeLiquifyTests)
|
||||
compositor_test(WarpStrokeTests)
|
||||
compositor_test(WarpFailureTests)
|
||||
compositor_test(CommitContinuationTests)
|
||||
compositor_test(LargeCanvasBrushTests)
|
||||
compositor_test(BlurBrushTests)
|
||||
compositor_test(BlurToolTests)
|
||||
@@ -201,6 +203,9 @@ compositor_test(DitherKernelTests)
|
||||
compositor_test(AcceptanceTests)
|
||||
compositor_test(AcceptanceColorTests)
|
||||
compositor_test(AcceptanceProjectTests)
|
||||
compositor_test(AcceptanceNewTests)
|
||||
compositor_test(AcceptanceEditTests)
|
||||
compositor_test(AcceptanceFinishTests)
|
||||
compositor_test(WindowTeardownTests)
|
||||
compositor_test(RecentProjectsCoreTests)
|
||||
compositor_test(ProjectWorkspaceSignalTests)
|
||||
|
||||
@@ -125,7 +125,7 @@ void TextColorModelTests::everyChannelOfARunIsChecked()
|
||||
session->setPaletteColor(red, false);
|
||||
QVERIFY(session->finishText());
|
||||
ProjectSnapshot snapshot = session->projectSnapshot().value();
|
||||
snapshot.manifest.layers.back().text->colorRuns->front().blue = 2;
|
||||
snapshot.manifest.layers.back().text.value().colorRuns.value().front().blue = 2;
|
||||
QTemporaryDir root;
|
||||
try {
|
||||
ProjectStore::save(snapshot, root.filePath(QStringLiteral("Bad.comp")));
|
||||
|
||||
@@ -35,6 +35,8 @@ private slots:
|
||||
void hoveringTriesAFaceAndClosingPutsItBack();
|
||||
void aChoiceKeepsWhatShows();
|
||||
void onlyOpenTextPreviews();
|
||||
void aClosedMenusHighlightTriesNothing();
|
||||
void escapePutsTheFaceBack();
|
||||
};
|
||||
|
||||
void TypeFontPreviewTests::theMenuDrawsEachFaceInItself()
|
||||
@@ -133,5 +135,37 @@ void TypeFontPreviewTests::onlyOpenTextPreviews()
|
||||
QCOMPARE(typed.session.activeLayer().value().liveText().value().style, kept);
|
||||
}
|
||||
|
||||
void TypeFontPreviewTests::aClosedMenusHighlightTriesNothing()
|
||||
{
|
||||
Typed typed;
|
||||
// Qt 6.10 signals as the menu follows the caret, closed.
|
||||
QSignalSpy changed(&typed.session, &EditorSession::changed);
|
||||
typed.hover(mono);
|
||||
QVERIFY(changed.isEmpty() && typed.face() == sans);
|
||||
// So a later close puts back nothing typed meanwhile.
|
||||
QTest::keyClick(typed.canvas, Qt::Key_End);
|
||||
QTest::keyClicks(typed.canvas, QStringLiteral("!"));
|
||||
typed.menu().showPopup();
|
||||
typed.menu().hidePopup();
|
||||
QCoreApplication::processEvents();
|
||||
QCOMPARE(typed.session.textDraft().value().style.content, QString("Hello!"));
|
||||
}
|
||||
|
||||
void TypeFontPreviewTests::escapePutsTheFaceBack()
|
||||
{
|
||||
Typed typed;
|
||||
typed.menu().showPopup();
|
||||
QTRY_VERIFY(typed.menu().view()->isVisible());
|
||||
typed.hover(mono);
|
||||
// The open popup's own events leave the preview showing.
|
||||
typed.menu().view()->window()->update();
|
||||
QTest::qWait(50);
|
||||
QCOMPARE(typed.face(), mono);
|
||||
// Qt 6.10 closes on Escape without calling hidePopup.
|
||||
QTest::keyClick(typed.menu().view(), Qt::Key_Escape);
|
||||
QVERIFY(!typed.menu().view()->isVisible());
|
||||
QTRY_COMPARE(typed.face(), sans);
|
||||
}
|
||||
|
||||
QTEST_MAIN(TypeFontPreviewTests)
|
||||
#include "TypeFontPreviewTests.moc"
|
||||
@@ -0,0 +1,90 @@
|
||||
#include "AddressSpaceLimit.h"
|
||||
#include "BrushFixtures.h"
|
||||
#include "Document/SmudgeLiquify.h"
|
||||
#include "IO/ImageExporter.h"
|
||||
#include <QtTest>
|
||||
#include <malloc.h>
|
||||
|
||||
// The Smear's buffers, starved of memory mid-stroke.
|
||||
namespace {
|
||||
WarpStroke warp(const QImage &image, BlurToolMode mode, const BrushSettings &settings)
|
||||
{
|
||||
const ImageLayer layer(ImportedImage(image, image, QStringLiteral("Picture")), QPointF(0, 0));
|
||||
return WarpStroke(layer, image, layer.transform, QSizeF(image.size()), mode, settings);
|
||||
}
|
||||
|
||||
QImage stripes(int side)
|
||||
{
|
||||
QImage image = BrushRaster::context(side, side, false);
|
||||
for (int x = 0; x < side; ++x)
|
||||
QPainter(&image).fillRect(x, 0, 1, side, x % 2 ? Qt::red : Qt::blue);
|
||||
return image;
|
||||
}
|
||||
}
|
||||
|
||||
class WarpFailureTests : public QObject {
|
||||
Q_OBJECT
|
||||
private slots:
|
||||
// Large asks map memory, so the address limit counts them.
|
||||
void initTestCase() { mallopt(M_MMAP_THRESHOLD, 64 * 1024); }
|
||||
void aLiquifyDabWithoutScratchIsSkipped();
|
||||
void smudgeWithoutRoomToCarryIsARenderError();
|
||||
void liquifyWithoutItsOffsetsIsARenderError();
|
||||
};
|
||||
|
||||
void WarpFailureTests::aLiquifyDabWithoutScratchIsSkipped()
|
||||
{
|
||||
const QImage image = stripes(2400);
|
||||
WarpStroke stroke = warp(image, BlurToolMode::liquify, brush(2000, 0.5, 0, 0, 0, 1));
|
||||
stroke.append(QPointF(1200, 1200));
|
||||
{
|
||||
// The dab's scratch, about 33 MB, cannot be had.
|
||||
const AddressSpaceLimit limit(8ll * 1024 * 1024);
|
||||
QTest::ignoreMessage(QtWarningMsg, QRegularExpression("a Liquify dab finds no memory"));
|
||||
stroke.append(QPointF(1250, 1200));
|
||||
}
|
||||
QCOMPARE(stroke.image(), image);
|
||||
// With memory back the next dab pushes.
|
||||
stroke.append(QPointF(1300, 1200));
|
||||
QVERIFY(stroke.image() != image);
|
||||
}
|
||||
|
||||
void WarpFailureTests::smudgeWithoutRoomToCarryIsARenderError()
|
||||
{
|
||||
const QImage image = stripes(2400);
|
||||
WarpStroke stroke = warp(image, BlurToolMode::smudge, brush(2000, 0.5, 0, 0, 0, 1));
|
||||
{
|
||||
// The carried colour, about 64 MB, cannot be had.
|
||||
const AddressSpaceLimit limit(8ll * 1024 * 1024);
|
||||
try {
|
||||
stroke.append(QPointF(1200, 1200));
|
||||
QFAIL("the carried colour was had");
|
||||
} catch (const ExportError &error) {
|
||||
QCOMPARE(error.kind, ExportError::Kind::render);
|
||||
}
|
||||
}
|
||||
QCOMPARE(stroke.image(), image);
|
||||
}
|
||||
|
||||
void WarpFailureTests::liquifyWithoutItsOffsetsIsARenderError()
|
||||
{
|
||||
// Room for two 36 MB copies, not the offsets.
|
||||
const QImage image = stripes(3000);
|
||||
{
|
||||
const AddressSpaceLimit limit(90ll * 1024 * 1024);
|
||||
try {
|
||||
warp(image, BlurToolMode::liquify, brush(100, 0.5, 0, 0, 0, 1));
|
||||
QFAIL("the offsets were had");
|
||||
} catch (const ExportError &error) {
|
||||
QCOMPARE(error.kind, ExportError::Kind::render);
|
||||
}
|
||||
}
|
||||
// Smudge needs neither.
|
||||
{
|
||||
const AddressSpaceLimit limit(52ll * 1024 * 1024);
|
||||
QCOMPARE(warp(image, BlurToolMode::smudge, brush(100, 0.5, 0, 0, 0, 1)).image(), image);
|
||||
}
|
||||
}
|
||||
|
||||
QTEST_GUILESS_MAIN(WarpFailureTests)
|
||||
#include "WarpFailureTests.moc"
|
||||
@@ -111,6 +111,18 @@ void WarpStrokeTests::aCommitKeepsATwentiethAndTheLastPoint()
|
||||
QCOMPARE(kept[6], stroke.points()[18]);
|
||||
// Two and a half from the previous, kept as last.
|
||||
QCOMPARE(kept.back(), QPointF(51, 10));
|
||||
// Exactly the spacing apart is kept: a 40 brush.
|
||||
WarpStroke even = warp(image, BlurToolMode::liquify, brush(40, 0.5, 0, 0, 0, 1));
|
||||
even.append(QPointF(0, 10));
|
||||
even.append(QPointF(10, 10));
|
||||
QCOMPARE(even.committedPoints(), (std::vector<QPointF>{{1, 10}, {3, 10}, {5, 10}, {7, 10}, {9, 10}, {10, 10}}));
|
||||
// A small brush still keeps points a pixel apart.
|
||||
WarpStroke small = warp(image, BlurToolMode::liquify, brush(10, 0.5, 0, 0, 0, 1));
|
||||
small.append(QPointF(0, 10));
|
||||
small.append(QPointF(1.5, 10));
|
||||
small.append(QPointF(3, 10));
|
||||
QCOMPARE(small.points().size(), size_t(4));
|
||||
QCOMPARE(small.committedPoints(), (std::vector<QPointF>{{0.75, 10}, {2.25, 10}, {3, 10}}));
|
||||
}
|
||||
|
||||
QTEST_GUILESS_MAIN(WarpStrokeTests)
|
||||
|
||||
@@ -220,7 +220,7 @@ void WritingProjectsGuideTests::hsvSettingsWinOverTheLegacyFields()
|
||||
QJsonObject adjustment = layer.value(QStringLiteral("adjustment")).toObject();
|
||||
adjustment.insert(QStringLiteral("hue"), legacyHue);
|
||||
if (masterHue) {
|
||||
const QJsonObject values{{"hue", *masterHue}, {"saturation", 0}, {"lightness", 0}};
|
||||
const QJsonObject values{{"hue", masterHue.value()}, {"saturation", 0}, {"lightness", 0}};
|
||||
adjustment.insert(QStringLiteral("hsvSettings"), QJsonObject{{"range", "Master"}, {"colorize", false}, {"invertRange", false},
|
||||
{"adjustments", QJsonArray{"Master", values}}, {"bands", QJsonArray{}}});
|
||||
}
|
||||
|
||||
@@ -59,6 +59,7 @@ OmaPhoto 1.4.5 catches up with Compositor 1.4.5. It follows 1.3.3.
|
||||
|
||||
- Quit works in the middle of a gradient or with a dialog open. Pending edits are applied or cancelled first.
|
||||
- Two crashes when a window closed are fixed.
|
||||
- On Arch, Fedora and Ubuntu 26.04, Escape in the blend mode menu no longer leaves the previewed mode showing.
|
||||
- On NVIDIA with Hyprland at a fractional scale, OmaPhoto's own cursors can show garbled. The README names the workaround: software cursors.
|
||||
|
||||
## Packages
|
||||
|
||||