Skip to content

Conversation

@ContextFound
Copy link

Summary

The motivation is to create a comprehensive, flexible testing framework for validating the library's output - which is deterministic, but has to process potentially complex user inputs. It allows a more test driven approach to bugs where you create a test that validates the unexpected behavior, validates the fix, and then is moved in a passing state to regression to ensure the bug doesn't re-appear in the future.

It uses a custom serializer that converts rendered markdown into stable, comparable strings like TEXT("bold")[bold] and UL_ITEM(TEXT("item")).

What's Included

Infrastructure

  • test/utils/serializer.dart - Stable widget-to-string serialization
  • test/utils/test_helpers.dart - pumpMarkdown(), getSerializedOutput(), expectMarkdown()
  • test/README.md - Full documentation

Test Coverage (141 tests)

  • Inline: bold, italic, strikethrough, underline, highlight, links
  • Block: headings, lists, checkboxes, radio buttons, tables, blockquotes, code blocks
  • LaTeX, images, integration tests

Bug Tracking Workflow

  • test/bugs/ -> Known unfixed bugs (expected to fail)
  • test/regression/ -> Fixed bugs (expected to pass, prevent recurrence)

Bugs Discovered

  1. LinkButton.url property not populated when links are created
  2. Links with title attributes [text](url "title") not parsed

Both documented with failing tests in test/bugs/. Tests are skipped allowing passing 'current state' run.

Running Tests

All tests except known bugs

flutter test test/block test/inline test/latex test/images test/integration test/regression

Context Found added 2 commits January 11, 2026 10:22
- Add custom stable serializer for widget tree comparison (test/utils/serializer.dart)
- Add test helpers: pumpMarkdown, expectMarkdown, expectMarkdownContains (test/utils/test_helpers.dart)
- Add inline element tests: bold, italic, strikethrough, underline, highlight, links
- Add block element tests: headings, lists, code blocks, tables, checkboxes, radio buttons, blockquotes, horizontal rules, indentation
- Add LaTeX tests: inline and block math expressions
- Add image tests with dimension support
- Add regression test folder structure for bug reproduction tests
- Add test framework documentation (test/README.md)

The serializer produces stable, comparable string output that avoids brittle widget equality checks. Tests verify both structural output and widget rendering.

All 123 tests pass.
failing tests in /bugs to identify known bugs
once fixed, move to /regression
test/README outlining approach
complex integration test added
serializer fix to render internal text
two known link rendering bugs identified, but currently skipped
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant