Skip to content

Figure out a way to make diagnostic numbers print the same when running on the web. #87364

Open

Description

@darrenaustin

As part of the skip test audit (#86396), there is a problem with debugFillProperties on the web that causes a couple of tests to fail.

Dart doubles and ints are backed by the same kind of object because JavaScript does not support integers. So, the Dart double "4.0" is identical to "4", which results in the web evaluating to the value "4" regardless of which one is used. This results in a difference for doubles in debugFillProperties between the web and the rest of Flutter's target platforms.

So when we are testing diagnostic strings in tests they will fail even though the data is almost identical. For example if we turn off the skip on:

test('DecorationImage with null textDirection configuration should throw Error', () async {

It will fail with a difference in the error strings that are generated:

  Expected: 'FlutterError\n'
              '   DecorationImage.matchTextDirection can only be used when a\n'
              '   TextDirection is available.\n'
              '   When DecorationImagePainter.paint() was called, there was no text\n'
              '   direction provided in the ImageConfiguration object to match.\n'
              '   The DecorationImage was:\n'
              '     DecorationImage(SynchronousTestImageProvider(),\n'
              '     Alignment.center, match text direction, scale: 1.0)\n'
              '   The ImageConfiguration was:\n'
              '     ImageConfiguration(size: Size(100.0, 100.0))\n'
              ''
    Actual: 'FlutterError\n'
              '   DecorationImage.matchTextDirection can only be used when a\n'
              '   TextDirection is available.\n'
              '   When DecorationImagePainter.paint() was called, there was no text\n'
              '   direction provided in the ImageConfiguration object to match.\n'
              '   The DecorationImage was:\n'
              '     DecorationImage(SynchronousTestImageProvider(),\n'
              '     Alignment.center, match text direction, scale: 1)\n'
              '   The ImageConfiguration was:\n'
              '     ImageConfiguration(size: Size(100.0, 100.0))\n'
              ''
     Which: is different.
            Expected: ... , scale: 1.0)\n   Th ...
              Actual: ... , scale: 1)\n   The  ...
                                    ^
             Differ at offset 381

We should find a way to fix this or workaround it.

Another test that is turned off because of this is:

testWidgets('AppBarTheme implements debugFillProperties', (WidgetTester tester) async {

Activity

  1. added
    team: skip-testAn issue used to track tests that are skipped.
    c: contributor-productivityTeam-specific productivity, code health, technical debt.
    c: tech-debtTechnical debt, code quality, testing, etc.
    on Jul 30, 2021
  2. added
    frameworkflutter/packages/flutter repository. See also f: labels.
    platform-webWeb applications specifically
    on Apr 27, 2022
  3. added
    P2Important issues not at the top of the work list
    on May 5, 2022
  4. removed their assignment
    on May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: contributor-productivityTeam-specific productivity, code health, technical debt.c: tech-debtTechnical debt, code quality, testing, etc.frameworkflutter/packages/flutter repository. See also f: labels.platform-webWeb applications specificallyteam-webOwned by Web platform teamteam: skip-testAn issue used to track tests that are skipped.triaged-webTriaged by Web platform team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions