Skip to content

Add comprehensive golden testing for PDF rendering with pdf-test.pdf and CI workflow#5

Merged
evaisse merged 5 commits into
masterfrom
copilot/add-pdf-rendering-test
Nov 12, 2025
Merged

Add comprehensive golden testing for PDF rendering with pdf-test.pdf and CI workflow#5
evaisse merged 5 commits into
masterfrom
copilot/add-pdf-rendering-test

Conversation

Copilot AI commented Oct 20, 2025

Copy link
Copy Markdown
Contributor
  • Download and verify the test PDF file (pdf-test.pdf)
  • Add golden testing dependency to pubspec.yaml if needed
  • Create a new test file for PDF rendering golden tests
  • Implement golden test that loads the PDF from bytes
  • Generate golden master images for comparison
  • Run tests to verify the implementation
  • Update .gitignore if needed to include golden files
  • Add comprehensive test documentation
  • Fix documentation inconsistency about PDF page count
  • Add GitHub CI workflow with format, analyze, and test steps
  • Fix CI workflow errors by resolving analyzer issues
Original prompt

This section details on the original issue you should resolve

<issue_title>Implements test for PDF</issue_title>
<issue_description>Add test with goldentesting to test the pdf rendering with th following test file

pdf-test.pdf</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #4


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI and others added 2 commits October 20, 2025 19:28
Co-authored-by: evaisse <28737+evaisse@users.noreply.github.com>
- Added comprehensive golden tests for PDF rendering
- Implemented tests for loading, navigation, and UI states
- Generated golden master files for visual regression testing
- Created test documentation in test/README.md

Co-authored-by: evaisse <28737+evaisse@users.noreply.github.com>
@evaisse evaisse requested a review from Copilot October 20, 2025 19:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds comprehensive golden testing infrastructure for PDF rendering functionality using the test file pdf-test.pdf. The implementation includes unit tests for PDF loading, golden tests for visual verification of the PDF viewer widget in various states, and navigation tests.

Key Changes:

  • Added pdf_rendering_test.dart with three test groups covering PDF loading, rendering golden tests, and navigation
  • Created comprehensive test documentation in test/README.md explaining golden tests, test coverage, and CI/CD considerations
  • Implemented 9 test cases verifying PDF loading, widget rendering in different configurations, and UI states

Reviewed Changes

Copilot reviewed 2 out of 10 changed files in this pull request and generated 1 comment.

File Description
test/pdf_rendering_test.dart New test file implementing golden tests for PDF viewer widget rendering, PDF loading verification, and navigation controls
test/README.md New documentation file providing guidelines for running tests, updating golden files, and describing test coverage

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread test/README.md Outdated
- Different UI states (loading, no document, etc.)

### pdf-test.pdf
A 10-page test PDF document (39,762 bytes) used for testing PDF loading and rendering.

Copilot AI Oct 20, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation states the test PDF is a '10-page test PDF document', but the navigation test comments (line 238 in pdf_rendering_test.dart) indicate that pageCount is hardcoded to 1. This inconsistency between documentation and actual behavior should be clarified or corrected.

Suggested change
A 10-page test PDF document (39,762 bytes) used for testing PDF loading and rendering.
A single-page test PDF document (39,762 bytes) used for testing PDF loading and rendering.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in commit 6d3d8b5. Updated the documentation to clarify that while the PDF file contains 10 pages, the current implementation renders it as a single page since full PDF parsing is not yet implemented.

Copilot AI changed the title [WIP] Add test for PDF rendering using goldentesting Add comprehensive golden testing for PDF rendering with pdf-test.pdf Oct 20, 2025
Copilot AI requested a review from evaisse October 20, 2025 19:40

@evaisse evaisse left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a test github workflow ?

@evaisse

evaisse commented Nov 12, 2025

Copy link
Copy Markdown
Owner

@copilot can you add a github workflow for CI with steps dart format, flutter analyze --fatal-infos and flutter test ?

- Created .github/workflows/ci.yml with dart format, flutter analyze, and flutter test steps
- Updated test/README.md to clarify PDF page count vs implementation behavior
- Applied dart format to all code files for consistency

Co-authored-by: evaisse <28737+evaisse@users.noreply.github.com>

Copilot AI commented Nov 12, 2025

Copy link
Copy Markdown
Contributor Author

@copilot can you add a github workflow for CI with steps dart format, flutter analyze --fatal-infos and flutter test ?

Added GitHub CI workflow in commit 6d3d8b5. The workflow includes all requested steps:

  • dart format --output=none --set-exit-if-changed .
  • flutter analyze --fatal-infos
  • flutter test

The workflow runs on pushes and pull requests to the main/master branches.

Copilot AI changed the title Add comprehensive golden testing for PDF rendering with pdf-test.pdf Add comprehensive golden testing for PDF rendering with pdf-test.pdf and CI workflow Nov 12, 2025
Copilot AI requested a review from evaisse November 12, 2025 09:22
@evaisse

evaisse commented Nov 12, 2025

Copy link
Copy Markdown
Owner

@copilot their is errors while executing the CI workflow, can you fix these errors?

- Removed unnecessary dart:typed_data import from pdf_controller.dart
- Removed unused package:pdf/pdf.dart import from pdf_document.dart
- Removed unused _document field from PdfDocument class
- All CI steps now pass: format check, analyze with --fatal-infos, and tests

Co-authored-by: evaisse <28737+evaisse@users.noreply.github.com>

Copilot AI commented Nov 12, 2025

Copy link
Copy Markdown
Contributor Author

@copilot their is errors while executing the CI workflow, can you fix these errors?

Fixed in commit 3f0e619. The CI errors were caused by analyzer issues in the code:

  • Removed unnecessary dart:typed_data import
  • Removed unused package:pdf/pdf.dart import
  • Removed unused _document field

All CI steps now pass successfully:
✓ dart format check
✓ flutter analyze --fatal-infos (no issues found)
✓ flutter test (all 20 tests pass)

@evaisse evaisse marked this pull request as ready for review November 12, 2025 13:49
@evaisse evaisse merged commit b95e047 into master Nov 12, 2025
2 checks passed
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.

Implements test for PDF

3 participants