mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-03 15:21:17 -05:00
Merge main into fix/census-behavior-tables
This commit is contained in:
@@ -26,7 +26,7 @@ jobs:
|
||||
uses: storytold/craft-common-actions/.github/workflows/gate.yml@main
|
||||
with:
|
||||
# Same craft-fonts commit as release.yml.
|
||||
craft-fonts-ref: b076417b5880bd4154bd22f00695b1d28c6bea83
|
||||
craft-fonts-ref: 16bbfc3d451fad51971ca3f2a28c1e69e279b67c
|
||||
# A cold `cache warm` leg (the nightly run, or any run after a toolchain or lockfile change)
|
||||
# took 90 minutes to reach its last three steps on 2026-11-27 and was canceled there; with
|
||||
# those steps and the save it needs about two hours.
|
||||
|
||||
@@ -29,7 +29,7 @@ jobs:
|
||||
uses: storytold/craft-common-actions/.github/workflows/freebsd.yml@main
|
||||
with:
|
||||
require-craft-fonts: true
|
||||
craft-fonts-ref: b076417b5880bd4154bd22f00695b1d28c6bea83
|
||||
craft-fonts-ref: 16bbfc3d451fad51971ca3f2a28c1e69e279b67c
|
||||
run-package-check: true
|
||||
# The test builds of this workspace's largest crates (engine, ui-egui) need more than the
|
||||
# VM's 12 GB when two compile at once: the build was killed (exit 137) every night with
|
||||
|
||||
@@ -47,7 +47,7 @@ jobs:
|
||||
- name: Check out craft-fonts
|
||||
uses: storytold/craft-common-actions/actions/checkout-craft-fonts@main
|
||||
with:
|
||||
ref: b076417b5880bd4154bd22f00695b1d28c6bea83
|
||||
ref: 16bbfc3d451fad51971ca3f2a28c1e69e279b67c
|
||||
- id: rust
|
||||
uses: storytold/craft-common-actions/actions/rust-channel@main
|
||||
with:
|
||||
|
||||
@@ -28,7 +28,7 @@ jobs:
|
||||
tooling-revision: main
|
||||
app-name: vectorcraft
|
||||
manual-actors: '["bflatastic","dylanmtaylor","echelon","FredApps","skylartaylor"]'
|
||||
craft-fonts-ref: b076417b5880bd4154bd22f00695b1d28c6bea83
|
||||
craft-fonts-ref: 16bbfc3d451fad51971ca3f2a28c1e69e279b67c
|
||||
# One producer run builds every listed platform for one all-or-nothing release. The pin is the
|
||||
# craft-common-actions main commit that merged the exact-analysis admission (#371, after #370,
|
||||
# #369 and #364).
|
||||
|
||||
@@ -44,7 +44,7 @@ jobs:
|
||||
app-title: VectorCraft
|
||||
macos-runner: macos-15
|
||||
macos-split-build: true
|
||||
craft-fonts-ref: b076417b5880bd4154bd22f00695b1d28c6bea83
|
||||
craft-fonts-ref: 16bbfc3d451fad51971ca3f2a28c1e69e279b67c
|
||||
web-craft-fonts: true
|
||||
version: ${{ inputs.version }}
|
||||
contributors-artifact: ${{ needs.credits.outputs.artifact-name }}
|
||||
|
||||
Generated
+97
-97
@@ -1231,7 +1231,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"craft-automation",
|
||||
"craft-behavior",
|
||||
@@ -1272,7 +1272,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-affinity"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"crc32fast",
|
||||
"flate2",
|
||||
@@ -1283,7 +1283,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-appkit"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"block2 0.6.2",
|
||||
"objc2 0.6.5",
|
||||
@@ -1295,7 +1295,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-atomic"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"rustix 1.1.6",
|
||||
]
|
||||
@@ -1303,7 +1303,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-automation"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"base64 0.23.1",
|
||||
"craft-behavior",
|
||||
@@ -1328,7 +1328,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-behavior"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"accesskit",
|
||||
"bitflags 2.13.2",
|
||||
@@ -1346,7 +1346,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-browse"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-docpath",
|
||||
@@ -1364,7 +1364,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-cdr"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"crc32fast",
|
||||
"flate2",
|
||||
@@ -1373,7 +1373,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-cloud-ui"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"egui",
|
||||
]
|
||||
@@ -1381,7 +1381,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-cms"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"md-5",
|
||||
"rayon",
|
||||
@@ -1390,12 +1390,12 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-codepage"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
|
||||
[[package]]
|
||||
name = "craft-color-ui"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-cms",
|
||||
@@ -1415,7 +1415,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-control"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"craft-control-protocol",
|
||||
"craft-platform",
|
||||
@@ -1426,7 +1426,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-control-protocol"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"getrandom 0.3.4",
|
||||
"serde_json",
|
||||
@@ -1436,7 +1436,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-dds"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"rayon",
|
||||
]
|
||||
@@ -1444,7 +1444,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-dialogs"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"block2 0.6.2",
|
||||
"craft-appkit",
|
||||
@@ -1470,7 +1470,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-doc"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"blake3",
|
||||
"craft-ecproj-format",
|
||||
@@ -1486,7 +1486,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-docpath"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
@@ -1494,7 +1494,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-draw"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-color-ui",
|
||||
@@ -1513,7 +1513,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-dxf"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"craft-codepage",
|
||||
"encoding_rs",
|
||||
@@ -1525,7 +1525,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-ecproj-format"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
@@ -1535,12 +1535,12 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-eps"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
|
||||
[[package]]
|
||||
name = "craft-font-catalog"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"fontique",
|
||||
"harfrust 0.13.3",
|
||||
@@ -1555,7 +1555,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-font-manager"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-font-catalog",
|
||||
@@ -1574,7 +1574,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-font-os-windows"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"windows-registry",
|
||||
"windows-sys 0.61.2",
|
||||
@@ -1583,7 +1583,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-font-store"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"cap-primitives",
|
||||
"craft-atomic",
|
||||
@@ -1606,12 +1606,12 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-fonts-build"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
|
||||
[[package]]
|
||||
name = "craft-gif"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"gif",
|
||||
]
|
||||
@@ -1619,7 +1619,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-gzip"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"flate2",
|
||||
]
|
||||
@@ -1627,7 +1627,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-host"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"bitflags 2.13.2",
|
||||
"craft-i18n",
|
||||
@@ -1640,7 +1640,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-i18n"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"brotli 9.1.3",
|
||||
"brotli-decompressor 6.3.2",
|
||||
@@ -1670,7 +1670,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-image-codecs"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"craft-dds",
|
||||
"craft-jpeg",
|
||||
@@ -1697,7 +1697,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-imaging"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-color-ui",
|
||||
@@ -1715,7 +1715,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-jpeg"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"thiserror 2.0.21",
|
||||
]
|
||||
@@ -1723,7 +1723,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-jxl"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"brotli-decompressor 5.0.3",
|
||||
"jixel",
|
||||
@@ -1734,7 +1734,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-keymap"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"craft-host",
|
||||
"craft-i18n",
|
||||
@@ -1749,7 +1749,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-layers"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-i18n",
|
||||
@@ -1763,7 +1763,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-menu"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-host",
|
||||
@@ -1781,7 +1781,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-metadata"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"brotli-decompressor 6.3.2",
|
||||
"chrono",
|
||||
@@ -1793,7 +1793,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-metafile"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"encoding_rs",
|
||||
"image",
|
||||
@@ -1804,7 +1804,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-mime"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"craft-codepage",
|
||||
@@ -1814,7 +1814,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-nightly"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"uds_windows",
|
||||
"winsafe",
|
||||
@@ -1823,7 +1823,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-pages"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-keymap",
|
||||
@@ -1839,7 +1839,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-pcraft-format"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"flate2",
|
||||
"serde",
|
||||
@@ -1850,7 +1850,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-pdf"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"hayro-interpret",
|
||||
"hayro-syntax",
|
||||
@@ -1862,7 +1862,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-platform"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"async-channel",
|
||||
"async-io",
|
||||
@@ -1895,7 +1895,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-plotter"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"kurbo 0.13.1",
|
||||
"thiserror 2.0.21",
|
||||
@@ -1904,7 +1904,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-print"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-host",
|
||||
@@ -1928,7 +1928,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-proof"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"log",
|
||||
"miniz_oxide 0.9.1",
|
||||
@@ -1939,7 +1939,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-ps"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"craft-eps",
|
||||
"flate2",
|
||||
@@ -1953,7 +1953,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-psd"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"encoding_rs",
|
||||
"flate2",
|
||||
@@ -1964,7 +1964,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-quit"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"dispatch2",
|
||||
"egui",
|
||||
@@ -1977,7 +1977,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-review"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"base64 0.23.1",
|
||||
"craft-behavior",
|
||||
@@ -1996,7 +1996,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-settings"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"craft-atomic",
|
||||
"craft-host",
|
||||
@@ -2013,7 +2013,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-stream-codecs"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"fax",
|
||||
"hayro-ccitt",
|
||||
@@ -2024,7 +2024,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-svg"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"craft-image-codecs",
|
||||
"craft-xml",
|
||||
@@ -2045,7 +2045,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-table"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-keymap",
|
||||
@@ -2057,7 +2057,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-text"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-font-manager",
|
||||
@@ -2082,7 +2082,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-theme"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"bitflags 2.13.2",
|
||||
"craft-tracked",
|
||||
@@ -2097,7 +2097,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-theme-store"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"craft-atomic",
|
||||
"craft-behavior",
|
||||
@@ -2112,7 +2112,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-tiff"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"thiserror 2.0.21",
|
||||
@@ -2122,7 +2122,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-time"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"thiserror 2.0.21",
|
||||
@@ -2131,7 +2131,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-timeline"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-keymap",
|
||||
@@ -2146,12 +2146,12 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-tracked"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
|
||||
[[package]]
|
||||
name = "craft-ui"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"craft-cloud-ui",
|
||||
"craft-ui-canvas",
|
||||
@@ -2165,7 +2165,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-ui-canvas"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-font-catalog",
|
||||
@@ -2182,7 +2182,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-ui-contract"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"accesskit",
|
||||
"craft-behavior",
|
||||
@@ -2220,7 +2220,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-ui-macros"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"proc-macro-crate",
|
||||
"proc-macro2",
|
||||
@@ -2231,7 +2231,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-ui-panels"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-host",
|
||||
@@ -2249,7 +2249,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-ui-patterns"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-host",
|
||||
@@ -2270,7 +2270,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-ui-shell"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-host",
|
||||
@@ -2291,7 +2291,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-ui-widgets"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-host",
|
||||
@@ -2310,7 +2310,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-update"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"chrono",
|
||||
@@ -2342,7 +2342,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-vectorcraft-format"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"flate2",
|
||||
"serde",
|
||||
@@ -2353,7 +2353,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-wayland"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"raw-window-handle",
|
||||
"wayland-backend",
|
||||
@@ -2363,7 +2363,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-web-api"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"serde_json",
|
||||
@@ -2374,7 +2374,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-win32"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"winsafe",
|
||||
]
|
||||
@@ -2382,7 +2382,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-window"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"craft-appkit",
|
||||
"craft-atomic",
|
||||
@@ -2414,7 +2414,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-xml"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"quick-xml 0.41.0",
|
||||
"serde",
|
||||
@@ -2759,7 +2759,7 @@ checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813"
|
||||
[[package]]
|
||||
name = "ecolor"
|
||||
version = "0.37.0"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=861d60a65c50850e995bbb3dcee7c1f3b06815f6#861d60a65c50850e995bbb3dcee7c1f3b06815f6"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"emath",
|
||||
@@ -2792,7 +2792,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "eframe"
|
||||
version = "0.37.0"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=861d60a65c50850e995bbb3dcee7c1f3b06815f6#861d60a65c50850e995bbb3dcee7c1f3b06815f6"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"bytemuck",
|
||||
@@ -2827,7 +2827,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "egui"
|
||||
version = "0.37.0"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=861d60a65c50850e995bbb3dcee7c1f3b06815f6#861d60a65c50850e995bbb3dcee7c1f3b06815f6"
|
||||
dependencies = [
|
||||
"accesskit",
|
||||
"ahash",
|
||||
@@ -2846,7 +2846,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "egui-wgpu"
|
||||
version = "0.37.0"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=861d60a65c50850e995bbb3dcee7c1f3b06815f6#861d60a65c50850e995bbb3dcee7c1f3b06815f6"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"bytemuck",
|
||||
@@ -2865,7 +2865,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "egui-winit"
|
||||
version = "0.37.0"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=861d60a65c50850e995bbb3dcee7c1f3b06815f6#861d60a65c50850e995bbb3dcee7c1f3b06815f6"
|
||||
dependencies = [
|
||||
"accesskit_winit",
|
||||
"arboard",
|
||||
@@ -2890,7 +2890,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "egui_extras"
|
||||
version = "0.37.0"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=861d60a65c50850e995bbb3dcee7c1f3b06815f6#861d60a65c50850e995bbb3dcee7c1f3b06815f6"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"egui",
|
||||
@@ -2904,7 +2904,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "egui_glow"
|
||||
version = "0.37.0"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=861d60a65c50850e995bbb3dcee7c1f3b06815f6#861d60a65c50850e995bbb3dcee7c1f3b06815f6"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"egui",
|
||||
@@ -2917,7 +2917,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "egui_kittest"
|
||||
version = "0.37.0"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=861d60a65c50850e995bbb3dcee7c1f3b06815f6#861d60a65c50850e995bbb3dcee7c1f3b06815f6"
|
||||
dependencies = [
|
||||
"dify",
|
||||
"eframe",
|
||||
@@ -2943,7 +2943,7 @@ checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be"
|
||||
[[package]]
|
||||
name = "emath"
|
||||
version = "0.37.0"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=861d60a65c50850e995bbb3dcee7c1f3b06815f6#861d60a65c50850e995bbb3dcee7c1f3b06815f6"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
]
|
||||
@@ -3024,7 +3024,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "epaint"
|
||||
version = "0.37.0"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=861d60a65c50850e995bbb3dcee7c1f3b06815f6#861d60a65c50850e995bbb3dcee7c1f3b06815f6"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"bytemuck",
|
||||
@@ -3050,7 +3050,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "epaint_default_fonts"
|
||||
version = "0.37.0"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321"
|
||||
source = "git+https://github.com/storytold/egui.git?rev=861d60a65c50850e995bbb3dcee7c1f3b06815f6#861d60a65c50850e995bbb3dcee7c1f3b06815f6"
|
||||
dependencies = [
|
||||
"brotli 9.1.3",
|
||||
"brotli-decompressor 6.3.2",
|
||||
@@ -3773,7 +3773,7 @@ checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a"
|
||||
[[package]]
|
||||
name = "hayro-cmap"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"brotli 8.0.4",
|
||||
"hayro-postscript",
|
||||
@@ -3782,7 +3782,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "hayro-interpret"
|
||||
version = "0.7.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"bitflags 2.13.2",
|
||||
"hayro-cmap",
|
||||
@@ -3800,7 +3800,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "hayro-jbig2"
|
||||
version = "0.3.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"fearless_simd",
|
||||
"hayro-ccitt",
|
||||
@@ -3818,12 +3818,12 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "hayro-postscript"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
|
||||
[[package]]
|
||||
name = "hayro-syntax"
|
||||
version = "0.7.2"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"flate2",
|
||||
"hayro-ccitt",
|
||||
@@ -4806,7 +4806,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "krilla"
|
||||
version = "0.8.2"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"bumpalo",
|
||||
@@ -4963,7 +4963,7 @@ checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4"
|
||||
[[package]]
|
||||
name = "linesweeper"
|
||||
version = "0.5.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=965c7beeb6076480e016e448bddddcce0a738ff6#965c7beeb6076480e016e448bddddcce0a738ff6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=77ade517ecb2a6ad86feb2f9983a098ad5738fc6#77ade517ecb2a6ad86feb2f9983a098ad5738fc6"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"kurbo 0.13.1",
|
||||
|
||||
+49
-49
@@ -10,51 +10,51 @@ license = "MIT OR Apache-2.0"
|
||||
rust-version = "1.95"
|
||||
|
||||
[workspace.dependencies]
|
||||
craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" }
|
||||
craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6", default-features = false, features = ["interpret", "write"] }
|
||||
craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" }
|
||||
craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" }
|
||||
craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" }
|
||||
craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6", default-features = false, features = ["interpret", "write"] }
|
||||
craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" }
|
||||
craft-proof = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" }
|
||||
# Language packs: the Craft apps' shared font store installs them (#4936).
|
||||
craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" }
|
||||
craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" }
|
||||
craft-font-store = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" }
|
||||
craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" }
|
||||
# The `.vectorcraft` envelope: its members, version, embedded images and the data after the JSON.
|
||||
craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" }
|
||||
craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" }
|
||||
craft-vectorcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" }
|
||||
craft-gzip = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" }
|
||||
# `.pcraft` documents: their manifest, full-size composite, preview, layer pixels and ICC profile.
|
||||
craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6", features = ["pcraft-pixels"] }
|
||||
craft-doc = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6", features = ["pcraft-pixels"] }
|
||||
# Native Affinity documents (craft-libs#914).
|
||||
craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" }
|
||||
craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" }
|
||||
# Bounded CDR (v1-v27) and CMX (32-bit) reader (craft-libs#778).
|
||||
craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" }
|
||||
craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" }
|
||||
# SVG parsing, limits, SVGZ and writer (craft-libs#778).
|
||||
craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6", features = ["tree"] }
|
||||
craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" }
|
||||
craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6", features = ["tree"] }
|
||||
craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" }
|
||||
# EPS container, previews, ASCII85 and DSC comments (craft-libs#778).
|
||||
craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" }
|
||||
craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" }
|
||||
# DXF tags, reader and writer (craft-libs#778, #926, #927).
|
||||
craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" }
|
||||
craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" }
|
||||
craft-plotter = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" }
|
||||
craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" }
|
||||
# WMF, EMF and EMF+ reader (craft-libs#778).
|
||||
craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" }
|
||||
craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" }
|
||||
craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" }
|
||||
craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" }
|
||||
craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" }
|
||||
craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6", default-features = false, features = ["read", "write"] }
|
||||
craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" }
|
||||
craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" }
|
||||
craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" }
|
||||
craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" }
|
||||
craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" }
|
||||
craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" }
|
||||
craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" }
|
||||
craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" }
|
||||
craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" }
|
||||
craft-ps = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6", default-features = false, features = ["read", "write"] }
|
||||
craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" }
|
||||
craft-stream-codecs = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" }
|
||||
craft-jxl = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" }
|
||||
craft-codepage = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" }
|
||||
# The framework facade (`craft::ui`, `craft::settings`, `craft::platform`, ...). No default features: each crate names
|
||||
# the members it imports.
|
||||
craft = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" }
|
||||
craft = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" }
|
||||
# Below the egui layer, so not through the facade: the colour harmony rules and their settings (craft-color-ui
|
||||
# without its `ui` feature), the colour type they work in, and the craft-fonts tables the text crate's build writes.
|
||||
craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" }
|
||||
craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" }
|
||||
craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" }
|
||||
craft-color-ui = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" }
|
||||
craft-theme = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" }
|
||||
craft-fonts-build = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" }
|
||||
# Nightly profile isolation, launch protocol, and security fence.
|
||||
craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" }
|
||||
craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" }
|
||||
# internal
|
||||
vectorcraft-geom = { path = "crates/geom" }
|
||||
vectorcraft-color = { path = "crates/color" }
|
||||
@@ -194,22 +194,22 @@ lto = "thin"
|
||||
codegen-units = 1
|
||||
|
||||
[patch.crates-io]
|
||||
hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" }
|
||||
hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" }
|
||||
hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" }
|
||||
hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" }
|
||||
hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" }
|
||||
krilla = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" }
|
||||
linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6" }
|
||||
ecolor = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" }
|
||||
emath = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" }
|
||||
epaint = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" }
|
||||
epaint_default_fonts = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" }
|
||||
egui = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" }
|
||||
egui-winit = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" }
|
||||
egui-wgpu = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" }
|
||||
egui_glow = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" }
|
||||
egui_extras = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" }
|
||||
egui_kittest = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" }
|
||||
eframe = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" }
|
||||
hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" }
|
||||
hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" }
|
||||
hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" }
|
||||
hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" }
|
||||
hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" }
|
||||
krilla = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" }
|
||||
linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6" }
|
||||
ecolor = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" }
|
||||
emath = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" }
|
||||
epaint = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" }
|
||||
epaint_default_fonts = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" }
|
||||
egui = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" }
|
||||
egui-winit = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" }
|
||||
egui-wgpu = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" }
|
||||
egui_glow = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" }
|
||||
egui_extras = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" }
|
||||
egui_kittest = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" }
|
||||
eframe = { git = "https://github.com/storytold/egui.git", rev = "861d60a65c50850e995bbb3dcee7c1f3b06815f6" }
|
||||
winit = { git = "https://github.com/storytold/winit.git", rev = "0dfcec0eb62fda5904137a63a6dd0c3d83295f45" }
|
||||
|
||||
@@ -28,7 +28,7 @@ egui_extras = { workspace = true }
|
||||
# `wgpu` pulls egui-wgpu's defaults: WebGPU plus the WebGL2 fallback.
|
||||
eframe = { workspace = true, features = ["default_fonts", "wgpu", "accesskit"] }
|
||||
# The page command API (storytold/craft-libs#413): the request plumbing behind window.vectorcraft.
|
||||
craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "965c7beeb6076480e016e448bddddcce0a738ff6", version = "0.1.0" }
|
||||
craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6", version = "0.1.0" }
|
||||
|
||||
wasm-bindgen = "0.2"
|
||||
serde_json = { workspace = true }
|
||||
|
||||
@@ -449,6 +449,7 @@ fn cropping_off_the_pixel_grid_keeps_the_hidden_colors_in_the_pixels() {
|
||||
})
|
||||
.unwrap()
|
||||
.to_rgba8();
|
||||
assert_eq!(own.dimensions(), (6, 5), "the cut's pixels");
|
||||
assert!(own.pixels().all(|p| p.0[3] == 255), "the cut pixels are the image's own, white included");
|
||||
assert_eq!(drawn(d, id, 0, 0)[3], 0, "white is hidden");
|
||||
s.execute(REMOVE_COLOR_MASK, &json!({"ids": [id.0]})).unwrap();
|
||||
|
||||
@@ -237,6 +237,7 @@ fn add_points_splits_selected_segments_evenly() {
|
||||
let n = steps(&s);
|
||||
assert_eq!(s.execute("addon.pathtools.addPoints", &json!({"count": 3})).unwrap()["added"], json!(3));
|
||||
let xs: Vec<f64> = path(&s, l).anchors().map(|(_, _, a)| a.p.x).collect();
|
||||
assert_eq!(xs.len(), 5, "{xs:?}");
|
||||
assert!(xs.iter().zip([0.0, 25.0, 50.0, 75.0, 100.0]).all(|(x, w)| (x - w).abs() < 1e-3), "{xs:?}");
|
||||
assert_eq!(steps(&s), n + 1);
|
||||
refuses(&mut s, "addon.pathtools.addPoints", &[json!({"count": 0}), json!({"count": 101}), json!({"count": 1.5})]);
|
||||
|
||||
@@ -69,7 +69,8 @@ fn a_straight_ramp_sizes_each_letter_and_skips_spaces() {
|
||||
assert_eq!(sizes, [('a', 10.0), ('b', 20.0), (' ', 20.0), ('c', 30.0), ('d', 40.0)], "the space keeps its size");
|
||||
assert_eq!(obj(&s, id).plain_text(), "ab cd", "the text stays live");
|
||||
s.execute("edit.undo", &json!({})).unwrap();
|
||||
assert!(styles(&s, id).iter().all(|(_, st)| st.size == 20.0), "undone");
|
||||
let undone: Vec<(char, f64)> = styles(&s, id).into_iter().map(|(c, st)| (c, st.size)).collect();
|
||||
assert_eq!(undone, [('a', 20.0), ('b', 20.0), (' ', 20.0), ('c', 20.0), ('d', 20.0)], "undone");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -1586,6 +1586,8 @@ mod trace_limit_tests {
|
||||
// anchors each.
|
||||
let strokes = |f: &tr::SeamFills| f.strokes.iter().map(|tp| tp.path.anchor_count()).sum::<usize>();
|
||||
let outlined = seams_within(&res, ¶ms, (24, 16), MAX_TRACE_ANCHORS, true, &go).unwrap().unwrap();
|
||||
assert!(!outlined.strokes.is_empty(), "{res:?}");
|
||||
assert_eq!(outlined.strokes.len(), all.as_ref().unwrap().strokes.len(), "one outline for each seam fill: {outlined:?}");
|
||||
assert!(outlined.strokes.iter().all(|tp| tp.stroke.is_none() && !tp.path.is_empty()), "{outlined:?}");
|
||||
let n = strokes(all.as_ref().unwrap());
|
||||
assert!(strokes(&outlined) <= SEAM_OUTLINE_ANCHORS * n, "{} outline anchors, {n} stroke anchors", strokes(&outlined));
|
||||
|
||||
@@ -696,9 +696,13 @@ mod tests {
|
||||
let c = s.execute("object.compoundPath.make", &json!({})).unwrap()["id"].as_u64().unwrap();
|
||||
assert_eq!(c, layer, "the scenario needs the id to be reused");
|
||||
s.execute("edit.paste", &json!({})).unwrap();
|
||||
let d = &s.doc().unwrap().doc;
|
||||
let st = s.doc().unwrap();
|
||||
let d = &st.doc;
|
||||
let compound = d.node(NodeId(c)).unwrap();
|
||||
assert!(compound.children().unwrap().iter().all(|ch| matches!(ch.kind, vectorcraft_doc::NodeKind::Path { .. })));
|
||||
assert_eq!(compound.children().unwrap().len(), 1, "the compound path holds only the rectangle it was made from");
|
||||
let pasted = st.selection.objects.clone();
|
||||
assert_eq!(pasted.len(), 1);
|
||||
assert!(d.parent_of(pasted[0]).is_some_and(|p| d.node(p).unwrap().is_layer()), "the copy lands on a layer");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -1722,7 +1722,7 @@ mod tests {
|
||||
let jags = polyline(&ring);
|
||||
let sp = SubPath::new(jags.clone(), true);
|
||||
assert!(subpath_len(&sp) < 24.0);
|
||||
assert!(smooth_corners(&jags, true, 1e-6).iter().all(|c| *c), "each jag turns sharply at its anchor");
|
||||
assert_eq!(smooth_corners(&jags, true, 1e-6), vec![true; 16], "each jag turns sharply at its anchor");
|
||||
assert_eq!(smooth_corners(&jags, true, 12.0), vec![false; 16]);
|
||||
assert_eq!(smooth_corners(&polyline(&[(0.0, 0.0), (6.0, 0.0), (3.0, 5.196)]), true, 12.0), vec![true; 3]);
|
||||
}
|
||||
|
||||
@@ -104,8 +104,15 @@ fn bmp_options_reach_the_file() {
|
||||
assert_eq!(i32::from_le_bytes(flipped[22..26].try_into().unwrap()), -40, "top-down rows");
|
||||
let os2 = bmp(&mut s, json!({"fileFormat": "os2", "depth": 4}));
|
||||
assert_eq!(u32::from_le_bytes(os2[14..18].try_into().unwrap()), 12, "OS/2 core header");
|
||||
let gray = image::load_from_memory_with_format(&bmp(&mut s, json!({"colorModel": "gray", "depth": 8})), image::ImageFormat::Bmp).unwrap();
|
||||
assert!(gray.to_rgb8().pixels().all(|p| p[0] == p[1] && p[1] == p[2]));
|
||||
// A red square, whose gray is neither black nor white.
|
||||
let red = s.execute("shape.rectangle", &json!({"x": 0, "y": 0, "width": 10, "height": 40})).unwrap()["id"].clone();
|
||||
s.execute("paint.setFill", &json!({"ids": [red], "color": "#ff0000"})).unwrap();
|
||||
let gray =
|
||||
image::load_from_memory_with_format(&bmp(&mut s, json!({"colorModel": "gray", "depth": 8})), image::ImageFormat::Bmp).unwrap().to_rgb8();
|
||||
assert_eq!(gray.dimensions(), (60, 40));
|
||||
assert!(gray.pixels().all(|p| p[0] == p[1] && p[1] == p[2]));
|
||||
let [r, _, _] = gray.get_pixel(5, 20).0;
|
||||
assert!(r > 0 && r < 255, "red is a middle gray: {r}");
|
||||
for bad in [
|
||||
json!({"depth": 2}),
|
||||
json!({"depth": 24, "rle": true}),
|
||||
|
||||
@@ -30,19 +30,29 @@ impl Visitor for Names {
|
||||
}
|
||||
}
|
||||
|
||||
/// Reads every file, and waits on reading one until its channel sends or closes.
|
||||
struct Blocked(Mutex<mpsc::Receiver<()>>);
|
||||
/// Reads every file, says on its second channel that a read began, and waits on reading one until
|
||||
/// its first channel sends or closes.
|
||||
struct Blocked(Mutex<mpsc::Receiver<()>>, mpsc::Sender<()>);
|
||||
|
||||
impl Visitor for Blocked {
|
||||
fn wants(&self, _: &str) -> bool {
|
||||
true
|
||||
}
|
||||
fn items(&self, _: &Path) -> Vec<usize> {
|
||||
let _ = self.1.send(());
|
||||
let _ = self.0.lock().unwrap().recv();
|
||||
vec![]
|
||||
}
|
||||
}
|
||||
|
||||
/// A [`Blocked`] visitor with the sender that lets its reads end and the receiver that hears each
|
||||
/// read begin.
|
||||
fn blocked() -> (mpsc::Sender<()>, mpsc::Receiver<()>, Arc<dyn Visitor>) {
|
||||
let (go, wait_for_go) = mpsc::channel();
|
||||
let (entered, reading) = mpsc::channel();
|
||||
(go, reading, Arc::new(Blocked(Mutex::new(wait_for_go), entered)))
|
||||
}
|
||||
|
||||
/// A test's folder tree, removed with everything in it when dropped, also when the test panics,
|
||||
/// and also when the test locked a folder in it. A removal that fails (a walker still holding a
|
||||
/// file open) is ignored.
|
||||
@@ -316,29 +326,35 @@ fn the_search_ends_at_its_limits_and_when_stopped() {
|
||||
#[test]
|
||||
fn the_search_answers_at_its_deadline_while_a_walker_is_blocked() {
|
||||
let root = tree("blocked", &["f.ttf"]);
|
||||
let (tx, rx) = mpsc::channel();
|
||||
let (tx, reading, visitor) = blocked();
|
||||
let started = Instant::now();
|
||||
let s = begin(root.clone(), rules(&root), Limits { seconds: 0.2, ..Limits::default() }, 1, 1, Arc::new(Blocked(Mutex::new(rx))));
|
||||
std::thread::sleep(Duration::from_millis(300));
|
||||
let s = begin(root.clone(), rules(&root), Limits::default(), 1, 1, visitor);
|
||||
// The walker is blocked reading the file.
|
||||
assert!(reading.recv_timeout(WAIT).is_ok(), "the walker reads the file");
|
||||
assert_eq!((s.progress().state(), s.progress().read), ("searching", 1));
|
||||
s.expire();
|
||||
let p = s.progress();
|
||||
// The search ended when it answered, and it ran no longer than the test has waited.
|
||||
let waited = started.elapsed().as_secs_f64();
|
||||
assert_eq!((p.state(), p.stopped()), ("stopped", Some("time")), "{p:?}");
|
||||
assert!(p.seconds >= 0.2 && p.seconds <= waited, "{p:?}, {waited} s");
|
||||
let (tx2, rx2) = mpsc::channel();
|
||||
let s2 = begin(root.clone(), rules(&root), Limits::default(), 1, 1, Arc::new(Blocked(Mutex::new(rx2))));
|
||||
let until = Instant::now() + WAIT;
|
||||
while s2.progress().read == 0 && Instant::now() < until {
|
||||
std::thread::sleep(Duration::from_millis(2));
|
||||
}
|
||||
assert!(p.seconds <= waited, "{p:?}, {waited} s");
|
||||
assert_eq!(s.progress().seconds, p.seconds, "the time it ended at stays");
|
||||
// A limit of no seconds has run out as the search starts; a long one hasn't.
|
||||
let (_tx0, _, visitor) = blocked();
|
||||
let none = begin(root.clone(), rules(&root), Limits { seconds: 0.0, ..Limits::default() }, 1, 1, visitor);
|
||||
assert_eq!(none.progress().stopped(), Some("time"));
|
||||
let (tx2, reading2, visitor) = blocked();
|
||||
let s2 = begin(root.clone(), rules(&root), Limits::default(), 1, 1, visitor);
|
||||
assert!(reading2.recv_timeout(WAIT).is_ok(), "the walker reads the file");
|
||||
assert_eq!(s2.progress().state(), "searching");
|
||||
s2.stop();
|
||||
assert_eq!(s2.progress().stopped(), Some("stop"));
|
||||
drop((tx, tx2));
|
||||
}
|
||||
|
||||
/// Every file is item 0; reading the second file waits until the channel closes.
|
||||
struct SecondBlocks(Mutex<(usize, mpsc::Receiver<()>)>);
|
||||
/// Every file is item 0; reading the second file says so on the second channel, then waits until
|
||||
/// the first channel closes.
|
||||
struct SecondBlocks(Mutex<(usize, mpsc::Receiver<()>)>, mpsc::Sender<()>);
|
||||
|
||||
impl Visitor for SecondBlocks {
|
||||
fn wants(&self, _: &str) -> bool {
|
||||
@@ -348,6 +364,7 @@ impl Visitor for SecondBlocks {
|
||||
let mut read = self.0.lock().unwrap();
|
||||
read.0 += 1;
|
||||
if read.0 == 2 {
|
||||
let _ = self.1.send(());
|
||||
let _ = read.1.recv();
|
||||
}
|
||||
vec![0]
|
||||
@@ -360,11 +377,9 @@ impl Visitor for SecondBlocks {
|
||||
fn files_found_are_kept_as_they_are_read() {
|
||||
let root = tree("kept", &["a.ttf", "b.ttf", "c.ttf"]);
|
||||
let (tx, rx) = mpsc::channel();
|
||||
let s = begin(root.clone(), rules(&root), Limits::default(), 1, 2, Arc::new(SecondBlocks(Mutex::new((0, rx)))));
|
||||
let until = Instant::now() + WAIT;
|
||||
while s.progress().read < 2 && Instant::now() < until {
|
||||
std::thread::sleep(Duration::from_millis(2));
|
||||
}
|
||||
let (second, reading_second) = mpsc::channel();
|
||||
let s = begin(root.clone(), rules(&root), Limits::default(), 1, 2, Arc::new(SecondBlocks(Mutex::new((0, rx)), second)));
|
||||
assert!(reading_second.recv_timeout(WAIT).is_ok(), "the walker reads a second file");
|
||||
let p = s.progress();
|
||||
assert_eq!((p.state(), p.hits.len()), ("searching", 1), "{p:?}");
|
||||
s.stop();
|
||||
@@ -527,16 +542,12 @@ fn system_roots_and_homes_are_told_by_what_they_hold() {
|
||||
fn a_search_starts_with_the_threads_left_and_fails_when_none_is() {
|
||||
static POOL: Pool = Pool::new(3);
|
||||
let root = tree("pool", &["f.ttf"]);
|
||||
let blocked = || {
|
||||
let (tx, rx) = mpsc::channel();
|
||||
(tx, Arc::new(Blocked(Mutex::new(rx))) as Arc<dyn Visitor>)
|
||||
};
|
||||
let (tx_a, a) = blocked();
|
||||
let (tx_b, b) = blocked();
|
||||
let (tx_a, _, a) = blocked();
|
||||
let (tx_b, _, b) = blocked();
|
||||
let a = start_in(&POOL, root.clone(), Some(rules(&root)), Limits::default(), 2, 1, a).unwrap();
|
||||
let b = start_in(&POOL, root.clone(), Some(rules(&root)), Limits::default(), 4, 1, b).unwrap();
|
||||
assert_eq!(POOL.live(), 3);
|
||||
let (_, c) = blocked();
|
||||
let (_, _, c) = blocked();
|
||||
let c = start_in(&POOL, root.clone(), Some(rules(&root)), Limits::default(), 1, 1, c);
|
||||
assert_eq!(c.err().as_deref(), Some("the search couldn't start: try again in a moment"));
|
||||
drop((tx_a, tx_b));
|
||||
|
||||
@@ -238,12 +238,18 @@ impl Search {
|
||||
self.shared.finish(&mut w, End::Stopped);
|
||||
}
|
||||
|
||||
/// Move the search's deadline to now, as if its time had run out.
|
||||
#[cfg(test)]
|
||||
pub(crate) fn expire(&self) {
|
||||
self.shared.deadline.store(0, Ordering::Relaxed);
|
||||
}
|
||||
|
||||
/// Where the search stands. Past its deadline it has ended ([`End::Time`]), even while a walker
|
||||
/// is still waiting for a slow folder or file.
|
||||
pub fn progress(&self) -> Progress {
|
||||
let s = &self.shared;
|
||||
let mut w = s.lock();
|
||||
if w.end.is_none() && Instant::now() >= s.deadline {
|
||||
if w.end.is_none() && s.time_up() {
|
||||
s.finish(&mut w, End::Time);
|
||||
}
|
||||
Progress {
|
||||
@@ -310,7 +316,7 @@ pub(crate) fn start_in(
|
||||
entries: AtomicU64::new(0),
|
||||
read: AtomicU64::new(0),
|
||||
started,
|
||||
deadline: started + Duration::from_secs_f64(seconds),
|
||||
deadline: AtomicU64::new(u64::try_from(Duration::from_secs_f64(seconds).as_nanos()).unwrap_or(u64::MAX)),
|
||||
limits,
|
||||
items,
|
||||
given: rules,
|
||||
@@ -355,7 +361,8 @@ struct Shared {
|
||||
entries: AtomicU64,
|
||||
read: AtomicU64,
|
||||
started: Instant,
|
||||
deadline: Instant,
|
||||
/// Nanoseconds after `started` at which the search's time is up.
|
||||
deadline: AtomicU64,
|
||||
limits: Limits,
|
||||
items: usize,
|
||||
/// The rules given to [`start`], else this computer's, read by the first walker.
|
||||
@@ -419,7 +426,12 @@ impl Shared {
|
||||
|
||||
/// Whether to stop listing and reading: the search ended or its time is up.
|
||||
fn should_stop(&self) -> bool {
|
||||
self.stop.load(Ordering::Relaxed) || Instant::now() >= self.deadline
|
||||
self.stop.load(Ordering::Relaxed) || self.time_up()
|
||||
}
|
||||
|
||||
/// Whether the search's time is up: [`Shared::deadline`] nanoseconds passed since it started.
|
||||
fn time_up(&self) -> bool {
|
||||
u64::try_from(self.started.elapsed().as_nanos()).unwrap_or(u64::MAX) >= self.deadline.load(Ordering::Relaxed)
|
||||
}
|
||||
|
||||
/// Whether the folders waiting to be listed and `more` folders found in the folder being listed
|
||||
@@ -618,7 +630,7 @@ fn walker(s: &Shared) {
|
||||
if w.end.is_some() {
|
||||
return;
|
||||
}
|
||||
if Instant::now() >= s.deadline {
|
||||
if s.time_up() {
|
||||
s.finish(&mut w, End::Time);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2588,6 +2588,7 @@ fn a_line_series_draws_its_kept_stroke_on_the_line_and_its_kept_fill_on_the_mark
|
||||
s.execute("graph.setData", &json!({"rows": [[1, 2], [3, 4]]})).unwrap();
|
||||
let (drawn, others) = line_parts(&s, id);
|
||||
assert_eq!((drawn.appearance.fill_paint(), drawn.appearance.stroke_paint()), (Paint::None, red));
|
||||
assert!(!others.is_empty(), "the markers and the legend swatch are drawn");
|
||||
assert!(others.iter().all(|m| m.appearance.fill_paint() == blue), "{others:?}");
|
||||
}
|
||||
|
||||
@@ -4867,7 +4868,7 @@ fn blanks_read_back_as_null_and_year_header_rows_still_read_as_headers() {
|
||||
#[test]
|
||||
fn a_huge_ragged_grid_is_capped() {
|
||||
let g = GraphSpec { rows: vec![vec![0.0; vectorcraft_doc::MAX_GRAPH_SERIES + 10]; 3], ..GraphSpec::default() };
|
||||
assert!(g.cells().iter().all(|r| r.len() == vectorcraft_doc::MAX_GRAPH_SERIES));
|
||||
assert_eq!(g.cells().iter().map(Vec::len).collect::<Vec<_>>(), [vectorcraft_doc::MAX_GRAPH_SERIES; 3]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -6720,7 +6721,17 @@ fn designs_and_markers_survive_save_and_open() {
|
||||
d.graph_designs.push(vectorcraft_doc::GraphDesign { name: "Dot".into(), art: std::sync::Arc::new(dot) });
|
||||
let art = super::generate(&mut d, &g);
|
||||
let s0 = art.iter().find(|n| n.extras().series_index == Some(0)).unwrap();
|
||||
assert!(s0.children().unwrap().iter().all(|n| matches!(n.kind, NodeKind::Path { .. })));
|
||||
let marks = s0.children().unwrap();
|
||||
assert!(marks.iter().all(|n| matches!(n.kind, NodeKind::Path { .. })));
|
||||
assert_eq!(marks.iter().filter(|n| sized(n, 5.0)).count(), 1, "a default square at the one data point");
|
||||
}
|
||||
|
||||
/// Whether `n` is a square path `side` points across, drawn as the four corners of its bounds (a default point marker
|
||||
/// is 5, a default legend swatch 8).
|
||||
fn sized(n: &vectorcraft_doc::Node, side: f64) -> bool {
|
||||
let Some(b) = n.geometric_bounds() else { return false };
|
||||
let square = matches!(&n.kind, NodeKind::Path { path, .. } if *path == vectorcraft_geom::shapes::rectangle(b));
|
||||
square && (b.width() - side).abs() < 1e-6 && (b.height() - side).abs() < 1e-6
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -6773,7 +6784,11 @@ fn designs_too_big_for_a_graph_are_refused_and_drawn_as_squares() {
|
||||
let mut d = (*s.doc().unwrap().doc).clone();
|
||||
let art = super::generate(&mut d, &g);
|
||||
let s0 = art.iter().find(|n| n.extras().series_index == Some(0)).unwrap();
|
||||
assert!(s0.children().unwrap().iter().all(|n| matches!(n.kind, NodeKind::Path { .. })));
|
||||
let marks = s0.children().unwrap();
|
||||
assert!(marks.iter().all(|n| matches!(n.kind, NodeKind::Path { .. })));
|
||||
assert_eq!(marks.iter().filter(|n| sized(n, 5.0)).count(), 200, "a default square at each of the 200 points");
|
||||
let line = marks.iter().filter(|n| n.geometric_bounds().is_some_and(|b| b.width() > 100.0)).count();
|
||||
assert_eq!(line, 1, "the series line is drawn as well");
|
||||
// Too many objects for one design.
|
||||
let ids: Vec<u64> = (0..2001)
|
||||
.map(|i| s.execute("shape.rectangle", &json!({"x": i % 40, "y": i / 40, "width": 1, "height": 1})).unwrap()["id"].as_u64().unwrap())
|
||||
@@ -7157,7 +7172,16 @@ fn graph_column_params_are_checked_and_designs_too_big_are_drawn_plain() {
|
||||
let mut d = (*s.doc().unwrap().doc).clone();
|
||||
let art = super::generate(&mut d, &g);
|
||||
let s0 = art.iter().find(|n| n.extras().series_index == Some(0)).unwrap();
|
||||
assert!(s0.children().unwrap().iter().all(|n| matches!(n.kind, NodeKind::Path { .. })));
|
||||
let marks = s0.children().unwrap();
|
||||
assert!(marks.iter().all(|n| matches!(n.kind, NodeKind::Path { .. })));
|
||||
assert_eq!(marks.iter().filter(|n| sized(n, 8.0)).count(), 1, "a default square as the legend swatch");
|
||||
let columns: Vec<_> = marks.iter().filter(|n| !sized(n, 8.0)).collect();
|
||||
assert_eq!(columns.len(), 1, "one plain column for the one value");
|
||||
let bounds = columns[0].geometric_bounds();
|
||||
let height = bounds.map(|b| b.height());
|
||||
assert!(height.is_some_and(|h| (h - 140.0).abs() < 1e-6), "the column has the value's height: {height:?}");
|
||||
let rectangle = bounds.map(vectorcraft_geom::shapes::rectangle);
|
||||
assert!(matches!(&columns[0].kind, NodeKind::Path { path, .. } if Some(path) == rectangle.as_ref()), "the plain column is a rectangle");
|
||||
// Columns of 0 on a value axis from 10,000 to 10,001 run 2,000,000 points from the clamped zero line: a copy each
|
||||
// 0.1 is past the budget too.
|
||||
let far = one_series(&mut s, "column", &[0.0, 0.0]);
|
||||
@@ -7840,7 +7864,9 @@ fn the_legend_across_top_keeps_above_labels_over_the_plot() {
|
||||
let n = s.doc().unwrap().doc.node(col).unwrap().clone();
|
||||
let texts: Vec<_> = group(&n, "Legend").children().unwrap().iter().filter_map(|c| c.geometric_bounds()).collect();
|
||||
let last_row = texts.iter().map(|b| b.y0).fold(f64::MIN, f64::max);
|
||||
assert!(texts.iter().filter(|b| b.y0 < last_row - 1e-6).all(|b| b.x1 <= 400.0 + 1e-6), "{texts:?}");
|
||||
let above: Vec<_> = texts.iter().filter(|b| b.y0 < last_row - 1e-6).collect();
|
||||
assert!(!above.is_empty(), "the legend takes more than one row: {texts:?}");
|
||||
assert!(above.iter().all(|b| b.x1 <= 400.0 + 1e-6), "{texts:?}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -8024,6 +8050,7 @@ fn formatting_the_whole_graphs_text_survives_it_being_drawn_again() {
|
||||
s.execute("select.set", &json!({"ids": [id.0]})).unwrap();
|
||||
s.execute("text.setStyle", &json!({"size": 12})).unwrap();
|
||||
let looks = label_looks(&mut s, id);
|
||||
assert!(!looks.is_empty());
|
||||
assert!(looks.iter().all(|(_, size, _)| (*size - 12.0).abs() < 1e-6), "{looks:?}");
|
||||
let g = spec(&s, id);
|
||||
assert!(g.label_styles.values.is_some() && g.label_styles.categories.is_some() && g.label_styles.legend.is_some());
|
||||
@@ -9145,10 +9172,13 @@ fn line_look(n: &vectorcraft_doc::Node) -> (String, f64, f32) {
|
||||
(stroke, n.appearance.stroke_width(), n.opacity)
|
||||
}
|
||||
|
||||
/// The looks of graph `id`'s lines after it is drawn again.
|
||||
/// The looks of graph `id`'s lines after it is drawn again: more than three (a radar graph's
|
||||
/// three spokes come first, then its rings).
|
||||
fn redrawn_line_looks(s: &mut Session, id: NodeId) -> Vec<(String, f64, f32)> {
|
||||
s.execute("graph.setData", &json!({"id": id.0, "csv": ",2024,2025\nQ1,3,2\nQ2,5,4\nQ3,-1,6"})).unwrap();
|
||||
line_nodes(s, id).iter().map(line_look).collect()
|
||||
let looks: Vec<_> = line_nodes(s, id).iter().map(line_look).collect();
|
||||
assert!(looks.len() > 3, "the graph is drawn with its lines: {looks:?}");
|
||||
looks
|
||||
}
|
||||
|
||||
/// A stroke, a weight, no stroke or an opacity given to one axis line is kept for every axis line and tick mark when the
|
||||
|
||||
@@ -1563,6 +1563,12 @@ pub fn auto_simplify_level(s: &Session) -> Result<f64> {
|
||||
fn simplify(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
const C: &str = "object.path.simplify";
|
||||
let (auto, given_level, given_tolerance) = (switch_or(p, "auto", false, C)?, number_given(p, "level", C)?, length_given(p, "tolerance", C)?);
|
||||
if given_tolerance.is_some_and(|t| t < 0.0) {
|
||||
return Err(bad(C, "`tolerance` must be 0 or more"));
|
||||
}
|
||||
if given_level.is_some_and(|l| !(0.0..=100.0).contains(&l)) {
|
||||
return Err(bad(C, "`level` must be from 0 to 100"));
|
||||
}
|
||||
let corner_angle = number_given(p, "cornerAngle", C)?.unwrap_or(30.0).clamp(0.0, 180.0);
|
||||
let (straight_lines, whole) = (switch_or(p, "straightLines", false, C)?, switch_or(p, "wholePaths", false, C)?);
|
||||
// With auto, the slider's level is Auto-Simplify's for the selection's size; otherwise it is the level given.
|
||||
|
||||
@@ -1753,6 +1753,29 @@ fn candidates(indexes: &[&RetypeIndex], path: &BezPath, part: bool, near: bool,
|
||||
if exact.is_empty() && near { indexes.iter().flat_map(|ix| painted(ix, ix.near_matches(path, tolerance), tolerance)).collect() } else { exact }
|
||||
}
|
||||
|
||||
/// Joins whole shape `pc`, whose matches `ms` are near ones in faces other than `l`'s alone, to line
|
||||
/// `l` by its near matches among the glyphs of `l`'s face in `indexes`: the 256 glyphs closest to a
|
||||
/// shape in proportion can all be glyphs of other faces drawn alike (a period, a dot). Those
|
||||
/// matches when the shape joins, `None` when it does not (`l` unchanged).
|
||||
fn join_in_line_face(l: &mut Line, pc: &Piece, ms: &[GlyphMatch], indexes: &[RetypeIndex], tolerance: f64) -> Option<Vec<GlyphMatch>> {
|
||||
let face = l.face.id();
|
||||
if ms.iter().any(|m| m.exact || m.face.id() == face) {
|
||||
return None;
|
||||
}
|
||||
let fill = pc.filled.then_some(pc.nonzero);
|
||||
let own: Vec<GlyphMatch> = indexes
|
||||
.iter()
|
||||
.flat_map(|ix| {
|
||||
let found = ix.near_matches_in(&pc.path, tolerance, face);
|
||||
match fill {
|
||||
Some(nonzero) => found.iter().filter_map(|m| ix.painted_agrees(m, &pc.path, nonzero, tolerance)).collect(),
|
||||
None => found,
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
join(l, pc, &own).then_some(own)
|
||||
}
|
||||
|
||||
/// The parts of the shape `path` ([`parts`]: the whole shape, or the glyphs of its contour
|
||||
/// `groups`), each with its [`candidates`] in `indexes`; empty when it matches nothing. `fill` is
|
||||
/// as [`candidates`] takes it, and `once` is set when the shape paints its overlaps once, as
|
||||
@@ -1886,14 +1909,17 @@ fn retype(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
extra.push(f);
|
||||
}
|
||||
}
|
||||
if !extra.is_empty() {
|
||||
let indexes: Vec<RetypeIndex> = if extra.is_empty() {
|
||||
vec![index]
|
||||
} else {
|
||||
// Near matching spends an index's comparison budget, so with a tolerance the
|
||||
// candidates are indexed again for this pass.
|
||||
let first = if tolerance > 0.0 { build(cands) } else { index };
|
||||
let others: Vec<RetypeIndex> = extra.chunks(vectorcraft_text::retype::MAX_FACES).map(|g| build(g.to_vec())).collect();
|
||||
let all: Vec<&RetypeIndex> = std::iter::once(&first).chain(&others).collect();
|
||||
found = match_pieces(&pieces, &groups, &all, tolerance);
|
||||
}
|
||||
let mut all = vec![first];
|
||||
all.extend(extra.chunks(vectorcraft_text::retype::MAX_FACES).map(|g| build(g.to_vec())));
|
||||
found = match_pieces(&pieces, &groups, &all.iter().collect::<Vec<_>>(), tolerance);
|
||||
all
|
||||
};
|
||||
// The face most shapes match, so a glyph several fonts share is set in the same font as
|
||||
// the glyphs around it. Among faces that as many shapes match, the one whose glyphs fit
|
||||
// them closest in all (the least leftover distance summed over those shapes), so every
|
||||
@@ -1949,11 +1975,19 @@ fn retype(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
for ms in parts {
|
||||
// The part's candidates in the face most shapes fit (see `ranked`).
|
||||
let face = ms.iter().enumerate().max_by(ranked).map(|(_, m)| m.face.id());
|
||||
let cands: Vec<GlyphMatch> = ms.iter().filter(|m| Some(m.face.id()) == face).cloned().collect();
|
||||
let joined = match lines.last_mut() {
|
||||
let mut cands: Vec<GlyphMatch> = ms.iter().filter(|m| Some(m.face.id()) == face).cloned().collect();
|
||||
let mut joined = match lines.last_mut() {
|
||||
Some(l) if open => join(l, pc, &cands),
|
||||
_ => false,
|
||||
};
|
||||
if !joined
|
||||
&& open
|
||||
&& parts.len() == 1
|
||||
&& let Some(own) = lines.last_mut().and_then(|l| join_in_line_face(l, pc, ms, &indexes, tolerance))
|
||||
{
|
||||
joined = true;
|
||||
cands = own;
|
||||
}
|
||||
// A part that joined a line, perhaps as a mark, that is also another character, in
|
||||
// that face or else in the face most shapes fit of those it is a character in: the
|
||||
// character, should a split leave the part first on a line ([`verified`]). Kept by
|
||||
|
||||
@@ -149,6 +149,10 @@ fn of_two_versions_only_the_one_the_name_gives_is_listed() {
|
||||
db.add_font(named_copy(true, (FAMILY, "Regular", "Version 2.000", "VersiontestSans-Regular")).unwrap());
|
||||
assert_eq!(db.face(FAMILY, "Regular").unwrap().version, "Version 1.000");
|
||||
let mut s = session();
|
||||
// Live type in the family puts the font among those compared first. Added last, after the
|
||||
// bundled fonts and however many faces craft-fonts supplies, it can fall past the fonts
|
||||
// Retype compares (`MAX_FACES`).
|
||||
s.execute("text.create", &json!({"x": 40, "y": 300, "text": "live", "size": 40, "font": FAMILY, "style": "Regular"})).unwrap();
|
||||
let inter = outlined(&mut s, json!({"x": 40, "y": 100, "text": "Kg", "size": 40, "font": "Inter", "style": "Regular"}));
|
||||
s.execute("select.set", &json!({"ids": [inter]})).unwrap();
|
||||
let r = query(&mut s, json!({"count": 96}), &db);
|
||||
|
||||
@@ -102,10 +102,12 @@ fn a_mark_in_one_font_starts_its_line_as_another_fonts_character() {
|
||||
use vectorcraft_text::test_fonts::{SPACING_COMMA_FAMILY, spacing_comma_font};
|
||||
// The comma below of Source Sans 3 is only marks there, and a modifier letter in this face.
|
||||
vectorcraft_text::FontDb::global().add_font(spacing_comma_font().unwrap());
|
||||
// Named, so it is among the fonts compared first, however many faces are loaded before it.
|
||||
let fonts = json!([SPACING_COMMA_FAMILY]);
|
||||
let mut s = session();
|
||||
let g = outlined(&mut s, json!({"x": 40, "y": 100, "text": "\u{326}", "size": 40, "font": "Source Sans 3", "style": "Regular"}));
|
||||
s.execute("select.set", &json!({"ids": [g]})).unwrap();
|
||||
let r = s.execute("type.retype", &json!({})).unwrap();
|
||||
let r = s.execute("type.retype", &json!({"fonts": fonts})).unwrap();
|
||||
assert_eq!(r["texts"], json!(["\u{2bb}"]), "{r}");
|
||||
assert_eq!(r["fonts"][0]["family"], json!(SPACING_COMMA_FAMILY), "{r}");
|
||||
// After a base, it joins the line as the mark; moved off its base, the split leaves it first,
|
||||
@@ -115,7 +117,7 @@ fn a_mark_in_one_font_starts_its_line_as_another_fonts_character() {
|
||||
s.execute("select.set", &json!({"ids": [mark]})).unwrap();
|
||||
s.execute("object.move", &json!({"dx": 3, "dy": 0})).unwrap();
|
||||
s.execute("select.set", &json!({"ids": [g]})).unwrap();
|
||||
let r = s.execute("type.retype", &json!({})).unwrap();
|
||||
let r = s.execute("type.retype", &json!({"fonts": fonts})).unwrap();
|
||||
assert_eq!((&r["texts"], &r["unmatched"]), (&json!(["x", "\u{2bb}", "yz"]), &json!([])), "{r}");
|
||||
assert_eq!(r["fonts"][1]["family"], json!(SPACING_COMMA_FAMILY), "{r}");
|
||||
}
|
||||
@@ -1099,7 +1101,9 @@ fn lines_that_do_not_stack_as_a_paragraph_stay_apart() {
|
||||
s.execute("select.set", &json!({"ids": [a]})).unwrap();
|
||||
let r = s.execute("type.retype", &json!({})).unwrap();
|
||||
assert_eq!(r["texts"], json!(["Top", "Far", "Askew"]), "{r}");
|
||||
assert!(r["fonts"].as_array().unwrap().iter().all(|f| f["area"] == json!(false)), "{r}");
|
||||
let fonts = r["fonts"].as_array().unwrap();
|
||||
assert!(!fonts.is_empty(), "{r}");
|
||||
assert!(fonts.iter().all(|f| f["area"] == json!(false)), "{r}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1918,16 +1922,24 @@ fn lines_in(s: &Session, g: u64) -> Vec<super::Line> {
|
||||
lines_in_family(s, g, None)
|
||||
}
|
||||
|
||||
/// [`lines_in`] with the face of the first glyph's match in `family` when given.
|
||||
/// [`lines_in`] with the face of the first glyph's match in `family` when given. The family is
|
||||
/// compared first, as `type.retype`'s `fonts` puts it, so the faces loaded before it cannot leave it
|
||||
/// out of the fonts Retype compares.
|
||||
fn lines_in_family(s: &Session, g: u64, family: Option<&str>) -> Vec<super::Line> {
|
||||
let d = &s.doc().unwrap().doc;
|
||||
let (mut barrier, mut truncated, mut pieces) = (true, false, vec![]);
|
||||
super::collect(d.node(NodeId(g)).unwrap(), d.parent_of(NodeId(g)), 0, &mut barrier, &mut truncated, &mut pieces);
|
||||
let db = vectorcraft_text::FontDb::global();
|
||||
let wanted = pieces.iter().filter_map(|pc| vectorcraft_text::retype::shape_key(&pc.path)).collect();
|
||||
let index = super::RetypeIndex::build(db, super::candidate_faces(db, d, &[]), &wanted);
|
||||
let fonts: Vec<String> = family.into_iter().map(str::to_string).collect();
|
||||
let index = super::RetypeIndex::build(db, super::candidate_faces(db, d, &fonts), &wanted);
|
||||
let first = index.matches(&pieces[0].path);
|
||||
let face = first.iter().find(|m| family.is_none_or(|f| m.face.family == f)).unwrap_or(&first[0]).face.id();
|
||||
let face = match family {
|
||||
Some(f) => first.iter().find(|m| m.face.family == f).unwrap_or_else(|| panic!("the first glyph matches no glyph of {f}")),
|
||||
None => &first[0],
|
||||
}
|
||||
.face
|
||||
.id();
|
||||
let mut lines: Vec<super::Line> = vec![];
|
||||
for pc in &pieces {
|
||||
let cands: Vec<_> = index.matches(&pc.path).into_iter().filter(|m| m.face.id() == face).collect();
|
||||
|
||||
@@ -1854,9 +1854,12 @@ fn kana_style_and_roman_italics_are_character_features() {
|
||||
}
|
||||
assert_eq!(runs(&s), before);
|
||||
s.execute("text.setRangeStyle", &json!({"id": id, "featureChanges": ["-hkna", "-ital"]})).unwrap();
|
||||
let text = |s: &Session| runs(s).into_iter().map(|(t, _)| t).collect::<String>();
|
||||
assert_eq!(text(&s), "かなAB");
|
||||
assert!(runs(&s).iter().all(|(_, f)| f.is_empty()), "{:?}", runs(&s));
|
||||
s.execute("charStyle.new", &json!({"name": "Kana", "attrs": {"features": ["hkna", "ital"]}})).unwrap();
|
||||
s.execute("charStyle.apply", &json!({"name": "Kana", "id": id})).unwrap();
|
||||
assert_eq!(text(&s), "かなAB");
|
||||
assert!(runs(&s).iter().all(|(_, f)| *f == ["hkna", "ital"]), "{:?}", runs(&s));
|
||||
let e = s.execute("charStyle.new", &json!({"name": "Bad", "attrs": {"features": ["ital=2"]}})).unwrap_err().to_string();
|
||||
assert!(e.contains("unknown OpenType feature `ital=2`"), "{e}");
|
||||
|
||||
@@ -257,6 +257,7 @@ fn gaps_set_word_spacing_and_leading() {
|
||||
// The layout uses the gap as the Desired word spacing; the paragraph keeps its own.
|
||||
assert_eq!(t.para_at(0).justification.word_spacing, [80.0, 100.0, 133.0]);
|
||||
assert_eq!(t.layout_justification(t.para_at(0)).word_spacing, [80.0, 300.0, 300.0]);
|
||||
assert_eq!(t.plain_text(), "two words\nthree more words", "the runs hold the text");
|
||||
assert!(t.runs.iter().all(|r| (r.style.leading.unwrap() - r.style.size - 6.0).abs() < 1e-9), "{:?}", t.runs);
|
||||
assert_block(&t);
|
||||
assert!(size_at(&t, 0) < size_at(&plain, 0), "wider word spaces leave the letters less room");
|
||||
@@ -850,6 +851,7 @@ fn a_range_leading_change_with_block_on_moves_the_line_gap() {
|
||||
let t = text(&s, id);
|
||||
assert!((t.area.line_gap - 5.0).abs() < 1e-9, "line gap {}", t.area.line_gap);
|
||||
assert!(leading_at(&t, 4).is_some_and(|l| (l - second - 5.0).abs() < 1e-9), "{:?}", leading_at(&t, 4));
|
||||
assert_eq!(t.plain_text(), "BIG\na much longer second line\nmid one", "the runs hold the text");
|
||||
assert!(t.runs.iter().all(|r| r.style.leading.is_some_and(|l| (l - r.style.size - 5.0).abs() < 1e-9)), "every line spreads");
|
||||
// Reset Panel's form: the leading is set and Block keeps the line gap.
|
||||
s.execute("text.setRangeStyle", &json!({"id": id, "start": 4, "end": 10, "leading": "auto", "keepLineGap": true})).unwrap();
|
||||
|
||||
@@ -4498,11 +4498,14 @@ fn stale_current_layer_id_never_targets_a_reused_id() {
|
||||
s.execute("select.set", &json!({"ids": [a.0, b.0]})).unwrap();
|
||||
let c = NodeId(s.execute("object.compoundPath.make", &json!({})).unwrap()["id"].as_u64().unwrap());
|
||||
assert_eq!(c, layer, "precondition: id reused");
|
||||
// Undo gives back the layer that was current before New Layer; a remembered id left over
|
||||
// from elsewhere still names the compound path now.
|
||||
s.doc_mut().unwrap().active_layer = Some(c);
|
||||
let d = rect(&mut s, 50.0, 50.0, 10.0, 10.0);
|
||||
s.execute("select.set", &json!({"ids": [d.0]})).unwrap();
|
||||
s.execute("object.arrange.sendToCurrentLayer", &json!({})).unwrap();
|
||||
let doc = &s.doc().unwrap().doc;
|
||||
assert!(doc.node(c).unwrap().children().unwrap().iter().all(|n| n.path_data().is_some()));
|
||||
assert_eq!(doc.node(c).unwrap().children().unwrap().len(), 2, "the compound path holds only the two rectangles it was made from");
|
||||
assert!(doc.parent_of(d).is_some_and(|p| doc.node(p).unwrap().is_layer()));
|
||||
// layer.delete without an id must not delete the compound path.
|
||||
s.execute("layer.delete", &json!({})).ok();
|
||||
|
||||
@@ -374,52 +374,6 @@ fn auto_height_in_columns_matches_the_full_search_when_lines_start_small() {
|
||||
}
|
||||
}
|
||||
|
||||
/// Time typing at the start of a story of 5,000, 20,000 and 50,000 characters in Auto Size area
|
||||
/// type in 2 and 3 columns: 20 letters typed one at a time with the Type tool, with Auto Size as it
|
||||
/// runs and with `FULL_SEARCH` on (the columns laid out at every step of the bisection).
|
||||
/// Run with `cargo test --release -p vectorcraft-engine --lib auto_height_in_columns_typing_timing -- --ignored --nocapture`.
|
||||
#[test]
|
||||
#[ignore = "manual timing probe; wall-clock performance depends on machine load"]
|
||||
fn auto_height_in_columns_typing_timing() {
|
||||
use crate::cmd::typecmd::{COLUMN_LAYOUTS, FULL_SEARCH};
|
||||
const WORDS: &str = "The quick brown fox jumps over the lazy dog and keeps running far beyond the first frame of this story. ";
|
||||
let v = ViewInfo::default();
|
||||
for n in [5_000, 20_000, 50_000] {
|
||||
let story = format!("{}\n", WORDS.repeat(6).trim_end()).repeat(n / 600 + 1)[..n].to_string();
|
||||
for cols in [2, 3] {
|
||||
let mut row = format!("{n} characters in {cols} columns:");
|
||||
for full in [false, true] {
|
||||
FULL_SEARCH.with(|c| c.set(full));
|
||||
let mut s = Session::new();
|
||||
s.execute("file.new", &json!({"width": 4400, "height": 1200})).unwrap();
|
||||
let area = json!({"width": 500, "height": 100, "fit": "autoHeight"});
|
||||
let id = s.execute("text.create", &json!({"x": 20, "y": 20, "size": 9, "text": story, "area": area})).unwrap()["id"].clone();
|
||||
s.execute("select.set", &json!({"ids": [id]})).unwrap();
|
||||
s.execute("text.areaOptions", &json!({"columns": cols, "gutter": 12})).unwrap();
|
||||
s.select_tool("type", v).unwrap();
|
||||
for kind in [PointerKind::Down, PointerKind::Up] {
|
||||
s.pointer(&PointerEvent::new(kind, 21.0, 24.0), v).unwrap();
|
||||
}
|
||||
let layouts = COLUMN_LAYOUTS.with(std::cell::Cell::get);
|
||||
let mut ms: Vec<f64> = "abcdefghijklmnopqrst"
|
||||
.chars()
|
||||
.map(|ch| {
|
||||
let start = std::time::Instant::now();
|
||||
s.tool_text(&ch.to_string(), v).unwrap();
|
||||
start.elapsed().as_secs_f64() * 1000.0
|
||||
})
|
||||
.collect();
|
||||
let per_key = (COLUMN_LAYOUTS.with(std::cell::Cell::get) - layouts) as f64 / ms.len() as f64;
|
||||
ms.sort_by(f64::total_cmp);
|
||||
let how = if full { "every step laid out" } else { "Auto Size" };
|
||||
row += &format!(" {how} {:.1} ms a keystroke ({per_key:.1} column layouts);", ms[ms.len() / 2]);
|
||||
}
|
||||
FULL_SEARCH.with(|c| c.set(false));
|
||||
println!("{row}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn shrink_text_round_trips_through_the_native_format() {
|
||||
let mut s = session();
|
||||
|
||||
@@ -553,7 +553,7 @@ fn reset_bounding_box_squares_the_objects_inside_a_group() {
|
||||
// The group and both members, in one step.
|
||||
assert_eq!(s.execute("object.resetBoundingBox", &json!({})).unwrap()["changed"], 3);
|
||||
assert_eq!(undo_len(&s), n + 1);
|
||||
assert!(object_angles(&s).iter().all(|a| *a == 0.0), "{:?}", object_angles(&s));
|
||||
assert_eq!(object_angles(&s), [0.0; 3], "the group and both members");
|
||||
s.execute("object.ungroup", &json!({})).unwrap();
|
||||
assert_eq!(selection_box(&s).angle, 0.0);
|
||||
assert_eq!(s.execute("object.resetBoundingBox", &json!({})).unwrap()["changed"], 0);
|
||||
@@ -709,9 +709,11 @@ fn reset_bounding_box_squares_every_box_rotate_bounding_box_turned() {
|
||||
let art = (anchors(&s, a), anchors(&s, c));
|
||||
// The group, the masked object, its mask's art and the other rectangle.
|
||||
assert_eq!(s.execute("object.rotateBoundingBox", &json!({"angle": 25})).unwrap()["changed"], 4);
|
||||
assert!(object_angles(&s).iter().all(|x| near(*x, 25.0)), "{:?}", object_angles(&s));
|
||||
let turned = object_angles(&s);
|
||||
assert_eq!(turned.len(), 4, "{turned:?}");
|
||||
assert!(turned.iter().all(|x| near(*x, 25.0)), "{turned:?}");
|
||||
assert_eq!(s.execute("object.resetBoundingBox", &json!({})).unwrap()["changed"], 4);
|
||||
assert!(object_angles(&s).iter().all(|x| *x == 0.0), "{:?}", object_angles(&s));
|
||||
assert_eq!(object_angles(&s), [0.0; 4]);
|
||||
assert_eq!((anchors(&s, a), anchors(&s, c)), art);
|
||||
}
|
||||
|
||||
|
||||
@@ -1247,10 +1247,13 @@ fn pasted_brushed_art_brings_the_patterns_its_brush_art_uses() {
|
||||
run(&mut s, "brush.apply", json!({"name": "Dotted Band", "ids": [line]}));
|
||||
run(&mut s, "select.set", json!({"ids": [line]}));
|
||||
run(&mut s, "edit.copy", json!({}));
|
||||
let (brush, dots) = (vectorcraft_brush::find(doc(&s), "Dotted Band"), doc(&s).pattern("Dots").cloned());
|
||||
run(&mut s, "file.new", json!({"width": 200, "height": 200}));
|
||||
assert_eq!((vectorcraft_brush::find(doc(&s), "Dotted Band"), doc(&s).pattern("Dots")), (None, None), "a new document has neither");
|
||||
run(&mut s, "edit.paste", json!({}));
|
||||
assert!(vectorcraft_brush::find(doc(&s), "Dotted Band").is_some());
|
||||
assert!(doc(&s).pattern("Dots").is_some(), "the brush's art is filled with it");
|
||||
assert_eq!(vectorcraft_brush::find(doc(&s), "Dotted Band"), brush);
|
||||
assert_eq!(doc(&s).pattern("Dots").cloned(), dots, "the brush's art is filled with it");
|
||||
assert!(dots.is_some());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -2533,6 +2533,9 @@ fn shape_builder_erase_click_or_drag_from_inside_a_narrow_overlap_deletes_it() {
|
||||
assert_eq!(r["edges"].as_u64(), Some(0), "{points}: {r}");
|
||||
let d = &s.doc().unwrap().doc;
|
||||
let left: Vec<f64> = d.children(d.default_layer()).unwrap().iter().filter_map(|c| c.geometric_bounds()).map(|b| b.width()).collect();
|
||||
let erased = r["regions"].as_u64().unwrap();
|
||||
assert!((1..=3).contains(&erased), "{points}: {r}");
|
||||
assert_eq!(left.len() as u64, 3 - erased, "{points}: the regions not erased stay: {left:?}");
|
||||
assert!(left.iter().all(|w| *w > 2.0), "{points}: no strip is left: {left:?}");
|
||||
}
|
||||
}
|
||||
@@ -4583,6 +4586,7 @@ fn live_paint_group_default_clears_the_faces_and_gives_the_edges_a_thin_black_st
|
||||
s.execute("paint.setStroke", &json!({"color": "#0000ff"})).unwrap();
|
||||
s.execute("paint.default", &json!({})).unwrap();
|
||||
let (faces, edges) = part_looks(&s, g);
|
||||
assert_eq!((faces.len(), edges.len() >= 4), (3, true), "{}", edges.len());
|
||||
assert!(faces.iter().all(|f| f.fill_paint().is_none() && f.stroke_paint().is_none()));
|
||||
assert!(edges.iter().all(|e| e.stroke_paint() == Paint::solid(Color::BLACK) && e.stroke_width() == 0.5 && e.fill_paint().is_none()));
|
||||
assert_eq!(sources_looks(&s, g), sources0);
|
||||
@@ -4627,6 +4631,7 @@ fn live_paint_group_invert_recolors_the_faces_fill() {
|
||||
let (_, edges0) = part_looks(&s, g);
|
||||
s.execute("paint.invert", &json!({"stroke": false})).unwrap();
|
||||
let (faces, edges) = part_looks(&s, g);
|
||||
assert_eq!((faces.len(), edges.len() >= 4), (3, true), "{}", edges.len());
|
||||
assert!(faces.iter().all(|f| f.fill_paint() == Paint::solid(Color::rgb(0.0, 1.0, 1.0))));
|
||||
assert_eq!(edges, edges0);
|
||||
assert_eq!(sources_looks(&s, g), sources0);
|
||||
@@ -4634,12 +4639,14 @@ fn live_paint_group_invert_recolors_the_faces_fill() {
|
||||
s.execute("paint.invert", &json!({"stroke": true, "target": "contents"})).unwrap();
|
||||
let (faces1, edges1) = part_looks(&s, g);
|
||||
assert_eq!(faces1, faces);
|
||||
assert_eq!(edges1.len(), edges.len());
|
||||
assert!(edges1.iter().all(|e| e.stroke_paint() == Paint::solid(Color::WHITE)));
|
||||
assert_eq!(sources_looks(&s, g), sources0);
|
||||
// A gradient edit of the fill goes to the faces only.
|
||||
s.execute("paint.setFill", &json!({"gradient": {}})).unwrap();
|
||||
s.execute("paint.editGradient", &json!({"stroke": false, "angle": 45})).unwrap();
|
||||
let (faces2, edges2) = part_looks(&s, g);
|
||||
assert_eq!(faces2.len(), 3);
|
||||
assert!(faces2.iter().all(|f| matches!(f.fill_paint(), Paint::Gradient(_))));
|
||||
assert_eq!(edges2, edges1, "edges take no fill gradient");
|
||||
assert_eq!(sources_looks(&s, g), sources0);
|
||||
@@ -4674,7 +4681,9 @@ fn live_paint_group_gradient_vector_and_freeform_edits_change_its_faces() {
|
||||
assert_eq!(sources_looks(&s, g), sources0);
|
||||
s.execute("paint.setFill", &json!({"gradient": {"kind": "freeform"}})).unwrap();
|
||||
s.execute("paint.freeform.addPoint", &json!({"stroke": false, "at": [25, 50], "color": "#00ff00"})).unwrap();
|
||||
assert!(part_looks(&s, g).0.iter().all(|f| matches!(f.fill_paint(), Paint::Gradient(gr) if gr.freeform.is_some())));
|
||||
let faces_now = part_looks(&s, g).0;
|
||||
assert_eq!(faces_now.len(), face_ids.len());
|
||||
assert!(faces_now.iter().all(|f| matches!(f.fill_paint(), Paint::Gradient(gr) if gr.freeform.is_some())));
|
||||
assert_eq!(part_looks(&s, g).1, edges0);
|
||||
assert_eq!(sources_looks(&s, g), sources0);
|
||||
}
|
||||
@@ -4944,16 +4953,19 @@ fn live_paint_group_contents_edits_follow_the_group_rule() {
|
||||
let sources0 = sources_looks(&s, g);
|
||||
s.execute("appearance.addFill", &json!({"target": "contents"})).unwrap();
|
||||
let (faces1, edges1) = part_looks(&s, g);
|
||||
assert_eq!((faces0.len(), faces1.len(), edges0.len() >= 4), (3, 3, true), "{}", edges0.len());
|
||||
assert!(faces1.iter().zip(&faces0).all(|(f, f0)| f.items.len() == f0.items.len() + 1), "every face takes a new fill");
|
||||
assert_eq!(edges1, edges0, "edges take no new fill");
|
||||
s.execute("appearance.addStroke", &json!({"target": "contents"})).unwrap();
|
||||
let (faces2, edges2) = part_looks(&s, g);
|
||||
assert_eq!(faces2, faces1, "faces take no new stroke");
|
||||
assert_eq!(edges2.len(), edges1.len());
|
||||
assert!(edges2.iter().zip(&edges1).all(|(e, e0)| e.items.len() == e0.items.len() + 1), "every edge takes a new stroke");
|
||||
// A stroke row edit of the contents reaches the edges, not the faces.
|
||||
s.execute("stroke.set", &json!({"target": "contents", "item": 0, "weight": 7})).unwrap();
|
||||
let (faces3, edges3) = part_looks(&s, g);
|
||||
assert_eq!(faces3, faces2, "faces keep their rows");
|
||||
assert_eq!(edges3.len(), edges2.len());
|
||||
assert!(edges3.iter().all(|e| e.stroke_at(Some(0)).map(|st| st.width) == Some(7.0)), "every edge's stroke row takes the weight");
|
||||
s.execute("appearance.clear", &json!({"target": "contents"})).unwrap();
|
||||
assert_eq!(sources_looks(&s, g), sources0, "the hidden source paths keep their appearance");
|
||||
@@ -5203,6 +5215,7 @@ fn live_paint_group_contents_take_a_graphic_style_by_kind() {
|
||||
s.execute("graphicStyle.apply", &json!({"name": "Both", "target": "contents", "add": add})).unwrap();
|
||||
assert!(parts_hold_their_kind(&s, g), "add {add}: faces hold fills and edges strokes");
|
||||
let (faces, edges) = part_looks(&s, g);
|
||||
assert_eq!((faces.len(), edges.len() >= 4), (3, true), "add {add}: {}", edges.len());
|
||||
assert!(faces.iter().all(|a| a.items.iter().any(|it| *it.paint() == red)), "add {add}: each face takes the style's fill");
|
||||
assert!(edges.iter().all(|a| a.items.iter().any(|it| *it.paint() == blue)), "add {add}: each edge takes the style's stroke");
|
||||
let n = node(&s, g);
|
||||
@@ -6199,6 +6212,7 @@ fn live_paint_bucket_edge_double_click_after_filling_a_face_paints_the_joined_ed
|
||||
let black = Paint::solid(Color::rgb(0.0, 0.0, 0.0));
|
||||
let green = Paint::solid(Color::from_hex("#00ff00").unwrap());
|
||||
let all = edges_in(&s, g, Rect::new(-1.0, -1.0, 101.0, 51.0));
|
||||
assert!(all.len() >= 3, "the outline and the shared edge: {all:?}");
|
||||
paint_parts(&mut s, &all, &black, &[(a, black.clone()), (b, black.clone())]);
|
||||
let v = ViewInfo::default();
|
||||
s.select_tool("livePaintBucket", v).unwrap();
|
||||
@@ -9217,16 +9231,23 @@ fn image_trace_refuses_an_unknown_setting() {
|
||||
}
|
||||
}
|
||||
|
||||
/// Every preset's settings, as imageTrace.presets lists them, trace when passed back whole.
|
||||
/// A preset's settings, as imageTrace.presets lists them, trace when passed back whole, and the
|
||||
/// trace keeps them: a preset with an enhanced version, both ways, and a preset without one.
|
||||
#[test]
|
||||
fn image_trace_takes_every_preset_back_as_params() {
|
||||
fn image_trace_takes_a_preset_back_as_params() {
|
||||
let list = session().execute("imageTrace.presets", &json!({})).unwrap();
|
||||
for preset in list["presets"].as_array().unwrap() {
|
||||
for params in [&preset["params"], &preset["enhanced"]].into_iter().filter(|p| !p.is_null()) {
|
||||
let mut s = session();
|
||||
image_doc(&mut s);
|
||||
let r = s.execute("imageTrace.make", &json!({"preset": preset["name"], "params": params}));
|
||||
assert!(r.is_ok(), "{}: {r:?}", preset["name"]);
|
||||
let preset = |name: &str| list["presets"].as_array().unwrap().iter().find(|p| p["name"] == name).unwrap().clone();
|
||||
let (six, flat) = (preset("6 Colors"), preset("Flat Logo"));
|
||||
for (name, params) in [("6 Colors", &six["params"]), ("6 Colors", &six["enhanced"]), ("Flat Logo", &flat["params"])] {
|
||||
let mut s = session();
|
||||
image_doc(&mut s);
|
||||
let r = s.execute("imageTrace.make", &json!({"preset": name, "params": params})).unwrap();
|
||||
let stored = node(&s, NodeId(r["id"].as_u64().unwrap())).extras().trace.clone().unwrap();
|
||||
assert_eq!(stored["preset"], name);
|
||||
let given = params.as_object().unwrap();
|
||||
assert!(given.len() > 1, "{name}: {params}");
|
||||
for (key, value) in given {
|
||||
assert_eq!(&stored["params"][key], value, "{name}: `{key}` is kept");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,5 +87,10 @@ fn nothing_is_cancelled_outside_a_scope() {
|
||||
token.cancel();
|
||||
// The token only counts for work run under it, on its thread.
|
||||
let mut s = session(1);
|
||||
assert!(s.execute("document.exportPdf", &json!({})).is_ok());
|
||||
let r = cancel::scope(&token, None, || s.execute("document.exportPdf", &json!({})));
|
||||
assert!(matches!(r, Err(EngineError::Cancelled)), "under the token: {r:?}");
|
||||
let r = s.execute("document.exportPdf", &json!({})).unwrap();
|
||||
let bytes = vectorcraft_format::base64_decode(r["dataBase64"].as_str().unwrap()).unwrap();
|
||||
assert!(bytes.starts_with(b"%PDF-"), "outside it the whole file is written");
|
||||
assert!(bytes.ends_with(b"%%EOF"), "to its end");
|
||||
}
|
||||
|
||||
@@ -155,5 +155,7 @@ fn type_as_a_clipping_path_paints_its_characters() {
|
||||
let p = paint(&s);
|
||||
assert!(p.stroke.is_none());
|
||||
let NodeKind::Text(fill) = &p.fill.expect("the characters' fill paints").kind else { panic!("type") };
|
||||
assert!(fill.runs.iter().all(|r| r.style.fill.color().is_some() && r.style.stroke.is_none()));
|
||||
assert_eq!(fill.plain_text(), "Clip");
|
||||
let blue = vectorcraft_color::Color::from_hex("#0000ff");
|
||||
assert!(!fill.runs.is_empty() && fill.runs.iter().all(|r| r.style.fill.color() == blue && r.style.stroke.is_none()), "{:?}", fill.runs);
|
||||
}
|
||||
|
||||
@@ -739,7 +739,9 @@ fn separations_preview_compares_the_visible_plates_as_a_set() {
|
||||
assert_eq!(sep(&mut s, json!({"plates": ["Cyan", "Magenta", "Yellow", "Black"]})), all, "every plate in plate order");
|
||||
sep(&mut s, json!({"plates": ["Cyan", "Cyan"]}));
|
||||
let r = s.execute("view.separationsPreview", &json!({"toggle": "Cyan"})).unwrap();
|
||||
assert!(r["plates"].as_array().unwrap().iter().all(|p| p["visible"] == false), "{r}");
|
||||
let plates = r["plates"].as_array().unwrap();
|
||||
assert_eq!(plates.len(), 4, "{r}");
|
||||
assert!(plates.iter().all(|p| p["visible"] == false), "{r}");
|
||||
}
|
||||
|
||||
/// Each plate's visibility in a `view.separationsPreview` or `color.plates` reply, in plate order.
|
||||
|
||||
@@ -345,7 +345,9 @@ fn constrain_angle_turns_the_new_objects_bounding_box() {
|
||||
let id =
|
||||
NodeId(s.execute("shape.polarGrid", &json!({"x": 0, "y": 0, "width": 40, "height": 20, "rotation": -30})).unwrap()["id"].as_u64().unwrap());
|
||||
let n = s.doc().unwrap().doc.node(id).unwrap().clone();
|
||||
assert!(n.children().unwrap().iter().all(|c| close(c.bbox_angle, 30.0)));
|
||||
let lines = n.children().unwrap();
|
||||
assert!(lines.len() > 1, "{}", lines.len());
|
||||
assert!(lines.iter().all(|c| close(c.bbox_angle, 30.0)));
|
||||
s.execute("text.create", &json!({"x": 10, "y": 20, "text": "Hi", "rotation": -30})).unwrap();
|
||||
assert!(close(selection_rotation(&s), 30.0));
|
||||
s.execute("text.create", &json!({"x": 10, "y": 20, "text": "Hi"})).unwrap();
|
||||
|
||||
@@ -1350,7 +1350,9 @@ fn a_stroke_on_a_picked_type_object_without_a_weight_draws() {
|
||||
s.execute("paint.setStroke", &json!({"color": "#ff0000"})).unwrap();
|
||||
let part = s.doc().unwrap().selected_symbol_part().unwrap();
|
||||
let NodeKind::Text(tx) = &part.kind else { panic!("type: {part:?}") };
|
||||
assert!(tx.runs.iter().all(|r| r.style.stroke_width == 1.0 && !r.style.stroke.is_none()), "{:?}", tx.runs);
|
||||
assert_eq!(tx.plain_text(), "Hi");
|
||||
let red = Paint::solid(vectorcraft_color::Color::from_hex("#ff0000").unwrap());
|
||||
assert!(!tx.runs.is_empty() && tx.runs.iter().all(|r| r.style.stroke_width == 1.0 && r.style.stroke == red), "{:?}", tx.runs);
|
||||
}
|
||||
|
||||
/// The colors the Fill and Stroke proxies show, as `paint.proxies` replies them.
|
||||
|
||||
@@ -115,7 +115,9 @@ fn cmyk_stops_recolor_the_points_with_inks() {
|
||||
let id = shape(&mut s, "shape.rectangle", 100.0, 100.0, 100.0, 100.0);
|
||||
run(&mut s, "paint.setFill", json!({"gradient": {"kind": "linear", "stops": cyan_to_black}}));
|
||||
run(&mut s, "paint.editGradient", json!({"kind": "freeform"}));
|
||||
assert!(points(&s, id).points.iter().all(|p| cyan_and_black(p.color)), "{:?}", points(&s, id).points);
|
||||
let placed = points(&s, id).points;
|
||||
assert!(!placed.is_empty());
|
||||
assert!(placed.iter().all(|p| cyan_and_black(p.color)), "{placed:?}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -181,6 +183,7 @@ fn reapplied_gradients_place_their_points_afresh() {
|
||||
let other = shape(&mut s, "shape.rectangle", 400.0, 300.0, 100.0, 100.0);
|
||||
run(&mut s, "paint.lastGradient", json!({}));
|
||||
let (a, (b, _)) = (points(&s, id), node(&s, other).proxy_freeform(false, None).unwrap());
|
||||
assert!(!a.points.is_empty() && b.points.len() == a.points.len(), "{:?}", b.points);
|
||||
assert!(b.points.iter().all(|p| p.at.x >= 400.0 && p.at.y >= 300.0), "{:?}", b.points);
|
||||
assert_eq!(a.points.iter().map(|p| p.color.to_hex()).collect::<Vec<_>>(), b.points.iter().map(|p| p.color.to_hex()).collect::<Vec<_>>());
|
||||
}
|
||||
|
||||
@@ -38,8 +38,11 @@ fn new_gradient_defaults_follow_the_cmyk_document_mode() {
|
||||
let id = rect(&mut s, 10.0, 10.0, 100.0, 100.0);
|
||||
s.execute("paint.editGradient", &json!({"kind":kind})).unwrap();
|
||||
let g = fill_gradient(&s, id);
|
||||
assert!(g.gradient.stops.len() >= 2, "{kind}: {:?}", g.gradient.stops);
|
||||
assert!(g.gradient.stops.iter().all(|stop| matches!(stop.color, Color::Cmyk { .. })), "{kind}: {:?}", g.gradient.stops);
|
||||
assert_eq!(g.freeform.is_some(), kind == "freeform", "{kind}");
|
||||
if let Some(freeform) = g.freeform {
|
||||
assert!(!freeform.points.is_empty());
|
||||
assert!(freeform.points.iter().all(|point| matches!(point.color, Color::Cmyk { .. })), "freeform points must use the same color model");
|
||||
}
|
||||
}
|
||||
@@ -52,6 +55,7 @@ fn editing_an_explicit_rgb_gradient_in_cmyk_keeps_its_color_model() {
|
||||
let id = rect(&mut s, 10.0, 10.0, 100.0, 100.0);
|
||||
s.execute("paint.editGradient", &json!({"kind":"linear","keepModel":true})).unwrap();
|
||||
let before = fill_gradient(&s, id).gradient.stops;
|
||||
assert_eq!(before.len(), 2, "{before:?}");
|
||||
assert!(before.iter().all(|stop| matches!(stop.color, Color::Rgb { .. })));
|
||||
s.execute("paint.editGradient", &json!({"angle":45})).unwrap();
|
||||
assert_eq!(fill_gradient(&s, id).gradient.stops, before);
|
||||
@@ -67,6 +71,7 @@ fn drawing_a_new_gradient_vector_uses_cmyk_default_stops() {
|
||||
let appearance = &node(&s, id).appearance;
|
||||
let paint = if stroke { appearance.stroke_paint() } else { appearance.fill_paint() };
|
||||
let Paint::Gradient(g) = paint else { panic!("not a gradient") };
|
||||
assert_eq!(g.gradient.stops.len(), 2, "stroke={stroke}: {:?}", g.gradient.stops);
|
||||
assert!(g.gradient.stops.iter().all(|stop| matches!(stop.color, Color::Cmyk { .. })), "stroke={stroke}: {:?}", g.gradient.stops);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,10 +25,15 @@ fn ids_stand_in_for_the_selection() {
|
||||
("object.makePixelPerfect", json!({})),
|
||||
] {
|
||||
let (mut s, id) = doc_with_rect();
|
||||
assert!(s.execute(cmd, ¶ms).is_err(), "{cmd}: nothing selected and no ids");
|
||||
let (before, undo) = (s.doc().unwrap().doc.clone(), s.doc().unwrap().history.undo.len());
|
||||
let mut p = params;
|
||||
p["ids"] = json!([id]);
|
||||
let r = s.execute(cmd, &p);
|
||||
assert!(r.is_ok(), "{cmd}: {r:?}");
|
||||
let st = s.doc().unwrap();
|
||||
assert_ne!(st.doc, before, "{cmd}: the object given is changed");
|
||||
assert_eq!(st.history.undo.len(), undo + 1, "{cmd}: one undo step");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -174,10 +174,10 @@ fn guides_align_to_a_key_object_among_others_and_parallel_ones_to_a_key_guide()
|
||||
s.execute("select.key", &json!({"id": b.0})).unwrap();
|
||||
s.execute("object.align", &json!({"horizontal": "left"})).unwrap();
|
||||
assert_eq!(bounds(&s, a).x0, 300.0);
|
||||
assert!(positions(&s).iter().all(|p| *p == 300.0));
|
||||
assert_eq!(positions(&s), [300.0, 300.0], "both guides");
|
||||
// Aligning to the selection leaves guides alone.
|
||||
s.execute("object.align", &json!({"horizontal": "right", "to": "selection"})).unwrap();
|
||||
assert!(positions(&s).iter().all(|p| *p == 300.0));
|
||||
assert_eq!(positions(&s), [300.0, 300.0]);
|
||||
// A key guide stays put, and the other vertical guide lines up on it.
|
||||
s.execute("guide.move", &json!({"index": 1, "pos": 700})).unwrap();
|
||||
s.execute("select.key", &json!({"guide": 1})).unwrap();
|
||||
|
||||
@@ -4113,7 +4113,8 @@ fn smart_punctuation_with_nothing_to_change_records_no_undo_step() {
|
||||
let before = history(&s);
|
||||
let r = s.execute("type.smartPunctuation", &json!({})).unwrap();
|
||||
assert_eq!(r["changed"], 0, "{id:?}");
|
||||
assert!(r["replaced"].as_object().unwrap().values().all(|n| n == 0), "{id:?}: {r}");
|
||||
let none = json!({"fiLigatures": 0, "flLigatures": 0, "quotes": 0, "spaces": 0, "dashes": 0, "ellipses": 0, "fractions": 0});
|
||||
assert_eq!(r["replaced"], none, "{id:?}: {r}");
|
||||
assert_eq!(history(&s), before, "{id:?}");
|
||||
}
|
||||
assert_eq!(plain(&s, t), "“Hi” it’s 1–2 and 3—4…");
|
||||
|
||||
@@ -269,7 +269,8 @@ fn overprint_black_covers_type_gradients_spots_and_groups() {
|
||||
|
||||
s.execute("edit.colors.overprintBlack", &json!({})).unwrap();
|
||||
let NodeKind::Text(tx) = &node(&s, t).kind else { panic!() };
|
||||
assert!(tx.runs.iter().all(|r| r.style.overprint_fill), "type characters, inside the selected group");
|
||||
assert_eq!(tx.plain_text(), "Hi");
|
||||
assert!(!tx.runs.is_empty() && tx.runs.iter().all(|r| r.style.overprint_fill), "type characters, inside the selected group");
|
||||
let fill = |s: &Session, id| node(s, id).appearance.fill().unwrap().overprint;
|
||||
assert!(!fill(&s, g), "a gradient with a rich-black stop");
|
||||
assert!(!fill(&s, spot), "spot blacks need includeSpotBlacks");
|
||||
|
||||
@@ -78,7 +78,9 @@ fn two_links_and_a_font_are_collected_and_relinked() {
|
||||
s.doc().unwrap().doc.visit_images(|_, im| paths.push(im.link.clone().unwrap()));
|
||||
paths
|
||||
};
|
||||
assert!(link(&s).iter().all(|l| l.path.contains("art")));
|
||||
let links = link(&s);
|
||||
assert_eq!(links.len(), 2, "{links:?}");
|
||||
assert!(links.iter().all(|l| l.path.contains("art")), "{links:?}");
|
||||
// The packaged one opens with the copies, even with the originals gone.
|
||||
std::fs::remove_dir_all(dir.0.join("art")).unwrap();
|
||||
let r = open(&mut s, &root.join("poster.vectorcraft").to_string_lossy());
|
||||
|
||||
@@ -1794,12 +1794,16 @@ fn commands_reject_bad_input() {
|
||||
("object.path.offsetPath", json!({"offset": "abc"})),
|
||||
("object.path.offsetPath", json!({"offset": 1e300})),
|
||||
("object.path.simplify", json!({"tolerance": -5})),
|
||||
("object.path.simplify", json!({"level": 101})),
|
||||
("object.path.splitIntoGrid", json!({"rows": 1e9, "columns": -1})),
|
||||
("text.setStyle", json!({"size": -3})),
|
||||
("type.createOutlines", json!({})),
|
||||
("object.pathfinder.divide", json!({"junk": [1, 2]})),
|
||||
] {
|
||||
let _ = s.execute(c, &p);
|
||||
let (before, undo) = (s.doc().unwrap().doc.clone(), s.doc().unwrap().history.undo.len());
|
||||
let r = s.execute(c, &p);
|
||||
assert!(r.is_err(), "{c} {p}: {r:?}");
|
||||
assert_eq!((&s.doc().unwrap().doc, s.doc().unwrap().history.undo.len()), (&before, undo), "{c} {p}: nothing changes");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1087,13 +1087,17 @@ fn delete_and_rename_reach_a_graphs_stored_paints() {
|
||||
let mut s = session();
|
||||
make_dots(&mut s);
|
||||
let g = graph_painted_with(&mut s, "Dots");
|
||||
assert_eq!(stored_graph_paints(&s, g).len(), 4, "the series fill and stroke and the value labels' fill and stroke");
|
||||
s.execute("pattern.options", &json!({"name": "Dots", "newName": "Spots"})).unwrap();
|
||||
assert!(stored_graph_paints(&s, g).iter().all(|p| is_pattern(p, "Spots")), "the rename reaches the graph");
|
||||
let renamed = stored_graph_paints(&s, g);
|
||||
assert!(renamed.len() == 4 && renamed.iter().all(|p| is_pattern(p, "Spots")), "the rename reaches the graph: {renamed:?}");
|
||||
s.execute("edit.undo", &json!({})).unwrap();
|
||||
assert!(stored_graph_paints(&s, g).iter().all(|p| is_pattern(p, "Dots")));
|
||||
let back = stored_graph_paints(&s, g);
|
||||
assert!(back.len() == 4 && back.iter().all(|p| is_pattern(p, "Dots")), "{back:?}");
|
||||
let v = s.execute("pattern.delete", &json!({"name": "Dots"})).unwrap();
|
||||
assert_eq!(v["unpainted"], 4, "the series fill and stroke and the value labels' fill and stroke");
|
||||
assert!(stored_graph_paints(&s, g).iter().all(Paint::is_none));
|
||||
let cleared = stored_graph_paints(&s, g);
|
||||
assert!(cleared.len() == 4 && cleared.iter().all(Paint::is_none), "{cleared:?}");
|
||||
s.execute("graph.setData", &json!({"id": g.0, "rows": [[2], [4]]})).unwrap();
|
||||
assert_eq!(pattern_uses(doc(&s), "Dots"), 0, "the redrawn graph holds no paint of the deleted pattern");
|
||||
}
|
||||
|
||||
@@ -496,12 +496,14 @@ fn snap_to_grid_lands_drawn_and_moved_art_on_gridlines() {
|
||||
let n = s.doc().unwrap().doc.node(id).unwrap().path_data().unwrap().clone();
|
||||
n.anchors().map(|(_, _, an)| g.to_plane(Plane::Left, an.p).unwrap()).collect()
|
||||
};
|
||||
assert!(corners(&s).iter().all(|q| on_line(q.x) && on_line(q.y)), "{:?}", corners(&s));
|
||||
let drawn = corners(&s);
|
||||
assert!(drawn.len() == 4 && drawn.iter().all(|q| on_line(q.x) && on_line(q.y)), "{drawn:?}");
|
||||
// Moved a cell and a bit: it lands a whole cell over.
|
||||
let from = g.to_page(Plane::Left, Point::new(3.0 * g.cell, 2.0 * g.cell)).unwrap();
|
||||
let to = g.to_page(Plane::Left, Point::new(4.0 * g.cell + 2.0, 2.0 * g.cell)).unwrap();
|
||||
run(&mut s, "perspective.move", json!({"ids": [id.0], "from": [from.x, from.y], "to": [to.x, to.y]}));
|
||||
assert!(corners(&s).iter().all(|q| on_line(q.x) && on_line(q.y)), "{:?}", corners(&s));
|
||||
let moved = corners(&s);
|
||||
assert!(moved.len() == 4 && moved.iter().all(|q| on_line(q.x) && on_line(q.y)), "{moved:?}");
|
||||
// Without snapping it moves exactly.
|
||||
let before = corners(&s);
|
||||
run(&mut s, "perspective.move", json!({"ids": [id.0], "from": [from.x, from.y], "to": [to.x, to.y], "snap": false}));
|
||||
|
||||
@@ -205,6 +205,7 @@ fn stroke_edits_keep_it_aligned() {
|
||||
assert!(whole(&points(&s, id)), "{:?}", points(&s, id));
|
||||
s.execute("stroke.set", &json!({"weight": 3})).unwrap();
|
||||
let pts = points(&s, id);
|
||||
assert_eq!(pts.len(), 4, "{pts:?}");
|
||||
assert!(pts.iter().all(|(x, y)| (x - x.floor() - 0.5).abs() < 1e-9 && (y - y.floor() - 0.5).abs() < 1e-9), "{pts:?}");
|
||||
// Inside alignment puts the stroke within the path, so the anchors go back to whole points.
|
||||
s.execute("stroke.set", &json!({"align": "inside"})).unwrap();
|
||||
@@ -763,8 +764,10 @@ fn objects_on_path_members_stay_on_the_grid() {
|
||||
// Editing the path places the member again, and it goes back on the grid.
|
||||
let anchors = json!([{"x": 0.6, "y": 120.7}, {"x": 300.6, "y": 120.7}]);
|
||||
s.execute("path.setAnchors", &json!({"id": spine, "subpaths": [{"anchors": anchors, "closed": false}]})).unwrap();
|
||||
assert!(whole(&points(&s, a)), "path edited: {:?}", points(&s, a));
|
||||
assert!(points(&s, a).iter().all(|(_, y)| *y > 105.0), "followed the path: {:?}", points(&s, a));
|
||||
let placed = points(&s, a);
|
||||
assert_eq!(placed.len(), 4, "{placed:?}");
|
||||
assert!(whole(&placed), "path edited: {placed:?}");
|
||||
assert!(placed.iter().all(|(_, y)| *y > 105.0), "followed the path: {placed:?}");
|
||||
}
|
||||
|
||||
fn align_new(s: &Session) -> bool {
|
||||
@@ -1465,6 +1468,7 @@ fn an_instance_snapped_to_the_grid_moves_its_linked_mask() {
|
||||
assert!(whole(&[(e, f)]) && (e, f) != (e0, f0), "{e} {f}");
|
||||
let moved: Vec<_> = mask_before.iter().map(|(x, y)| (x + e - e0, y + f - f0)).collect();
|
||||
let after = mask_points(&s, linked);
|
||||
assert!(!moved.is_empty() && after.len() == moved.len(), "{after:?} != {moved:?}");
|
||||
assert!(moved.iter().zip(&after).all(|(a, b)| close(*a, *b)), "{after:?} != {moved:?}");
|
||||
assert!(whole(&placed_points(&s, unlinked)));
|
||||
assert_eq!(mask_points(&s, unlinked), unlinked_before);
|
||||
|
||||
@@ -1916,19 +1916,6 @@ fn refresh_takes_objects_in_definition_art() {
|
||||
assert_eq!(listed(&mut s), [kept.0]);
|
||||
}
|
||||
|
||||
/// `CRAFT_PLUGIN_PAINTS_WASM=<folder>` saves a test live effect to try in the app
|
||||
/// (`stroke-width-test-effect.wasm`): it draws a triangle over the area 100,80–300,230 while its
|
||||
/// object's stroke is 5 pt wide, and hands the geometry back otherwise.
|
||||
#[test]
|
||||
fn stroke_width_test_effect() {
|
||||
let Some(dir) = std::env::var_os("CRAFT_PLUGIN_PAINTS_WASM") else { return };
|
||||
let triangle = PathData::single(SubPath::polyline(&[Point::new(100.0, 230.0), Point::new(300.0, 230.0), Point::new(200.0, 80.0)], true));
|
||||
let manifest = r#"{"id":"org.example.strokewidth","name":"Stroke Width (test plug-in)","version":"1","kind":"effect",
|
||||
"description":"Draws a triangle while the object's stroke is 5 pt wide.","params":{}}"#;
|
||||
let src = tpl::when_given(manifest, tpl::Given::Input, r#""width":5.0"#, &json!({"objects": [{"path": triangle}]}).to_string());
|
||||
std::fs::write(std::path::Path::new(&dir).join("stroke-width-test-effect.wasm"), wat::parse_str(src).unwrap()).unwrap();
|
||||
}
|
||||
|
||||
/// A filter is given its objects' effect records and their strokes' join, cap and miter limit, and
|
||||
/// may return them. The records are admitted as effect.apply would admit them; one that isn't
|
||||
/// refuses the whole output, and nothing changes.
|
||||
@@ -1978,26 +1965,6 @@ fn filters_set_effects_and_stroke_styles() {
|
||||
}
|
||||
}
|
||||
|
||||
/// `CRAFT_PLUGIN_FRAME_WASM=<folder>` saves a test filter to try in the app
|
||||
/// (`rough-frame-test-filter.wasm`): it adds a frame around 60,40–340,260 with a 6 pt stroke with
|
||||
/// round joins and caps, roughened by the Roughen effect.
|
||||
#[test]
|
||||
fn rough_frame_test_filter() {
|
||||
let Some(dir) = std::env::var_os("CRAFT_PLUGIN_FRAME_WASM") else { return };
|
||||
let frame = PathData::single(SubPath::polyline(
|
||||
&[Point::new(60.0, 40.0), Point::new(340.0, 40.0), Point::new(340.0, 260.0), Point::new(60.0, 260.0)],
|
||||
true,
|
||||
));
|
||||
let ink = json!({"type": "solid", "color": {"model": "rgb", "r": 0.15, "g": 0.2, "b": 0.45}});
|
||||
let out = json!({"objects": [{"name": "Frame", "path": frame, "fills": [],
|
||||
"strokes": [{"paint": ink, "width": 6, "join": "round", "cap": "round"}],
|
||||
"effects": [{"id": "distort.roughen", "params": {"size": 2, "detail": 8, "points": "smooth"}}]}]});
|
||||
let manifest = r#"{"id":"org.example.frame","name":"Rough Frame (test plug-in)","version":"1","kind":"filter",
|
||||
"description":"Adds a frame whose stroke is roughened by the Roughen effect.","params":{}}"#;
|
||||
let src = tpl::returning(manifest, &out.to_string());
|
||||
std::fs::write(std::path::Path::new(&dir).join("rough-frame-test-filter.wasm"), wat::parse_str(src).unwrap()).unwrap();
|
||||
}
|
||||
|
||||
/// A filter keeps data with the document: it writes it with `documentData` in the same undo step as
|
||||
/// its objects (`null` removes it) and reads what it last wrote in `_context.documentData`, which
|
||||
/// no other filter is given. It is the document's foreign data, so the native file keeps it with
|
||||
@@ -2177,11 +2144,13 @@ fn plugins_folder_set_again_after_clearing_installs_its_plugins() {
|
||||
let mut s = session();
|
||||
let folder = json!({"key": "pluginsFolder", "value": dir.0.display().to_string()});
|
||||
run(&mut s, "prefs.set", folder.clone());
|
||||
assert!(vectorcraft_plugins::registry::get(id).is_some(), "installed from the folder");
|
||||
assert_eq!(run(&mut s, "plugin.list", json!({}))["folder"]["loaded"], json!([id]), "installed from the folder");
|
||||
run(&mut s, "plugin.remove", json!({"id": id}));
|
||||
assert!(vectorcraft_plugins::registry::get(id).is_none());
|
||||
run(&mut s, "prefs.set", json!({"key": "pluginsFolder", "value": ""}));
|
||||
assert_eq!(run(&mut s, "plugin.list", json!({}))["folder"]["loaded"], json!(null), "a cleared folder loads nothing");
|
||||
run(&mut s, "prefs.set", folder);
|
||||
assert!(vectorcraft_plugins::registry::get(id).is_some(), "installed again when the folder is set again");
|
||||
assert_eq!(run(&mut s, "plugin.list", json!({}))["folder"]["loaded"], json!([id]), "installed again when the folder is set again");
|
||||
run(&mut s, "plugin.remove", json!({"id": id}));
|
||||
}
|
||||
|
||||
|
||||
@@ -99,6 +99,7 @@ fn a_white_background_makes_effect_images_opaque() {
|
||||
assert_eq!(clear.get_pixel(0, 0)[3], 0, "transparent by default");
|
||||
s.execute(C, &json!({"background": "white"})).unwrap();
|
||||
let white = effect_image(&s.doc().unwrap().doc);
|
||||
assert_eq!(white.dimensions(), clear.dimensions(), "the same image, on white");
|
||||
assert!(white.pixels().all(|p| p[3] == 255), "every pixel is opaque");
|
||||
assert_eq!(white.get_pixel(0, 0).0, [255, 255, 255, 255]);
|
||||
// With a clipping mask, the white stays under the art only.
|
||||
|
||||
@@ -250,7 +250,8 @@ fn used_colors_give_no_swatch_for_a_stop_that_mixes_its_ink_with_process_inks()
|
||||
assert_eq!(entry("cmyk 0 50 30 0")["swatch"], "Ink", "{r}");
|
||||
// recolor.colors keeps the swatch it lists.
|
||||
let listed = run(&mut s, "recolor.colors", json!({}));
|
||||
assert!(listed["colors"].as_array().unwrap().iter().all(|c| c["swatch"] == "Ink"), "{listed}");
|
||||
let colors = listed["colors"].as_array().unwrap();
|
||||
assert!(!colors.is_empty() && colors.iter().all(|c| c["swatch"] == "Ink"), "{listed}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -446,7 +447,9 @@ fn limit_to_library_snaps_new_colours() {
|
||||
let c = color_value(k).unwrap();
|
||||
c.to_rgb().iter().all(|v| ((v * 5.0).round() - v * 5.0).abs() < 1e-3)
|
||||
};
|
||||
assert!(r["map"].as_array().unwrap().iter().all(|row| web(&row["to"])), "{r}");
|
||||
let map = r["map"].as_array().unwrap();
|
||||
assert_eq!(map.len(), 2, "a row for each color: {r}");
|
||||
assert!(map.iter().all(|row| web(&row["to"])), "{r}");
|
||||
run(&mut s, "recolor.apply", json!({"map": {"#f01020": "#f01020"}, "limitTo": "Web Safe 216"}));
|
||||
let hexes: Vec<Value> = run(&mut s, "recolor.colors", json!({}))["colors"].as_array().unwrap().iter().map(|c| c["hex"].clone()).collect();
|
||||
assert!(hexes.contains(&json!("#ff0033")) && !hexes.contains(&json!("#f01020")), "{hexes:?}");
|
||||
@@ -1333,10 +1336,11 @@ fn document_model_converts_the_colours_of_a_group_too() {
|
||||
g.swatches.iter().filter_map(|w| w.paint.color()).collect()
|
||||
};
|
||||
// Group-only edit from the rows, and with explicit group colours.
|
||||
let cmyk = |cs: &[Color]| cs.len() == 1 && cs.iter().all(|c| c.model() == vectorcraft_color::cms::Model::Cmyk);
|
||||
run(&mut s, "recolor.apply", json!({"map": {"cmyk 0 0 0 50": "#ff0000"}, "group": "Theme", "model": "document"}));
|
||||
assert!(group(&s).iter().all(|c| c.model() == vectorcraft_color::cms::Model::Cmyk), "{:?}", group(&s));
|
||||
assert!(cmyk(&group(&s)), "{:?}", group(&s));
|
||||
run(&mut s, "recolor.apply", json!({"map": [], "group": "Theme", "groupColors": ["#00ff00"], "model": "document"}));
|
||||
assert!(group(&s).iter().all(|c| c.model() == vectorcraft_color::cms::Model::Cmyk), "{:?}", group(&s));
|
||||
assert!(cmyk(&group(&s)), "{:?}", group(&s));
|
||||
}
|
||||
|
||||
fn stroke(s: &Session, id: NodeId) -> Color {
|
||||
@@ -1620,7 +1624,7 @@ fn theme_picker_leaves_out_clear_pixels_and_unreadable_images() {
|
||||
let cut = super::menucmds::place_undecodable_png(&mut s);
|
||||
let cb = s.doc().unwrap().doc.node(cut).unwrap().visual_bounds().unwrap();
|
||||
let r = run(&mut s, "recolor.pickTheme", json!({"picks": [{"rect": [cb.x0, cb.y0, cb.x1, cb.y1]}]}));
|
||||
assert!(r["colors"].as_array().unwrap().iter().all(|k| k == "rgb 255 0 0"), "the undecodable image adds nothing: {r}");
|
||||
assert_eq!(r["colors"], json!(["rgb 255 0 0"]), "the undecodable image adds nothing to the red under it: {r}");
|
||||
}
|
||||
|
||||
/// A large image is read through about 65,536 pixels: its palette still holds both halves.
|
||||
|
||||
@@ -2,9 +2,11 @@
|
||||
//! specifiers and paths, the run's limits, and errors at the file they are in.
|
||||
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::time::Duration;
|
||||
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use crate::script::folder::Clock;
|
||||
use crate::*;
|
||||
|
||||
/// A fresh folder for test `name`, with a `main` folder inside it for the script.
|
||||
@@ -217,8 +219,11 @@ fn script_module_is_listed_and_taken_by_path() {
|
||||
write(&root.join("tool.mjs"), "export var a = 1;");
|
||||
let mut s = Session::new();
|
||||
s.attach_scripts_dir(root.clone());
|
||||
// The listing's time limit is checked against a clock that does not move.
|
||||
s.set_script_listing_clock(Clock::Fixed(Duration::ZERO));
|
||||
let listed = s.execute("script.listInstalled", &json!({})).unwrap();
|
||||
assert_eq!(listed["scripts"], json!([{"path": root.join("tool.mjs").to_string_lossy(), "label": "tool", "folders": []}]));
|
||||
assert_eq!(listed["truncated"], false);
|
||||
// A script given as text is not a module, whatever its name.
|
||||
let mut s = Session::new();
|
||||
let r = s.execute("script.run", &json!({"source": "export var a = 1;", "name": "t.mjs"}));
|
||||
|
||||
@@ -260,7 +260,10 @@ fn a_leading_equal_to_the_auto_leading_turns_auto_leading_off() {
|
||||
assert_eq!(out, vec![json!([false, 14.4])]);
|
||||
assert_eq!(undo_steps(&s), before + 1);
|
||||
match &s.active().unwrap().doc.node(id).unwrap().kind {
|
||||
NodeKind::Text(t) => assert!(t.runs.iter().all(|r| r.style.leading.is_some_and(|l| (l - 14.4).abs() < 1e-9)), "{:?}", t.runs),
|
||||
NodeKind::Text(t) => {
|
||||
assert_eq!(t.plain_text(), "abc");
|
||||
assert!(!t.runs.is_empty() && t.runs.iter().all(|r| r.style.leading.is_some_and(|l| (l - 14.4).abs() < 1e-9)), "{:?}", t.runs);
|
||||
}
|
||||
_ => panic!("not text"),
|
||||
}
|
||||
// A fixed leading set to its own value is still no change.
|
||||
@@ -371,7 +374,10 @@ fn turning_auto_leading_off_keeps_each_characters_leading() {
|
||||
assert!(e.contains("autoLeading cannot be turned off"), "{e}");
|
||||
assert_eq!(undo_steps(&s), before);
|
||||
match &s.active().unwrap().doc.node(id).unwrap().kind {
|
||||
NodeKind::Text(t) => assert!(t.runs.iter().all(|r| r.style.leading.is_none())),
|
||||
NodeKind::Text(t) => {
|
||||
assert_eq!(t.plain_text(), "ab\ncd");
|
||||
assert!(!t.runs.is_empty() && t.runs.iter().all(|r| r.style.leading.is_none()), "{:?}", t.runs);
|
||||
}
|
||||
_ => panic!("not text"),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -730,8 +730,7 @@ fn a_temporary_file_starts_private() {
|
||||
|
||||
/// A replaced sidecar that had no access ACL takes none from its folder's default ACL, whose named
|
||||
/// users the sidecar's group bits would let in. The default ACL is set through its extended
|
||||
/// attribute, so the test runs where the `acl` tools are not installed. (Skipped on a file system
|
||||
/// without ACLs.)
|
||||
/// attribute, so the test runs where the `acl` tools are not installed.
|
||||
#[cfg(target_os = "linux")]
|
||||
#[test]
|
||||
fn a_replaced_sidecar_takes_no_inherited_acl() {
|
||||
@@ -752,14 +751,8 @@ fn a_replaced_sidecar_takes_no_inherited_acl() {
|
||||
acl.extend(perm.to_le_bytes());
|
||||
acl.extend(id.to_le_bytes());
|
||||
}
|
||||
match rustix::fs::setxattr(parent, "system.posix_acl_default", &acl, rustix::fs::XattrFlags::empty()) {
|
||||
Ok(()) => {}
|
||||
Err(e) if e == rustix::io::Errno::NOTSUP => {
|
||||
let _ = std::fs::remove_dir_all(base);
|
||||
return;
|
||||
}
|
||||
Err(e) => panic!("setting the default ACL: {e}"),
|
||||
}
|
||||
rustix::fs::setxattr(parent, "system.posix_acl_default", &acl, rustix::fs::XattrFlags::empty())
|
||||
.unwrap_or_else(|e| panic!("setting the default ACL (the temporary folder's file system needs ACLs): {e}"));
|
||||
let mut buf = vec![0u8; 4096];
|
||||
let probe = parent.join("probe");
|
||||
std::fs::write(&probe, b"").unwrap();
|
||||
|
||||
@@ -34,12 +34,10 @@ fn arrow_align_is_set_per_stroke_and_validated() {
|
||||
#[test]
|
||||
fn profiles_come_from_the_preset_catalogue() {
|
||||
let (mut s, id) = session_with_line();
|
||||
for p in WidthProfile::PRESETS {
|
||||
s.execute("stroke.set", &json!({"profile": p.id})).unwrap();
|
||||
let st = stroke(&s, id);
|
||||
assert_eq!(WidthProfile::id_of(st.profile.as_ref()), p.id);
|
||||
}
|
||||
assert!(stroke(&s, id).profile.is_some());
|
||||
s.execute("stroke.set", &json!({"profile": "lens"})).unwrap();
|
||||
assert_eq!(stroke(&s, id).profile.map(|p| p.points), Some(vec![(0.0, 0.0, 0.0), (0.5, 1.0, 1.0), (1.0, 0.0, 0.0)]));
|
||||
s.execute("stroke.set", &json!({"profile": "pinch"})).unwrap();
|
||||
assert_eq!(stroke(&s, id).profile.map(|p| p.points), Some(vec![(0.0, 1.0, 1.0), (0.5, 0.25, 0.25), (1.0, 1.0, 1.0)]));
|
||||
s.execute("stroke.set", &json!({"profile": "uniform"})).unwrap();
|
||||
assert!(stroke(&s, id).profile.is_none(), "uniform is the plain stroke");
|
||||
assert!(s.execute("stroke.set", &json!({"profile": "zigzag"})).is_err());
|
||||
@@ -53,9 +51,12 @@ fn profiles_come_from_the_preset_catalogue() {
|
||||
for a in vectorcraft_doc::Arrowhead::ALL {
|
||||
let name = serde_json::to_value(&a).unwrap();
|
||||
assert!(spec.params.contains(name.as_str().unwrap()), "{name}");
|
||||
s.execute("stroke.set", &json!({"endArrow": name})).unwrap();
|
||||
assert_eq!(stroke(&s, id).end_arrow, Some(a));
|
||||
}
|
||||
s.execute("stroke.set", &json!({"endArrow": "TriangleOpen", "startArrow": "Diamond"})).unwrap();
|
||||
let st = stroke(&s, id);
|
||||
assert_eq!((st.start_arrow, st.end_arrow), (Some(Arrowhead::Diamond), Some(Arrowhead::TriangleOpen)));
|
||||
assert!(s.execute("stroke.set", &json!({"endArrow": "Arrow999"})).is_err());
|
||||
assert_eq!(stroke(&s, id).end_arrow, Some(Arrowhead::TriangleOpen), "a refused name changes nothing");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -125,9 +125,12 @@ fn override_character_color_clears_the_run_fill() {
|
||||
assert_eq!(run(&mut s, "graphicStyle.setOptions", json!({}))["overrideCharColor"], true);
|
||||
let a = text(&mut s, 100.0);
|
||||
run(&mut s, "paint.setFill", json!({"color": "#ff0000", "ids": [a.0]}));
|
||||
assert!(runs(&s, a).iter().all(|(f, _)| *f != Paint::None));
|
||||
let red = Paint::solid(Color::from_hex("#ff0000").unwrap());
|
||||
let painted = runs(&s, a);
|
||||
assert!(!painted.is_empty() && painted.iter().all(|(f, _)| *f == red), "{painted:?}");
|
||||
run(&mut s, "graphicStyle.apply", json!({"name": "Blue", "ids": [a.0]}));
|
||||
assert!(runs(&s, a).iter().all(|(f, st)| *f == Paint::None && *st == Paint::None));
|
||||
let styled = runs(&s, a);
|
||||
assert!(styled.len() == painted.len() && styled.iter().all(|(f, st)| *f == Paint::None && *st == Paint::None), "{styled:?}");
|
||||
assert_eq!(s.doc().unwrap().doc.node(a).unwrap().appearance.fill_paint(), Paint::solid(Color::from_hex("#0000ff").unwrap()));
|
||||
// Off: they keep it (the style's paint draws over them).
|
||||
assert_eq!(run(&mut s, "graphicStyle.setOptions", json!({"overrideCharColor": false}))["overrideCharColor"], false);
|
||||
|
||||
@@ -722,7 +722,8 @@ fn a_cmyk_document_starts_with_cmyk_swatches_and_stores_new_colours_as_cmyk() {
|
||||
json!({"ids": [a.0], "gradient": {"stops": [{"offset": 0, "color": "#ffffff"}, {"offset": 1, "color": "#0000ff"}]}}),
|
||||
);
|
||||
let Paint::Gradient(g) = fill(&s, a) else { panic!("a gradient") };
|
||||
assert!(g.gradient.stops.iter().all(|st| matches!(st.color, Color::Cmyk { .. })));
|
||||
assert_eq!(g.gradient.stops.len(), 2, "{:?}", g.gradient.stops);
|
||||
assert!(g.gradient.stops.iter().all(|st| matches!(st.color, Color::Cmyk { .. })), "{:?}", g.gradient.stops);
|
||||
// A swatch made from a hex colour is CMYK as well; the document round-trips natively.
|
||||
let name = run(&mut s, "swatch.new", json!({"color": "#00ff00"}))["name"].as_str().unwrap().to_string();
|
||||
assert_eq!(doc(&s).swatch(&name).and_then(|w| w.paint.color()), Some(managed(Color::rgb(0.0, 1.0, 0.0))));
|
||||
|
||||
@@ -265,6 +265,7 @@ fn nature_icons_library_places_and_survives_save() {
|
||||
for (i, name) in names.iter().enumerate() {
|
||||
let symbol = &library["symbols"][i];
|
||||
let size = symbol["size"].as_array().unwrap();
|
||||
assert_eq!(size.len(), 2, "{name}: width and height");
|
||||
assert!(size.iter().all(|n| n.as_f64().is_some_and(|n| n.is_finite() && n > 0.0)), "{name}");
|
||||
let added = run(
|
||||
&mut s,
|
||||
|
||||
@@ -161,7 +161,11 @@ fn auto_height_x_composer() {
|
||||
}
|
||||
s.execute("text.setFormat", &json!({"ids": [id.0], "composer": "singleLine"})).unwrap();
|
||||
s.execute("text.setStyle", &json!({"id": id.0, "justify": "justifyAll"})).unwrap();
|
||||
assert!(text(&s, id).paragraph_styles().iter().all(|p| p.composer == Composer::SingleLine && p.justify == Justify::JustifyAll));
|
||||
let t = text(&s, id);
|
||||
assert_eq!(t.paragraph_count(), 2);
|
||||
for k in 0..2 {
|
||||
assert_eq!((t.para_at(k).composer, t.para_at(k).justify), (Composer::SingleLine, Justify::JustifyAll), "paragraph {k}");
|
||||
}
|
||||
assert_tight(&s, id, "justified");
|
||||
}
|
||||
|
||||
|
||||
@@ -323,7 +323,8 @@ fn optical_set_format_clears_existing_pair_override() {
|
||||
let result = s.execute("text.setFormat", &json!({"ids": [id.0], "kerning": "optical"})).unwrap();
|
||||
assert_eq!(result["kerning"], "optical");
|
||||
let t = obj(&s, id);
|
||||
assert!(t.runs.iter().all(|r| r.style.optical_kerning));
|
||||
assert_eq!(t.plain_text(), "III");
|
||||
assert!(!t.runs.is_empty() && t.runs.iter().all(|r| r.style.optical_kerning), "{:?}", t.runs);
|
||||
assert!(t.runs.iter().all(|r| r.style.kerning.is_none()), "choosing Optical clears the manual value");
|
||||
}
|
||||
|
||||
@@ -488,8 +489,10 @@ fn char_style_range_past_u32_styles_nothing() {
|
||||
let mut s = session();
|
||||
let id = text(&mut s, "Hello world");
|
||||
s.execute("charStyle.new", &json!({"name": "Big", "attrs": {"size": 40.0}})).unwrap();
|
||||
let before = obj(&s, id);
|
||||
assert!(!before.runs.is_empty() && before.runs.iter().all(|r| r.style.size == 20.0 && r.style.style_name.is_none()), "{:?}", before.runs);
|
||||
s.execute("charStyle.apply", &json!({"name": "Big", "id": id.0, "start": 1u64 << 32, "end": (1u64 << 32) + 5})).unwrap();
|
||||
assert!(obj(&s, id).runs.iter().all(|r| r.style.size == 20.0 && r.style.style_name.is_none()), "{:?}", obj(&s, id).runs);
|
||||
assert_eq!(obj(&s, id), before, "no character is styled");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -2008,7 +2011,8 @@ fn the_eyedropper_styles_the_whole_story_that_select_all_selected() {
|
||||
let r = s.execute("appearance.copyFrom", &json!({"source": source})).unwrap();
|
||||
assert_eq!(r, json!({"ids": [a.0, b.0]}));
|
||||
for id in [a, b] {
|
||||
assert!(obj(&s, id).runs.iter().all(|r| (r.style.size - 30.0).abs() < 1e-9), "every character of frame {} takes the size", id.0);
|
||||
let runs = obj(&s, id).runs;
|
||||
assert!(!runs.is_empty() && runs.iter().all(|r| (r.style.size - 30.0).abs() < 1e-9), "every character of frame {} takes the size", id.0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2223,7 +2227,8 @@ fn a_type_step_keeps_a_story_that_left_the_edited_frame_selected() {
|
||||
let c = selected_story_moved_into_a_new_frame(&mut s, a, b);
|
||||
// Alt+Right steps the tracking of the selected text, not the kerning at a caret.
|
||||
key(&mut s, ToolKey::Right, Mods { alt: true, ..Mods::default() });
|
||||
assert!(obj(&s, c).runs.iter().all(|r| r.style.tracking > 0.0), "every character of the story takes the step");
|
||||
let runs = obj(&s, c).runs;
|
||||
assert!(!runs.is_empty() && runs.iter().all(|r| r.style.tracking > 0.0), "every character of the story takes the step: {runs:?}");
|
||||
// A key that does nothing leaves it selected as well.
|
||||
key(&mut s, ToolKey::BracketLeft, Mods::default());
|
||||
assert!(third_frame_highlighted(&mut s));
|
||||
@@ -2567,6 +2572,7 @@ fn convert_to_text_in_one_frame_leaves_the_other_frames() {
|
||||
let (ta, tb) = (obj(&s, a), obj(&s, b));
|
||||
assert_eq!(ta.plain_text(), in_a, "the first frame's text is as it was");
|
||||
assert!(ta.para_at(0).list.is_some(), "the first frame stays a list");
|
||||
assert!(tb.paragraph_count() > 1, "{:?}", tb.plain_text());
|
||||
assert!((0..tb.paragraph_count()).all(|k| tb.para_at(k).list.is_none()), "the edited frame leaves its list");
|
||||
assert!(tb.plain_text().contains("\u{2022}\t"), "the edited frame holds its bullets as characters");
|
||||
}
|
||||
@@ -3765,7 +3771,7 @@ fn the_glyph_query_shapes_an_overflowing_character_in_its_paragraph_direction()
|
||||
|
||||
let boxed = create(&mut s, text, rtl, char_ltr, 30.0);
|
||||
let lay = vectorcraft_text::layout(db, &obj(&s, boxed));
|
||||
assert!(lay.glyphs.iter().all(|g| g.byte < 2), "{text:?}: the second paragraph overflows");
|
||||
assert!(!lay.glyphs.is_empty() && lay.glyphs.iter().all(|g| g.byte < 2), "{text:?}: only the first paragraph is laid out");
|
||||
let r = s.execute("text.glyphAlternates", &json!({"id": boxed.0, "start": at})).unwrap();
|
||||
assert_eq!(r["chosen"], json!(face.glyph_for(drawn)), "{text:?}: the glyph drawn when it fits");
|
||||
}
|
||||
|
||||
@@ -123,7 +123,8 @@ fn transform_again_after_a_handle_drag_resizes_the_type_area_again() {
|
||||
assert!(near(r.origin(), Point::ZERO) && (r.width() - 640.0 / 3.0).abs() < 1e-6 && (r.height() - 250.0).abs() < 1e-6, "{r:?}");
|
||||
let t = text(&s, id);
|
||||
assert_eq!(t.xf, Affine::translate((40.0, 40.0)), "the type isn't scaled");
|
||||
assert!(t.runs.iter().all(|r| r.style.size == 12.0));
|
||||
assert_eq!(t.plain_text(), STORY);
|
||||
assert!(!t.runs.is_empty() && t.runs.iter().all(|r| r.style.size == 12.0), "{:?}", t.runs);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -1367,6 +1367,7 @@ fn distort_refuses_corners_type_and_symbol_instances_cannot_follow() {
|
||||
let want = [(0.4, 0.0), (0.6, 0.0), (1.0, 1.0), (0.0, 1.0)].map(|(u, v)| Point::new(b.x0 + u * b.width(), b.y0 + v * b.height()));
|
||||
s.execute("object.distort", &json!({ "corners": want.map(|p| [p.x, p.y]) })).unwrap();
|
||||
let got = drawn_corners(&s, id);
|
||||
assert_eq!(got.len(), 4, "{got:?}");
|
||||
assert!(got.iter().zip(want).all(|(g, w)| g.distance(w) < 1e-3), "{got:?} against {want:?}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//! recursively) opens as editable art, and each artboard is compared with the thumbnail Affinity
|
||||
//! stored in the file. Reports the mean difference per artboard (0–255, both on white); with
|
||||
//! `AFFINITY_SAMPLES_OUT` set, writes each board's thumbnail crop and render side by side there.
|
||||
//! Skipped when `AFFINITY_SAMPLES` is unset (as in CI).
|
||||
//! Ignored by default; run it with `--ignored` and `AFFINITY_SAMPLES` set.
|
||||
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
@@ -28,8 +28,9 @@ fn on_white(p: &[u8]) -> [f64; 3] {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore = "local samples: set AFFINITY_SAMPLES to a folder of Affinity documents"]
|
||||
fn local_affinity_documents_render_like_their_thumbnails() {
|
||||
let Some(root) = std::env::var_os("AFFINITY_SAMPLES").map(PathBuf::from) else { return };
|
||||
let root = PathBuf::from(std::env::var_os("AFFINITY_SAMPLES").expect("AFFINITY_SAMPLES names the folder of documents to check"));
|
||||
let out = std::env::var_os("AFFINITY_SAMPLES_OUT").map(PathBuf::from);
|
||||
let mut paths = Vec::new();
|
||||
files(&root, &mut paths);
|
||||
|
||||
@@ -476,6 +476,7 @@ fn turned_horizontal_dimensions_stay_horizontal() {
|
||||
let mut ys = [d.a.y.round(), d.b.y.round()];
|
||||
ys.sort_by(f64::total_cmp);
|
||||
assert_eq!(ys, [180.0, 280.0]);
|
||||
assert_eq!(path_ends(&s, id)[2].len(), 2, "{:?}", path_ends(&s, id));
|
||||
assert!(path_ends(&s, id)[2].iter().all(|(_, y)| (y - 130.0).abs() < 1e-6), "{:?}", path_ends(&s, id));
|
||||
let line = run(&mut s, "shape.line", json!({"x1":100,"y1":400,"x2":200,"y2":400}))["id"].as_u64().unwrap();
|
||||
let anchor = |anchor: u64| json!({"node":line,"subpath":0,"anchor":anchor});
|
||||
|
||||
@@ -76,10 +76,18 @@ fn a_file_the_import_left_things_out_of_is_not_written_over_unasked() {
|
||||
fn a_file_the_import_read_whole_is_written_over_as_before() {
|
||||
let d = dir("b");
|
||||
let src = d.join("plain.eps");
|
||||
std::fs::write(&src, "%!PS-Adobe-3.0 EPSF-3.0\n%%BoundingBox: 0 0 100 100\n%%EndComments\n0 0 1 0 setcmykcolor 10 10 moveto 14 10 lineto 14 14 lineto closepath fill\nshowpage\n%%EOF\n").unwrap();
|
||||
let original = "%!PS-Adobe-3.0 EPSF-3.0\n%%BoundingBox: 0 0 100 100\n%%EndComments\n0 0 1 0 setcmykcolor 10 10 moveto 14 10 lineto 14 14 lineto closepath fill\nshowpage\n%%EOF\n";
|
||||
std::fs::write(&src, original).unwrap();
|
||||
let mut s = Session::new();
|
||||
s.execute("document.open", &json!({ "path": src.to_string_lossy() })).unwrap();
|
||||
let opened = s.execute("document.open", &json!({ "path": src.to_string_lossy() })).unwrap();
|
||||
assert_eq!(opened["warnings"], json!([]), "{opened}");
|
||||
s.execute("document.export", &json!({ "path": src.to_string_lossy(), "format": "eps" })).unwrap();
|
||||
let written = std::fs::read(&src).unwrap();
|
||||
assert_ne!(written, original.as_bytes(), "the export wrote over the file");
|
||||
let mut again = Session::new();
|
||||
again.execute("document.open", &json!({ "path": src.to_string_lossy() })).unwrap();
|
||||
let doc = &again.doc().unwrap().doc;
|
||||
assert!(doc.layers.iter().any(|l| l.children().is_some_and(|c| !c.is_empty())), "the square is in the file written");
|
||||
std::fs::remove_dir_all(d).ok();
|
||||
}
|
||||
|
||||
|
||||
@@ -209,7 +209,9 @@ fn preflight_resource_font_finding_locates_its_instance() {
|
||||
s.execute("symbol.new", &json!({ "name": "Label" })).unwrap();
|
||||
let r = check(&mut s);
|
||||
let f = r["findings"].as_array().unwrap().iter().find(|f| f["code"] == "missingFont").unwrap();
|
||||
assert!(f["ids"].as_array().unwrap().iter().all(|id| s.doc().unwrap().doc.node(NodeId(id.as_u64().unwrap())).is_some()), "{r}");
|
||||
let ids = f["ids"].as_array().unwrap();
|
||||
assert!(!ids.is_empty(), "the finding names where the font is used: {r}");
|
||||
assert!(ids.iter().all(|id| s.doc().unwrap().doc.node(NodeId(id.as_u64().unwrap())).is_some()), "{r}");
|
||||
}
|
||||
|
||||
struct Folder(std::path::PathBuf);
|
||||
|
||||
@@ -24,14 +24,14 @@ impl FontDb {
|
||||
/// A database holding the bundled fonts, whose system font scan reads `font_dirs` (folders,
|
||||
/// read with their subfolders, and font files) and nothing else.
|
||||
pub fn with_font_dirs(font_dirs: Vec<PathBuf>) -> Self {
|
||||
// No platform folders, font store or font service.
|
||||
let catalog = Catalog::new(FontEnv { os: Os::None, ..FontEnv::default() }).with_font_service(false);
|
||||
// A path that isn't a folder is a font file named by itself, read whatever its name (font
|
||||
// services keep fonts in files without an extension); one that becomes a folder is read as one.
|
||||
let (folders, files): (Vec<PathBuf>, Vec<PathBuf>) = font_dirs.into_iter().partition(|p| p.is_dir());
|
||||
let catalog = catalog.with_lister(Arc::new(move || files.clone()));
|
||||
catalog.set_app_dirs(folders);
|
||||
Self::new(catalog)
|
||||
Self::new(font_dirs_catalog(font_dirs))
|
||||
}
|
||||
|
||||
/// [`FontDb::with_font_dirs`] whose every scan also calls `lister` before it reads a folder,
|
||||
/// for tests that hold a scan until they let it go on.
|
||||
#[cfg(test)]
|
||||
pub(crate) fn with_font_dirs_and_lister(font_dirs: Vec<PathBuf>, lister: craft::font_catalog::Lister) -> Self {
|
||||
Self::new(font_dirs_catalog(font_dirs).with_lister(lister))
|
||||
}
|
||||
|
||||
/// Same scan paths as [`FontDb::global`] (platform lister and font folders), for tests.
|
||||
@@ -418,3 +418,15 @@ impl FontDb {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
/// [`FontDb::with_font_dirs`]'s catalog: it reads `font_dirs` (folders with their subfolders, and
|
||||
/// font files) and no platform folders, font store or font service.
|
||||
fn font_dirs_catalog(font_dirs: Vec<PathBuf>) -> Catalog {
|
||||
let catalog = Catalog::new(FontEnv { os: Os::None, ..FontEnv::default() }).with_font_service(false);
|
||||
// A path that isn't a folder is a font file named by itself, read whatever its name (font
|
||||
// services keep fonts in files without an extension); one that becomes a folder is read as one.
|
||||
let (folders, files): (Vec<PathBuf>, Vec<PathBuf>) = font_dirs.into_iter().partition(|p| p.is_dir());
|
||||
let catalog = catalog.with_lister(Arc::new(move || files.clone()));
|
||||
catalog.set_app_dirs(folders);
|
||||
catalog
|
||||
}
|
||||
|
||||
@@ -502,6 +502,21 @@ impl RetypeIndex {
|
||||
/// all (ranking a glyph by proportion counts as one per contour and one more); once they are
|
||||
/// spent, the glyphs not yet ranked or compared are left out.
|
||||
pub fn near_matches(&self, shape: &BezPath, tolerance: f64) -> Vec<GlyphMatch> {
|
||||
self.near_matches_among(shape, tolerance, None)
|
||||
}
|
||||
|
||||
/// [`Self::near_matches`] among the glyphs of the indexed face with id `face` alone: the 256
|
||||
/// of its glyphs closest to `shape` in proportion, which the glyphs of the other faces cannot
|
||||
/// crowd out. Empty when the index does not hold that face.
|
||||
pub fn near_matches_in(&self, shape: &BezPath, tolerance: f64, face: u32) -> Vec<GlyphMatch> {
|
||||
match self.faces.iter().position(|f| f.id() == face) {
|
||||
Some(i) => self.near_matches_among(shape, tolerance, Some(i)),
|
||||
None => vec![],
|
||||
}
|
||||
}
|
||||
|
||||
/// [`Self::near_matches`], among the glyphs of face `only` (an index into `faces`) when given.
|
||||
fn near_matches_among(&self, shape: &BezPath, tolerance: f64, only: Option<usize>) -> Vec<GlyphMatch> {
|
||||
// NaN too.
|
||||
if tolerance.is_nan() || tolerance <= 0.0 {
|
||||
return vec![];
|
||||
@@ -528,7 +543,7 @@ impl RetypeIndex {
|
||||
Err(now) => seen = now,
|
||||
}
|
||||
};
|
||||
let near = self.ranked_near(&s, &mut work);
|
||||
let near = self.ranked_near(&s, only, &mut work);
|
||||
for (_, e) in near {
|
||||
if work == 0 {
|
||||
break;
|
||||
@@ -572,8 +587,8 @@ impl RetypeIndex {
|
||||
/// proportion, at most [`NEAR_FITS`], closest first: their spread-to-length ratio, and the
|
||||
/// share of the length each contour has, longest first. Ranking a glyph takes one comparison
|
||||
/// per contour, and one more, from `work`; once it is spent, the glyphs not yet ranked are
|
||||
/// left out.
|
||||
fn ranked_near(&self, s: &Signature, work: &mut u64) -> Vec<(f64, &Entry)> {
|
||||
/// left out. With `only`, the glyphs of that face (an index into `faces`) alone.
|
||||
fn ranked_near(&self, s: &Signature, only: Option<usize>, work: &mut u64) -> Vec<(f64, &Entry)> {
|
||||
let Some(list) = self.buckets.get(&s.contours) else { return vec![] };
|
||||
let lo = s.invariant * (1.0 - NEAR_INVARIANT_SLACK);
|
||||
let hi = s.invariant * (1.0 + NEAR_INVARIANT_SLACK);
|
||||
@@ -597,6 +612,9 @@ impl RetypeIndex {
|
||||
let cost = s.contours as u64 + 1;
|
||||
let mut near: Vec<(f64, &Entry)> = vec![];
|
||||
for e in list.iter().skip(start).filter_map(|i| self.entries.get(*i)).take_while(|e| e.sig.invariant <= hi) {
|
||||
if only.is_some_and(|f| e.face != f) {
|
||||
continue;
|
||||
}
|
||||
let Some(left) = work.checked_sub(cost) else { break };
|
||||
*work = left;
|
||||
near.push((apart(e), e));
|
||||
@@ -2106,6 +2124,33 @@ mod tests {
|
||||
assert!(found.len() > MAX_CANDIDATES && has_every_period(&found), "near: {} matches", found.len());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn near_matches_in_one_face_find_its_glyphs_however_many_faces_are_drawn_alike() {
|
||||
// Source Sans 3 Regular last, after 95 copies of it under other names: every face has
|
||||
// several glyphs drawn as the period, far more than the 256 near matching fits in all.
|
||||
let db = FontDb::with_font_dirs(vec![]);
|
||||
for i in 0..MAX_FACES - 1 {
|
||||
let family = format!("Crowd {i} Sans");
|
||||
let postscript = format!("Crowd{i}Sans-Regular");
|
||||
db.add_font(crate::test_fonts::named_copy(false, (&family, "Regular", "Version 1.000", &postscript)).unwrap());
|
||||
}
|
||||
let mut faces: Vec<Arc<FontFace>> = (0..MAX_FACES - 1).map(|i| db.face(&format!("Crowd {i} Sans"), "Regular").unwrap()).collect();
|
||||
let source = db.face("Source Sans 3", "Regular").unwrap();
|
||||
faces.push(source.clone());
|
||||
let gid = source.mapped_chars().iter().find(|(c, _)| *c == '.').map(|(_, g)| *g).unwrap();
|
||||
let period = Affine::translate((100.0, 200.0)) * Affine::scale(0.04) * db.outline_uncached(&source, gid);
|
||||
let simple = simplified(&period, 0.05);
|
||||
let index = RetypeIndex::build_near(&db, faces.clone(), &BTreeSet::new(), &[near_key(&simple).unwrap()]);
|
||||
for face in [&faces[0], &source] {
|
||||
let found = index.near_matches_in(&simple, 0.02, face.id());
|
||||
assert!(found.iter().all(|m| m.face.id() == face.id()), "{}", face.family);
|
||||
assert!(found.iter().any(|m| m.ch == '.') && found.len() <= MAX_CANDIDATES, "{}: {} matches", face.family, found.len());
|
||||
}
|
||||
// A face the index does not hold has no matches.
|
||||
let other = db.face("Inter", "Regular").unwrap();
|
||||
assert!(index.near_matches_in(&simple, 0.02, other.id()).is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_face_past_its_near_share_keeps_the_glyphs_closest_to_the_shapes() {
|
||||
// One glyph of the face is indexed for near matching: the one closest to a simplified o,
|
||||
@@ -2377,12 +2422,12 @@ mod tests {
|
||||
let index = RetypeIndex::build_near(db, [face], &BTreeSet::new(), &[near_key(&shape).unwrap()]);
|
||||
let s = near_signature(&shape).unwrap();
|
||||
let mut all = u64::MAX;
|
||||
let ranked = index.ranked_near(&s, &mut all).len();
|
||||
let ranked = index.ranked_near(&s, None, &mut all).len();
|
||||
assert!(ranked >= 1, "the o is ranked");
|
||||
assert_eq!(u64::MAX - all, ranked as u64 * 3, "each glyph of two contours takes three");
|
||||
// Enough to rank one glyph of two contours and nothing more.
|
||||
let mut work = 4;
|
||||
assert_eq!(index.ranked_near(&s, &mut work).len(), 1);
|
||||
assert_eq!(index.ranked_near(&s, None, &mut work).len(), 1);
|
||||
assert_eq!(work, 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -1936,7 +1936,9 @@ fn all_supplied_craft_font_families_are_registered_without_system_fonts() {
|
||||
return;
|
||||
}
|
||||
let db = FontDb::with_font_dirs(vec![]);
|
||||
for font in CRAFT_FONTS {
|
||||
// The faces the document font database loads: the tab-title face draws document tab titles
|
||||
// alone and is left out.
|
||||
for font in crate::craft_fonts::document_fonts() {
|
||||
let face = db.face(font.family, font.style).unwrap();
|
||||
assert_eq!(face.family, font.family, "{} {}", font.family, font.style);
|
||||
}
|
||||
|
||||
@@ -524,40 +524,28 @@ fn a_background_scan_serves_the_first_lookup() {
|
||||
/// for the scan of the installed fonts: a large library would hold the first frame past the
|
||||
/// first-frame watchdog, and the app would never show its window (#5483). Once the scan ends, the
|
||||
/// list has the installed fonts.
|
||||
#[cfg(unix)]
|
||||
#[test]
|
||||
fn the_menu_family_list_now_does_not_wait_for_the_scan() {
|
||||
let dir = font_dir("held-scan");
|
||||
// A named pipe with a font's name: the scan opens it and waits there until something writes.
|
||||
let pipe = dir.join("Held.ttf");
|
||||
assert!(std::process::Command::new("mkfifo").arg(&pipe).status().unwrap().success());
|
||||
let db: &'static FontDb = Box::leak(Box::new(FontDb::with_font_dirs(vec![dir])));
|
||||
// The scan calls this lister before it reads the folder, and the lister waits there until the
|
||||
// test drops `release`, once the calls below have returned. A list that waited for the scan
|
||||
// would then hold the installed fonts. The lister gives up after 10 s, so such a list fails
|
||||
// the test instead of hanging it. Later scans find `release` dropped and don't wait.
|
||||
let (release, held) = std::sync::mpsc::channel::<()>();
|
||||
let held = std::sync::Mutex::new(held);
|
||||
let hold: craft::font_catalog::Lister = Arc::new(move || {
|
||||
let _ = held.lock().unwrap().recv_timeout(std::time::Duration::from_secs(10));
|
||||
Vec::new()
|
||||
});
|
||||
let db: &'static FontDb = Box::leak(Box::new(FontDb::with_font_dirs_and_lister(vec![dir], hold)));
|
||||
let generation = db.generation();
|
||||
db.scan_in_background();
|
||||
// The scan can't end until the pipe is opened for writing, so a list that waited for it would
|
||||
// hold the installed fonts. This thread lets the scan go on once the calls return, or after 10 s
|
||||
// if they are still waiting, so that such a test fails instead of hanging. It opens the pipe
|
||||
// for reading and writing, which doesn't wait for a reader, and repeats that until the scan has
|
||||
// ended: a single open for writing waits for any reader and lets only the readers already
|
||||
// waiting go, so the test hung when the scan reached the pipe later, or ran on this thread
|
||||
// because its own thread didn't start.
|
||||
let (returned, waiting) = std::sync::mpsc::channel::<()>();
|
||||
let release = pipe.clone();
|
||||
let guard = std::thread::spawn(move || {
|
||||
let _ = waiting.recv_timeout(std::time::Duration::from_secs(10));
|
||||
while !db.installed_fonts_ready() {
|
||||
// The pipe is opened and closed with nothing written.
|
||||
drop(std::fs::OpenOptions::new().read(true).write(true).open(&release).unwrap());
|
||||
std::thread::yield_now();
|
||||
}
|
||||
});
|
||||
let ready = db.installed_fonts_ready();
|
||||
let listed = db.menu_family_list_now();
|
||||
drop(returned);
|
||||
drop(release);
|
||||
assert!(!ready && !has(&listed, FAMILY), "before the scan ends, only the fonts already loaded");
|
||||
// Waits for the scan.
|
||||
assert!(has(&db.menu_family_list(), FAMILY));
|
||||
guard.join().unwrap();
|
||||
assert!(db.installed_fonts_ready());
|
||||
assert_ne!(db.generation(), generation, "a menu built from the short list is built again");
|
||||
assert!(has(&db.menu_family_list_now(), FAMILY));
|
||||
|
||||
@@ -331,10 +331,21 @@ pub fn wait_all(app: &mut VectorcraftApp) {
|
||||
wait_until(app, |_| false);
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
thread_local! {
|
||||
/// Run once on this thread when [`wait_until`] next starts to wait for a job's result, so a test
|
||||
/// lets a held job finish only once the wait has started.
|
||||
pub(crate) static ON_WAIT: std::cell::RefCell<Option<Box<dyn FnOnce()>>> = const { std::cell::RefCell::new(None) };
|
||||
}
|
||||
|
||||
/// Apply the jobs' results as they arrive (in the order the jobs were started) until `ready` holds
|
||||
/// or no job is left.
|
||||
pub fn wait_until(app: &mut VectorcraftApp, ready: impl Fn(&VectorcraftApp) -> bool) {
|
||||
while !ready(app) && !app.background.jobs.is_empty() {
|
||||
#[cfg(test)]
|
||||
if let Some(waiting) = ON_WAIT.with_borrow_mut(Option::take) {
|
||||
waiting();
|
||||
}
|
||||
let Some(done) = app.background.results.as_ref().and_then(|(_, rx)| rx.recv().ok()) else {
|
||||
// No result can arrive: the jobs can't finish.
|
||||
for job in std::mem::take(&mut app.background.jobs) {
|
||||
|
||||
@@ -29,9 +29,11 @@ fn the_artboard_tool_names_its_active_artboard_once() {
|
||||
assert!(names.iter().enumerate().all(|(i, n)| n.as_deref().is_some_and(|n| n.starts_with(&format!("{:02} - ", i + 1)))));
|
||||
let mut single = app_with(1);
|
||||
use_tool(&mut single, "selection");
|
||||
assert!(frames_of(&single, false).iter().all(|f| f.name.is_none()));
|
||||
let unnamed = frames_of(&single, false);
|
||||
assert!(unnamed.len() == 1 && unnamed[0].name.is_none(), "{:?}", unnamed.len());
|
||||
use_tool(&mut single, "artboard");
|
||||
assert!(frames_of(&single, false).iter().all(|f| f.name.is_some()));
|
||||
let named = frames_of(&single, false);
|
||||
assert!(named.len() == 1 && named[0].name.is_some(), "{:?}", named.len());
|
||||
use_tool(&mut app, "artboard");
|
||||
assert_eq!(frames_of(&app, false).iter().filter(|f| f.name.is_some()).count(), 2);
|
||||
}
|
||||
@@ -53,10 +55,14 @@ fn outline_has_white_artboards_on_a_white_canvas_with_line_edges() {
|
||||
let st = app.session.active().unwrap();
|
||||
assert_eq!(pasteboard_color(&app, st, true), PasteboardColor::Custom(DataColor::new(Color32::WHITE)));
|
||||
assert_eq!(border(true), PageBorder::Line);
|
||||
assert!(frames_of(&app, true).iter().all(|f| f.fill == Some(PageFill::Color(DataColor::new(Color32::WHITE)))));
|
||||
let outline = frames_of(&app, true);
|
||||
assert_eq!(outline.len(), 2, "a frame for each artboard");
|
||||
assert!(outline.iter().all(|f| f.fill == Some(PageFill::Color(DataColor::new(Color32::WHITE)))));
|
||||
assert_eq!(pasteboard_color(&app, st, false), PasteboardColor::Default);
|
||||
assert_eq!(border(false), PageBorder::DropShadow);
|
||||
assert!(frames_of(&app, false).iter().all(|f| f.fill.is_some()));
|
||||
let preview = frames_of(&app, false);
|
||||
assert_eq!(preview.len(), 2, "a frame for each artboard");
|
||||
assert!(preview.iter().all(|f| f.fill.is_some()));
|
||||
}
|
||||
|
||||
/// Overprint Preview, and Separations Preview, which turns it on, draw a white canvas around the artboards and no
|
||||
@@ -83,7 +89,9 @@ fn overprint_preview_draws_a_white_canvas_without_shadows() {
|
||||
assert_eq!(border(false), PageBorder::DropShadow, "{at}");
|
||||
}
|
||||
assert_eq!(border(true), PageBorder::Line, "{at}");
|
||||
assert!(frames_of(&app, false).iter().all(|f| f.fill.is_some()), "{at}");
|
||||
let frames = frames_of(&app, false);
|
||||
assert_eq!(frames.len(), 2, "{at}: a frame for each artboard");
|
||||
assert!(frames.iter().all(|f| f.fill.is_some()), "{at}");
|
||||
}
|
||||
}
|
||||
app.run("view.overprintPreview", json!({"on": true})).unwrap();
|
||||
@@ -182,7 +190,9 @@ fn paper_is_the_artboard_color_times_the_simulated_paper() {
|
||||
assert_eq!(artboard_paper(&ab, Color32::WHITE), Color32::from_rgb(51, 102, 153));
|
||||
// The frame carries the same fill.
|
||||
app.run("view.transparencyGrid", json!({})).unwrap();
|
||||
assert!(frames_of(&app, false).iter().all(|f| matches!(f.fill, Some(PageFill::Checker(_)))));
|
||||
let frames = frames_of(&app, false);
|
||||
assert_eq!(frames.len(), 1, "the artboard's frame");
|
||||
assert!(frames.iter().all(|f| matches!(f.fill, Some(PageFill::Checker(_)))));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -205,7 +215,9 @@ fn the_transparency_grid_follows_each_document_and_the_view_menu_label() {
|
||||
assert_eq!(menus::dynamic_label(&app, "view.transparencyGrid", ""), "Show Transparency Grid");
|
||||
assert_eq!(app.run("view.transparencyGrid", json!({})).unwrap(), json!({"on": true}));
|
||||
assert!(shows_transparency_grid(app.session.active().unwrap()));
|
||||
assert!(frames_of(&app, false).iter().all(|f| matches!(f.fill, Some(PageFill::Checker(_)))));
|
||||
let frames = frames_of(&app, false);
|
||||
assert_eq!(frames.len(), 1, "the artboard's frame");
|
||||
assert!(frames.iter().all(|f| matches!(f.fill, Some(PageFill::Checker(_)))));
|
||||
assert_eq!(menus::dynamic_label(&app, "view.transparencyGrid", ""), "Hide Transparency Grid");
|
||||
app.run("document.activate", json!({"index": 0})).unwrap();
|
||||
assert!(!shows_transparency_grid(app.session.active().unwrap()));
|
||||
|
||||
@@ -1,15 +1,5 @@
|
||||
use super::*;
|
||||
|
||||
/// A hotspot is data a typo moves off the glyph: every painted tool cursor's lies in its icon's box.
|
||||
#[test]
|
||||
fn every_tool_cursors_hotspot_lies_inside_its_icon_box() {
|
||||
for c in GLYPHS {
|
||||
if let cb::Cursor::Painted(PaintedCursor::Tool { hotspot, .. }) = tool_cursor(c) {
|
||||
assert!((0.0..=24.0).contains(&hotspot.x) && (0.0..=24.0).contains(&hotspot.y), "{c:?}: {hotspot:?}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A click lands where the glyph points: in every painted tool cursor's image, the icon's own
|
||||
/// mark color (not only its halo) covers the hotspot pixel or one next to it.
|
||||
#[test]
|
||||
|
||||
@@ -345,13 +345,9 @@ fn a_dirty_documents_save_is_written_before_its_package() {
|
||||
app.session.execute("prefs.set", &json!({"values": {"backgroundExport": false}})).unwrap();
|
||||
app.run("shape.rectangle", json!({"x": 0, "y": 0, "width": 10, "height": 10})).unwrap();
|
||||
package_dialog(&mut app, &out);
|
||||
let opener = gate.clone();
|
||||
let release = std::thread::spawn(move || {
|
||||
std::thread::sleep(std::time::Duration::from_millis(50));
|
||||
opener.open();
|
||||
});
|
||||
let waited = gate.open_on_wait();
|
||||
reply(&mut app).unwrap();
|
||||
release.join().unwrap();
|
||||
assert!(waited.get(), "the package waited for the save");
|
||||
assert_eq!(written(&files), [doc]);
|
||||
assert!(app.background.jobs.is_empty() && !app.session.active().unwrap().is_dirty());
|
||||
assert!(app.ui.status.starts_with("Packaged 3 files in "), "the package's status came last: {}", app.ui.status);
|
||||
@@ -451,14 +447,10 @@ fn a_package_made_at_once_waits_for_one_in_the_background() {
|
||||
// the background.
|
||||
app.session.execute("prefs.set", &json!({"values": {"backgroundExport": false}})).unwrap();
|
||||
package_dialog(&mut app, &out);
|
||||
let opener = gate.clone();
|
||||
let release = std::thread::spawn(move || {
|
||||
std::thread::sleep(std::time::Duration::from_millis(500));
|
||||
opener.open();
|
||||
});
|
||||
let waited = gate.open_on_wait();
|
||||
reply(&mut app).unwrap();
|
||||
assert!(waited.get(), "the package made at once waited for the one in the background");
|
||||
assert!(app.background.jobs.is_empty(), "the package in the background was written first");
|
||||
release.join().unwrap();
|
||||
assert_eq!(written(&files).len(), 3);
|
||||
assert!(std::path::Path::new(&out).join("card Folder/card.vectorcraft").is_file());
|
||||
}
|
||||
|
||||
@@ -653,14 +653,10 @@ fn an_export_made_at_once_waits_for_one_in_the_background() {
|
||||
let p = json!({"folder": folder, "formats": [{"format": "svg"}]});
|
||||
assert_eq!(app.run("file.exportForScreens", p.clone()).unwrap()["background"], true);
|
||||
background_export(&mut app, false);
|
||||
let opener = gate.clone();
|
||||
let release = std::thread::spawn(move || {
|
||||
std::thread::sleep(std::time::Duration::from_millis(500));
|
||||
opener.open();
|
||||
});
|
||||
let waited = gate.open_on_wait();
|
||||
let r = app.run("file.exportForScreens", p).unwrap();
|
||||
assert!(waited.get(), "the export made at once waited for the one in the background");
|
||||
assert!(app.background.jobs.is_empty(), "the export in the background was written first");
|
||||
release.join().unwrap();
|
||||
let file = format!("{folder}/Artboard-1.svg");
|
||||
assert_eq!((written(&files), r["files"].clone()), (vec![file.clone()], json!([file])));
|
||||
assert_eq!(app.ui.status, format!("Exported 1 file to {folder}"));
|
||||
|
||||
@@ -1208,11 +1208,12 @@ mod tests {
|
||||
d.pending = Some(Action::ChangeAll);
|
||||
});
|
||||
pump_now(&mut app);
|
||||
assert!(fonts(&mut app).iter().all(|f| f["family"] == "Source Serif 4"), "the document changed");
|
||||
let d = opened(&app);
|
||||
let now = fonts(&mut app);
|
||||
let families: Vec<&Value> = now.iter().map(|f| &f["family"]).collect();
|
||||
assert_eq!(families, [&json!("Source Serif 4")], "the document changed");
|
||||
let d = opened(&app);
|
||||
assert_eq!(d.rows, replacement_rows(&app, "document", &now), "the rows follow the document");
|
||||
assert!(d.rows.iter().all(|r| r.family == "Source Serif 4"), "{:?}", d.rows);
|
||||
assert_eq!(d.rows.iter().map(|r| r.family.as_str()).collect::<Vec<_>>(), ["Source Serif 4"], "{:?}", d.rows);
|
||||
assert!(d.pending.is_none(), "the press was taken");
|
||||
}
|
||||
|
||||
|
||||
@@ -820,11 +820,12 @@ fn literal_spans(code: &str) -> Vec<(usize, usize)> {
|
||||
out
|
||||
}
|
||||
|
||||
/// For translators, `cargo test -p vectorcraft-ui-egui dump_source_strings` writes every English
|
||||
/// interface string to `VECTORCRAFT_I18N_DUMP=<file>`, and every status and error message as a
|
||||
/// For translators, `cargo test -p vectorcraft-ui-egui dump_source_strings -- --ignored` writes every
|
||||
/// English interface string to `VECTORCRAFT_I18N_DUMP=<file>`, and every status and error message as a
|
||||
/// catalog template that [`untranslated_report`] checks to `VECTORCRAFT_I18N_DUMP_MESSAGES=<file>`,
|
||||
/// one per line.
|
||||
#[test]
|
||||
#[ignore = "translator tool: writes the files VECTORCRAFT_I18N_DUMP and VECTORCRAFT_I18N_DUMP_MESSAGES name"]
|
||||
fn dump_source_strings() {
|
||||
if let Ok(path) = std::env::var("VECTORCRAFT_I18N_DUMP") {
|
||||
let mut all = crate::menus::menu_strings();
|
||||
@@ -835,27 +836,11 @@ fn dump_source_strings() {
|
||||
std::fs::write(path, text).expect("write dump");
|
||||
}
|
||||
if let Ok(path) = std::env::var("VECTORCRAFT_I18N_DUMP_MESSAGES") {
|
||||
std::fs::write(path, message_dump()).expect("write dump");
|
||||
let text: String = reported_messages().iter().map(|m| format!("{m}\n")).collect();
|
||||
std::fs::write(path, text).expect("write dump");
|
||||
}
|
||||
}
|
||||
|
||||
/// The text [`dump_source_strings`] writes to `VECTORCRAFT_I18N_DUMP_MESSAGES`.
|
||||
fn message_dump() -> String {
|
||||
reported_messages().iter().map(|m| format!("{m}\n")).collect()
|
||||
}
|
||||
|
||||
/// The translators' message dump lists every message the untranslated report checks, the
|
||||
/// phrases a parameter schema's error builds included.
|
||||
#[test]
|
||||
fn message_dump_lists_the_reported_messages() {
|
||||
let dump = message_dump();
|
||||
let lines: std::collections::BTreeSet<&str> = dump.lines().collect();
|
||||
for phrase in SCHEMA_PHRASES {
|
||||
assert!(lines.contains(phrase), "the dump skips {phrase:?}");
|
||||
}
|
||||
assert!(lines.contains("the color book is cut short"));
|
||||
}
|
||||
|
||||
/// Languages whose catalogs leave [`MENU_KEEP_AS_IS`] in English.
|
||||
const KEEPS_MENU_NAMES: [&str; 20] =
|
||||
["cs", "de", "el", "es", "fr", "hi", "hu", "it", "ja", "ka", "ko", "pl", "pt-br", "ru", "sv", "uk", "vi", "fi", "tr", "ca"];
|
||||
@@ -1221,9 +1206,9 @@ fn reported_messages() -> std::collections::BTreeSet<String> {
|
||||
}
|
||||
|
||||
/// The untranslated report checks the messages of the effects and of the crates whose errors the
|
||||
/// engine and the effects pass on, and the phrases a parameter schema's error builds.
|
||||
/// engine and the effects pass on.
|
||||
#[test]
|
||||
fn untranslated_report_checks_every_message_crate_and_schema_phrase() {
|
||||
fn untranslated_report_checks_every_message_crate() {
|
||||
let reported = reported_messages();
|
||||
let passed_on = [
|
||||
("effects", "the SVG filter has no primitives"),
|
||||
@@ -1236,9 +1221,6 @@ fn untranslated_report_checks_every_message_crate_and_schema_phrase() {
|
||||
assert!(message_literals_in(&[krate]).contains(m), "{krate}: {m}");
|
||||
assert!(reported.contains(m), "the report skips {krate}: {m}");
|
||||
}
|
||||
for phrase in SCHEMA_PHRASES {
|
||||
assert!(reported.contains(*phrase), "the report skips the schema phrase {phrase:?}");
|
||||
}
|
||||
}
|
||||
|
||||
/// Banner Hems and Grommets' errors and the status of a recovery copy that failed without a folder
|
||||
@@ -1936,6 +1918,54 @@ fn f(p: &Value) -> Result<()> {
|
||||
assert_eq!(source_messages(code, &engine, &consts), ["the name is too long", "`path` is empty"]);
|
||||
}
|
||||
|
||||
/// What the parameter schema's error says a value of `ty` must be, for `bad`, a value of another
|
||||
/// type.
|
||||
fn schema_expected(ty: vectorcraft_apischema::Type, bad: serde_json::Value) -> String {
|
||||
use vectorcraft_apischema::{Param, ParamSchema, Problem};
|
||||
let params: &'static [Param] = Box::leak(Box::new([Param::new("v", ty)]));
|
||||
let refused = ParamSchema::new(params, "").validate(&serde_json::json!({ "v": bad }));
|
||||
match refused {
|
||||
Err(e) => match e.problem {
|
||||
Problem::WrongType { expected, .. } => expected,
|
||||
other => panic!("{ty:?} refused {other:?}, not a value of the wrong type"),
|
||||
},
|
||||
Ok(_) => panic!("{ty:?} took a value of another type"),
|
||||
}
|
||||
}
|
||||
|
||||
/// `text` with each of `values`, found in order, written as the next unnamed placeholder.
|
||||
fn with_placeholders(text: &str, values: &[&str]) -> String {
|
||||
let (mut out, mut rest) = (String::new(), text);
|
||||
for (n, value) in values.iter().enumerate() {
|
||||
let at = rest.find(value).unwrap_or_else(|| panic!("{text:?} does not hold {value:?}"));
|
||||
out.push_str(&rest[..at]);
|
||||
out.push_str(&format!("{{_{}}}", n + 1));
|
||||
rest = &rest[at + value.len()..];
|
||||
}
|
||||
out + rest
|
||||
}
|
||||
|
||||
/// The phrase the parameter schema's error builds for a number's range and unit, an integer's
|
||||
/// range, a choice of names and a value with no range is one [`SCHEMA_PHRASES`] lists, with the
|
||||
/// schema's own values as placeholders.
|
||||
#[test]
|
||||
fn schema_phrases_hold_what_the_schema_error_says() {
|
||||
use vectorcraft_apischema::{Bound, Type};
|
||||
let cases: [(Type, serde_json::Value, &[&str]); 7] = [
|
||||
(Type::NUMBER, "x".into(), &[]),
|
||||
(Type::Number { min: Some(Bound::Inclusive(1.5)), max: Some(Bound::Inclusive(2.5)), unit: None }, "x".into(), &["1.5", "2.5"]),
|
||||
(Type::Number { min: Some(Bound::Exclusive(1.5)), max: Some(Bound::Inclusive(2.5)), unit: Some("pt") }, "x".into(), &["1.5", "2.5", "pt"]),
|
||||
(Type::Number { min: None, max: Some(Bound::Exclusive(2.5)), unit: Some("deg") }, "x".into(), &["2.5", "deg"]),
|
||||
(Type::Integer { min: Some(3), max: None }, "x".into(), &["3"]),
|
||||
(Type::Enum(&["left", "right"]), true.into(), &["\"left\", \"right\""]),
|
||||
(Type::Array(&Type::String), "x".into(), &[]),
|
||||
];
|
||||
for (ty, bad, values) in cases {
|
||||
let phrase = with_placeholders(&schema_expected(ty, bad), values);
|
||||
assert!(SCHEMA_PHRASES.contains(&phrase.as_str()), "{ty:?}: SCHEMA_PHRASES lacks {phrase:?}");
|
||||
}
|
||||
}
|
||||
|
||||
/// The phrases a parameter schema's error uses for what a value must be, as `@msg` sources: one
|
||||
/// for each type, and for a number each range and unit form.
|
||||
const SCHEMA_PHRASES: &[&str] = &[
|
||||
|
||||
@@ -439,7 +439,9 @@ fn a_file_opened_under_automation_roots_finishes_under_them() {
|
||||
start(&mut app, "/art/Scoped.vectorcraft", vectorcraft_format::save(&vectorcraft_doc::Document::new(10.0, 10.0), false))
|
||||
});
|
||||
let scope = app.opening.pending[0].scope.clone();
|
||||
assert!(scope.run(file_access::current).is_some(), "the roots go with the open");
|
||||
assert!(file_access::current().is_none(), "the desktop has no roots here");
|
||||
let (given, kept) = (roots.expect("roots for the folder"), scope.run(file_access::current).expect("the roots go with the open"));
|
||||
assert!(std::sync::Arc::ptr_eq(&given, &kept), "the open keeps the roots it started under");
|
||||
}
|
||||
|
||||
/// A file asked for again while it is still being read is not read a second time (#3455).
|
||||
@@ -600,10 +602,11 @@ fn cancelling_an_open_opens_nothing() {
|
||||
let before = app.session.documents().len();
|
||||
start(&mut app, "/art/Big.vectorcraft", bytes("Big"));
|
||||
assert!(crate::menus::enabled(&app, "file.cancelOpen"));
|
||||
// The file has been read and its result waits for the next frame when Cancel is pressed.
|
||||
wait_read(&mut app);
|
||||
assert_eq!(app.run("file.cancelOpen", json!({})).unwrap()["cancelled"], 1);
|
||||
assert!(app.opening.pending.is_empty() && !long_operation_busy(&app));
|
||||
assert!(!app.ui.status.starts_with("Opening"), "{}", app.ui.status);
|
||||
std::thread::sleep(std::time::Duration::from_millis(50));
|
||||
poll(&mut app);
|
||||
assert_eq!(app.session.documents().len(), before);
|
||||
assert_ne!(app.ui.recent_files.first().map(String::as_str), Some("/art/Big.vectorcraft"));
|
||||
|
||||
@@ -300,11 +300,16 @@ mod tests {
|
||||
fn freeform_chip_shows_the_points_opacity() {
|
||||
use vectorcraft_color::{Freeform, FreeformPoint};
|
||||
use vectorcraft_geom::kurbo::Point;
|
||||
let mut gp = paint(GradientKind::Freeform, 0.0);
|
||||
let clear = FreeformPoint { opacity: 0.0, ..FreeformPoint::new(Point::new(10.0, 10.0), Color::BLACK) };
|
||||
gp.freeform = Some(Freeform { points: vec![clear], ..Default::default() });
|
||||
let chip = gradient_chip_colors(&gp, 20.0, 20.0, 4, 4);
|
||||
assert!(chip.iter().all(|c| c.a() == 0), "{chip:?}");
|
||||
let chip = |opacity: f32| {
|
||||
let mut gp = paint(GradientKind::Freeform, 0.0);
|
||||
let point = FreeformPoint { opacity, ..FreeformPoint::new(Point::new(10.0, 10.0), Color::BLACK) };
|
||||
gp.freeform = Some(Freeform { points: vec![point], ..Default::default() });
|
||||
gradient_chip_colors(&gp, 20.0, 20.0, 4, 4)
|
||||
};
|
||||
let (clear, opaque) = (chip(0.0), chip(1.0));
|
||||
assert_eq!((clear.len(), opaque.len()), (25, 25), "a color at each corner of the 4 by 4 cells");
|
||||
assert!(clear.iter().all(|c| c.a() == 0), "{clear:?}");
|
||||
assert!(opaque.iter().all(|c| *c == Color32::BLACK), "{opaque:?}");
|
||||
}
|
||||
|
||||
/// A Holographic glow's chip is clear at the corners and nearly opaque at the center; a foil's
|
||||
@@ -320,6 +325,7 @@ mod tests {
|
||||
assert!([0, 4, 20, 24].iter().all(|&i| glow[i].a() == 0), "{glow:?}");
|
||||
assert!(glow[2 * 5 + 2].a() >= 240, "{glow:?}");
|
||||
let foil = chip("Prism Veil");
|
||||
assert_eq!(foil.len(), glow.len(), "the same 5 by 5 corners");
|
||||
assert!(foil.iter().all(|c| c.a() == 255), "{foil:?}");
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,9 @@ struct Window {
|
||||
hovered: Vec<egui::HoveredFile>,
|
||||
dropped: Vec<egui::DroppedFileHandle>,
|
||||
close_requested: bool,
|
||||
/// Whether the window shows on the desktop: the builder's visibility when it opened, then each
|
||||
/// `Visible` command.
|
||||
visible: bool,
|
||||
frames: usize,
|
||||
/// The texts its last frame drew, with their rects in the window.
|
||||
texts: Vec<(String, Rect)>,
|
||||
@@ -72,6 +75,7 @@ impl Host {
|
||||
ViewportCommand::OuterPosition(pos) => window.rect = Rect::from_min_size(*pos, window.rect.size()),
|
||||
ViewportCommand::InnerSize(size) => window.rect = Rect::from_min_size(window.rect.min, *size),
|
||||
ViewportCommand::CancelClose => window.close_requested = false,
|
||||
ViewportCommand::Visible(visible) => window.visible = *visible,
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
@@ -91,6 +95,7 @@ impl Host {
|
||||
hovered: Vec::new(),
|
||||
dropped: Vec::new(),
|
||||
close_requested: false,
|
||||
visible: builder.visible != Some(false),
|
||||
frames: 0,
|
||||
texts: Vec::new(),
|
||||
nodes: Vec::new(),
|
||||
@@ -572,3 +577,59 @@ fn copy_and_cut_in_a_native_window_act_on_the_art_while_another_windows_label_ha
|
||||
assert!(![copied, cut].concat().iter().any(|t| t == LABEL), "{what}: the floating window copied no label text");
|
||||
}
|
||||
}
|
||||
|
||||
/// A panel opened from the Window menu floats in an OS window that keeps showing while the art on
|
||||
/// the canvas is selected and moved, and the Selection tool's move ends where it is released.
|
||||
#[test]
|
||||
fn a_window_menu_panel_stays_shown_while_art_is_selected_and_moved() {
|
||||
for (command, params, panel) in
|
||||
[("window.learn", json!({}), crate::panels::learn::ID), ("window.panel", json!({"panel": "imageTrace", "toggle": true}), "imageTrace")]
|
||||
{
|
||||
let mut h = Harness::new();
|
||||
h.app.select_tool("selection");
|
||||
h.app.ui.view.smart_guides = false;
|
||||
h.app.ui.view.snap_to_point = false;
|
||||
h.app.ui.view.snap_to_grid = false;
|
||||
h.app.ui.view.snap_to_pixel = false;
|
||||
let id = h.app.run("shape.rectangle", json!({"x": 280, "y": 180, "width": 60, "height": 50})).unwrap()["id"].as_u64().unwrap();
|
||||
let id = vectorcraft_doc::NodeId(id);
|
||||
h.app.run("select.none", json!({})).unwrap();
|
||||
h.app.run(command, params).unwrap();
|
||||
h.frames(4);
|
||||
let viewport = h.viewport(panel);
|
||||
let shown = |h: &Harness| h.host.borrow().windows.get(&viewport).is_some_and(|w| w.visible);
|
||||
assert!(shown(&h), "{panel}: the window shows");
|
||||
let corner = |h: &Harness| {
|
||||
let b = h.app.session.active().unwrap().doc.node(id).and_then(|n| n.geometric_bounds()).unwrap();
|
||||
(b.min_x(), b.min_y())
|
||||
};
|
||||
let before = corner(&h);
|
||||
let undo = h.app.session.active().unwrap().history.undo.len();
|
||||
let view = h.app.canvas_view().expect("the canvas was drawn");
|
||||
let from = view.to_screen(vectorcraft_geom::Point::new(310.0, 205.0));
|
||||
let to = from + vec2(-40.0, 30.0);
|
||||
let window = h.host.borrow().windows[&viewport].rect.translate(-ORIGIN.to_vec2());
|
||||
assert!(view.rect.contains(from) && view.rect.contains(to), "{panel}: the move stays on the canvas");
|
||||
assert!(!window.contains(from) && !window.contains(to), "{panel}: the move stays clear of the window");
|
||||
h.frame(vec![Event::PointerMoved(from), button(from, true)]);
|
||||
assert!(shown(&h), "{panel}: the window shows with the art selected");
|
||||
for k in 1..=6 {
|
||||
h.frame(vec![Event::PointerMoved(from + (to - from) * (k as f32 / 6.0))]);
|
||||
assert!(shown(&h), "{panel}: the window shows during the move");
|
||||
}
|
||||
h.frame(vec![Event::PointerMoved(to), button(to, false)]);
|
||||
h.frames(3);
|
||||
assert!(shown(&h), "{panel}: the window shows after the move");
|
||||
let st = h.app.session.active().unwrap();
|
||||
assert!(st.interaction.is_none(), "{panel}: no move is left open");
|
||||
assert_eq!(st.history.undo.len(), undo + 1, "{panel}: the move is one undo step");
|
||||
let (dx, dy) = (view.to_doc(to).x - view.to_doc(from).x, view.to_doc(to).y - view.to_doc(from).y);
|
||||
let after = corner(&h);
|
||||
assert!(
|
||||
(after.0 - before.0 - dx).abs() < 0.01 && (after.1 - before.1 - dy).abs() < 0.01,
|
||||
"{panel}: the art stays where it was released: moved by ({}, {}), released at ({dx}, {dy})",
|
||||
after.0 - before.0,
|
||||
after.1 - before.1
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@ struct Harness {
|
||||
ctx: egui::Context,
|
||||
time: f64,
|
||||
nodes: Vec<(egui::accesskit::NodeId, egui::accesskit::Node)>,
|
||||
/// The node with key focus in the last frame's accessibility update.
|
||||
focus: Option<egui::accesskit::NodeId>,
|
||||
shapes: Vec<egui::epaint::ClippedShape>,
|
||||
}
|
||||
|
||||
@@ -27,7 +29,7 @@ impl Harness {
|
||||
app.run("file.new", json!({"width": 400, "height": 300})).unwrap();
|
||||
let ctx = crate::testing::ui_context();
|
||||
ctx.enable_accesskit();
|
||||
let mut h = Self { app, ctx, time: 0.0, nodes: Vec::new(), shapes: Vec::new() };
|
||||
let mut h = Self { app, ctx, time: 0.0, nodes: Vec::new(), focus: None, shapes: Vec::new() };
|
||||
h.frames(3);
|
||||
h
|
||||
}
|
||||
@@ -47,7 +49,9 @@ impl Harness {
|
||||
/// Draw one application frame and retain its accessibility output and shapes for assertions.
|
||||
fn run(&mut self, input: egui::RawInput) {
|
||||
let out = crate::testing::app_frame(&mut self.app, &self.ctx, input);
|
||||
self.nodes = out.platform_output.accesskit_update.map_or_else(Vec::new, |update| update.nodes);
|
||||
let update = out.platform_output.accesskit_update;
|
||||
self.focus = update.as_ref().map(|update| update.focus);
|
||||
self.nodes = update.map_or_else(Vec::new, |update| update.nodes);
|
||||
self.shapes = out.shapes;
|
||||
}
|
||||
|
||||
@@ -1107,6 +1111,93 @@ fn a_docked_column_is_never_narrower_than_the_panel_minimum() {
|
||||
assert!(body_width(&h, "Properties") >= PANEL_MIN_WIDTH - 0.5, "saved 100 pt wide: {}", body_width(&h, "Properties"));
|
||||
}
|
||||
|
||||
impl Harness {
|
||||
/// The node with key focus in the last frame.
|
||||
fn focused_node(&self) -> Option<&egui::accesskit::Node> {
|
||||
let focus = self.focus?;
|
||||
self.nodes.iter().find(|(id, _)| *id == focus).map(|(_, node)| node)
|
||||
}
|
||||
|
||||
/// The first node named `label` in the last frame.
|
||||
fn node_named(&self, label: &str) -> Option<&egui::accesskit::Node> {
|
||||
self.nodes.iter().map(|(_, node)| node).find(|node| node.label() == Some(label))
|
||||
}
|
||||
|
||||
/// Whether key focus is on the tab strip of a panel group: the strip or one of its tabs.
|
||||
fn strip_has_focus(&self) -> bool {
|
||||
use egui::accesskit::Role;
|
||||
self.focused_node().is_some_and(|node| node.role() == Role::Tab && !node.label().is_some_and(|l| l.starts_with("Untitled")))
|
||||
|| self.focused_node().is_some_and(|node| node.role() == Role::TabList && node.label() == Some("Panels"))
|
||||
}
|
||||
}
|
||||
|
||||
/// The tabs of a docked group that does not fit them are reached from the keyboard through the strip's More tabs menu:
|
||||
/// Tab moves key focus onto the strip, Alt+Down opens the menu with the focus on its first row, the arrow keys move
|
||||
/// through its rows, Escape closes it and gives the focus back to the strip, and Enter shows the picked panel, with
|
||||
/// the focus still on the strip. More tabs is announced as a button that opens a menu, expanded only while the menu is
|
||||
/// open, and Alt+Down opens this menu and not the group's other menus.
|
||||
#[test]
|
||||
fn the_overflow_menu_of_a_docked_group_is_reached_and_used_from_the_keyboard() {
|
||||
use egui::accesskit::Role;
|
||||
use egui::{Key, Modifiers};
|
||||
|
||||
let mut h = Harness::new();
|
||||
let panels =
|
||||
"swatches stroke color gradient character paragraph appearance align pathfinder brushes symbols transparency graphicStyles transform";
|
||||
for panel in panels.split(' ') {
|
||||
h.app.run("window.panel.dock", json!({"panel": panel, "onto": "layers"})).unwrap();
|
||||
}
|
||||
h.frames(3);
|
||||
assert!(showing(&h.app.ui, "transform"), "the last panel docked onto the group shows");
|
||||
let more = h.node_named("More tabs").expect("the group's tabs do not fit, so the strip has a More tabs button");
|
||||
assert_eq!(more.role(), Role::Button, "More tabs is a button");
|
||||
assert_eq!(more.has_popup(), Some(egui::accesskit::HasPopup::Menu), "More tabs announces the menu it opens");
|
||||
assert_eq!(more.is_expanded(), Some(false), "More tabs starts collapsed");
|
||||
assert!(h.tab("swatches").is_none(), "Swatches is one of the tabs that do not fit");
|
||||
let expanded = |h: &Harness| h.node_named("More tabs").and_then(|node| node.is_expanded());
|
||||
let menu_focus = |h: &Harness| h.focused_node().filter(|node| node.role() == Role::MenuItem).and_then(|node| node.label()).map(str::to_owned);
|
||||
|
||||
// A press inside the group gives its strip key focus; Shift+Tab leaves the strip and Tab comes back to it.
|
||||
let strip = h.named("Panels", Role::TabList).expect("the group's tab strip");
|
||||
h.click(pos2(strip.center().x, strip.bottom() + 25.0));
|
||||
assert!(h.strip_has_focus(), "a press in the group focuses its strip: {:?}", h.focused_node().map(|n| (n.role(), n.label())));
|
||||
h.press(Key::Tab, Modifiers::SHIFT);
|
||||
assert!(!h.strip_has_focus(), "Shift+Tab moves the focus off the strip");
|
||||
h.press(Key::Tab, Modifiers::NONE);
|
||||
assert!(h.strip_has_focus(), "Tab moves the focus back onto the strip");
|
||||
|
||||
// Alt+Down opens the overflow menu, listing the tabs that do not fit, with the focus on a row.
|
||||
h.press(Key::ArrowDown, Modifiers::ALT);
|
||||
assert_eq!(expanded(&h), Some(true), "More tabs is expanded while its menu is open");
|
||||
let first = menu_focus(&h).expect("the focus enters the overflow menu");
|
||||
let rows: Vec<&str> = h.nodes.iter().filter(|(_, n)| n.role() == Role::MenuItem).filter_map(|(_, n)| n.label()).collect();
|
||||
assert!(rows.contains(&"Swatches"), "the menu lists a tab that does not fit: {rows:?}");
|
||||
assert!(first != "Transform" && h.tab(&first).is_none(), "the focused row names a panel whose tab does not fit: {first}");
|
||||
h.press(Key::ArrowDown, Modifiers::NONE);
|
||||
let second = menu_focus(&h).expect("the focus stays in the menu");
|
||||
assert_ne!(second, first, "Down moves the focus to the next row");
|
||||
h.press(Key::ArrowUp, Modifiers::NONE);
|
||||
assert_eq!(menu_focus(&h).as_deref(), Some(first.as_str()), "Up moves it back");
|
||||
|
||||
// Escape closes the menu and gives the focus back to the strip, with the shown panel unchanged.
|
||||
h.press(Key::Escape, Modifiers::NONE);
|
||||
assert_eq!(expanded(&h), Some(false), "Escape closes the overflow menu");
|
||||
assert!(h.strip_has_focus(), "Escape gives the focus back to the strip");
|
||||
assert!(showing(&h.app.ui, "transform"), "Escape picks nothing");
|
||||
|
||||
// Enter on a row shows that panel; its tab is drawn and selected, and the focus stays on the strip.
|
||||
h.press(Key::ArrowDown, Modifiers::ALT);
|
||||
h.press(Key::ArrowDown, Modifiers::NONE);
|
||||
let picked = menu_focus(&h).expect("a row has the focus");
|
||||
h.press(Key::Enter, Modifiers::NONE);
|
||||
h.frames(1);
|
||||
assert_eq!(expanded(&h), Some(false), "Enter closes the overflow menu");
|
||||
assert!(!showing(&h.app.ui, "transform"), "the picked panel replaces Transform");
|
||||
let tab = h.nodes.iter().map(|(_, n)| n).find(|n| n.role() == Role::Tab && n.label() == Some(picked.as_str()));
|
||||
assert_eq!(tab.and_then(|n| n.is_selected()), Some(true), "the picked panel's tab, {picked}, is drawn and selected");
|
||||
assert!(h.strip_has_focus(), "the focus stays on the strip after the pick");
|
||||
}
|
||||
|
||||
/// A tab group dragged out of the icon column by its grip floats as an expanded panel: its tabs show
|
||||
/// in the window, and a click on each tab shows that panel.
|
||||
#[test]
|
||||
|
||||
@@ -155,13 +155,17 @@ pub(crate) fn corner_radius_row(app: &mut VectorcraftApp, ui: &mut Ui, n: &Node)
|
||||
}
|
||||
|
||||
/// The Corner select of a live rectangle whose corners share one radius field: the kind of all
|
||||
/// four corners, also while some of them are Direct-Selected, blank when they differ. A pick sets
|
||||
/// it on every corner of each selected live rectangle ([`set_rectangle_kinds`]).
|
||||
/// four corners, also while some of them are Direct-Selected, blank when they differ. It is one
|
||||
/// number cell wide, as the Corner Radius field above it is. A pick sets it on every corner of each
|
||||
/// selected live rectangle ([`set_rectangle_kinds`]).
|
||||
fn corner_kind_row(app: &mut VectorcraftApp, ui: &mut Ui, n: &Node) {
|
||||
let Some(lc) = LiveCorners::of(n) else { return };
|
||||
let entries = corner_entries();
|
||||
let current = lc.style(&lc.all()).1;
|
||||
let picked = Field::new(tl!("Corner")).show(ui, |ui, _| corner_select(ui, tl!("Corner"), current, &entries)).inner.flatten();
|
||||
let current = lc.style(&lc.all()).1.map_or(Mixed::Mixed, Mixed::Same);
|
||||
let picked = Field::new(tl!("Corner"))
|
||||
.show(ui, |ui, _| Select::new(tl!("Corner"), Bind::given(current), &entries).number_cell().show(ui).events.committed().copied())
|
||||
.inner
|
||||
.flatten();
|
||||
if let Some(kind) = picked {
|
||||
set_rectangle_kinds(app, kind, None);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,21 @@ fn picked(panel: &Panel) -> (Vec<RowKey>, Option<RowKey>, Option<RowKey>) {
|
||||
(s.items.clone(), s.lead, s.anchor)
|
||||
}
|
||||
|
||||
/// Every footer action is announced as a button named by its label, and none announces a pressed state: they are
|
||||
/// plain actions. Add New Effect announces the menu it opens.
|
||||
#[test]
|
||||
fn the_footer_actions_are_buttons_without_a_pressed_state() {
|
||||
use craft::ui::contract::{PopupKind, Role};
|
||||
|
||||
let panel = Panel::new(app_with_a_selected_rectangle(), show);
|
||||
for name in ["Add New Stroke", "Add New Fill", "Add New Effect", "Delete Selected Item", "Duplicate Selected Item", "Clear Appearance"] {
|
||||
assert!(panel.shows_role(name, Role::BUTTON), "{name} is a button");
|
||||
assert_eq!(panel.toggled(name), None, "{name} announces no pressed state");
|
||||
}
|
||||
assert_eq!(panel.popup_kind("Add New Effect"), Some(PopupKind::Menu));
|
||||
assert_eq!(panel.popup_kind("Clear Appearance"), None);
|
||||
}
|
||||
|
||||
/// Duplicating rows picks the copies, each right above its original, as the Layers panel does:
|
||||
/// the active row's copy becomes active, the anchor's copy the anchor.
|
||||
#[test]
|
||||
|
||||
@@ -105,11 +105,12 @@ pub(super) fn corner_rows(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
Row::new().show(ui, |ui, _| panels::corners_link(app, ui));
|
||||
return;
|
||||
}
|
||||
// The corners differ in kind: no entry is the value.
|
||||
// The corners differ in kind: no entry is the value. The select is one number cell wide, as
|
||||
// the Corner Radius field under it is.
|
||||
let kind = picked.kind.map_or(Mixed::Mixed, Mixed::Same);
|
||||
let entries = panels::corner_entries();
|
||||
let chosen = Field::new(tl!("Corner"))
|
||||
.show(ui, |ui, _| Select::new(tl!("Corner"), Bind::given(kind), &entries).show(ui).events.committed().copied())
|
||||
.show(ui, |ui, _| Select::new(tl!("Corner"), Bind::given(kind), &entries).number_cell().show(ui).events.committed().copied())
|
||||
.inner;
|
||||
if let Some(Some(kind)) = chosen {
|
||||
panels::set_picked_corners(app, &picked, json!({"kind": kind}));
|
||||
|
||||
@@ -231,6 +231,47 @@ fn the_footer_menu_buttons_report_that_they_open_a_menu() {
|
||||
}
|
||||
}
|
||||
|
||||
/// Every footer action is announced as a button named by its label. Swatch Libraries and Show Swatch Kinds also
|
||||
/// announce a pressed state that follows the panel: Show Swatch Kinds is pressed while a kind other than All shows, and
|
||||
/// Swatch Libraries while a swatch library panel is open. The other actions announce no pressed state.
|
||||
#[test]
|
||||
fn the_footer_buttons_are_buttons_and_only_the_stateful_ones_announce_pressed() {
|
||||
use crate::tests::panel_harness::Panel;
|
||||
use craft::behavior::Mixed;
|
||||
use craft::ui::contract::Role;
|
||||
use egui::{Key, Modifiers};
|
||||
|
||||
let mut panel = Panel::new(app(), show);
|
||||
for name in [SwatchLibraries::MENU, "Show Swatch Kinds", "Swatch Options", "Delete Swatch", "New Swatch", "New Color Group"] {
|
||||
assert!(panel.shows_role(name, Role::BUTTON), "{name} is a button");
|
||||
}
|
||||
for name in ["Swatch Options", "Delete Swatch", "New Swatch", "New Color Group"] {
|
||||
assert_eq!(panel.toggled(name), None, "{name} announces no pressed state");
|
||||
}
|
||||
assert_eq!(panel.toggled("Show Swatch Kinds"), Some(Mixed::Same(false)), "every kind shows");
|
||||
assert_eq!(panel.toggled(SwatchLibraries::MENU), Some(Mixed::Same(false)), "no library is open");
|
||||
|
||||
// Space on the focused footer button opens its menu; the footer sits below the harness's room.
|
||||
let pick = |panel: &mut Panel, kind: &str| {
|
||||
panel.focus("Show Swatch Kinds");
|
||||
panel.key(Key::Space, Modifiers::NONE);
|
||||
panel.frame();
|
||||
panel.click_role(kind, Role::MENU_ITEM_RADIO);
|
||||
panel.frame();
|
||||
};
|
||||
pick(&mut panel, "Show Color Swatches");
|
||||
assert_eq!(panel.app().ui.swatches_panel.kind, Kind::Color);
|
||||
assert_eq!(panel.toggled("Show Swatch Kinds"), Some(Mixed::Same(true)), "a kind filter is on");
|
||||
pick(&mut panel, "Show All Swatches");
|
||||
assert_eq!(panel.app().ui.swatches_panel.kind, Kind::All);
|
||||
assert_eq!(panel.toggled("Show Swatch Kinds"), Some(Mixed::Same(false)), "the filter is off again");
|
||||
|
||||
let id = library_panel::tests::menu_library_ids::<SwatchLibraries>(&panel.app()).into_iter().next().expect("a swatch library");
|
||||
panel.app().run("window.swatchLibrary", json!({"library": id})).unwrap();
|
||||
panel.frame();
|
||||
assert_eq!(panel.toggled(SwatchLibraries::MENU), Some(Mixed::Same(true)), "a library panel is open");
|
||||
}
|
||||
|
||||
/// The footer reads the panel's selection while the browser holds the panel's model: with one swatch selected, Swatch
|
||||
/// Options and Delete Swatch are enabled.
|
||||
#[test]
|
||||
|
||||
@@ -229,12 +229,13 @@ fn sides_row(app: &mut VectorcraftApp, ui: &mut Ui, sides: u32) {
|
||||
}
|
||||
}
|
||||
|
||||
/// The polygon's Corner type select, blank while `kind` is `None` (the corners differ).
|
||||
/// The polygon's Corner type select, blank while `kind` is `None` (the corners differ), one number cell wide as the
|
||||
/// number fields of its column are.
|
||||
fn corner_kind_row(app: &mut VectorcraftApp, ui: &mut Ui, kind: Option<CornerKind>) {
|
||||
let entries = corner_entries();
|
||||
let mut edit = None;
|
||||
Field::new(tl!("Corner")).show(ui, |ui, _| {
|
||||
edit = Some(Select::new(tl!("Corner"), Bind::given(kind.map_or(Mixed::Mixed, Mixed::Same)), &entries).show(ui));
|
||||
edit = Some(Select::new(tl!("Corner"), Bind::given(kind.map_or(Mixed::Mixed, Mixed::Same)), &entries).number_cell().show(ui));
|
||||
});
|
||||
if let Some(edit) = edit {
|
||||
apply_edits(app, &edit, EditPath::Scope, |app, k, _| set_live_shape(app, json!({ "kind": k })));
|
||||
|
||||
@@ -246,6 +246,66 @@ fn unlinked_corner_labels_start_in_one_column() {
|
||||
}
|
||||
}
|
||||
|
||||
/// An app with a live rectangle selected whose Corner Radius is linked.
|
||||
fn linked_rectangle_app() -> VectorcraftApp {
|
||||
let mut app = new_app();
|
||||
app.run("shape.rectangle", json!({"x": 50, "y": 50, "width": 120, "height": 80, "radius": 10})).unwrap();
|
||||
set_pref(&mut app, "singleCornerRadius", true);
|
||||
app
|
||||
}
|
||||
|
||||
/// An app with the Direct Selection tool chosen and corner 2 of a star selected.
|
||||
fn star_corner_app() -> VectorcraftApp {
|
||||
let mut app = new_app();
|
||||
let star = app.run("shape.star", json!({"cx": 200, "cy": 150, "radius1": 80, "radius2": 40})).unwrap()["id"].as_u64().unwrap();
|
||||
app.select_tool("directSelection");
|
||||
app.run("select.anchors", json!({"id": star, "anchors": [[0, 2]], "mode": "set"})).unwrap();
|
||||
app
|
||||
}
|
||||
|
||||
/// A Corner select in a column of number fields is one number cell wide, as the Corner Radius field of its column
|
||||
/// is: a live rectangle's linked Corner and a live polygon's Corner, in the Transform panel and the Properties panel's
|
||||
/// Transform section, and the Corner of a path's Direct-Selected corners in the Properties panel. Each still opens,
|
||||
/// and Enter sets the kind highlighted in its list on the corner it reads.
|
||||
#[test]
|
||||
fn corner_selects_are_as_wide_as_the_corner_radius_field() {
|
||||
use craft::ui::contract::Role;
|
||||
use egui::{Key, Modifiers};
|
||||
use vectorcraft_doc::LiveCorners;
|
||||
use vectorcraft_geom::shapes::CornerKind;
|
||||
type Draw = fn(&mut VectorcraftApp, &mut Ui);
|
||||
/// A case's name, the app it starts from, the panel it draws and the corner whose kind it reads.
|
||||
type Case = (&'static str, fn() -> VectorcraftApp, Draw, usize);
|
||||
let transform = show as Draw;
|
||||
let properties = crate::panels::properties::transform_section as Draw;
|
||||
let cases: [Case; 5] = [
|
||||
("Transform panel, linked rectangle", linked_rectangle_app, transform, 0),
|
||||
("Properties panel, linked rectangle", linked_rectangle_app, properties, 0),
|
||||
("Transform panel, polygon", || polygon_app(6), transform, 0),
|
||||
("Properties panel, polygon", || polygon_app(6), properties, 0),
|
||||
("Properties panel, Direct-Selected corner", star_corner_app, crate::panels::properties::show, 2),
|
||||
];
|
||||
for (case, app, draw, corner) in cases {
|
||||
let mut p = Panel::new(app(), draw);
|
||||
let select = p.rect_role("Corner", Role::COMBO_BOX);
|
||||
let field = p.rect_role("Corner Radius", Role::SPIN_BUTTON);
|
||||
assert!(
|
||||
(select.width() - field.width()).abs() < 0.5,
|
||||
"{case}: the Corner select is {} wide, the Corner Radius field {}",
|
||||
select.width(),
|
||||
field.width()
|
||||
);
|
||||
let kind = |p: &Panel| LiveCorners::of(&first_selected(&p.app()).unwrap()).unwrap().kind(corner);
|
||||
assert_eq!(kind(&p), CornerKind::ALL[0], "{case}");
|
||||
let undo = undo_depth(&p.app());
|
||||
p.click_role("Corner", Role::COMBO_BOX);
|
||||
p.key(Key::ArrowDown, Modifiers::NONE);
|
||||
p.key(Key::Enter, Modifiers::NONE);
|
||||
assert_eq!(kind(&p), CornerKind::ALL[1], "{case}: Enter sets the highlighted kind");
|
||||
assert_eq!(undo_depth(&p.app()), undo + 1, "{case}: the kind is one undo step");
|
||||
}
|
||||
}
|
||||
|
||||
/// A corner kind set with no live rectangle selected leaves the selected polygon, the document and
|
||||
/// its undo history as they are.
|
||||
#[test]
|
||||
|
||||
@@ -28,6 +28,18 @@ impl Gate {
|
||||
std::thread::sleep(std::time::Duration::from_millis(1));
|
||||
}
|
||||
}
|
||||
|
||||
/// Open the gate once this thread starts to wait for a background job ([`background::wait_until`]).
|
||||
/// The flag returned says whether it did.
|
||||
pub(crate) fn open_on_wait(&self) -> std::rc::Rc<std::cell::Cell<bool>> {
|
||||
let (gate, opened) = (self.clone(), std::rc::Rc::new(std::cell::Cell::new(false)));
|
||||
let flag = opened.clone();
|
||||
background::ON_WAIT.set(Some(Box::new(move || {
|
||||
flag.set(true);
|
||||
gate.open();
|
||||
})));
|
||||
opened
|
||||
}
|
||||
}
|
||||
|
||||
/// Gives `app` a window host over `jobs`, as the window installs it, so its background work runs
|
||||
@@ -347,14 +359,10 @@ fn quitting_waits_for_background_saves() {
|
||||
let (mut app, files) = app(gate.clone());
|
||||
app.run("file.new", json!({"width": 100, "height": 100})).unwrap();
|
||||
app.run("file.save", json!({"path": "/docs/q.vectorcraft"})).unwrap();
|
||||
let opener = gate.clone();
|
||||
let release = std::thread::spawn(move || {
|
||||
std::thread::sleep(std::time::Duration::from_millis(50));
|
||||
opener.open();
|
||||
});
|
||||
let waited = gate.open_on_wait();
|
||||
// Without waiting, the document would still count as modified and Quit would ask about it.
|
||||
let r: Value = app.run("app.quit", json!({})).unwrap();
|
||||
release.join().unwrap();
|
||||
assert!(waited.get(), "Quit waited for the save");
|
||||
assert!(r.is_null(), "{r}");
|
||||
assert_eq!(app.ui.status, "quit");
|
||||
assert_eq!(written(&files), ["/docs/q.vectorcraft"]);
|
||||
|
||||
@@ -290,6 +290,7 @@ fn a_touchpad_steps_once_per_wheel_line() {
|
||||
/// the rest of the gesture; Ctrl let go during the gesture still counts until it ends. egui reports a
|
||||
/// touchpad gesture's phases on macOS; on Windows and Linux the framework reads a touchpad's
|
||||
/// Ctrl+scroll as a pinch, which carries no phases.
|
||||
// test-lint: allow never-run touchpad gesture phases reach the app only on macOS
|
||||
#[cfg(target_os = "macos")]
|
||||
#[test]
|
||||
// test-lint: allow never-run egui reports touchpad gesture phases only on macOS
|
||||
|
||||
@@ -218,13 +218,16 @@ pub fn mono(size: f32) -> FontId {
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
/// The saved strings are what Preferences and old settings files hold.
|
||||
/// Preferences saves a brightness by its id, and old settings files hold its label, in any
|
||||
/// case; any other text is not a brightness.
|
||||
#[test]
|
||||
fn brightness_roundtrip() {
|
||||
for b in Brightness::ALL {
|
||||
assert_eq!(Brightness::parse(b.id()), Some(b));
|
||||
assert_eq!(Brightness::parse(b.label()), Some(b));
|
||||
}
|
||||
fn brightness_reads_saved_ids_and_old_labels() {
|
||||
assert_eq!(Brightness::MediumDark.id(), "mediumDark", "the id Preferences saves");
|
||||
assert_eq!(Brightness::parse("mediumDark"), Some(Brightness::MediumDark));
|
||||
assert_eq!(Brightness::parse("Medium Light"), Some(Brightness::MediumLight));
|
||||
assert_eq!(Brightness::parse("LIGHT"), Some(Brightness::Light));
|
||||
assert_eq!(Brightness::parse("medium"), None);
|
||||
assert_eq!(Brightness::parse(""), None);
|
||||
}
|
||||
|
||||
/// A size `app_sizes` cannot read is only logged and dropped, which brings the pill buttons back unnoticed.
|
||||
|
||||
@@ -318,6 +318,9 @@ fn the_controls_under_the_tools_share_a_line_under_a_rule() {
|
||||
let chips = ["Color (, or Shift+,)", "Gradient (. or Shift+.)", "None (/)"].map(|label| named_rect(&nodes, label));
|
||||
assert!(chips.iter().all(|r| (r.top() - chips[0].top()).abs() < 0.5), "one line: {chips:?}");
|
||||
let last = cells(&app, &nodes).into_iter().max_by(|a, b| a.bottom().total_cmp(&b.bottom())).expect("the rail shows tools");
|
||||
// The line fits the column of tools, and the chips do not cover each other.
|
||||
assert!(chips.iter().all(|r| r.left() >= last.left() - 0.5 && r.right() <= last.right() + 0.5), "inside {last:?}: {chips:?}");
|
||||
assert!(chips.windows(2).all(|w| w[0].right() <= w[1].left() + 0.01), "apart: {chips:?}");
|
||||
let proxy = named_rect(&nodes, "Fill and Stroke");
|
||||
let screen_rect = Some(egui::Rect::from_min_size(Pos2::ZERO, egui::vec2(1200.0, 2000.0)));
|
||||
let out = crate::testing::app_frame(&mut app, &ctx, egui::RawInput { time: Some(1.0), screen_rect, ..Default::default() });
|
||||
@@ -336,6 +339,22 @@ fn the_controls_under_the_tools_share_a_line_under_a_rule() {
|
||||
assert_eq!(rules, 1, "one rule lies between the last tool {last:?} and Fill and Stroke {proxy:?}");
|
||||
}
|
||||
|
||||
/// At UI scale 2 the one-column rail's Color, Gradient and None chips still share one line inside the column of tools.
|
||||
#[test]
|
||||
fn the_color_chips_share_a_line_at_ui_scale_2() {
|
||||
let mut app = app_with(200, 200);
|
||||
let ctx = reader();
|
||||
app.session.prefs.ui_scaling = 2.0;
|
||||
app.run("window.toolbarColumns", json!({ "double": false })).unwrap();
|
||||
let nodes = settled(&mut app, &ctx, 0.0, 2000.0);
|
||||
assert_eq!(ctx.zoom_factor(), 2.0, "the frames run at UI scale 2");
|
||||
let chips = ["Color (, or Shift+,)", "Gradient (. or Shift+.)", "None (/)"].map(|label| named_rect(&nodes, label));
|
||||
assert!(chips.iter().all(|r| (r.top() - chips[0].top()).abs() < 0.5), "one line: {chips:?}");
|
||||
let last = cells(&app, &nodes).into_iter().max_by(|a, b| a.bottom().total_cmp(&b.bottom())).expect("the rail shows tools");
|
||||
assert!(chips.iter().all(|r| r.left() >= last.left() - 0.5 && r.right() <= last.right() + 0.5), "inside {last:?}: {chips:?}");
|
||||
assert!(chips.windows(2).all(|w| w[0].right() <= w[1].left() + 0.01), "apart: {chips:?}");
|
||||
}
|
||||
|
||||
/// A screen reader reads the drawing-mode buttons' state as the rail shows it, in every mode: in two columns the
|
||||
/// current mode's button reads pressed and the other two not pressed; in one column the single button is named for the
|
||||
/// current mode and cycles the modes, so it reads as a plain button with no pressed state.
|
||||
|
||||
+3
-3
@@ -294,7 +294,7 @@ other `sv-*` locale resolve to it), Georgian (`ka`, complete; `ka-GE` and `ka_GE
|
||||
placeholders and ellipses agree, command ids exist, every row of a partial catalog is a string the UI
|
||||
shows, the UI fonts have every glyph, no Simplified characters in `zh-hant`) pick it up. Set `complete_menus`
|
||||
once the menus and `tl!` literals are translated; the untranslated report then lists what the catalog lacks
|
||||
(`VECTORCRAFT_I18N_DUMP=strings.txt cargo test -p vectorcraft-ui-egui dump_source_strings` lists every
|
||||
(`VECTORCRAFT_I18N_DUMP=strings.txt cargo test -p vectorcraft-ui-egui dump_source_strings -- --ignored` lists every
|
||||
English string).
|
||||
- A missing translation never fails a test or a build: the interface shows the English text until a translator
|
||||
adds the row. `cargo xtask i18n-report` prints, per language, the strings its catalog lacks (menu strings,
|
||||
@@ -329,7 +329,7 @@ other `sv-*` locale resolve to it), Georgian (`ka`, complete; `ka-GE` and `ka_GE
|
||||
`bad(…)` or `failed(…)`, and the messages a `.map_err(|e| …)` closure returns (from each `if` branch,
|
||||
`match` arm and statement of a block) or the handler a `.map_err(name)` names returns (a closure bound with `let name = |e| …;` or a
|
||||
function `fn name(…)`), and skips calls inside comments
|
||||
(`VECTORCRAFT_I18N_DUMP_MESSAGES=messages.txt cargo test -p vectorcraft-ui-egui dump_source_strings` lists them
|
||||
(`VECTORCRAFT_I18N_DUMP_MESSAGES=messages.txt cargo test -p vectorcraft-ui-egui dump_source_strings -- --ignored` lists them
|
||||
all). A missing row shows the English message. Other languages show messages in English until they add `@msg`
|
||||
rows.
|
||||
- Not translated on purpose: names that are user data (layers, swatches, fonts, documents), the tab
|
||||
@@ -353,7 +353,7 @@ The app decides which cursors exist; whoever draws them works from the list. For
|
||||
|
||||
## Test lint
|
||||
|
||||
`cargo xtask test-lint` (part of `cargo xtask ci`) checks tests that a wrong result can pass, in the lines and tests changed since a base. It fails on an `assert_eq!` or `assert_ne!` of an expression with itself, such as `assert_eq!(x, x)` (`self-compare`), `#[ignore]` without a reason (`ignore-without-reason`), `thread::sleep` in test code (`sleep`), test code that reads Rust source outside the audits listed in `SOURCE_AUDITS` (`reads-source`), and a test that a `cfg` on it or on a `mod` above it excludes from every CI target that builds the crate (`never-run`). `never-run` reports a test only when it can evaluate the `cfg` on every such target; a predicate it does not evaluate, such as a `feature`, counts as unknown, so `#[cfg(all(feature = "gpu", not(feature = "gpu")))]` is not reported. It lists the hits of the other rules without failing: a test whose only checks are that a value exists or a collection is not empty (`is_ok`, `is_some`, `!is_empty`, `len() > 0`: `only-weak`), `assert!(….all(…))` on a collection the test does not show to be non-empty (`all-unguarded`), a process test that checks only the exit status, a test with no assertion and no asserting helper, a silent early `return` on a value from the code under test, an environment variable that no CI leg sets, and the hits of `census`, `mirror`, `constant-echo`, `fixture-only` and `exact-pixel`. The base is `--base <rev>` or `TEST_LINT_BASE`; in CI it is the first parent of the checked-out commit, and elsewhere the merge base with `upstream/main` or `origin/main`. Hits on unchanged lines are counted but do not fail it. A `// test-lint: allow <rule> <reason>` comment exempts its own line and the line below it; `xtask/src/test_lint.rs` lists the rules and their ids. `cargo xtask test-lint --all` lists every hit in the workspace by crate and rule, and does not fail.
|
||||
`cargo xtask test-lint` (part of `cargo xtask ci`) checks tests that a wrong result can pass, in the lines and tests changed since a base. It fails on an `assert_eq!` or `assert_ne!` of an expression with itself, such as `assert_eq!(x, x)` (`self-compare`), `#[ignore]` without a reason (`ignore-without-reason`), `thread::sleep` in test code (`sleep`), test code that reads Rust source outside the audits listed in `SOURCE_AUDITS` (`reads-source`), and a test that a `cfg` on it or on a `mod` above it excludes from every CI target that builds the crate (`never-run`). `never-run` reports a test only when it can evaluate the `cfg` on every such target; a predicate it does not evaluate, such as a `feature`, counts as unknown, so `#[cfg(all(feature = "gpu", not(feature = "gpu")))]` is not reported. A `never-run` test that still builds on macOS or Windows, such as a test of a macOS-only module, is listed without failing; run it locally on that platform. It lists the hits of the other rules without failing: a test whose only checks are that a value exists or a collection is not empty (`is_ok`, `is_some`, `!is_empty`, `len() > 0`: `only-weak`), `assert!(….all(…))` on a collection the test does not show to be non-empty (`all-unguarded`), a process test that checks only the exit status, a test with no assertion and no asserting helper, a silent early `return` on a value from the code under test, an environment variable that no CI leg sets, and the hits of `census`, `mirror`, `constant-echo`, `fixture-only` and `exact-pixel`. The base is `--base <rev>` or `TEST_LINT_BASE`; in CI it is the first parent of the checked-out commit, and elsewhere the merge base with `upstream/main` or `origin/main`. Hits on unchanged lines are counted but do not fail it. A `// test-lint: allow <rule> <reason>` comment exempts its own line and the line below it; `xtask/src/test_lint.rs` lists the rules and their ids. `cargo xtask test-lint --all` lists every hit in the workspace by crate and rule, and does not fail.
|
||||
|
||||
## Tests
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ English) in-app help, and the docs are English.
|
||||
(`bflatastic`), with community contributors adding or correcting (German by `dwetscher`, Japanese and Traditional
|
||||
Chinese by `imachus`). Georgian and the original Gujarati catalog are recorded as reviewed by native speakers; the contributor approved all 387 later Gujarati additions on 2026-11-14.
|
||||
|
||||
> **Gujarati status (2026-11-14, #6613):** 4,673 catalog rows: the original 4,286 remain unchanged; all 387 additions are contributor-reviewed and approved, with 11 wording corrections. Status/error messages remain partial, and the pinned CI/release fonts and web startup list contain no Gujarati face; web selection stays unavailable until a Gujarati interface face is bundled. Scores and estimates unchanged.
|
||||
> **Gujarati status (2026-11-14, #6613):** 4,673 catalog rows: the original 4,286 remain unchanged; all 387 additions are contributor-reviewed and approved, with 11 wording corrections. Status/error messages remain partial. The pinned CI/release fonts include Noto Sans Gujarati as an optional `Gujr` fallback, but the web startup list contains no Gujarati face; web selection stays unavailable until a Gujarati interface face is bundled. Scores and estimates unchanged.
|
||||
|
||||
## The thirteen key languages
|
||||
|
||||
@@ -34,7 +34,7 @@ Chinese by `imachus`). Georgian and the original Gujarati catalog are recorded a
|
||||
| Simplified Chinese (Mandarin) | `zh-hans` | 9,625 rows, 3,735 of them `@msg` and 51 `@msgplural` (counted 2026-11-17 on `main` at `ee60c51fd9`) | all (the untranslated report lists 237 messages without a row for it) | CJK UI font from craft-fonts (BIZ UDPGothic) when embedded, else a system font; IME with marked text at the caret; vertical type partial ([type-parity.md](type-parity.md)) | no | full | — (review) |
|
||||
| Spanish | `es` | 4,009 / 4,020 (99.7%) | all (3,770 `@msg` and 55 `@msgplural` rows, counted 2026-11-18: the untranslated report lists 269 messages without a Spanish row, 236 in its own section and 33 that all 24 checked languages lack) | Latin | no | full | — (review) |
|
||||
| Hindi | `hi` | 8,782 rows (2026-11-13): 3,014 `@msg`, 47 `@msgplural`, 41 `@plural`; the untranslated report on main `f793044f83` (2026-11-14) lists 676 missing rows for it: 608 in its own section and 68 that every checked language lacks | menus, dialogs, tooltips and scanned messages; contributor-approved loanword terminology; agent wording pass | UI and document text shape with HarfRust; installed desktop Devanagari fallback, or a `Deva` craft-fonts face; the web fetches Noto Sans Devanagari when the interface needs it | contributor terminology review; 2026-11-13 wording pass on messages and longer labels, and a word-sense pass on short labels, with a glossary-term test; wider proofread welcome | complete catalog, machine-assisted draft | reported missing rows, native review and layout |
|
||||
| Gujarati | `gu` | 4,673 rows (2026-11-14): original 4,286 unchanged; all 387 additions contributor-reviewed and approved | menus and dialogs; status/error messages partial | installed Gujarati fonts on desktop; optional `Gujr` craft-fonts fallback; no Gujarati face in the pinned CI/release fonts or web startup list | original catalog reviewed by a native speaker; all 387 later additions approved by the contributor, with 11 wording corrections | contributor-reviewed catalog | remaining messages and a bundled Gujarati web font |
|
||||
| Gujarati | `gu` | 4,673 rows (2026-11-14): original 4,286 unchanged; all 387 additions contributor-reviewed and approved | menus and dialogs; status/error messages partial | installed Gujarati fonts on desktop; optional `Gujr` craft-fonts fallback (Noto Sans Gujarati, in the pinned CI/release fonts); not in the web startup list | original catalog reviewed by a native speaker; all 387 later additions approved by the contributor, with 11 wording corrections | contributor-reviewed catalog | remaining messages and a bundled Gujarati web font |
|
||||
| Arabic | `ar` | preparatory registration (native name العربية) and 6-form CLDR plural probe only; translations maintained upstream in `storytold/craft-i18n` (`locales/ar/vectorcraft.tsv`) and not yet consumed | none (UI not exposed pending shared catalog) | document text: existing bidirectional layout and paragraph direction; interface UI: not exposed pending shared catalog, with full shell mirroring pending STD-I18N-001 | — (preparatory) | preparatory (not exposed) | 15–20 |
|
||||
| French | `fr` | 9,166 rows, 3,436 of them `@msg` and 48 `@msgplural` (counted 2026-11-13): the untranslated report lists 178 missing messages for it | all | Latin | no | full | — (review) |
|
||||
| Portuguese | `pt-br` | 9,378 rows, 3,563 of them `@msg` and 48 `@msgplural` (counted 2026-11-13): the untranslated report lists 55 missing messages for it, which open #7116, #7211, #7330, #7378 and #7405 translate; one/other plurals | all | Latin | contributor is a Brazilian Portuguese speaker; further native review welcome | full | — (review) |
|
||||
|
||||
+6
-1
@@ -13658,7 +13658,12 @@ for near matches; when none passes, the shape stays an outline. Glyphs fused int
|
||||
or 65,536 path elements is matched whole only. One command groups at most 16,384 contours, in selection order; the shapes after them are
|
||||
matched whole only. Near matching compares a shape with at most the 256 glyphs closest to it in proportion, in at
|
||||
most 50 million point comparisons per shape and 2 billion per command, ranking a glyph by proportion counting as one
|
||||
comparison per contour and one more; past them, the glyphs not yet ranked or compared are left out. It looks glyphs up for at most 1,024 distinct shapes and runs per command: every selected shape first, in
|
||||
comparison per contour and one more; past them, the glyphs not yet ranked or compared are left out. Those 256 can
|
||||
all be glyphs of other fonts drawn alike (a period or a dot): a shape matched whole, whose matches are all near
|
||||
matches in other fonts than that of the line before it, is also compared with the 256 glyphs of that line's font
|
||||
closest to it in proportion when it does not join the line, and joins the line when one of them fits. A shape with an
|
||||
exact match, a shape split into several glyphs, a shape that matches no glyph at all and a shape after an unmatched
|
||||
shape are not compared again. It looks glyphs up for at most 1,024 distinct shapes and runs per command: every selected shape first, in
|
||||
selection order, then the runs of groups of the compound paths. Glyphs close only to the shapes and runs past that
|
||||
limit are not looked up. At most 262,144 glyphs are drawn to check whether they could near match, and at most 32,768
|
||||
are indexed for it, each face taking an equal share of both; of a face's glyphs, those closest to the selected shapes
|
||||
|
||||
@@ -1360,7 +1360,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
|
||||
- In that Liquify warning, the tool's name and each kind of object it left (graphs, type, symbols, images, meshes, envelopes, repeats, placed documents, blends) are shown in the interface language too, in the order the command lists them and joined as the language joins a list, in each catalog that translates all status and error messages (`liquify-tool`, `liquify-kind` and `liquify-list-*` rows); a kind that Liquify does not list leaves the tool and the list in English (`liquify_warning_translates_its_tool_and_kinds_in_every_complete_catalog`).
|
||||
- An effect a plug-in's output or an importer plug-in's objects carry that VectorCraft refuses (``[0] `id`: reason``) shows in the status bar with its reason in the interface language inside `plug-in output: …` and `can't open …`, in every catalog that translates all status and error messages; the index and the effect id stay as they are, and a JSON array in a message stays as it is (`nested_effect_refusals_translate_with_their_reason`, `bracketed_message_parts_translate_only_as_exact_messages`).
|
||||
- A filter run (`plugin.run`) or plug-in command whose output changes no object and none of the data the plug-in keeps with the document records no undo step and leaves a saved document unmodified, with its objects still selected; a run that may call commands records none when its calls leave the document as it was (engine `plugins::a_filter_run_that_changes_nothing_records_no_undo_step`, `plugins::a_filter_that_keeps_the_same_data_records_no_undo_step`, `plugins::a_plugin_command_that_changes_nothing_records_no_undo_step`).
|
||||
- The untranslated report lists the status and error messages of the effects, swatch libraries, raster sizes and encoders, 3D solids and path operations that a catalog lacks, the messages that a `.map_err` closure or a named error handler returns, and the phrases a parameter schema's error builds for what a value must be (`untranslated_report_checks_every_message_crate_and_schema_phrase`, `message_scan_reads_map_err_closures`, `message_scan_reads_named_map_err_handlers`).
|
||||
- The untranslated report lists the status and error messages of the effects, swatch libraries, raster sizes and encoders, 3D solids and path operations that a catalog lacks, the messages that a `.map_err` closure or a named error handler returns, and the phrases a parameter schema's error builds for what a value must be (`untranslated_report_checks_every_message_crate`, `message_scan_reads_map_err_closures`, `message_scan_reads_named_map_err_handlers`).
|
||||
- The Swedish catalog has rows for the Apply SVG Filter and Check Spelling command names, the SVG Filter effect's name, which also names its undo step, and the 3D and Materials panel's note that graphics map onto the Plane, Extrude and Revolve object types, so these show in Swedish instead of English (`swedish_svg_filter_spelling_and_3d_labels_are_complete`).
|
||||
- Spanish messages (2026-11-13): the Spanish catalog (`crates/ui-egui/src/i18n/es.tsv`) has an `@msg` row for 114 of the 167 status and error messages that the untranslated report (`untranslated_report`) lists as missing in all 23 complete-message languages: the errors of the image encoders, color profiles, swatch exchange files and color books, 3D and Revolve, path operations, DXF import, the script engine and the parameter checks. Open #7211 and #7378 translate 51 of the others (the composite font and SVG filter errors), and 2 stay in English. The rows keep the placeholders, backticked names, accepted values and limits of their English (`spanish_translates_encoder_profile_swatch_revolve_and_parameter_errors`); native review remains; scores and estimates unchanged.
|
||||
- Export commands run through MCP, the control channel or the CLI refuse a key that no format takes, and warn about a key that only another format takes (`{"format": "pdf", "quality": 80}` writes the PDF with the warning "`quality` was not used: PDF files don't read it"; `an_option_only_another_format_reads_gets_a_note`, `control_export_notes_an_option_the_format_does_not_read`, `convert_warns_about_an_unused_option_only_when_one_was_given`), and a command that writes one format (`document.exportPdf`, `document.exportEps`, `document.exportDxf`) or takes one format's options (`document.pdfSettings`, `pdf.preset.save`) refuses a key that format doesn't take. An unknown key inside `marks`, `bleed`, `compression`, `output`, `advanced`, `security` or `flattener` is refused by its path.
|
||||
|
||||
+1
-1
@@ -464,7 +464,7 @@ next unit in the order a right-click on a ruler lists them, from Feet back to Po
|
||||
| A middle-click on a document tab or its × closes it as the × does; closing a modified document's last view asks to save first (VectorCraft addition, as in PhotoCraft) | done | #6506; `chrome::tests::a_middle_click_on_a_tab_closes_it_as_the_close_box_does`; not scored |
|
||||
| When the document tabs don't all fit, the first tab that doesn't fit whole fills the room before the » button with its title shortened and ending in "…", once that room leaves at least 40 pt for the title; with the active tab among the last ones, the tab before the ones shown fills the room left at the start instead; an active tab wider than the strip is shortened to it, and a tab narrower than 25 pt shows no ×; the tooltip of a shortened tab shows the whole title, wrapped to the window (VectorCraft's own rule) | done | #8584; `tests::tab_overflow`; not scored |
|
||||
| An inactive document tab shows the document's name, the view number and the unsaved-changes mark, without the zoom and the mode in parentheses (the color mode and view, or the opacity mask being edited); the active tab keeps its whole title, and an inactive tab's tooltip shows the whole title (VectorCraft's own rule) | done | #8582; `tests::tab_overflow::inactive_tabs_show_the_name_alone_so_more_tabs_fit`; not scored |
|
||||
| Document tab titles draw in a condensed face (craft-fonts' Noto Sans Condensed SemiBold) at the x-height of the interface's semibold face, so more tabs fit; builds without that face draw them in the semibold face (VectorCraft's own rule) | done; release builds pending | #8583; craft-ui's `TypeRole::TabTitle` and `craft_fonts_build::Embed::tab_face`; `craft_fonts::tests::document_fonts_leave_out_the_tab_title_face`; the release and FreeBSD workflows pin a craft-fonts commit without the face, so official builds draw tab titles in the semibold face until that pin moves past storytold/craft-fonts#72; not scored |
|
||||
| Document tab titles draw in a condensed face (craft-fonts' Noto Sans Condensed SemiBold) at the x-height of the interface's semibold face, so more tabs fit; builds without that face draw them in the semibold face (VectorCraft's own rule) | done; release builds pending | #8583; craft-ui's `TypeRole::TabTitle` and `craft_fonts_build::Embed::tab_face`; `craft_fonts::tests::document_fonts_leave_out_the_tab_title_face`; the CI, nightly, release and FreeBSD workflows pin craft-fonts `16bbfc3`, which has the face (storytold/craft-fonts#72), so official desktop builds made from them draw tab titles in it; web builds draw them in the semibold face; not scored |
|
||||
| Panels hidden by Tab or Shift+Tab show for a while when the pointer rests on the left or right edge of the window, over the canvas, and hide again when it moves away; Tab shows them for good | done | Part of #5661; `window.panels.peek` ([Workspace basics](https://web.archive.org/web/2014/https://helpx.adobe.com/illustrator/using/workspace-basics.html), "Hide or show all panels"); VectorCraft's own choices: the 6 pt band and the 0.3 s delays, only the docked panels on that side show (floating panels, Tools and the Control bar stay hidden), and nothing shows in Presentation Mode; `panel_docking::tests::resting_on_the_right_edge_shows_the_hidden_panels_over_the_canvas_until_the_pointer_leaves` and the tests after it |
|
||||
|
||||
| Behaviour | Status | Notes |
|
||||
|
||||
@@ -5,7 +5,7 @@ use std::process::Command;
|
||||
|
||||
use serde_json::Value;
|
||||
|
||||
const REV: &str = "965c7beeb6076480e016e448bddddcce0a738ff6";
|
||||
const REV: &str = "77ade517ecb2a6ad86feb2f9983a098ad5738fc6";
|
||||
const PACKAGES: &[(&str, &str, &str)] = &[
|
||||
("craft-pdf", "0.1.0", REV),
|
||||
("krilla", "0.8.2", REV),
|
||||
|
||||
+598
-23
@@ -36,7 +36,10 @@
|
||||
//! file's code sets `NAME`; workflow mapping keys and `NAME=` assignments count, but comments,
|
||||
//! string literals, `echo` or `printf` output that is not written to `$GITHUB_ENV`, and variable
|
||||
//! reads do not;
|
||||
//! * `sleep`: `thread::sleep` in test code, or a bare `sleep(…)` in a file that imports it;
|
||||
//! * `sleep`: `thread::sleep` in test code, or a bare `sleep(…)` in a file that imports it. Left
|
||||
//! out: the pause of a `while` or `loop` that checks a condition (its condition or body calls a
|
||||
//! function or method besides reading the clock), also under an `if` or `match` inside that
|
||||
//! loop, and the delay inside a closure passed to `spawn` whose thread handle the test drops;
|
||||
//! * `reads-source`: test code that reads Rust source (`include_str!` of a `.rs` file,
|
||||
//! `read_to_string` of a path with a `.rs` literal, or a walk that keeps files ending in `.rs`),
|
||||
//! outside the source audits in [`SOURCE_AUDITS`];
|
||||
@@ -59,7 +62,9 @@
|
||||
//! test bound (in scope) to such values, so nothing the code under test returned is checked;
|
||||
//! * `never-run`: a test that the `cfg` attributes on it, on the items around it or on the `mod`
|
||||
//! declarations above its file leave out of every target CI runs tests on (Linux and FreeBSD on
|
||||
//! x86_64, and Windows for the app and the UI crate's print tests);
|
||||
//! x86_64, and Windows for the app and the UI crate's print tests). A test that still builds on
|
||||
//! macOS or Windows is listed without failing the check: it tests code or behavior of that
|
||||
//! platform and runs locally there;
|
||||
//! * `exact-pixel`: in a file that uses egui, an assertion that a screen rect (an identifier `rect`,
|
||||
//! `rect_…` or `…_rect`, whole or through a corner, edge or size) equals numbers written out.
|
||||
//!
|
||||
@@ -76,8 +81,8 @@
|
||||
//! `fn` line. An allow without a reason exempts nothing.
|
||||
//!
|
||||
//! `cargo xtask test-lint` fails on hits of `self-compare`, `ignore-without-reason`, `sleep`,
|
||||
//! `reads-source` and `never-run` in the lines and tests changed since a base, and lists the other
|
||||
//! rules' hits there without failing. The base is `--base <rev>` or `TEST_LINT_BASE`; in GitHub Actions the first parent of `HEAD` (a pull request's
|
||||
//! `reads-source` and `never-run` (except a test that builds on macOS or Windows) in the lines and
|
||||
//! tests changed since a base, and lists the other rules' hits there without failing. The base is `--base <rev>` or `TEST_LINT_BASE`; in GitHub Actions the first parent of `HEAD` (a pull request's
|
||||
//! merge commit is checked out, and a shallow checkout fetches that parent); elsewhere the merge
|
||||
//! base of `HEAD` and `upstream/main` or `origin/main`. Uncommitted and untracked files count as
|
||||
//! changed. Hits on unchanged lines are counted but do not fail it. `--all` lists every hit in the
|
||||
@@ -245,11 +250,20 @@ pub struct Hit {
|
||||
pub first: usize,
|
||||
pub last: usize,
|
||||
/// Lines outside `first..=last` that also count as changes to the hit: the enclosing `cfg`
|
||||
/// attributes of a `never-run` test. An allow comment there does not exempt it.
|
||||
/// attributes of a `never-run` test, and the loop or spawn statement around a `sleep`. An
|
||||
/// allow comment there does not exempt it.
|
||||
pub gates: Vec<usize>,
|
||||
/// A `never-run` hit on a test that builds on macOS or Windows, which CI does not test on: it is
|
||||
/// listed with the report-only rules.
|
||||
pub report_only: bool,
|
||||
}
|
||||
|
||||
impl Hit {
|
||||
/// Whether the hit fails the check when it is on a changed line.
|
||||
fn fails(&self) -> bool {
|
||||
self.rule.fails() && !self.report_only
|
||||
}
|
||||
|
||||
fn show(&self) -> String {
|
||||
let test = if self.test.is_empty() { String::new() } else { format!(" `{}`", self.test) };
|
||||
format!("{}:{}: [{}]{test}: {}", self.path, self.line, self.rule.id(), self.note)
|
||||
@@ -526,7 +540,7 @@ impl Options {
|
||||
|
||||
fn finish(counted: &[Hit], older: usize, files: usize, base: &str) -> Result<(), String> {
|
||||
let older = if older == 0 { String::new() } else { format!("; {older} hit(s) on unchanged lines of those files are not counted") };
|
||||
let (failing, reported): (Vec<&Hit>, Vec<&Hit>) = counted.iter().partition(|h| h.rule.fails());
|
||||
let (failing, reported): (Vec<&Hit>, Vec<&Hit>) = counted.iter().partition(|h| h.fails());
|
||||
if !reported.is_empty() {
|
||||
println!(
|
||||
"test-lint: {} hit(s) of report-only rules in the lines changed since {base} (they do not fail the check):\n {}",
|
||||
@@ -1175,11 +1189,11 @@ const COMMON: &[&str] = &[
|
||||
/// The names called in `m[from..to]`: functions (`name(`, also through a path), methods
|
||||
/// (`.name(`), including calls with turbofish arguments, and macros (`name!`).
|
||||
fn calls(m: &[u8], from: usize, to: usize) -> Vec<(String, bool)> {
|
||||
calls_at(m, from, to).into_iter().map(|(name, method, _)| (name, method)).collect()
|
||||
calls_at(m, from, to).into_iter().map(|(_, name, method)| (name, method)).collect()
|
||||
}
|
||||
|
||||
/// [`calls`] with the offset where each name starts.
|
||||
fn calls_at(m: &[u8], from: usize, to: usize) -> Vec<(String, bool, usize)> {
|
||||
/// [`calls`] with the index where each name starts.
|
||||
fn calls_at(m: &[u8], from: usize, to: usize) -> Vec<(usize, String, bool)> {
|
||||
let m = &m[..to];
|
||||
let mut out = vec![];
|
||||
let mut i = from;
|
||||
@@ -1196,7 +1210,7 @@ fn calls_at(m: &[u8], from: usize, to: usize) -> Vec<(String, bool, usize)> {
|
||||
let name = String::from_utf8_lossy(&m[i..end]).into_owned();
|
||||
let method = i > 0 && m[i - 1] == b'.';
|
||||
if !KEYWORDS.contains(&name.as_str()) {
|
||||
out.push((if bang { format!("{name}!") } else { name }, method, i));
|
||||
out.push((i, if bang { format!("{name}!") } else { name }, method));
|
||||
}
|
||||
}
|
||||
i = end;
|
||||
@@ -1412,7 +1426,7 @@ struct File<'a> {
|
||||
impl File<'_> {
|
||||
fn hit(&self, at: usize, rule: Rule, test: &str, note: String) -> Hit {
|
||||
let line = self.lines.of(at);
|
||||
Hit { path: self.path.to_owned(), line, rule, test: test.to_owned(), note, first: line, last: line, gates: vec![] }
|
||||
Hit { path: self.path.to_owned(), line, rule, test: test.to_owned(), note, first: line, last: line, gates: vec![], report_only: false }
|
||||
}
|
||||
|
||||
fn test_at(&self, pos: usize) -> &str {
|
||||
@@ -1628,7 +1642,7 @@ fn census(v: &View, helpers: &HashSet<String>) -> Vec<Hit> {
|
||||
let body = &unmessaged[from - v.t.open..to - v.t.open];
|
||||
// A helper counts only where it runs whenever the assertions pass, not after an `||`.
|
||||
let (f, t) = (from + 1 - v.t.open, to - v.t.open);
|
||||
let helper_runs = calls_at(&unmessaged, f, t).into_iter().any(|(n, method, at)| {
|
||||
let helper_runs = calls_at(&unmessaged, f, t).into_iter().any(|(at, n, method)| {
|
||||
!(n.ends_with('!') && is_assert_macro(&n)) && is_helper_call(&n, method, helpers) && runs_with_assertion(&unmessaged, f, t, at)
|
||||
});
|
||||
!helper_runs
|
||||
@@ -3681,14 +3695,20 @@ fn ignore_reason(src: &[u8]) -> Option<&[u8]> {
|
||||
src.get(body..end)
|
||||
}
|
||||
|
||||
/// What the file's `use` items bring in for a `thread::spawn` call.
|
||||
#[derive(Clone, Copy)]
|
||||
struct Imports {
|
||||
/// `spawn` names `std::thread::spawn`.
|
||||
spawn: bool,
|
||||
/// `thread` names `std::thread`.
|
||||
thread: bool,
|
||||
}
|
||||
|
||||
fn sleep_hits(file: &File) -> Vec<Hit> {
|
||||
let m = &file.m;
|
||||
// A bare `sleep(…)` counts only where a `use` brings in `thread::sleep`.
|
||||
let imported = words(m, b"use", 0, m.len()).into_iter().any(|u| {
|
||||
let item = norm(&m[u..statement_end(m, u)]);
|
||||
item.contains("thread::sleep")
|
||||
|| item.split_once("thread::{").is_some_and(|(_, list)| !words(list.as_bytes(), b"sleep", 0, list.len()).is_empty())
|
||||
});
|
||||
let imported = thread_import(m, "sleep");
|
||||
let imports = Imports { spawn: thread_import(m, "spawn"), thread: std_thread_import(m) };
|
||||
words(m, b"sleep", 0, m.len())
|
||||
.into_iter()
|
||||
.filter(|&at| {
|
||||
@@ -3697,15 +3717,440 @@ fn sleep_hits(file: &File) -> Vec<Hit> {
|
||||
}
|
||||
let before = m[..at].trim_ascii_end();
|
||||
let path = before.strip_suffix(b"::").map(<[u8]>::trim_ascii_end);
|
||||
match path {
|
||||
let thread_sleep = match path {
|
||||
Some(p) => p.ends_with(b"thread") && !p.ends_with(b"_thread"),
|
||||
None => imported && !before.ends_with(b".") && !before.ends_with(b"fn"),
|
||||
}
|
||||
};
|
||||
thread_sleep && !polls_or_releases(m, at, imports)
|
||||
})
|
||||
.map(|at| {
|
||||
let mut hit = file.hit(at, Rule::Sleep, file.test_at(at), "sleeps in test code".into());
|
||||
// An edit to the loop or spawn around the sleep can remove what exempted it.
|
||||
if let Some((name, _)) = expression_closure_call(m, at).filter(|&(name, end)| &m[name..end] == b"spawn") {
|
||||
let end = spawn_statement_end(m, name).unwrap_or(m.len().saturating_sub(1));
|
||||
hit.gates.extend(file.lines.of(name)..=file.lines.of(end));
|
||||
} else if let Some(WaitBlock { start, open, through_other }) = wait_block(m, at) {
|
||||
let head_at = start + (m[start..open].len() - m[start..open].trim_ascii_start().len());
|
||||
if !through_other || closure_head(m[start..open].trim_ascii()) {
|
||||
let close = matching(m, open).unwrap_or(m.len().saturating_sub(1));
|
||||
// A spawn's span runs through the statement, which holds the use of its handle.
|
||||
let close = closure_spawn(m, start, open).and_then(|s| spawn_statement_end(m, s)).map_or(close, |end| end.max(close));
|
||||
hit.gates.extend(file.lines.of(head_at)..=file.lines.of(close));
|
||||
}
|
||||
}
|
||||
hit
|
||||
})
|
||||
.map(|at| file.hit(at, Rule::Sleep, file.test_at(at), "sleeps in test code".into()))
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Whether a `use` brings in `std::thread::<name>` under its own name, alone or in a `thread::{…}`
|
||||
/// list. An alias (`thread::spawn as spawn_thread`) brings in another name, and `crate::thread`
|
||||
/// is not the standard library's module.
|
||||
fn thread_import(m: &[u8], name: &str) -> bool {
|
||||
let path = format!("thread::{name}");
|
||||
let alias = format!("as{name}");
|
||||
words(m, b"use", 0, m.len()).into_iter().any(|u| {
|
||||
// `norm` drops spaces, so `spawn as s` reads `spawnass`.
|
||||
let item = norm(&m[u..statement_end(m, u)]);
|
||||
let named = |i: usize| {
|
||||
let rest = &item[i + path.len()..];
|
||||
let rest = rest.strip_prefix(alias.as_str()).unwrap_or(rest);
|
||||
!item.as_bytes()[..i].last().copied().is_some_and(is_ident) && !rest.bytes().next().is_some_and(is_ident)
|
||||
};
|
||||
item.match_indices(&path).any(|(i, _)| named(i) && under_std(&item[..i]))
|
||||
|| item.match_indices("thread::{").any(|(i, _)| {
|
||||
let list = &item[i + "thread::{".len()..];
|
||||
let list = &list[..list.find('}').unwrap_or(list.len())];
|
||||
under_std(&item[..i]) && !words(list.as_bytes(), name.as_bytes(), 0, list.len()).is_empty()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/// Whether a member of a `use` item whose normalized text before the member is `pre` sits directly
|
||||
/// under `std`: right after `use std::`, or a top-level member of a `use std::{…}` list.
|
||||
fn under_std(pre: &str) -> bool {
|
||||
let pre = pre.strip_prefix("use").unwrap_or(pre);
|
||||
let pre = pre.strip_prefix("::").unwrap_or(pre);
|
||||
let Some(rest) = pre.strip_prefix("std::") else { return false };
|
||||
rest.is_empty() || (rest.starts_with('{') && rest.ends_with(['{', ',']) && rest.matches('{').count() == 1 + rest.matches('}').count())
|
||||
}
|
||||
|
||||
/// Whether a `use` binds the name `thread` to `std::thread`: `use std::thread;`,
|
||||
/// `use std::{thread, …};` or `use std::thread::{self, …};`.
|
||||
fn std_thread_import(m: &[u8]) -> bool {
|
||||
words(m, b"use", 0, m.len()).into_iter().any(|u| {
|
||||
let item = norm(&m[u..statement_end(m, u)]);
|
||||
words(item.as_bytes(), b"thread", 0, item.len()).into_iter().any(|i| {
|
||||
let after = &item[i + "thread".len()..];
|
||||
// `{self as worker}` binds another name.
|
||||
let self_member =
|
||||
after.strip_prefix("::{").is_some_and(|list| list[..list.find('}').unwrap_or(list.len())].split(',').any(|x| x == "self"));
|
||||
under_std(&item[..i]) && (after.is_empty() || after.starts_with([';', ',', '}']) || self_member)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/// Calls that pass a value through without reading any state, such as the `unwrap` of
|
||||
/// `elapsed().checked_sub(D).unwrap()`.
|
||||
const PASS_THROUGH_CALLS: &[&str] = &["unwrap", "expect", "unwrap_or", "unwrap_or_default", "unwrap_or_else"];
|
||||
|
||||
/// Macros that print or log their arguments, such as the `println!("{}", t0.elapsed())` of a
|
||||
/// wait on the clock.
|
||||
const LOG_MACROS: &[&str] = &["print!", "println!", "eprint!", "eprintln!", "trace!", "debug!", "info!", "warn!", "error!", "log!"];
|
||||
|
||||
/// Calls that only read or build a time, which a wait on the clock alone makes.
|
||||
const TIME_CALLS: &[&str] = &[
|
||||
"sleep",
|
||||
"now",
|
||||
"elapsed",
|
||||
"duration_since",
|
||||
"saturating_duration_since",
|
||||
"checked_sub",
|
||||
"checked_add",
|
||||
"from_millis",
|
||||
"from_secs",
|
||||
"from_micros",
|
||||
"from_nanos",
|
||||
"from_secs_f32",
|
||||
"from_secs_f64",
|
||||
"as_secs",
|
||||
"as_millis",
|
||||
"as_micros",
|
||||
"as_nanos",
|
||||
"as_secs_f32",
|
||||
"as_secs_f64",
|
||||
"subsec_millis",
|
||||
"subsec_micros",
|
||||
"subsec_nanos",
|
||||
"mul_f32",
|
||||
"mul_f64",
|
||||
];
|
||||
|
||||
/// The enclosing block's opening brace and the start of the statement that opens it.
|
||||
fn enclosing_block(m: &[u8], at: usize) -> Option<(usize, usize)> {
|
||||
let mut depth = 0usize;
|
||||
let open = (0..at).rev().find(|&j| match m[j] {
|
||||
b'}' => {
|
||||
depth += 1;
|
||||
false
|
||||
}
|
||||
b'{' if depth == 0 => true,
|
||||
b'{' => {
|
||||
depth -= 1;
|
||||
false
|
||||
}
|
||||
_ => false,
|
||||
})?;
|
||||
// The statement that opens the block starts after the last `;`, `{` or `}` outside brackets, so
|
||||
// a condition such as `json!({}) != 1` stays whole. A block in the condition (`while { … } {`)
|
||||
// belongs to the statement too.
|
||||
let mut nest = 0usize;
|
||||
let mut j = open;
|
||||
let start = loop {
|
||||
let Some(k) = j.checked_sub(1) else { break 0 };
|
||||
j = k;
|
||||
match m[j] {
|
||||
b')' | b']' => nest += 1,
|
||||
b'}' if nest > 0 => nest += 1,
|
||||
b'(' | b'[' => nest = nest.saturating_sub(1),
|
||||
b'{' if nest > 0 => nest -= 1,
|
||||
b'}' => match opening_brace(m, j).filter(|&o| condition_block(&m[..o])) {
|
||||
Some(o) => j = o,
|
||||
None => break j + 1,
|
||||
},
|
||||
b';' if nest == 0 => break j + 1,
|
||||
b'{' => break j + 1,
|
||||
_ => {}
|
||||
}
|
||||
};
|
||||
Some((open, start))
|
||||
}
|
||||
|
||||
/// The `{` that the `}` at `close` closes.
|
||||
fn opening_brace(m: &[u8], close: usize) -> Option<usize> {
|
||||
let mut depth = 0usize;
|
||||
(0..close).rev().find(|&j| match m[j] {
|
||||
b'}' => {
|
||||
depth += 1;
|
||||
false
|
||||
}
|
||||
b'{' if depth == 0 => true,
|
||||
b'{' => {
|
||||
depth -= 1;
|
||||
false
|
||||
}
|
||||
_ => false,
|
||||
})
|
||||
}
|
||||
|
||||
/// Whether a block whose `{` follows `before` is an operand in a condition: it follows `while`,
|
||||
/// `if`, `match`, `&&`, `||`, `!` or a comparison.
|
||||
fn condition_block(before: &[u8]) -> bool {
|
||||
let before = before.trim_ascii_end();
|
||||
let keyword = |w: &[u8]| before.ends_with(w) && !before.len().checked_sub(w.len() + 1).is_some_and(|j| is_ident(before[j]));
|
||||
// A `!` after a name is a macro's (`m! { … }`), not a negation.
|
||||
let not = before.strip_suffix(b"!").is_some_and(|b| !b.trim_ascii_end().last().copied().is_some_and(is_ident));
|
||||
// `||` after an operand is an `or`; after `(`, `,`, `=`, `move` or `return` it starts a closure.
|
||||
let or = before.strip_suffix(b"||").map(<[u8]>::trim_ascii_end).is_some_and(|b| {
|
||||
let ends_word = |w: &[u8]| b.ends_with(w) && !b.len().checked_sub(w.len() + 1).is_some_and(|j| is_ident(b[j]));
|
||||
b.last().copied().is_some_and(|c| is_ident(c) || matches!(c, b')' | b']' | b'}' | b'?')) && !ends_word(b"move") && !ends_word(b"return")
|
||||
});
|
||||
// A comparison or shift has a space before `<` or `>` (`0 < { … }`); a generic (`Option<u8> {`),
|
||||
// `->` and `=>` do not.
|
||||
let angles = before.iter().rev().take_while(|&&c| c == b'<' || c == b'>').count();
|
||||
let compares = (1..=2).contains(&angles) && before.len().checked_sub(angles + 1).is_some_and(|j| before[j].is_ascii_whitespace());
|
||||
keyword(b"while") || keyword(b"if") || keyword(b"match") || before.ends_with(b"&&") || or || not || compares || before.ends_with(b"=")
|
||||
}
|
||||
|
||||
/// `head` without a leading loop label (`'outer:`).
|
||||
fn strip_label(head: &[u8]) -> &[u8] {
|
||||
if head.first() == Some(&b'\'') {
|
||||
let n = 1 + head[1..].iter().take_while(|&&c| is_ident(c)).count();
|
||||
if let Some(rest) = head[n..].trim_ascii_start().strip_prefix(b":") {
|
||||
return rest.trim_ascii_start();
|
||||
}
|
||||
}
|
||||
head
|
||||
}
|
||||
|
||||
/// Whether `head` opens the body of a closure without parameters: `|| {`, or `|| -> T {` with a return type.
|
||||
fn closure_head(head: &[u8]) -> bool {
|
||||
head.ends_with(b"||") || head.windows(2).rposition(|w| w == b"||").is_some_and(|p| head[p + 2..].trim_ascii_start().starts_with(b"->"))
|
||||
}
|
||||
|
||||
/// Keywords that cannot be a path segment before `spawn`, such as the `return` of `return ::std::thread::spawn(…);`.
|
||||
const NOT_PATH: &[&[u8]] = &[
|
||||
b"return", b"break", b"yield", b"let", b"else", b"in", b"as", b"move", b"match", b"if", b"while", b"loop", b"for", b"box", b"unsafe", b"async",
|
||||
b"await", b"const", b"static", b"mut", b"ref", b"dyn", b"impl",
|
||||
];
|
||||
|
||||
/// The block that decides whether the sleep at `at` waits: the nearest `while` or `loop`, or the
|
||||
/// nearest closure without parameters, around it.
|
||||
struct WaitBlock {
|
||||
open: usize,
|
||||
start: usize,
|
||||
/// The walk passed a block other than an `if`, `else`, `match` or match arm, such as a `let`
|
||||
/// initializer. Only a closure exempts the sleep then.
|
||||
through_other: bool,
|
||||
}
|
||||
|
||||
/// The [`WaitBlock`] around `at`. The walk stops at a function.
|
||||
fn wait_block(m: &[u8], at: usize) -> Option<WaitBlock> {
|
||||
let mut at = at;
|
||||
let mut through_other = false;
|
||||
loop {
|
||||
let (open, start) = enclosing_block(m, at)?;
|
||||
let head = m[start..open].trim_ascii();
|
||||
let labeled = strip_label(head);
|
||||
let keyword = |w: &[u8]| head.starts_with(w) && !head.get(w.len()).copied().is_some_and(is_ident);
|
||||
let starts_while = labeled.starts_with(b"while") && !labeled.get(5).copied().is_some_and(is_ident);
|
||||
// A `loop` can be the value of a `let` (`let p = loop { … };`), so it ends the head.
|
||||
let ends_loop = labeled.ends_with(b"loop") && !labeled.len().checked_sub(5).is_some_and(|j| is_ident(labeled[j]));
|
||||
if starts_while || ends_loop || closure_head(head) {
|
||||
return Some(WaitBlock { open, start, through_other });
|
||||
}
|
||||
if !words(head, b"fn", 0, head.len()).is_empty() {
|
||||
return None;
|
||||
}
|
||||
if !head.is_empty() && !keyword(b"if") && !keyword(b"else") && !keyword(b"match") && !head.ends_with(b"=>") {
|
||||
through_other = true;
|
||||
}
|
||||
at = open;
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether the `while` loop with head `head` counts its own passes: its condition compares a name
|
||||
/// with `<`, `<=`, `>`, `>=` or `!=` and nothing else, and its body adds to or subtracts from it.
|
||||
fn counted_while(m: &[u8], head: &[u8], open: usize, close: usize) -> bool {
|
||||
let Some(cond) = head.strip_prefix(b"while") else { return false };
|
||||
let cond = cond.trim_ascii_start();
|
||||
let n = cond.iter().take_while(|&&c| is_ident(c)).count();
|
||||
if n == 0 || cond[0].is_ascii_digit() || cond.windows(2).any(|w| w == b"&&" || w == b"||") {
|
||||
return false;
|
||||
}
|
||||
let op = cond[n..].trim_ascii_start();
|
||||
let compares = (op.starts_with(b"<") && !op.starts_with(b"<<")) || (op.starts_with(b">") && !op.starts_with(b">>")) || op.starts_with(b"!=");
|
||||
let name = &cond[..n];
|
||||
compares
|
||||
&& words(m, name, open, close).into_iter().any(|w| {
|
||||
let after = skip_ws(m, w + n);
|
||||
if matches!(m.get(after..after + 2), Some(b"+=" | b"-=")) {
|
||||
return true;
|
||||
}
|
||||
// `n = n + 1` or `n = n - 1`.
|
||||
if m.get(after) != Some(&b'=') || m.get(after + 1) == Some(&b'=') {
|
||||
return false;
|
||||
}
|
||||
let value = skip_ws(m, after + 1);
|
||||
m.get(value..value + n) == Some(name)
|
||||
&& !m.get(value + n).copied().is_some_and(is_ident)
|
||||
&& matches!(m.get(skip_ws(m, value + n)), Some(b'+' | b'-'))
|
||||
})
|
||||
}
|
||||
|
||||
/// Whether the sleep at `at` is the pause of a loop that checks a condition, or the delay of a
|
||||
/// spawned thread's fallback release. A `while` or `loop` around it polls when its condition or
|
||||
/// body calls a function or method other than [`TIME_CALLS`] and [`PASS_THROUGH_CALLS`] (a
|
||||
/// flag's `load`, a `poll`, a progress read). A macro such as `println!`, a call inside the
|
||||
/// arguments of `stringify!`, of a [`LOG_MACROS`] macro or of the sleep itself, a nested `fn` name
|
||||
/// and `Duration::new` do not count. A closure passed directly to a `thread::spawn` call whose
|
||||
/// handle is dropped runs beside the test, which does not wait for it. In `while n < bound` with
|
||||
/// `n += 1`, `n -= 1`, `n = n + 1` or `n = n - 1` in the body, the loop counts its own passes, so
|
||||
/// only calls in the body count.
|
||||
fn polls_or_releases(m: &[u8], at: usize, imports: Imports) -> bool {
|
||||
if let Some((name, end)) = expression_closure_call(m, at) {
|
||||
return &m[name..end] == b"spawn" && dropped_spawn(m, name, imports);
|
||||
}
|
||||
let Some(WaitBlock { open, start, through_other }) = wait_block(m, at) else { return false };
|
||||
let head = m[start..open].trim_ascii();
|
||||
if closure_head(head) {
|
||||
return closure_spawn(m, start, open).is_some_and(|s| dropped_spawn(m, s, imports));
|
||||
}
|
||||
// A sleep inside another block, such as a `let` initializer, in the loop is reported.
|
||||
if through_other {
|
||||
return false;
|
||||
}
|
||||
let close = matching(m, open).unwrap_or(m.len());
|
||||
let from = if counted_while(m, strip_label(head), open, close) { open } else { start };
|
||||
let found = calls_at(m, from, close);
|
||||
// The arguments of `stringify!`, of a logging macro and of a sleep are not polling work.
|
||||
let skipped: Vec<(usize, usize)> = found
|
||||
.iter()
|
||||
.filter(|(_, name, _)| name == "stringify!" || name == "sleep" || LOG_MACROS.contains(&name.as_str()))
|
||||
.filter_map(|(p, name, _)| {
|
||||
let o = skip_ws(m, p + name.len());
|
||||
matching(m, o).map(|c| (o, c))
|
||||
})
|
||||
.collect();
|
||||
let before = |p: usize| m[..p].trim_ascii_end();
|
||||
// `new` builds a time only as `Duration::new`, with `Duration` as a whole path segment.
|
||||
let duration_new = |p: usize| {
|
||||
before(p)
|
||||
.strip_suffix(b"::")
|
||||
.map(<[u8]>::trim_ascii_end)
|
||||
.is_some_and(|q| q.ends_with(b"Duration") && !q.len().checked_sub(9).is_some_and(|j| is_ident(q[j])))
|
||||
};
|
||||
// A nested `fn` item's name is a declaration, not a call.
|
||||
let declared = |p: usize| {
|
||||
let b = before(p);
|
||||
b.ends_with(b"fn") && !b.len().checked_sub(3).is_some_and(|j| is_ident(b[j]))
|
||||
};
|
||||
found.iter().any(|&(p, ref name, method)| {
|
||||
!name.ends_with('!')
|
||||
&& !TIME_CALLS.contains(&name.as_str())
|
||||
&& !PASS_THROUGH_CALLS.contains(&name.as_str())
|
||||
&& !skipped.iter().any(|&(o, c)| o < p && p < c)
|
||||
&& !(name == "new" && !method && duration_new(p))
|
||||
&& !(!method && declared(p))
|
||||
})
|
||||
}
|
||||
|
||||
/// The start of the name of the `spawn(…)` call that takes the closure whose head is `m[start..open]`
|
||||
/// as its argument directly (`spawn(|| {`, `spawn(move || {`), not through another call such as
|
||||
/// `spawn(prepare(|| {`.
|
||||
fn closure_spawn(m: &[u8], start: usize, open: usize) -> Option<usize> {
|
||||
let head = &m[start..open];
|
||||
words(head, b"spawn", 0, head.len()).into_iter().rev().find_map(|s| {
|
||||
let paren = skip_ws(head, s + "spawn".len());
|
||||
if head.get(paren) != Some(&b'(') {
|
||||
return None;
|
||||
}
|
||||
let arg = head[paren + 1..].trim_ascii_start();
|
||||
let arg = match arg.strip_prefix(b"move") {
|
||||
Some(rest) if !rest.first().copied().is_some_and(is_ident) => rest.trim_ascii_start(),
|
||||
_ => arg,
|
||||
};
|
||||
arg.starts_with(b"||").then_some(start + s)
|
||||
})
|
||||
}
|
||||
|
||||
/// The offset of the `;` that ends the statement holding the `spawn(…)` call whose name starts at
|
||||
/// `at`, so an edit that keeps or joins the handle (`).join().unwrap();`) falls in the hit's span.
|
||||
fn spawn_statement_end(m: &[u8], at: usize) -> Option<usize> {
|
||||
let close = matching(m, skip_ws(m, at + "spawn".len()))?;
|
||||
Some(statement_end(m, close + 1).min(m.len().saturating_sub(1)))
|
||||
}
|
||||
|
||||
/// For a sleep that is the whole body of a closure without braces (`spawn(|| thread::sleep(D))`),
|
||||
/// the start and end of the name of the call that takes the closure.
|
||||
fn expression_closure_call(m: &[u8], at: usize) -> Option<(usize, usize)> {
|
||||
// The `(` of the call, or the `,` before the argument, that starts the argument holding `at`.
|
||||
let argument_start = |from: usize, comma: bool| {
|
||||
let mut depth = 0usize;
|
||||
let mut j = from;
|
||||
loop {
|
||||
j = j.checked_sub(1)?;
|
||||
match m[j] {
|
||||
b')' | b']' | b'}' => depth += 1,
|
||||
b'(' | b'[' | b'{' if depth > 0 => depth -= 1,
|
||||
b'(' if depth == 0 => return Some(j),
|
||||
b',' if depth == 0 && comma => return Some(j),
|
||||
b'[' | b'{' | b';' if depth == 0 => return None,
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
};
|
||||
let stop = argument_start(at, true)?;
|
||||
let arg = m[stop + 1..at].trim_ascii();
|
||||
let arg = match arg.strip_prefix(b"move") {
|
||||
Some(rest) if !rest.first().copied().is_some_and(is_ident) => rest.trim_ascii_start(),
|
||||
_ => arg,
|
||||
};
|
||||
let params = arg.strip_prefix(b"|")?;
|
||||
let body = ¶ms[params.iter().position(|&c| c == b'|')? + 1..];
|
||||
if !body.iter().all(|&c| is_ident(c) || c == b':' || c.is_ascii_whitespace()) {
|
||||
return None;
|
||||
}
|
||||
let paren = if m[stop] == b'(' { stop } else { argument_start(stop, false)? };
|
||||
let end = m[..paren].trim_ascii_end().len();
|
||||
let name = m[..end].iter().rposition(|&c| !is_ident(c)).map_or(0, |j| j + 1);
|
||||
(name < end).then_some((name, end))
|
||||
}
|
||||
|
||||
/// Whether the `spawn(…)` call whose name starts at `at` starts a thread and drops its handle.
|
||||
/// The call is the whole statement: `std::thread::` before it (or `thread::` where a `use` binds
|
||||
/// `thread` to `std::thread`, or no path where a `use` brings in `std::thread::spawn`) and a `;` after
|
||||
/// it. A `let`, an assignment, an argument or a chained `.join()` keeps the handle, and a test
|
||||
/// that joins it waits for the sleep.
|
||||
fn dropped_spawn(m: &[u8], at: usize, imports: Imports) -> bool {
|
||||
let from = m[..at].iter().rposition(|&c| !(is_ident(c) || c == b':' || c.is_ascii_whitespace())).map_or(0, |j| j + 1);
|
||||
if !matches!(m[..from].last().copied(), None | Some(b';' | b'{' | b'}')) {
|
||||
return false;
|
||||
}
|
||||
let path = m[from..at].trim_ascii();
|
||||
let path = path.strip_prefix(b"::").map_or(path, <[u8]>::trim_ascii_start);
|
||||
let mut segments: Vec<&[u8]> = vec![];
|
||||
let mut i = 0;
|
||||
while i < path.len() {
|
||||
if !is_ident(path[i]) || path[i].is_ascii_digit() {
|
||||
return false;
|
||||
}
|
||||
let segment = i;
|
||||
while i < path.len() && is_ident(path[i]) {
|
||||
i += 1;
|
||||
}
|
||||
let last = &path[segment..i];
|
||||
if NOT_PATH.contains(&last) {
|
||||
return false;
|
||||
}
|
||||
segments.push(last);
|
||||
i = skip_ws(path, i);
|
||||
if path.get(i..i + 2) != Some(&b"::"[..]) {
|
||||
return false;
|
||||
}
|
||||
i = skip_ws(path, i + 2);
|
||||
}
|
||||
// A `thread::` path names the standard library's module only where a `use` binds it.
|
||||
let thread = match segments[..] {
|
||||
[] => imports.spawn,
|
||||
[b"thread"] => imports.thread,
|
||||
[b"std", b"thread"] => true,
|
||||
_ => false,
|
||||
};
|
||||
let paren = skip_ws(m, at + "spawn".len());
|
||||
thread && matching(m, paren).is_some_and(|close| m.get(skip_ws(m, close + 1)) == Some(&b';'))
|
||||
}
|
||||
|
||||
fn reads_source_hits(file: &File) -> Vec<Hit> {
|
||||
if SOURCE_AUDITS.contains(&file.path) {
|
||||
return vec![];
|
||||
@@ -4402,6 +4847,15 @@ const CI_TARGETS: &[Target] = &[Target { os: "linux", family: "unix", arch: "x86
|
||||
/// The printing workflow also runs the app's tests and the UI crate's print tests on Windows.
|
||||
const WINDOWS_TARGET: Target = Target { os: "windows", family: "windows", arch: "x86_64" };
|
||||
|
||||
/// Desktop targets that CI does not test on, by name. A test that builds on one of them tests code
|
||||
/// or behavior of that platform.
|
||||
const PLATFORM_TARGETS: &[(&str, Target)] = &[
|
||||
("macOS", Target { os: "macos", family: "unix", arch: "aarch64" }),
|
||||
("macOS", Target { os: "macos", family: "unix", arch: "x86_64" }),
|
||||
("Windows", Target { os: "windows", family: "windows", arch: "x86_64" }),
|
||||
("Windows", Target { os: "windows", family: "windows", arch: "aarch64" }),
|
||||
];
|
||||
|
||||
fn windows_runs(path: &str) -> bool {
|
||||
path.starts_with("apps/vectorcraft/") || path == "crates/ui-egui/src/tests/printps.rs"
|
||||
}
|
||||
@@ -5142,7 +5596,14 @@ fn never_run(v: &View, ctx: &Ctx) -> Option<Hit> {
|
||||
let off = |t: &Target| preds.iter().any(|p| cfg_value(p, t) == Some(false));
|
||||
if CI_TARGETS.iter().chain(windows).all(off) {
|
||||
let shown: Vec<String> = preds.iter().filter(|p| p.as_str() != "test").map(|p| format!("cfg({p})")).collect();
|
||||
let mut hit = v.whole(Rule::NeverRun, format!("{} leaves it out of every target CI tests on", shown.join(", ")));
|
||||
let mut note = format!("{} leaves it out of every target CI tests on", shown.join(", "));
|
||||
let mut builds: Vec<&str> = PLATFORM_TARGETS.iter().filter(|(_, t)| !off(t)).map(|(name, _)| *name).collect();
|
||||
builds.dedup();
|
||||
if !builds.is_empty() {
|
||||
note += &format!("; it builds on {}, so run it there", builds.join(" and "));
|
||||
}
|
||||
let mut hit = v.whole(Rule::NeverRun, note);
|
||||
hit.report_only = !builds.is_empty();
|
||||
// Enclosing attributes count as separate lines, so an edit to code between them and the
|
||||
// test does not count.
|
||||
hit.gates = attr_lines.into_iter().filter(|&l| l < hit.first).collect();
|
||||
@@ -6578,8 +7039,8 @@ mod tests {
|
||||
fn only_failing_rules_fail_the_check() {
|
||||
let failing: Vec<&str> = Rule::ALL.into_iter().filter(|r| r.fails()).map(Rule::id).collect();
|
||||
assert_eq!(failing, ["self-compare", "ignore-without-reason", "sleep", "reads-source", "never-run"]);
|
||||
let mac = "#[cfg(target_os = \"macos\")]\n#[test]\nfn mac() {\n assert_eq!(f(), 1);\n}\n";
|
||||
assert!(finish(&lint_file("crates/x/src/tests.rs", mac, &ctx()), 0, 1, "base").is_err(), "never-run fails the check");
|
||||
let ios = "#[cfg(target_os = \"ios\")]\n#[test]\nfn ios() {\n assert_eq!(f(), 1);\n}\n";
|
||||
assert!(finish(&lint_file("crates/x/src/tests.rs", ios, &ctx()), 0, 1, "base").is_err(), "never-run fails the check");
|
||||
let weak = "#[test]\nfn weak() {\n assert!(f().is_ok());\n}\n";
|
||||
let unguarded = "#[test]\nfn all() {\n assert!(f().iter().all(|x| valid(x)));\n}\n";
|
||||
let skipped = "#[test]\n#[ignore]\nfn skipped() {\n assert_eq!(f(), 1);\n}\n";
|
||||
@@ -6736,6 +7197,97 @@ mod tests {
|
||||
assert!(touches(&found[0], Some(&[4].into_iter().collect())), "a change to the name alone");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sleep_in_a_condition_poll_or_a_spawned_release_is_not_reported() {
|
||||
let polls = [
|
||||
"fn wait(r: &R, back_off: bool) {\n while !r.load(SeqCst) {\n if back_off {\n thread::sleep(D);\n }\n }\n}\n",
|
||||
"fn wait(r: &R) {\n loop {\n match r.state() {\n S::Done => break,\n _ => {\n thread::sleep(D);\n }\n }\n }\n}\n",
|
||||
"fn wait(s: &S) -> P {\n loop {\n let p = s.progress();\n if p.done || Instant::now() > until {\n return p;\n }\n thread::sleep(D);\n }\n}\n",
|
||||
"fn wait(g: &G) {\n while !g.0.load(SeqCst) {\n std::thread::sleep(Duration::from_millis(1));\n }\n}\n",
|
||||
"fn wait(t: &mut T) {\n while t.waiting() {\n thread::sleep(D);\n t.poll();\n }\n}\n",
|
||||
"fn wait(s: &S) {\n while s.execute(\"a\", &json!({})).unwrap()[\"n\"] != 1 && Instant::now() < until {\n thread::sleep(D);\n }\n}\n",
|
||||
"#[test]\nfn t() {\n std::thread::spawn(move || {\n std::thread::sleep(Duration::from_secs(10));\n gate.open();\n });\n assert_eq!(f(), 1);\n}\n",
|
||||
"fn wait(r: &R) {\n while { r.load(SeqCst) } {\n thread::sleep(D);\n }\n}\n",
|
||||
"fn wait(r: &R) {\n m! { r }\n while !r.load(SeqCst) {\n thread::sleep(D);\n }\n}\n",
|
||||
"fn wait(r: &R) {\n 'outer: while !r.load(SeqCst) {\n thread::sleep(D);\n }\n}\n",
|
||||
"#[test]\nfn t() {\n std::thread::spawn(move || -> () {\n std::thread::sleep(D);\n gate.open();\n });\n assert_eq!(f(), 1);\n}\n",
|
||||
"fn wait() -> P {\n let p = loop {\n let p = progress();\n if p.done {\n break p;\n }\n std::thread::sleep(D);\n };\n p\n}\n",
|
||||
"#[test]\nfn t() {\n ::std::thread::spawn(move || {\n std::thread::sleep(D);\n release();\n });\n assert_eq!(f(), 1);\n}\n",
|
||||
"fn wait() {\n while ScheduleDuration::new().pending {\n thread::sleep(D);\n }\n}\n",
|
||||
"#[test]\nfn t() {\n std::thread::spawn(|| std::thread::sleep(D));\n assert_eq!(f(), 1);\n}\n",
|
||||
"use std::thread::{self, spawn};\n#[test]\nfn t() {\n spawn(|| {\n thread::sleep(D);\n });\n assert_eq!(f(), 1);\n}\n",
|
||||
"fn wait() {\n while !ready({ let key = 1; key }) {\n thread::sleep(D);\n }\n}\n",
|
||||
"fn wait(pending: bool) {\n while pending || { ready() } {\n thread::sleep(D);\n }\n}\n",
|
||||
"#[test]\nfn t() {\n std::thread::spawn(|| {\n let () = {\n std::thread::sleep(D);\n };\n });\n assert_eq!(f(), 1);\n}\n",
|
||||
"use std::thread;\n#[test]\nfn t() {\n thread::spawn(|| {\n thread::sleep(D);\n });\n assert_eq!(f(), 1);\n}\n",
|
||||
"use std::{thread, time::Duration};\n#[test]\nfn t() {\n thread::spawn(|| {\n thread::sleep(Duration::ZERO);\n });\n assert_eq!(f(), 1);\n}\n",
|
||||
"fn wait(q: &Q) {\n while q.len() < 3 {\n thread::sleep(D);\n }\n}\n",
|
||||
"fn wait(q: &Q) {\n while 0 < { q.len() } {\n thread::sleep(D);\n }\n}\n",
|
||||
"fn wait(q: &Q) {\n while 3 > { q.len() } {\n thread::sleep(D);\n }\n}\n",
|
||||
];
|
||||
for src in polls {
|
||||
assert_eq!(hits(src), [], "{src}");
|
||||
}
|
||||
let timed = [
|
||||
"fn wait() {\n for _ in 0..3 {\n if ready() {\n thread::sleep(D);\n }\n }\n}\n",
|
||||
"fn start() -> JoinHandle<()> {\n return std::thread::spawn(move || {\n std::thread::sleep(D);\n });\n}\n",
|
||||
"fn start() -> JoinHandle<()> {\n return ::std::thread::spawn(move || {\n std::thread::sleep(D);\n });\n}\n",
|
||||
"fn wait() {\n let t0 = Instant::now();\n while t0.elapsed() < D {\n fn unused() {}\n thread::sleep(D);\n }\n}\n",
|
||||
"fn wait() {\n let t0 = Instant::now();\n while t0.elapsed() < Duration::from_millis(50) {\n thread::sleep(Duration::from_millis(5));\n }\n}\n",
|
||||
"fn wait() {\n let t0 = Instant::now();\n while t0.elapsed().as_millis() < 50 {\n thread::sleep(D);\n }\n}\n",
|
||||
"fn wait() {\n let t0 = Instant::now();\n while t0.elapsed() < Duration::new(1, 0) {\n thread::sleep(D);\n }\n}\n",
|
||||
"fn wait() {\n let mut n = 0;\n loop {\n thread::sleep(D);\n n += 1;\n if n == 3 {\n break;\n }\n }\n}\n",
|
||||
"fn wait(g: &G) {\n if g.ready() {\n thread::sleep(D);\n }\n}\n",
|
||||
"fn wait() {\n let t0 = Instant::now();\n loop {\n thread::sleep(D);\n println!(\"{:?}\", t0.elapsed());\n if t0.elapsed() > D {\n break;\n }\n }\n}\n",
|
||||
"#[test]\nfn t() {\n let h = run(move || {\n thread::sleep(D);\n });\n assert_eq!(h, 1);\n}\n",
|
||||
"#[test]\nfn t() {\n std::thread::spawn(move || {\n std::thread::sleep(D);\n })\n .join()\n .unwrap();\n assert_eq!(f(), 1);\n}\n",
|
||||
"#[test]\nfn t() {\n handles.push(std::thread::spawn(move || {\n std::thread::sleep(D);\n }));\n assert_eq!(f(), 1);\n}\n",
|
||||
"#[test]\nfn t() {\n let release = std::thread::spawn(move || {\n std::thread::sleep(D);\n gate.open();\n });\n assert_eq!(f(), 1);\n release.join().unwrap();\n}\n",
|
||||
"fn spawn(f: impl FnOnce()) {\n f();\n}\n#[test]\nfn t() {\n spawn(|| {\n thread::sleep(D);\n });\n assert_eq!(f(), 1);\n}\n",
|
||||
"fn wait(t0: Instant) {\n while t0.elapsed() < Duration::new(1, 0) {\n let new = t0.elapsed();\n thread::sleep(D);\n }\n}\n",
|
||||
"fn wait() {\n let mut n = 0;\n while n < 3 {\n thread::sleep(delay());\n n += 1;\n }\n}\n",
|
||||
"fn wait(t0: Instant) {\n while t0.elapsed().checked_sub(Duration::ZERO).unwrap() < D {\n thread::sleep(D);\n }\n}\n",
|
||||
"fn wait(t0: Instant) {\n while t0.elapsed() < D {\n let _ = stringify!(probe());\n std::thread::sleep(D);\n }\n}\n",
|
||||
"#[test]\nfn t() {\n while !ready() {\n std::thread::spawn(|| std::thread::sleep(D)).join().unwrap();\n }\n assert_eq!(f(), 1);\n}\n",
|
||||
"fn wait() -> u8 {\n let mut n = 0;\n let r = loop {\n n += 1;\n if n == 3 {\n break n;\n }\n thread::sleep(D);\n };\n r\n}\n",
|
||||
"fn wait() {\n let attempts = [0, 1, 2];\n let mut n = 0;\n while n < attempts.len() {\n thread::sleep(D);\n n += 1;\n }\n}\n",
|
||||
"use std::thread::spawn as spawn_thread;\nfn spawn(f: impl FnOnce()) {\n f();\n}\n#[test]\nfn t() {\n spawn(|| {\n std::thread::sleep(D);\n });\n assert_eq!(f(), 1);\n}\n",
|
||||
"mod thread {\n pub fn spawn(f: impl FnOnce()) {\n f();\n }\n}\n#[test]\nfn t() {\n thread::spawn(|| {\n std::thread::sleep(D);\n });\n assert_eq!(f(), 1);\n}\n",
|
||||
"#[test]\nfn t() {\n let h = std::thread::spawn(|| {\n let () = {\n std::thread::sleep(D);\n };\n });\n h.join().unwrap();\n}\n",
|
||||
"fn wait(r: &R) {\n while !r.load(SeqCst) {\n let x = {\n thread::sleep(D);\n 1\n };\n }\n}\n",
|
||||
"fn wait() {\n let attempts = [0, 1, 2];\n let mut n = 0;\n while n < attempts.len() {\n thread::sleep(D);\n n = n + 1;\n }\n}\n",
|
||||
"#[test]\nfn t() {\n std::thread::spawn(prepare(|| {\n std::thread::sleep(D);\n }));\n assert_eq!(f(), 1);\n}\n",
|
||||
"fn wait(t0: Instant) {\n while t0.elapsed() < D {\n println!(\"{}\", 1u8.to_string());\n thread::sleep(D);\n }\n}\n",
|
||||
"use crate::thread::spawn;\n#[test]\nfn t() {\n spawn(|| {\n std::thread::sleep(D);\n });\n assert_eq!(f(), 1);\n}\n",
|
||||
"use std::thread::{self as worker};\nmod thread {\n pub fn spawn(f: impl FnOnce()) {\n f();\n }\n}\n#[test]\nfn t() {\n thread::spawn(|| {\n std::thread::sleep(D);\n });\n assert_eq!(f(), 1);\n}\n",
|
||||
];
|
||||
for src in timed {
|
||||
assert_eq!(hits(src).iter().filter(|h| h.1 == "sleep").count(), 1, "{src}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn an_edit_to_the_loop_around_a_sleep_counts_as_a_change() {
|
||||
let src = "fn wait() {\n let mut n = 0;\n while n < 3 {\n thread::sleep(D);\n n += 1;\n }\n}\n";
|
||||
let found = lint_file("crates/x/src/tests.rs", src, &ctx());
|
||||
assert_eq!(found.iter().map(|h| (h.rule, h.line)).collect::<Vec<_>>(), [(Rule::Sleep, 4)]);
|
||||
assert!(touches(&found[0], Some(&[3].into_iter().collect())), "a change to the loop's condition");
|
||||
assert!(!touches(&found[0], Some(&[2].into_iter().collect())), "a change outside the loop");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn an_edit_that_joins_a_spawned_sleep_counts_as_a_change() {
|
||||
let block = "#[test]\nfn t() {\n std::thread::spawn(move || {\n std::thread::sleep(D);\n })\n .join()\n .unwrap();\n assert_eq!(f(), 1);\n}\n";
|
||||
let bare =
|
||||
"#[test]\nfn t() {\n std::thread::spawn(|| std::thread::sleep(D))\n .join()\n .unwrap();\n assert_eq!(f(), 1);\n}\n";
|
||||
for (src, line, join) in [(block, 4, 7), (bare, 3, 5)] {
|
||||
let found = lint_file("crates/x/src/tests.rs", src, &ctx());
|
||||
assert_eq!(found.iter().map(|h| (h.rule, h.line)).collect::<Vec<_>>(), [(Rule::Sleep, line)], "{src}");
|
||||
assert!(touches(&found[0], Some(&[join].into_iter().collect())), "a change to the join: {src}");
|
||||
assert!(!touches(&found[0], Some(&[join + 1].into_iter().collect())), "a change after the statement: {src}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sleep_needs_the_thread_function() {
|
||||
let local = "fn sleep() -> u8 { 42 }\n#[test]\nfn t() {\n assert_eq!(sleep(), 42);\n}\n";
|
||||
@@ -6744,6 +7296,10 @@ mod tests {
|
||||
let src = format!("{import}\n#[test]\nfn t() {{\n sleep(D);\n assert_eq!(f(), 42);\n}}\n");
|
||||
assert_eq!(hits(&src), [(4, "sleep")], "{import}");
|
||||
}
|
||||
for import in ["use std::thread::sleep as nap;", "use std::thread::sleep_ms;", "use std::thread::{sleep as nap};"] {
|
||||
let src = format!("{import}\nfn sleep(_: u8) {{}}\n#[test]\nfn t() {{\n sleep(1);\n assert_eq!(f(), 42);\n}}\n");
|
||||
assert_eq!(hits(&src), [], "{import}");
|
||||
}
|
||||
assert_eq!(hits("#[test]\nfn t() {\n std :: thread :: sleep(D);\n assert_eq!(f(), 1);\n}\n"), [(3, "sleep")]);
|
||||
}
|
||||
|
||||
@@ -6958,6 +7514,25 @@ mod tests {
|
||||
assert_eq!(only("never-run", other), [], "a cfg on another item");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn never_run_lists_tests_that_build_on_macos_or_windows_without_failing() {
|
||||
let test = |gate: &str| format!("#[cfg({gate})]\n#[test]\nfn t() {{\n assert_eq!(f(), 1);\n}}\n");
|
||||
let check = |path: &str, gate: &str| {
|
||||
let found = lint_file(path, &test(gate), &ctx());
|
||||
assert_eq!(found.iter().filter(|h| h.rule == Rule::NeverRun).count(), 1, "{gate} is listed");
|
||||
finish(&found, 0, 1, "base")
|
||||
};
|
||||
// A touchpad gesture test that egui can only drive on macOS.
|
||||
assert!(check("crates/ui-egui/src/tests/quickpenwheel.rs", "target_os = \"macos\"").is_ok(), "macOS");
|
||||
// A test of performance counters that only Windows has.
|
||||
assert!(check("apps/vectorcraft-cli/src/perf.rs", "windows").is_ok(), "Windows");
|
||||
assert!(check("crates/x/src/tests.rs", "all(target_os = \"macos\", target_arch = \"aarch64\")").is_ok(), "Apple silicon");
|
||||
assert!(check("crates/x/src/tests.rs", "target_os = \"ios\"").is_err(), "no desktop target builds it");
|
||||
assert!(check("crates/x/src/tests.rs", "all(windows, unix)").is_err(), "no target builds it");
|
||||
let found = lint_file("apps/vectorcraft-cli/src/perf.rs", &test("windows"), &ctx());
|
||||
assert!(found[0].note.ends_with("it builds on Windows, so run it there"), "{}", found[0].note);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn module_gates_reads_each_candidate_once() {
|
||||
let paths: Vec<String> = (0..32).map(|i| format!("crates/x/src/parent/child{i}.rs")).collect();
|
||||
|
||||
Reference in New Issue
Block a user