-
-
Notifications
You must be signed in to change notification settings - Fork 5
feat: comprehensive Alchemist visual regression test suite #70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
davidlrichmond
wants to merge
26
commits into
rudi-q:main
Choose a base branch
from
davidlrichmond:alchemist-regression-testing
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 22 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
a187405
feat: add comprehensive Alchemist visual regression test suite
claude 2f2eec8
chore: update example/pubspec.lock after adding Alchemist dependency
claude c211ddc
feat(tests): add comprehensive Alchemist visual regression test suite
claude 0480a90
docs: enhance visual regression testing workflow documentation
claude 761bcc6
docs: add comprehensive test coverage analysis against API docs
claude ab47a79
feat(tests): achieve 100% visual regression coverage with 82 comprehe…
claude c96c56a
docs: update test documentation to reflect 100% visual coverage
claude 578a3a4
Merge branch 'rudi-q:main' into claude/alchemist-regression-tests-01X…
davidlrichmond 4d6f473
Merge pull request #1 from davidlrichmond/claude/alchemist-regression…
davidlrichmond 7e62e05
Minor doc changes, MacOS goldens
davidlrichmond a1b8d90
fix: suppress golden test tag warning by defining tags in dart_test.yaml
claude 525985c
dart_test.yaml golden tag
davidlrichmond d06eb72
analyzer and format linter
davidlrichmond 67fd913
feat(refactor): add foundation for AnimatedChartPainter refactoring
claude 443d585
feat(refactor): add GeometryCalculator for core chart types
claude 7f4c3c1
feat(refactor): integrate GeometryCalculator into AnimatedChartPainter
claude f75efea
docs: update REFACTORING_GUIDE.md to reflect Phase 1 completion
claude 4a4ba15
docs: add Phase 1 testing instructions
claude 95ad6c5
fix: correct PointShape/LineStyle imports and point rendering
claude 2efe835
chore: update Linux golden files for axis rendering changes
claude 4132c3e
Merge branch 'alchemist-regression-testing' into claude/update-golden…
davidlrichmond e206f0e
Merge pull request #2 from davidlrichmond/claude/update-golden-files-…
davidlrichmond bcc251b
chore: update Linux golden files for axis rendering changes
claude a8fa996
Revert "Claude/update golden files 01 x8 svey pu gw2ws u8 s sz1 xwq"
davidlrichmond 538db4f
Merge pull request #3 from davidlrichmond/revert-2-claude/update-gold…
davidlrichmond 9fb8b88
Merge pull request #4 from davidlrichmond/claude/golden-updates-only-…
davidlrichmond File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,162 @@ | ||
| # Phase 1 Testing Instructions | ||
|
|
||
| ## ⚠️ CRITICAL: Golden Tests Required | ||
|
|
||
| Phase 1 of the AnimatedChartPainter refactoring is complete, but **MUST BE TESTED** before proceeding. | ||
|
|
||
| --- | ||
|
|
||
| ## What Was Changed | ||
|
|
||
| **Core geometry calculations** for bars, lines, and points have been extracted from `AnimatedChartPainter` into `GeometryCalculator`: | ||
|
|
||
| ### Files Modified: | ||
| 1. **lib/src/core/render_models.dart** (NEW) | ||
| - All RenderData classes (BarRenderData, LineRenderData, PointRenderData, etc.) | ||
|
|
||
| 2. **lib/src/core/geometry_calculator.dart** (NEW) | ||
| - All calculation methods for bars, lines, points | ||
| - ~540 lines of extracted geometry logic | ||
|
|
||
| 3. **lib/src/widgets/animated_chart_painter.dart** (MODIFIED) | ||
| - Refactored to use GeometryCalculator | ||
| - Added renderer methods (_renderBar, _renderLine, _renderPoint) | ||
| - Net change: +331 lines, -240 lines | ||
|
|
||
| ### What Should NOT Have Changed: | ||
| - ❌ Visual output (pixels should be identical) | ||
| - ❌ Animation behavior | ||
| - ❌ Chart rendering for any chart type | ||
|
|
||
| --- | ||
|
|
||
| ## Required Testing | ||
|
|
||
| ### 1. Run All 82 Golden Tests | ||
|
|
||
| ```bash | ||
| flutter test test/golden/ | ||
| ``` | ||
|
|
||
| **Expected result:** ✅ All 82 tests PASS | ||
|
|
||
| If ANY test fails: | ||
| - **DO NOT UPDATE GOLDENS** (unless you're certain the change is intentional) | ||
| - Compare the failed golden to the expected output | ||
| - The failure indicates a bug in the refactoring | ||
| - Revert the changes and investigate | ||
|
|
||
| ### 2. Visual Inspection | ||
|
|
||
| Run the example app and manually check: | ||
|
|
||
| ```bash | ||
| cd example | ||
| flutter run | ||
| ``` | ||
|
|
||
| Check these chart types specifically: | ||
| - ✅ Simple bar charts | ||
| - ✅ Grouped bar charts | ||
| - ✅ Stacked bar charts | ||
| - ✅ Scatter plots (points) | ||
| - ✅ Line charts (single and multi-series) | ||
| - ✅ Charts with gradients | ||
| - ✅ Charts with custom colors | ||
| - ✅ Charts with borders and rounded corners | ||
|
|
||
| ### 3. Animation Verification | ||
|
|
||
| Verify animations still work correctly: | ||
| - Bars should animate from bottom-up (or left-right if flipped) | ||
| - Lines should draw segment-by-segment | ||
| - Points should grow from small to full size | ||
| - Stacked bars should build up progressively | ||
|
|
||
| --- | ||
|
|
||
| ## If Tests Pass ✅ | ||
|
|
||
| Proceed to Phase 2: | ||
| - Extract pie chart geometry | ||
| - Extract heat map geometry | ||
| - Extract area chart geometry | ||
|
|
||
| See `REFACTORING_GUIDE.md` for Phase 2 details. | ||
|
|
||
| --- | ||
|
|
||
| ## If Tests Fail ❌ | ||
|
|
||
| ### Debugging Steps: | ||
|
|
||
| 1. **Check which chart types failed:** | ||
| - Bar tests? → Bug in `calculateSingleBar()` or bar rendering | ||
| - Line tests? → Bug in `calculateLine()` or line rendering | ||
| - Point tests? → Bug in `calculatePoints()` or point rendering | ||
|
|
||
| 2. **Compare the logic:** | ||
| - Open `lib/src/core/geometry_calculator.dart` | ||
| - Open `lib/src/widgets/animated_chart_painter.dart` (old version in git) | ||
| - Verify the extracted logic matches exactly | ||
|
|
||
| 3. **Common issues:** | ||
| - Coordinate offsets (plotArea.left/top) - should be included in calculator | ||
| - Animation progress - should be applied AFTER calculation | ||
| - Color resolution priority - geometry.color > colorScale > theme | ||
| - Grouped bar positioning - customX and customWidth handling | ||
|
|
||
| 4. **Revert if needed:** | ||
| ```bash | ||
| git reset --hard HEAD~3 # Revert last 3 commits | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## Test Coverage | ||
|
|
||
| Phase 1 affects these test files: | ||
| - ✅ `test/golden/chart_types_test.dart` - Bar, scatter, line charts | ||
| - ✅ `test/golden/features_test.dart` - Stacked and grouped bars | ||
| - ✅ `test/golden/gradients_test.dart` - Bars and points with gradients | ||
| - ✅ `test/golden/custom_palettes_test.dart` - Custom colors | ||
| - ✅ `test/golden/advanced_styling_test.dart` - Borders, corners | ||
|
|
||
| **Total tests affected:** ~50 out of 82 | ||
|
|
||
| --- | ||
|
|
||
| ## What's NOT Affected | ||
|
|
||
| Phase 1 does NOT change: | ||
| - ❌ Pie charts (Phase 2) | ||
| - ❌ Heat maps (Phase 2) | ||
| - ❌ Area charts (Phase 2) | ||
| - ❌ Bubble charts (Phase 2) | ||
| - ❌ Progress bars (Phase 5, optional) | ||
| - ❌ Axes, legends, titles (never) | ||
| - ❌ SVG export (Phase 4) | ||
|
|
||
| --- | ||
|
|
||
| ## Success Criteria | ||
|
|
||
| Phase 1 is successful when: | ||
| 1. ✅ All 82 golden tests pass | ||
| 2. ✅ Example app renders identically | ||
| 3. ✅ Animations work correctly | ||
| 4. ✅ No performance regression | ||
|
|
||
| **Only then** should you proceed to Phase 2. | ||
|
|
||
| --- | ||
|
|
||
| ## Performance Note | ||
|
|
||
| The refactoring may introduce a **small performance overhead** due to: | ||
| - Creating RenderData objects | ||
| - Extra method calls | ||
|
|
||
| This is expected and acceptable. The benefits (testability, SVG export) outweigh the negligible cost. | ||
|
|
||
| If you notice significant performance issues (>10% slower), investigate the calculator instantiation - it's currently created per draw method, could be cached. | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial
Tight, practical testing guide; minor doc nits only
The Phase 1 testing checklist is clear and actionable. Two minor suggestions:
git reset --hard HEAD~3is destructive and intended only for local branches; recommendinggit revertfor shared branches would be safer.These are documentation tweaks only; the testing flow itself looks solid.
Also applies to: 89-113, 154-162
🤖 Prompt for AI Agents