Repository: flutter/flutter
File: packages/flutter/test/cupertino/button_test.dart (Dart)

Code before:
    );
    await gesture.up();
    await gesture.removePointer();
  });

  testWidgets('CupertinoButton respects foregroundColor', (WidgetTester tester) async {
    const Color customForegroundColor = Color(0xFF5500FF);

    await tester.pumpWidget(
      boilerplate(
        child: CupertinoButton(
          onPressed: () {},
          foregroundColor: customForegroundColor,
          child: const Text('Button'),
        ),
      ),
    );

    // Check that the text has the custom foreground color
    final RichText text = tester.widget(
      find.descendant(of: find.byType(CupertinoButton), matching: find.byType(RichText)),
    );
    expect(text.text.style?.color, customForegroundColor);
  });

  testWidgets('CupertinoButton foregroundColor applies to Icon', (WidgetTester tester) async {
    const Color customForegroundColor = Color(0xFF5500FF);

    await tester.pumpWidget(
      boilerplate(
        child: CupertinoButton(
          onPressed: () {},
          foregroundColor: customForegroundColor,
          child: const Icon(IconData(0xE000)),
        ),
      ),
    );

    // Check that the icon has the custom foreground color
    final IconTheme iconTheme = tester.widget(
      find.descendant(of: find.byType(CupertinoButton), matching: find.byType(IconTheme)),
    );
    expect(iconTheme.data.color, customForegroundColor);
  });

  testWidgets('CupertinoButton foregroundColor applies to both Text and Icon', (
    WidgetTester tester,
  ) async {
    const Color customForegroundColor = Color(0xFF5500FF);

    await tester.pumpWidget(

Review comment (suggestion):
```suggestion
  testWidgets('CupertinoButton foregroundColor applies to its icon', (WidgetTester tester) async {
```

Code after:
      SystemMouseCursors.copy,
    );
    focusNode.unfocus();

    // Test pressed state mouse cursor
    await tester.createGesture(kind: PointerDeviceKind.mouse);
    await gesture.down(tester.getCenter(find.byType(CupertinoButton)));
    await tester.pump();
    expect(
      RendererBinding.instance.mouseTracker.debugDeviceActiveCursor(1),
      SystemMouseCursors.grab,
    );
    await gesture.up();
    await gesture.removePointer();
  });

  testWidgets('CupertinoButton foregroundColor applies to its text', (WidgetTester tester) async {
    const Color customForegroundColor = Color(0xFF5500FF);

    await tester.pumpWidget(
      boilerplate(
        child: CupertinoButton(
          onPressed: () {},
          foregroundColor: customForegroundColor,
          child: const Text('Button'),
        ),
      ),
    );

    // Check that the text has the custom foreground color
    final RichText text = tester.widget(
      find.descendant(of: find.byType(CupertinoButton), matching: find.byType(RichText)),
    );
    expect(text.text.style?.color, customForegroundColor);
  });

  testWidgets('CupertinoButton foregroundColor applies to its icon', (WidgetTester tester) async {
    const Color customForegroundColor = Color(0xFF5500FF);

    await tester.pumpWidget(
      boilerplate(
        child: CupertinoButton(
          onPressed: () {},
          foregroundColor: customForegroundColor,
          child: const Icon(IconData(0xE000)),
        ),
      ),
    );

    // Check that the icon has the custom foreground color
    final IconTheme iconTheme = tester.widget(