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

Assets image displayed for CI snapshot but not for platform #16

Closed
1 task done
TesteurManiak opened this issue Feb 23, 2022 · 0 comments · Fixed by #25
Closed
1 task done

Assets image displayed for CI snapshot but not for platform #16

TesteurManiak opened this issue Feb 23, 2022 · 0 comments · Fixed by #25
Assignees
Labels
bug Something isn't working

Comments

@TesteurManiak
Copy link

Is there an existing issue for this?

  • I have searched the existing issues.

Version

0.2.1

Description

When I'm generating golden files using an asset image it is not rendered while it is rendered correctly for its ci equivalent.

Steps to reproduce

  1. Create a TestAssetBundle to load your assets
import 'dart:convert';

import 'package:flutter/services.dart';

class TestAssetBundle extends CachingAssetBundle {
  @override
  Future<String> loadString(String key, {bool cache = true}) async {
    final data = await load(key);
    return utf8.decode(data.buffer.asUint8List());
  }

  @override
  Future<ByteData> load(String key) => rootBundle.load(key);
}
  1. Write a goldenTest with an Image.asset widget (wrapped inside a DefaultAssetBundle)
import 'package:alchemist/alchemist.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';

import '../../utils/test_asset_bundle.dart';

void main() {
  setUpAll(TestWidgetsFlutterBinding.ensureInitialized);

  group('Image.asset: Golden Tests', () {
    goldenTest(
      'renders correctly',
      fileName: 'image_asset',
      widget: GoldenTestGroup(
        children: [
          GoldenTestScenario(
            name: 'XYZ Monster.jpg asset',
            child: DefaultAssetBundle(
              bundle: TestAssetBundle(),
              child: Image.asset('assets/type/XYZ Monster.jpg'),
            ),
          ),
        ],
      ),
    );
  });
}
  1. Run the command flutter test --update-goldens

Expected behavior

The golden file generated should display the asset image.

Screenshots

Asset Image

XYZ Monster

CI Golden

image_asset

Platform Golden

image_asset

Additional context and comments

  • flutter doctor -v:
[√] Flutter (Channel stable, 2.10.2, on Microsoft Windows [version 10.0.22000.527], locale fr-FR)
    • Flutter version 2.10.2 at C:\src\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 097d3313d8 (5 days ago), 2022-02-18 19:33:08 -0600
    • Engine revision a83ed0e5e3
    • Dart version 2.16.1
    • DevTools version 2.9.2

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at C:\Users\Guillaume\AppData\Local\Android\sdk
    • Platform android-30, build-tools 30.0.3
    • Java binary at: D:\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[!] Visual Studio - develop for Windows (Visual Studio Build Tools 2017 15.9.35)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools
    • Visual Studio Build Tools 2017 version 15.9.28307.1500
    • Windows 10 SDK version 10.0.17763.0
    X Visual Studio 2019 or later is required.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components

[√] Android Studio (version 4.1)
    • Android Studio at D:\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [version 10.0.22000.527]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 98.0.4758.102
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 97.0.1072.76

[√] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.
@TesteurManiak TesteurManiak added the bug Something isn't working label Feb 23, 2022
@Kirpal Kirpal self-assigned this Mar 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants