Skip to content
Open
Show file tree
Hide file tree
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 Nov 15, 2025
2f2eec8
chore: update example/pubspec.lock after adding Alchemist dependency
claude Nov 15, 2025
c211ddc
feat(tests): add comprehensive Alchemist visual regression test suite
claude Nov 15, 2025
0480a90
docs: enhance visual regression testing workflow documentation
claude Nov 15, 2025
761bcc6
docs: add comprehensive test coverage analysis against API docs
claude Nov 15, 2025
ab47a79
feat(tests): achieve 100% visual regression coverage with 82 comprehe…
claude Nov 15, 2025
c96c56a
docs: update test documentation to reflect 100% visual coverage
claude Nov 15, 2025
578a3a4
Merge branch 'rudi-q:main' into claude/alchemist-regression-tests-01X…
davidlrichmond Nov 15, 2025
4d6f473
Merge pull request #1 from davidlrichmond/claude/alchemist-regression…
davidlrichmond Nov 15, 2025
7e62e05
Minor doc changes, MacOS goldens
davidlrichmond Nov 15, 2025
a1b8d90
fix: suppress golden test tag warning by defining tags in dart_test.yaml
claude Nov 15, 2025
525985c
dart_test.yaml golden tag
davidlrichmond Nov 15, 2025
d06eb72
analyzer and format linter
davidlrichmond Nov 15, 2025
67fd913
feat(refactor): add foundation for AnimatedChartPainter refactoring
claude Nov 15, 2025
443d585
feat(refactor): add GeometryCalculator for core chart types
claude Nov 15, 2025
7f4c3c1
feat(refactor): integrate GeometryCalculator into AnimatedChartPainter
claude Nov 15, 2025
f75efea
docs: update REFACTORING_GUIDE.md to reflect Phase 1 completion
claude Nov 15, 2025
4a4ba15
docs: add Phase 1 testing instructions
claude Nov 15, 2025
95ad6c5
fix: correct PointShape/LineStyle imports and point rendering
claude Nov 15, 2025
2efe835
chore: update Linux golden files for axis rendering changes
claude Nov 15, 2025
4132c3e
Merge branch 'alchemist-regression-testing' into claude/update-golden…
davidlrichmond Nov 15, 2025
e206f0e
Merge pull request #2 from davidlrichmond/claude/update-golden-files-…
davidlrichmond Nov 15, 2025
bcc251b
chore: update Linux golden files for axis rendering changes
claude Nov 15, 2025
a8fa996
Revert "Claude/update golden files 01 x8 svey pu gw2ws u8 s sz1 xwq"
davidlrichmond Nov 15, 2025
538db4f
Merge pull request #3 from davidlrichmond/revert-2-claude/update-gold…
davidlrichmond Nov 15, 2025
9fb8b88
Merge pull request #4 from davidlrichmond/claude/golden-updates-only-…
davidlrichmond Nov 15, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
162 changes: 162 additions & 0 deletions PHASE1_TESTING.md
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

Copy link
Contributor

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:

  • Address the markdownlint hints (blank lines around headings/fences and the space inside emphasis at Line 23) to keep linters green.
  • Consider clarifying that git reset --hard HEAD~3 is destructive and intended only for local branches; recommending git revert for 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
In PHASE1_TESTING.md around lines 33 to 48 (also apply same markdown fixes to
ranges 89-113 and 154-162), fix the markdownlint/style nits by adding blank
lines before and after headings and fenced code blocks and remove the extra
space inside emphasis at line 23 so the emphasis is properly formatted;
additionally, update the git instruction text to clearly mark `git reset --hard
HEAD~3` as destructive and intended only for local/private branches and
recommend using `git revert` (or a non-destructive workflow) for shared
branches, with a brief one-line warning about data loss.

### 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.
Loading
Loading