Skip to content

fix: Unicode flags are not generated correctly #147

@AntoniPochopien

Description

@AntoniPochopien

Is there an existing issue for this?

  • I have searched the existing issues.

Version

0.11.0

Description

Hello,

We are displaying flags on one of our pages and would like to cover them with golden tests. Unfortunately, the flags are represented as hashed values, causing our golden tests to fail consistently.

Steps to reproduce

  1. Run the example code from Pub.dev and replace any displayed string with a Unicode flag emoji—in our case, 🇺🇸 (US). This issue likely affects all emojis, but we haven't verified that.

Here is the example code:

import 'package:alchemist/alchemist.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';

import 'package:alchemist_bug/main.dart';

void main() {
  final usFlag = String.fromCharCodes([0x1F1Fa, 0x1f1F8]);

  group('ListTile Golden Tests', () {
    goldenTest(
      'renders correctly',
      fileName: 'list_tile',
      builder: () => GoldenTestGroup(
        scenarioConstraints: const BoxConstraints(maxWidth: 600),
        children: [
          GoldenTestScenario(
            name: 'with title',
            child: ListTile(
              title: Text('ListTile.title $usFlag'),
            ),
          ),
          GoldenTestScenario(
            name: 'with title and subtitle',
            child: ListTile(
              title: Text('ListTile.title'),
              subtitle: Text('ListTile.subtitle'),
            ),
          ),
          GoldenTestScenario(
            name: 'with trailing icon',
            child: ListTile(
              title: Text('ListTile.title'),
              trailing: Icon(Icons.chevron_right_rounded),
            ),
          ),
        ],
      ),
    );
  });
}
  1. Run flutter test --update-goldens.
  2. Check the generated files.
  3. You will see hashes instead of emojis.

Expected behavior

Emojis should appear in the generated files in their correct form.

Screenshots

Image

Additional context and comments

We tried loading different fonts, but nothing worked.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions