ranger-compiler 3.5.0 → 3.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1160 -19
- package/LICENSE +3 -1
- package/README.md +124 -29
- package/dist/Lang.rgr +1188 -290
- package/dist/api.d.ts +2343 -879
- package/dist/api.js +79924 -56922
- package/dist/lib/JSON.rgr +102 -91
- package/dist/lib/Shell.rgr +4 -4
- package/dist/lib/apple/AppleToolchain.rgr +4 -4
- package/dist/lib/apple/README.md +5 -4
- package/dist/lib/apple/apple_test.rgr +1 -1
- package/dist/lib/core/README.md +1 -1
- package/dist/lib/evg/EVG.rgr +12 -0
- package/dist/lib/evg/EVGA11yFromTree.rgr +302 -0
- package/dist/lib/evg/EVGA11yTree.rgr +894 -0
- package/dist/lib/evg/EVGBox.rgr +267 -0
- package/dist/lib/evg/EVGBoxShorthandTest.rgr +220 -0
- package/dist/lib/evg/EVGCodepoint.rgr +316 -0
- package/dist/lib/evg/EVGColor.rgr +700 -0
- package/dist/lib/evg/EVGCommands.rgr +177 -0
- package/dist/lib/evg/EVGComponent.rgr +331 -0
- package/dist/lib/evg/EVGComponentTest.rgr +387 -0
- package/dist/lib/evg/EVGConnector.rgr +541 -0
- package/dist/lib/evg/EVGConnectorTest.rgr +306 -0
- package/dist/lib/evg/EVGDisplayList.rgr +4186 -0
- package/dist/lib/evg/EVGEasing.rgr +370 -0
- package/dist/lib/evg/EVGEffectTest.rgr +253 -0
- package/dist/lib/evg/EVGElement.rgr +4914 -0
- package/dist/lib/evg/EVGFixedTest.rgr +289 -0
- package/dist/lib/evg/EVGFlexRulesTest.rgr +317 -0
- package/dist/lib/evg/EVGFlexWrapTest.rgr +246 -0
- package/dist/lib/evg/EVGFling.rgr +244 -0
- package/dist/lib/evg/EVGFocus.rgr +400 -0
- package/dist/lib/evg/EVGFocusTest.rgr +399 -0
- package/dist/lib/evg/EVGGradient.rgr +322 -0
- package/dist/lib/evg/EVGGrapheme.rgr +190 -0
- package/dist/lib/evg/EVGGrid.rgr +975 -0
- package/dist/lib/evg/EVGHitTest.rgr +208 -0
- package/dist/lib/evg/EVGHoles.rgr +294 -0
- package/dist/lib/evg/EVGHostMeasurerTest.rgr +281 -0
- package/dist/lib/evg/EVGHostTextMeasurer.rgr +331 -0
- package/dist/lib/evg/EVGHostTree.rgr +834 -0
- package/dist/lib/evg/EVGHostTreeTest.rgr +447 -0
- package/dist/lib/evg/EVGImageDecode.rgr +117 -0
- package/dist/lib/evg/EVGImageMeasurer.rgr +86 -0
- package/dist/lib/evg/EVGInspect.rgr +883 -0
- package/dist/lib/evg/EVGInvalidateTest.rgr +432 -0
- package/dist/lib/evg/EVGJsonTest.rgr +535 -0
- package/dist/lib/evg/EVGLayout.rgr +4220 -0
- package/dist/lib/evg/EVGMeasure.rgr +1267 -0
- package/dist/lib/evg/EVGOverlayTest.rgr +626 -0
- package/dist/lib/evg/EVGPatch.rgr +1721 -0
- package/dist/lib/evg/EVGPatchTest.rgr +692 -0
- package/dist/lib/evg/EVGPopoverTest.rgr +395 -0
- package/dist/lib/evg/EVGReconcile.rgr +226 -0
- package/dist/lib/evg/EVGReconcileTest.rgr +421 -0
- package/dist/lib/evg/EVGReject.rgr +126 -0
- package/dist/lib/evg/EVGRelayoutTest.rgr +375 -0
- package/dist/lib/evg/EVGRtlLayoutTest.rgr +319 -0
- package/dist/lib/evg/EVGRuler.rgr +232 -0
- package/dist/lib/evg/EVGRulerTest.rgr +172 -0
- package/dist/lib/evg/EVGSelectChrome.rgr +178 -0
- package/dist/lib/evg/EVGStyleCacheTest.rgr +419 -0
- package/dist/lib/evg/EVGStyleSheet.rgr +2148 -0
- package/dist/lib/evg/EVGStyleStateTest.rgr +407 -0
- package/dist/lib/evg/EVGStyleVarTest.rgr +471 -0
- package/dist/lib/evg/EVGText.rgr +105 -0
- package/dist/lib/evg/EVGTextEngine.rgr +536 -0
- package/dist/lib/evg/EVGTextMeasurer.rgr +720 -0
- package/dist/lib/evg/EVGTimingTest.rgr +1417 -0
- package/dist/lib/evg/EVGToolbar.rgr +1369 -0
- package/dist/lib/evg/EVGTransition.rgr +728 -0
- package/dist/lib/evg/EVGTreeJson.rgr +721 -0
- package/dist/lib/evg/EVGUnit.rgr +554 -0
- package/dist/lib/evg/EVGViewportUnitTest.rgr +236 -0
- package/dist/lib/evg/EvgApp.rgr +189 -0
- package/dist/lib/evg/EvgBitmapTracer.rgr +4277 -0
- package/dist/lib/evg/EvgBitmapTracerTest.rgr +2119 -0
- package/dist/lib/evg/EvgHost.rgr +451 -0
- package/dist/lib/evg/EvgTest.rgr +91 -0
- package/dist/lib/evg/EvgTraceColor.rgr +236 -0
- package/dist/lib/evg/EvgTraceCurve.rgr +648 -0
- package/dist/lib/evg/EvgTraceFit.rgr +767 -0
- package/dist/lib/evg/EvgTracePath.rgr +435 -0
- package/dist/lib/evg/EvgTraceTypes.rgr +559 -0
- package/dist/lib/evg/EvgViewport.rgr +313 -0
- package/dist/lib/evg/FxDemoDoc.rgr +185 -0
- package/dist/lib/evg/HOSTS.md +227 -0
- package/dist/lib/evg/ISSUES.md +835 -0
- package/dist/lib/evg/PLAN_ACCESSIBILITY.md +650 -0
- package/dist/lib/evg/PLAN_CSS_LAYOUT_AND_FONTS.md +1124 -0
- package/dist/lib/evg/PLAN_EFFECTS.md +431 -0
- package/dist/lib/evg/PLAN_EVG.md +518 -0
- package/dist/lib/evg/PLAN_EVG_RENDERER.md +1674 -0
- package/dist/lib/evg/PLAN_INSPECTOR.md +788 -0
- package/dist/lib/evg/PLAN_LINKS_AND_FORMS.md +157 -0
- package/dist/lib/evg/PLAN_NATIVE_HOSTS.md +671 -0
- package/dist/lib/evg/PLAN_VECTOR_IR.md +664 -0
- package/dist/lib/evg/PLAN_VIEW_TRANSFORM.md +322 -0
- package/dist/lib/evg/PathBuilder.rgr +333 -0
- package/dist/lib/evg/README.md +1236 -0
- package/dist/lib/evg/SPEC.md +1252 -0
- package/dist/lib/evg/SVGPathParser.rgr +1199 -0
- package/dist/lib/evg/SvgParser.rgr +1736 -0
- package/dist/lib/evg/TODO_EVG_RENDERER.md +595 -0
- package/dist/lib/evg/VectorShapes.rgr +331 -0
- package/dist/lib/evg/VectorStroke.rgr +107 -0
- package/dist/lib/evg/VectorViewBox.rgr +380 -0
- package/dist/lib/evg/agent/README.md +290 -0
- package/dist/lib/evg/agent/evg_agent.rgr +899 -0
- package/dist/lib/evg/agent/fixtures/broken.evg.json +7 -0
- package/dist/lib/evg/agent/fixtures/card.evg.json +9 -0
- package/dist/lib/evg/agent/fixtures/connector.css +63 -0
- package/dist/lib/evg/agent/fixtures/connector.evg.json +14 -0
- package/dist/lib/evg/agent/fixtures/drawn.evg.json +129 -0
- package/dist/lib/evg/agent/fixtures/gradient.evg.json +4 -0
- package/dist/lib/evg/agent/fixtures/popover.css +99 -0
- package/dist/lib/evg/agent/fixtures/popover.evg.json +30 -0
- package/dist/lib/evg/agent/roundtrip.sh +74 -0
- package/dist/lib/evg/agent/smoke.sh +230 -0
- package/dist/lib/evg/android/README.md +97 -0
- package/dist/lib/evg/android/androidstubs/AndroidStubs.kt +175 -0
- package/dist/lib/evg/android/androidstubs/Annotation.kt +10 -0
- package/dist/lib/evg/android/androidstubs/App.kt +30 -0
- package/dist/lib/evg/android/androidstubs/Content.kt +41 -0
- package/dist/lib/evg/android/androidstubs/ContentRes.kt +12 -0
- package/dist/lib/evg/android/androidstubs/InputMethod.kt +46 -0
- package/dist/lib/evg/android/androidstubs/Net.kt +6 -0
- package/dist/lib/evg/android/androidstubs/Os.kt +30 -0
- package/dist/lib/evg/android/androidstubs/Util.kt +15 -0
- package/dist/lib/evg/android/androidstubs/View.kt +113 -0
- package/dist/lib/evg/android/androidstubs/Widget.kt +16 -0
- package/dist/lib/evg/android/src/android/kotlin/fi/ranger/evg/AndroidEvgSurface.kt +323 -0
- package/dist/lib/evg/android/src/android/kotlin/fi/ranger/evg/AndroidTextMeasurer.kt +56 -0
- package/dist/lib/evg/android/src/android/kotlin/fi/ranger/evg/RippleEffect.kt +262 -0
- package/dist/lib/evg/android/src/awt/kotlin/fi/ranger/evg/AwtEvgSurface.kt +238 -0
- package/dist/lib/evg/android/src/awt/kotlin/fi/ranger/evg/AwtTextMeasurer.kt +85 -0
- package/dist/lib/evg/android/src/main/kotlin/fi/ranger/evg/EvgEngineThread.kt +115 -0
- package/dist/lib/evg/android/src/main/kotlin/fi/ranger/evg/EvgPainter.kt +231 -0
- package/dist/lib/evg/android/src/main/kotlin/fi/ranger/evg/EvgSurface.kt +117 -0
- package/dist/lib/evg/android/src/main/kotlin/fi/ranger/evg/RecordingSurface.kt +94 -0
- package/dist/lib/evg/apple/README.md +128 -0
- package/dist/lib/evg/apple/Sources/CoreGraphicsEvgSurface.swift +329 -0
- package/dist/lib/evg/apple/Sources/CoreTextMeasurer.swift +70 -0
- package/dist/lib/evg/apple/Sources/EvgEngineQueue.swift +105 -0
- package/dist/lib/evg/apple/Sources/EvgPainter.swift +225 -0
- package/dist/lib/evg/apple/Sources/EvgSurface.swift +163 -0
- package/dist/lib/evg/apple/Sources/RecordingSurface.swift +110 -0
- package/dist/lib/evg/bench/EvgLayoutBench.rgr +34 -0
- package/dist/lib/evg/bench/README.md +64 -0
- package/dist/lib/evg/bench/layout-bench.mjs +316 -0
- package/dist/lib/evg/bench/layout-cases.mjs +510 -0
- package/dist/lib/evg/bench/layout-conformance.mjs +254 -0
- package/dist/lib/evg/bin/.gitignore +17 -0
- package/dist/lib/evg/evg_test.rgr +313 -0
- package/dist/lib/evg/gl/README.md +198 -0
- package/dist/lib/evg/gl/a11y-paint-check.mjs +73 -0
- package/dist/lib/evg/gl/blur-check.mjs +399 -0
- package/dist/lib/evg/gl/boxmodel.json +1 -0
- package/dist/lib/evg/gl/demo.html +46 -0
- package/dist/lib/evg/gl/effect-presets.css +285 -0
- package/dist/lib/evg/gl/effect-presets.js +63 -0
- package/dist/lib/evg/gl/effect-shots.mjs +135 -0
- package/dist/lib/evg/gl/evg-a11y.js +566 -0
- package/dist/lib/evg/gl/evg-binary.js +160 -0
- package/dist/lib/evg/gl/evg-engine.js +296 -0
- package/dist/lib/evg/gl/evg-fx.js +237 -0
- package/dist/lib/evg/gl/evg-gestures.js +209 -0
- package/dist/lib/evg/gl/evg-list.js +167 -0
- package/dist/lib/evg/gl/evg-measure.js +186 -0
- package/dist/lib/evg/gl/evg-textinput.js +303 -0
- package/dist/lib/evg/gl/evg-view.js +144 -0
- package/dist/lib/evg/gl/evg-webgl.js +3942 -0
- package/dist/lib/evg/gl/fx-check.mjs +998 -0
- package/dist/lib/evg/gl/fx-demo.html +166 -0
- package/dist/lib/evg/gl/fx-demo.js +2 -0
- package/dist/lib/evg/gl/fx-serve.mjs +47 -0
- package/dist/lib/evg/gl/gestures-check.mjs +189 -0
- package/dist/lib/evg/gl/list-binary-check.mjs +152 -0
- package/dist/lib/evg/gl/measure-check.mjs +135 -0
- package/dist/lib/evg/gl/rotation-check.mjs +207 -0
- package/dist/lib/evg/gl/shift-check.mjs +113 -0
- package/dist/lib/evg/gl/stroke-check.mjs +168 -0
- package/dist/lib/evg/gl/text-snap-check.mjs +139 -0
- package/dist/lib/evg/gl/view-check.mjs +343 -0
- package/dist/lib/evg/gl/view-policy-check.mjs +184 -0
- package/dist/lib/evg/html/evg-dom.js +318 -0
- package/dist/lib/evg/html/evg-html.js +600 -0
- package/dist/lib/evg/inspect/README.md +415 -0
- package/dist/lib/evg/inspect/browser-smoke.mjs +115 -0
- package/dist/lib/evg/inspect/evg-inspect.js +947 -0
- package/dist/lib/evg/inspect/shots/css.png +0 -0
- package/dist/lib/evg/inspect/shots/dashboard.png +0 -0
- package/dist/lib/evg/inspect/shots/pptx-slide.png +0 -0
- package/dist/lib/evg/inspect/shots/state.png +0 -0
- package/dist/lib/evg/inspect/shots.mjs +226 -0
- package/dist/lib/evg/oracle/css-blur.json +576 -0
- package/dist/lib/evg/oracle/css-box.json +157 -0
- package/dist/lib/evg/oracle/css-timing.json +709 -0
- package/dist/lib/evg/oracle/css_blur_oracle.mjs +529 -0
- package/dist/lib/evg/oracle/css_box_oracle.mjs +106 -0
- package/dist/lib/evg/oracle/css_timing_oracle.mjs +389 -0
- package/dist/lib/evg/original/EVGColor.clj +310 -0
- package/dist/lib/evg/original/EVGColorContext.rgr +178 -0
- package/dist/lib/evg/original/SVGPath.rgr +627 -0
- package/dist/lib/evg/original/Vec2.crgr +103 -0
- package/dist/lib/evg/ranger.json +9 -0
- package/dist/lib/evg/showcase/README.md +246 -0
- package/dist/lib/evg/showcase/assets/emblem.svg +30 -0
- package/dist/lib/evg/showcase/assets/rosette.svg +22 -0
- package/dist/lib/evg/showcase/build.mjs +651 -0
- package/dist/lib/evg/showcase/pages/album.tsx +30 -0
- package/dist/lib/evg/showcase/pages/boxmodel.tsx +37 -0
- package/dist/lib/evg/showcase/pages/cards.tsx +41 -0
- package/dist/lib/evg/showcase/pages/chart_api.tsx +170 -0
- package/dist/lib/evg/showcase/pages/charts.tsx +219 -0
- package/dist/lib/evg/showcase/pages/drawing.tsx +160 -0
- package/dist/lib/evg/showcase/pages/emoji.tsx +91 -0
- package/dist/lib/evg/showcase/pages/flex.tsx +46 -0
- package/dist/lib/evg/showcase/pages/more.tsx +332 -0
- package/dist/lib/evg/showcase/pages/plots.tsx +262 -0
- package/dist/lib/evg/showcase/pages/svg.tsx +63 -0
- package/dist/lib/evg/showcase/pages/tables.tsx +209 -0
- package/dist/lib/evg/showcase/pages/typography.tsx +43 -0
- package/dist/lib/evg/showcase/pages/units.tsx +35 -0
- package/dist/lib/evg/showcase/pages/variants.tsx +233 -0
- package/dist/lib/evg/showcase/pages/vector.tsx +75 -0
- package/dist/lib/evg/showcase/pages/views.tsx +223 -0
- package/dist/lib/evg/showcase/tests/chart_api_smoke.mjs +339 -0
- package/dist/lib/evg/showcase/tests/gl_smoke.mjs +125 -0
- package/dist/lib/evg/showcase/themes/chart_api-default.css +15 -0
- package/dist/lib/evg/showcase/themes/charts-default.css +29 -0
- package/dist/lib/evg/showcase/themes/drawing-default.css +35 -0
- package/dist/lib/evg/showcase/themes/more-default.css +128 -0
- package/dist/lib/evg/showcase/themes/plots-default.css +18 -0
- package/dist/lib/evg/showcase/themes/showcase.css +508 -0
- package/dist/lib/evg/showcase/themes/tables-default.css +123 -0
- package/dist/lib/evg/showcase/themes/variants-default.css +15 -0
- package/dist/lib/evg/showcase/themes/views-default.css +15 -0
- package/dist/lib/evg/tools/bench_vs_potrace.mjs +290 -0
- package/dist/lib/evg/tools/evg_image_tool.rgr +488 -0
- package/dist/lib/evg/tools/evg_trace_bench.rgr +114 -0
- package/dist/lib/evg/tools/evg_trace_cli.rgr +662 -0
- package/dist/lib/evg/tools/evg_trace_cpp_bench.rgr +83 -0
- package/dist/lib/evg/tools/run_trace_bench.sh +74 -0
- package/dist/lib/evg/tools/run_trace_cli_smoke.sh +128 -0
- package/dist/lib/evg/web/responsive/EvgResponsiveCheck.rgr +271 -0
- package/dist/lib/evg/web/responsive/EvgResponsiveDemo.rgr +531 -0
- package/dist/lib/evg/web/responsive/README.md +97 -0
- package/dist/lib/evg/web/responsive/build.mjs +90 -0
- package/dist/lib/evg/web/responsive/dom-check.mjs +169 -0
- package/dist/lib/evg/web/responsive/index.html +177 -0
- package/dist/lib/evg/web/responsive/smoke.mjs +221 -0
- package/dist/lib/evg/web/tools/assets-client.mjs +95 -0
- package/dist/lib/evg/web/tools/boot-bench.mjs +189 -0
- package/dist/lib/evg/web/tools/inline-assets.mjs +119 -0
- package/dist/lib/evg/web/tools/minify.mjs +60 -0
- package/dist/lib/evg/web/tracer/build.mjs +87 -0
- package/dist/lib/evg/web/tracer/index.html +2805 -0
- package/dist/lib/evg/web/tracer/sample.png +0 -0
- package/dist/lib/evg/web/tracer/smoke.mjs +1162 -0
- package/dist/lib/evgr/Cargo.lock +21 -0
- package/dist/lib/evgr/Cargo.toml +19 -0
- package/dist/lib/evgr/README.md +140 -0
- package/dist/lib/evgr/bench/NativeBench.rgr +246 -0
- package/dist/lib/evgr/bench/compare.mjs +252 -0
- package/dist/lib/evgr/bench/speed.mjs +277 -0
- package/dist/lib/evgr/bin/.gitignore +3 -0
- package/dist/lib/evgr/src/bin/bench.rs +106 -0
- package/dist/lib/evgr/src/bin/smoke.rs +13 -0
- package/dist/lib/evgr/src/grid.rs +730 -0
- package/dist/lib/evgr/src/lib.rs +1003 -0
- package/dist/lib/evgr/src/style.rs +468 -0
- package/dist/lib/evgr/src/text.rs +83 -0
- package/dist/lib/image/BitReader.rgr +171 -0
- package/dist/lib/image/Buffer.rgr +173 -0
- package/dist/lib/image/DCT.rgr +283 -0
- package/dist/lib/image/Deflate.rgr +339 -0
- package/dist/lib/image/HuffmanDecoder.rgr +181 -0
- package/dist/lib/image/ImageBuffer.rgr +706 -0
- package/dist/lib/image/JPEGDecoder.rgr +808 -0
- package/dist/lib/image/PNGDecoder.rgr +544 -0
- package/dist/lib/image/PNGEncoder.rgr +388 -0
- package/dist/lib/image/PPMImage.rgr +224 -0
- package/dist/lib/image/ProgressiveJPEGDecoder.rgr +1154 -0
- package/dist/lib/image/README.md +33 -0
- package/dist/lib/image/RasterBuffer.rgr +294 -0
- package/dist/lib/image/VP8BoolDecoder.rgr +163 -0
- package/dist/lib/image/WebPDecoder.rgr +433 -0
- package/dist/lib/image/WebPLossless.rgr +1035 -0
- package/dist/lib/image/WebPLossy.rgr +1929 -0
- package/dist/lib/image/ranger.json +9 -0
- package/dist/lib/image/testdata/webp/anim_2f_24x16.webp +0 -0
- package/dist/lib/image/testdata/webp/fixtures.txt +33 -0
- package/dist/lib/image/testdata/webp/gen_fixtures.py +261 -0
- package/dist/lib/image/testdata/webp/ll_1x1.webp +0 -0
- package/dist/lib/image/testdata/webp/ll_alpha_29x21.webp +0 -0
- package/dist/lib/image/testdata/webp/ll_gradient_64x64.webp +0 -0
- package/dist/lib/image/testdata/webp/ll_meta_32x32.webp +0 -0
- package/dist/lib/image/testdata/webp/ll_noise_17x9.webp +0 -0
- package/dist/lib/image/testdata/webp/ll_pal11_23x11.webp +0 -0
- package/dist/lib/image/testdata/webp/ll_pal2_19x7.webp +0 -0
- package/dist/lib/image/testdata/webp/ll_pal40_16x16.webp +0 -0
- package/dist/lib/image/testdata/webp/ll_pal4_13x5.webp +0 -0
- package/dist/lib/image/testdata/webp/ll_photo_40x30.webp +0 -0
- package/dist/lib/image/testdata/webp/ll_predictors_64x32.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_1x1.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_alph_raw_f0_21x13.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_alph_raw_f1_21x13.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_alph_raw_f2_21x13.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_alph_raw_f3_21x13.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_alph_vp8l_f0_21x13.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_alph_vp8l_f1_21x13.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_alph_vp8l_f2_21x13.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_alph_vp8l_f3_21x13.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_alpha_33x17.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_exif_15x11.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_i16_96x80.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_nofilter_24x20.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_odd_17x9.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_photo_48x40.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_q100_20x18.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_sharp_40x36.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_simple_filter_33x31.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_vpx_parts8_37x45.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_vpx_skip_96x80.webp +0 -0
- package/dist/lib/image/tests/WebPDecodeTool.rgr +81 -0
- package/dist/lib/image/tests/WebPDecoderTest.rgr +1162 -0
- package/dist/lib/image/tests/run_webp_tests.sh +39 -0
- package/dist/lib/rust/RsJson.rgr +468 -0
- package/dist/lib/rust/RsPrelude.rgr +1663 -0
- package/dist/lib/shell_test.rgr +7 -7
- package/dist/lib/stdlib.rgr +21 -5
- package/dist/lib/zip/ranger.json +6 -0
- package/dist/rgrc.js +87318 -67610
- package/package.json +1010 -1040
- package/dist/README.md +0 -117
- package/dist/package.json +0 -47
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
; SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
; ==============================================================================
|
|
4
|
+
; EVGStyleCacheTest — the cache against the thing it replaced
|
|
5
|
+
; ==============================================================================
|
|
6
|
+
;
|
|
7
|
+
; `EVGStyleSheet.applyTo` resolved every element from scratch: five full scans
|
|
8
|
+
; of the rule list, per element, per frame. On a 1600-row table that was 178ms
|
|
9
|
+
; of a 252ms frame — more than layout and display-list construction together —
|
|
10
|
+
; to produce eighteen distinct answers.
|
|
11
|
+
;
|
|
12
|
+
; It is a plan now, built once per (class string, theme, interaction state) and
|
|
13
|
+
; replayed. The risk of that is not that it is slow; it is that it is WRONG in
|
|
14
|
+
; some corner — a state rule that should have been cleared, an inline attribute
|
|
15
|
+
; that should have won, a theme that should have changed the answer — and wrong
|
|
16
|
+
; in a way that looks like a design decision rather than a bug.
|
|
17
|
+
;
|
|
18
|
+
; So the old implementation is kept as `applyToDirect` and this compares them.
|
|
19
|
+
; Not property by property: the same tree is built twice, styled both ways, and
|
|
20
|
+
; the DISPLAY LISTS are compared. That is field-agnostic — a property the cache
|
|
21
|
+
; gets wrong changes what is painted, and a property that changes nothing
|
|
22
|
+
; painted changes nothing at all — and it is the same argument `EVGReconcileTest`
|
|
23
|
+
; makes for its invariant.
|
|
24
|
+
;
|
|
25
|
+
; The fixture is deliberately awkward. It has:
|
|
26
|
+
;
|
|
27
|
+
; * elements sharing a class string, so the cache is exercised
|
|
28
|
+
; * every combination of hover / focus / active / disabled, because those four
|
|
29
|
+
; bits are the whole of what the key encodes about an element
|
|
30
|
+
; * two themes
|
|
31
|
+
; * INLINE attributes on some elements and not others — the one thing that is
|
|
32
|
+
; not in the key, and therefore the one thing a shared plan could get wrong
|
|
33
|
+
; * a `@media` block, so the viewport is part of the answer
|
|
34
|
+
; * state rules whose properties have to be cleared when the state goes away
|
|
35
|
+
; ==============================================================================
|
|
36
|
+
|
|
37
|
+
Import "EVGElement.rgr"
|
|
38
|
+
Import "EVGUnit.rgr"
|
|
39
|
+
Import "EVGStyleSheet.rgr"
|
|
40
|
+
Import "EVGLayout.rgr"
|
|
41
|
+
Import "EVGDisplayList.rgr"
|
|
42
|
+
Import "EVGColor.rgr"
|
|
43
|
+
|
|
44
|
+
class StyleCacheCheck {
|
|
45
|
+
def passed:int 0
|
|
46
|
+
def failed:int 0
|
|
47
|
+
|
|
48
|
+
fn ok:void (name:string cond:boolean) {
|
|
49
|
+
if cond {
|
|
50
|
+
passed = (passed + 1)
|
|
51
|
+
print (" PASS " + name)
|
|
52
|
+
} {
|
|
53
|
+
failed = (failed + 1)
|
|
54
|
+
print (" FAIL " + name)
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
fn eqStr:void (name:string got:string want:string) {
|
|
59
|
+
def good:boolean (got == want)
|
|
60
|
+
if (good == false) {
|
|
61
|
+
print (" got " + got)
|
|
62
|
+
print (" want " + want)
|
|
63
|
+
}
|
|
64
|
+
this.ok(name good)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
fn eqInt:void (name:string got:int want:int) {
|
|
68
|
+
this.eqStr(name (to_string got) (to_string want))
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
class EVGStyleCacheTest {
|
|
73
|
+
|
|
74
|
+
sfn sheetText:string () {
|
|
75
|
+
return (""
|
|
76
|
+
; A PALETTE, and one name the dark theme moves. `var()` is resolved
|
|
77
|
+
; where a value becomes an element's, and there are two such places
|
|
78
|
+
; — the plan builder and the direct scan this suite compares it
|
|
79
|
+
; against. A variable understood by one and not the other would
|
|
80
|
+
; show up here as the cache being wrong, which is the only reason
|
|
81
|
+
; the fixture carries variables at all.
|
|
82
|
+
+ "@vars { --ink: #111111; --fill: #cccccc; }"
|
|
83
|
+
+ "@vars dark { --ink: #eeeeee; --fill: #222222; }"
|
|
84
|
+
+ ".page { display: flex; flex-direction: column; width: 400px; }"
|
|
85
|
+
+ ".box { width: 100px; height: 20px; background-color: var(--fill);"
|
|
86
|
+
+ " opacity: 1; transform: none; color: var(--ink); }"
|
|
87
|
+
+ ".box:hover { background-color: #ff0000; opacity: 0.5; }"
|
|
88
|
+
+ ".box:focus { background-color: #00ff00; transform: scale(1.2); }"
|
|
89
|
+
+ ".box:active { background-color: #0000ff; }"
|
|
90
|
+
+ ".box:disabled { opacity: 0.25; }"
|
|
91
|
+
+ ".wide { width: 220px; }"
|
|
92
|
+
+ ".tall { height: 40px; }"
|
|
93
|
+
; `.theme-<name> .class` is the ONLY descendant form this sheet
|
|
94
|
+
; supports. The first version of this fixture wrote `.dark .box`,
|
|
95
|
+
; which is not that — it became a parse error, no theme rule
|
|
96
|
+
; existed, and the mutation that removed the theme from the cache
|
|
97
|
+
; key passed. `testFixtureParses` below is what stops that
|
|
98
|
+
; happening again.
|
|
99
|
+
+ ".theme-dark .box { border-radius: 4px; }"
|
|
100
|
+
; A class whose STATE rule sets a property its base rule does not.
|
|
101
|
+
; That is the only case where clearing the state properties matters
|
|
102
|
+
; — where the base rule re-writes the property anyway, dropping the
|
|
103
|
+
; clear changes nothing, and the mutation for it survived.
|
|
104
|
+
+ ".plain { width: 60px; height: 10px; }"
|
|
105
|
+
+ ".plain:hover { opacity: 0.35; }"
|
|
106
|
+
+ "@media (max-width: 300px) { .box { width: 50px; } }"
|
|
107
|
+
+ ".ink { color: #333333; font-size: 13px; }")
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
; One element. `variant` picks the class string, `state` the four bits, and
|
|
111
|
+
; `inline` says whether the element carries an inline attribute the sheet
|
|
112
|
+
; must not overwrite.
|
|
113
|
+
sfn box:EVGElement (i:int variant:int state:int inline:boolean) {
|
|
114
|
+
def el (EVGElement.createDiv())
|
|
115
|
+
el.id = ("b" + (to_string i))
|
|
116
|
+
def cls:string "box"
|
|
117
|
+
if (variant == 1) { cls = "box wide" }
|
|
118
|
+
if (variant == 2) { cls = "box tall" }
|
|
119
|
+
if (variant == 3) { cls = "box wide tall" }
|
|
120
|
+
if (variant == 4) { cls = "ink" }
|
|
121
|
+
if (variant == 5) { cls = "plain" }
|
|
122
|
+
el.className = cls
|
|
123
|
+
if ((state % 2) == 1) { el.isHovered = true }
|
|
124
|
+
if ((state % 4) >= 2) { el.isFocused = true }
|
|
125
|
+
if ((state % 8) >= 4) { el.isPressed = true }
|
|
126
|
+
if (state >= 8) { el.a11yDisabled = true }
|
|
127
|
+
if inline {
|
|
128
|
+
; The one fact a shared plan does not know. An element with this set
|
|
129
|
+
; must keep it however many siblings share its class.
|
|
130
|
+
el.setAttribute("background-color" "#123456")
|
|
131
|
+
el.markInline("background-color")
|
|
132
|
+
}
|
|
133
|
+
el.textContent = ("n" + (to_string i))
|
|
134
|
+
return el
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
sfn page:EVGElement () {
|
|
138
|
+
def p (EVGElement.createDiv())
|
|
139
|
+
p.className = "page"
|
|
140
|
+
p.id = "page"
|
|
141
|
+
def i:int 0
|
|
142
|
+
; 6 variants x 16 states x inline on/off, and every one of them shares
|
|
143
|
+
; a plan key with several others.
|
|
144
|
+
while (i < 192) {
|
|
145
|
+
def variant:int (i % 6)
|
|
146
|
+
def state:int ((to_int (i / 6)) % 16)
|
|
147
|
+
def inline:boolean (((to_int (i / 96)) % 2) == 1)
|
|
148
|
+
p.addChild((EVGStyleCacheTest.box(i variant state inline)))
|
|
149
|
+
i = (i + 1)
|
|
150
|
+
}
|
|
151
|
+
return p
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
sfn paintOf:string (root:EVGElement theme:string w:double cached:boolean) {
|
|
155
|
+
def s (new EVGStyleSheet())
|
|
156
|
+
s.parse((EVGStyleCacheTest.sheetText()))
|
|
157
|
+
s.setViewport(w 600.0 false)
|
|
158
|
+
if cached {
|
|
159
|
+
s.applyTree(root theme)
|
|
160
|
+
} {
|
|
161
|
+
s.applyTreeDirect(root theme)
|
|
162
|
+
}
|
|
163
|
+
def lay (new EVGLayout())
|
|
164
|
+
lay.setPageSize(w 600.0)
|
|
165
|
+
lay.layout(root)
|
|
166
|
+
def dl (new EVGDisplayList())
|
|
167
|
+
dl.setTextEngine((lay.getTextEngine()))
|
|
168
|
+
dl.build(root)
|
|
169
|
+
return (dl.toJson())
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
sfn sameBothWays:void (c:StyleCacheCheck label:string theme:string w:double) {
|
|
173
|
+
def a:EVGElement (EVGStyleCacheTest.page())
|
|
174
|
+
def b:EVGElement (EVGStyleCacheTest.page())
|
|
175
|
+
c.eqStr((label + ": the cache paints what the scan painted")
|
|
176
|
+
(EVGStyleCacheTest.paintOf(a theme w true))
|
|
177
|
+
(EVGStyleCacheTest.paintOf(b theme w false)))
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
; The fixture has to parse. This is not ceremony: the first version wrote
|
|
181
|
+
; `.dark .box`, which this sheet does not support, so the theme rule silently
|
|
182
|
+
; became an error and the mutation that dropped the theme from the cache key
|
|
183
|
+
; could not be caught. A test whose fixture does not contain the thing it is
|
|
184
|
+
; testing passes for the wrong reason.
|
|
185
|
+
sfn testFixtureParses:void (c:StyleCacheCheck) {
|
|
186
|
+
print "--- the fixture is what it says it is ---"
|
|
187
|
+
def s (new EVGStyleSheet())
|
|
188
|
+
s.parse((EVGStyleCacheTest.sheetText()))
|
|
189
|
+
def n:int (s.getErrorCount())
|
|
190
|
+
def i:int 0
|
|
191
|
+
while (i < n) {
|
|
192
|
+
print (" " + (s.getError(i)))
|
|
193
|
+
i = (i + 1)
|
|
194
|
+
}
|
|
195
|
+
c.eqInt("the stylesheet has no errors" n 0)
|
|
196
|
+
c.ok("and it has rules with states, themes and media in it" ((s.getRuleCount()) >= 10))
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
; The fixture's theme has to CHANGE something, or "cached == direct under
|
|
200
|
+
; the dark theme" is a comparison of two identical pictures. It used to be
|
|
201
|
+
; carried by a theme-scoped rule; now most of it is a palette, and this is
|
|
202
|
+
; what says the palette still moves the page.
|
|
203
|
+
sfn testThemeMatters:void (c:StyleCacheCheck) {
|
|
204
|
+
print "--- and the fixture's theme is worth comparing ---"
|
|
205
|
+
def a:EVGElement (EVGStyleCacheTest.page())
|
|
206
|
+
def b:EVGElement (EVGStyleCacheTest.page())
|
|
207
|
+
c.ok("the dark theme paints something else"
|
|
208
|
+
((EVGStyleCacheTest.paintOf(a "" 400.0 true)) != (EVGStyleCacheTest.paintOf(b "dark" 400.0 true))))
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
sfn testAgreement:void (c:StyleCacheCheck) {
|
|
212
|
+
print "--- cached == resolved from scratch ---"
|
|
213
|
+
EVGStyleCacheTest.sameBothWays(c "default theme, wide surface" "" 400.0)
|
|
214
|
+
; A theme changes which rules apply, and the theme is in the key.
|
|
215
|
+
EVGStyleCacheTest.sameBothWays(c "dark theme" "dark" 400.0)
|
|
216
|
+
; A narrow surface turns the `@media` rule on. The viewport is NOT in
|
|
217
|
+
; the key — it invalidates the whole cache instead — and this is what
|
|
218
|
+
; says that decision holds.
|
|
219
|
+
EVGStyleCacheTest.sameBothWays(c "narrow surface, media rule on" "" 280.0)
|
|
220
|
+
EVGStyleCacheTest.sameBothWays(c "narrow and dark" "dark" 280.0)
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
; The cache has to survive a viewport change ON ONE SHEET, which is the
|
|
224
|
+
; case `sameBothWays` cannot see because it builds a fresh sheet each time.
|
|
225
|
+
sfn testViewportInvalidates:void (c:StyleCacheCheck) {
|
|
226
|
+
print "--- one sheet, two surfaces ---"
|
|
227
|
+
def s (new EVGStyleSheet())
|
|
228
|
+
s.parse((EVGStyleCacheTest.sheetText()))
|
|
229
|
+
|
|
230
|
+
def wide:EVGElement (EVGStyleCacheTest.page())
|
|
231
|
+
s.setViewport(400.0 600.0 false)
|
|
232
|
+
s.applyTree(wide "")
|
|
233
|
+
def wideFirst:EVGElement (itemAt wide.children 0)
|
|
234
|
+
def wideW:string (to_string wideFirst.width.value)
|
|
235
|
+
|
|
236
|
+
; Same sheet, narrower surface: the media rule now applies, and every
|
|
237
|
+
; plan built a moment ago is a guess.
|
|
238
|
+
def narrow:EVGElement (EVGStyleCacheTest.page())
|
|
239
|
+
s.setViewport(280.0 600.0 false)
|
|
240
|
+
s.applyTree(narrow "")
|
|
241
|
+
def narrowFirst:EVGElement (itemAt narrow.children 0)
|
|
242
|
+
def narrowW:string (to_string narrowFirst.width.value)
|
|
243
|
+
|
|
244
|
+
c.eqStr("the wide surface gives the base width" wideW "100")
|
|
245
|
+
c.eqStr("and the narrow one the media width" narrowW "50")
|
|
246
|
+
|
|
247
|
+
; And back again, to catch a cache that only invalidates one way.
|
|
248
|
+
def wideAgain:EVGElement (EVGStyleCacheTest.page())
|
|
249
|
+
s.setViewport(400.0 600.0 false)
|
|
250
|
+
s.applyTree(wideAgain "")
|
|
251
|
+
def againFirst:EVGElement (itemAt wideAgain.children 0)
|
|
252
|
+
c.eqStr("and back to the base width" (to_string againFirst.width.value) "100")
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
; The state bits are the key's whole knowledge of an element, so an element
|
|
256
|
+
; that changes state must get a different plan — and going back must give
|
|
257
|
+
; back the base value, which is what `planStateClears` is for.
|
|
258
|
+
; Two themes through ONE sheet.
|
|
259
|
+
;
|
|
260
|
+
; `testAgreement` cannot see this: it builds a fresh sheet for every case,
|
|
261
|
+
; so each cache only ever holds one theme and the key never needs to carry
|
|
262
|
+
; it. Dropping the theme from the key passed every check until this existed.
|
|
263
|
+
sfn testThemeOnOneSheet:void (c:StyleCacheCheck) {
|
|
264
|
+
print "--- one sheet, two themes ---"
|
|
265
|
+
def s (new EVGStyleSheet())
|
|
266
|
+
s.parse((EVGStyleCacheTest.sheetText()))
|
|
267
|
+
s.setViewport(400.0 600.0 false)
|
|
268
|
+
|
|
269
|
+
def plain (EVGElement.createDiv())
|
|
270
|
+
plain.className = "box"
|
|
271
|
+
s.applyTree(plain "")
|
|
272
|
+
def plainC:EVGColor plain.backgroundColor
|
|
273
|
+
|
|
274
|
+
; Same sheet, same class, different theme. `.theme-dark .box` paints it
|
|
275
|
+
; a different colour, and the plan built a moment ago is not this one.
|
|
276
|
+
def dark (EVGElement.createDiv())
|
|
277
|
+
dark.className = "box"
|
|
278
|
+
s.applyTree(dark "dark")
|
|
279
|
+
def darkC:EVGColor dark.backgroundColor
|
|
280
|
+
|
|
281
|
+
; And back, to catch a cache that only notices the change one way.
|
|
282
|
+
def plain2 (EVGElement.createDiv())
|
|
283
|
+
plain2.className = "box"
|
|
284
|
+
s.applyTree(plain2 "")
|
|
285
|
+
def plain2C:EVGColor plain2.backgroundColor
|
|
286
|
+
|
|
287
|
+
c.eqStr("the unscoped theme gives the base colour" (plainC.toHexString()) "#CCCCCC")
|
|
288
|
+
c.eqStr("the dark theme gives its own" (darkC.toHexString()) "#222222")
|
|
289
|
+
c.eqStr("and going back gives the base again" (plain2C.toHexString()) "#CCCCCC")
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
; An inline attribute outranks every rule.
|
|
293
|
+
;
|
|
294
|
+
; `testAgreement` cannot see this either, for a different reason: it
|
|
295
|
+
; compares the cache against the direct path, and both call `hasInline`.
|
|
296
|
+
; Breaking `hasInline` breaks BOTH equally and the two display lists still
|
|
297
|
+
; agree — a differential oracle is blind to whatever the two sides share.
|
|
298
|
+
sfn testInlineWins:void (c:StyleCacheCheck) {
|
|
299
|
+
print "--- and an inline attribute still outranks the sheet ---"
|
|
300
|
+
def s (new EVGStyleSheet())
|
|
301
|
+
s.parse((EVGStyleCacheTest.sheetText()))
|
|
302
|
+
s.setViewport(400.0 600.0 false)
|
|
303
|
+
|
|
304
|
+
; Two siblings sharing a class and therefore a plan. One has an inline
|
|
305
|
+
; colour; the other must not catch it, and it must not lose its own.
|
|
306
|
+
def bare (EVGElement.createDiv())
|
|
307
|
+
bare.className = "box"
|
|
308
|
+
def inked (EVGElement.createDiv())
|
|
309
|
+
inked.className = "box"
|
|
310
|
+
inked.setAttribute("background-color" "#123456")
|
|
311
|
+
inked.markInline("background-color")
|
|
312
|
+
|
|
313
|
+
def page (EVGElement.createDiv())
|
|
314
|
+
page.className = "page"
|
|
315
|
+
page.addChild(bare)
|
|
316
|
+
page.addChild(inked)
|
|
317
|
+
s.applyTree(page "")
|
|
318
|
+
|
|
319
|
+
def bareC:EVGColor bare.backgroundColor
|
|
320
|
+
def inkedC:EVGColor inked.backgroundColor
|
|
321
|
+
c.eqStr("the plain sibling takes the rule's colour" (bareC.toHexString()) "#CCCCCC")
|
|
322
|
+
c.eqStr("and the inline one keeps its own" (inkedC.toHexString()) "#123456")
|
|
323
|
+
|
|
324
|
+
; Through a state change too, because the state clears write the
|
|
325
|
+
; INITIAL value and must not walk over an inline one either.
|
|
326
|
+
inked.isHovered = true
|
|
327
|
+
s.applyTree(page "")
|
|
328
|
+
def hovC:EVGColor inked.backgroundColor
|
|
329
|
+
c.eqStr("even hovered, where a state rule would have set it" (hovC.toHexString()) "#123456")
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
sfn testStateFlips:void (c:StyleCacheCheck) {
|
|
333
|
+
print "--- a state goes on, and comes off again ---"
|
|
334
|
+
def s (new EVGStyleSheet())
|
|
335
|
+
s.parse((EVGStyleCacheTest.sheetText()))
|
|
336
|
+
s.setViewport(400.0 600.0 false)
|
|
337
|
+
|
|
338
|
+
def el (EVGElement.createDiv())
|
|
339
|
+
el.className = "box"
|
|
340
|
+
s.applyTree(el "")
|
|
341
|
+
def baseC:EVGColor el.backgroundColor
|
|
342
|
+
def base:string (baseC.toHexString())
|
|
343
|
+
|
|
344
|
+
el.isHovered = true
|
|
345
|
+
s.applyTree(el "")
|
|
346
|
+
def hovC:EVGColor el.backgroundColor
|
|
347
|
+
def hovered:string (hovC.toHexString())
|
|
348
|
+
|
|
349
|
+
el.isHovered = false
|
|
350
|
+
s.applyTree(el "")
|
|
351
|
+
def backC:EVGColor el.backgroundColor
|
|
352
|
+
def back:string (backC.toHexString())
|
|
353
|
+
|
|
354
|
+
c.eqStr("at rest it is the base colour" base "#CCCCCC")
|
|
355
|
+
c.eqStr("hovered it is the state colour" hovered "#FF0000")
|
|
356
|
+
c.eqStr("and leaving the state puts the base back" back "#CCCCCC")
|
|
357
|
+
|
|
358
|
+
; The case the one above cannot see. `.box` declares `background-color`
|
|
359
|
+
; itself, so leaving `:hover` would restore it even with the state
|
|
360
|
+
; clears removed entirely — the base rule rewrites it on the way past.
|
|
361
|
+
; `.plain` declares no opacity, so the ONLY thing that puts opacity
|
|
362
|
+
; back to 1 is the clear.
|
|
363
|
+
def pl (EVGElement.createDiv())
|
|
364
|
+
pl.className = "plain"
|
|
365
|
+
s.applyTree(pl "")
|
|
366
|
+
def plBase:string (to_string pl.opacity)
|
|
367
|
+
pl.isHovered = true
|
|
368
|
+
s.applyTree(pl "")
|
|
369
|
+
def plHover:string (to_string pl.opacity)
|
|
370
|
+
pl.isHovered = false
|
|
371
|
+
s.applyTree(pl "")
|
|
372
|
+
def plBack:string (to_string pl.opacity)
|
|
373
|
+
c.eqStr("a property only a state rule sets starts at its initial" plBase "1")
|
|
374
|
+
c.eqStr("the state sets it" plHover "0.35")
|
|
375
|
+
c.eqStr("and leaving the state clears it back" plBack "1")
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
; The cache has to actually cache. A version that misses every time is
|
|
379
|
+
; correct and pointless, and every check above would still pass.
|
|
380
|
+
sfn testItCaches:void (c:StyleCacheCheck) {
|
|
381
|
+
print "--- and it answers from the plan ---"
|
|
382
|
+
def s (new EVGStyleSheet())
|
|
383
|
+
s.parse((EVGStyleCacheTest.sheetText()))
|
|
384
|
+
s.setViewport(400.0 600.0 false)
|
|
385
|
+
def p:EVGElement (EVGStyleCacheTest.page())
|
|
386
|
+
s.applyTree(p "")
|
|
387
|
+
; 193 styled elements, and at most 6 variants x 16 states = 96 distinct
|
|
388
|
+
; keys among them (plus the page). Printed rather than asserted at a
|
|
389
|
+
; round number, because the ratio is the whole claim.
|
|
390
|
+
print ((" " + (to_string s.planMisses)) + " scans, " + (to_string s.planHits) + " answered from a plan")
|
|
391
|
+
c.ok("it scanned no more often than there are distinct keys" (s.planMisses <= 97))
|
|
392
|
+
c.ok("and answered from a plan for everything else" (s.planHits >= 90))
|
|
393
|
+
|
|
394
|
+
; A second pass over the same tree must scan nothing at all.
|
|
395
|
+
def before:int s.planMisses
|
|
396
|
+
s.applyTree(p "")
|
|
397
|
+
c.eqInt("a second pass over the same tree scans nothing" (s.planMisses - before) 0)
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
sfn main:void () {
|
|
401
|
+
def c (new StyleCacheCheck())
|
|
402
|
+
print "=== EVG resolved-style cache ==="
|
|
403
|
+
EVGStyleCacheTest.testFixtureParses(c)
|
|
404
|
+
EVGStyleCacheTest.testThemeMatters(c)
|
|
405
|
+
EVGStyleCacheTest.testAgreement(c)
|
|
406
|
+
EVGStyleCacheTest.testViewportInvalidates(c)
|
|
407
|
+
EVGStyleCacheTest.testThemeOnOneSheet(c)
|
|
408
|
+
EVGStyleCacheTest.testInlineWins(c)
|
|
409
|
+
EVGStyleCacheTest.testStateFlips(c)
|
|
410
|
+
EVGStyleCacheTest.testItCaches(c)
|
|
411
|
+
print ""
|
|
412
|
+
print ("passed=" + (to_string c.passed) + " failed=" + (to_string c.failed))
|
|
413
|
+
if (c.failed > 0) {
|
|
414
|
+
print "FAILURES"
|
|
415
|
+
} {
|
|
416
|
+
print "ALL PASS"
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}
|