Skip to content
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

[flutter_markdown] Added height and width to image builder #6739

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

M97Chahboun
Copy link

@M97Chahboun M97Chahboun commented May 15, 2024

  • Adds height & width to imageBuilder.

Pre-launch Checklist

Copy link
Contributor

@domesticmouse domesticmouse left a comment

Choose a reason for hiding this comment

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

I'm curious how image height and width are parsed from the markdown.

@M97Chahboun
Copy link
Author

M97Chahboun commented May 18, 2024

@domesticmouse
If you means how markdown parse the h & w of image
check this line
parsed by get height and width from this format imageLink#200x200

@domesticmouse
Copy link
Contributor

Please add a test that covers width x height from markdown to final usage to prevent future breakage

@stuartmorgan
Copy link
Contributor

  • The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]

This was not done; please don't check boxes without completing the steps they describe.

  • All existing and new tests are passing.

CI indicates that the new test is not passing, which will need to be resolved before this can be reviewed.

@M97Chahboun M97Chahboun changed the title Added height and width to image builder [flutter_markdown] Added height and width to image builder Jun 4, 2024

// Force the asset image to be rasterized so it can be compared.
await tester.runAsync(() async {
final Element element = tester.element(find.byType(Markdown));
await precacheImage(image.image, element);
await precacheImage(image.image, element,
size: Size(image.width!, image.height!));
Copy link
Contributor

Choose a reason for hiding this comment

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

What happens if width and height are not specified?

Copy link
Author

Choose a reason for hiding this comment

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

Yes is same test result
I will remove it

@M97Chahboun
Copy link
Author

I run image tests before any changes and I get :

══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following assertion was thrown while running async test code:
Golden "assets/images/golden/image_test/resource_asset_logo.png": Pixel test failed, 0.00% diff
detected.
Failure feedback can be found at
/Users/user/Development/packages/packages/flutter_markdown/test/failures

When the exception was thrown, this was the stack:
#0      LocalFileComparator.compare (package:flutter_test/src/_goldens_io.dart:106:5)
<asynchronous suspension>
#1      MatchesGoldenFile.matchAsync.<anonymous closure> (package:flutter_test/src/_matchers_io.dart:118:32)
<asynchronous suspension>
<asynchronous suspension>
(elided one frame from dart:async)

The exception was caught asynchronously.
════════════════════════════════════════════

Any advise please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants