Skip to content

Commit 0f0019b

Browse files
committed
[rfw] Bump version to 1.1.4 and update CHANGELOG
Made-with: Cursor
1 parent f5e544a commit 0f0019b

3 files changed

Lines changed: 201 additions & 14 deletions

File tree

packages/rfw/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.1.4
2+
3+
* Fixes `fontWeight` not being applied in release mode for `Text` and `StrutStyle` widgets.
4+
15
## 1.1.3
26

37
* Fixes dartdoc comments that accidentally used HTML.

packages/rfw/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: rfw
22
description: "Remote Flutter widgets: a library for rendering declarative widget description files at runtime."
33
repository: https://github.com/flutter/packages/tree/main/packages/rfw
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+rfw%22
5-
version: 1.1.3
5+
version: 1.1.4
66

77
environment:
88
sdk: ^3.9.0

packages/rfw/test/argument_decoders_test.dart

Lines changed: 196 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -187,19 +187,6 @@ void main() {
187187
await tester.pump();
188188
expect(tester.widget<Directionality>(find.byType(Directionality)).textDirection, TextDirection.ltr);
189189

190-
runtime.update(const LibraryName(<String>['test']), parseLibraryFile('''
191-
import core;
192-
widget root = Directionality(
193-
textDirection: "ltr",
194-
child: Text(
195-
text: 'Hello',
196-
style: { fontWeight: "w700" },
197-
),
198-
);
199-
'''));
200-
await tester.pump();
201-
expect(tester.widget<Text>(find.byType(Text)).style!.fontWeight, FontWeight.w700);
202-
203190
runtime.update(const LibraryName(<String>['test']), parseLibraryFile('''
204191
import core;
205192
widget root = FittedBox(
@@ -564,4 +551,200 @@ void main() {
564551

565552
expect(eventLog, isEmpty);
566553
}, skip: kIsWeb || !isMainChannel); // https://github.com/flutter/flutter/pull/129851
554+
555+
// fontWeight decoder tests
556+
557+
testWidgets('fontWeight string values in textStyle', (WidgetTester tester) async {
558+
final runtime = Runtime()
559+
..update(const LibraryName(<String>['core']), createCoreWidgets());
560+
addTearDown(runtime.dispose);
561+
562+
Future<FontWeight?> pumpWithFontWeight(String value) async {
563+
runtime.update(
564+
const LibraryName(<String>['test']),
565+
parseLibraryFile('''
566+
import core;
567+
widget root = Directionality(
568+
textDirection: "ltr",
569+
child: Text(text: "hello", style: { fontWeight: "$value", fontSize: 16.0 }),
570+
);
571+
'''),
572+
);
573+
await tester.pumpWidget(RemoteWidget(
574+
runtime: runtime,
575+
data: DynamicContent(),
576+
widget: const FullyQualifiedWidgetName(LibraryName(<String>['test']), 'root'),
577+
onEvent: (_, __) {},
578+
));
579+
await tester.pump();
580+
return tester.widget<Text>(find.byType(Text)).style?.fontWeight;
581+
}
582+
583+
expect(await pumpWithFontWeight('w100'), FontWeight.w100);
584+
expect(await pumpWithFontWeight('w200'), FontWeight.w200);
585+
expect(await pumpWithFontWeight('w300'), FontWeight.w300);
586+
expect(await pumpWithFontWeight('w400'), FontWeight.w400);
587+
expect(await pumpWithFontWeight('w500'), FontWeight.w500);
588+
expect(await pumpWithFontWeight('w600'), FontWeight.w600);
589+
expect(await pumpWithFontWeight('w700'), FontWeight.w700);
590+
expect(await pumpWithFontWeight('w800'), FontWeight.w800);
591+
expect(await pumpWithFontWeight('w900'), FontWeight.w900);
592+
expect(await pumpWithFontWeight('normal'), FontWeight.w400);
593+
expect(await pumpWithFontWeight('bold'), FontWeight.w700);
594+
});
595+
596+
testWidgets('fontWeight integer values in textStyle', (WidgetTester tester) async {
597+
final runtime = Runtime()
598+
..update(const LibraryName(<String>['core']), createCoreWidgets());
599+
addTearDown(runtime.dispose);
600+
601+
Future<FontWeight?> pumpWithFontWeightInt(int value) async {
602+
runtime.update(
603+
const LibraryName(<String>['test']),
604+
parseLibraryFile('''
605+
import core;
606+
widget root = Directionality(
607+
textDirection: "ltr",
608+
child: Text(text: "hello", style: { fontWeight: $value, fontSize: 16.0 }),
609+
);
610+
'''),
611+
);
612+
await tester.pumpWidget(RemoteWidget(
613+
runtime: runtime,
614+
data: DynamicContent(),
615+
widget: const FullyQualifiedWidgetName(LibraryName(<String>['test']), 'root'),
616+
onEvent: (_, __) {},
617+
));
618+
await tester.pump();
619+
return tester.widget<Text>(find.byType(Text)).style?.fontWeight;
620+
}
621+
622+
expect(await pumpWithFontWeightInt(100), FontWeight.w100);
623+
expect(await pumpWithFontWeightInt(200), FontWeight.w200);
624+
expect(await pumpWithFontWeightInt(300), FontWeight.w300);
625+
expect(await pumpWithFontWeightInt(400), FontWeight.w400);
626+
expect(await pumpWithFontWeightInt(500), FontWeight.w500);
627+
expect(await pumpWithFontWeightInt(600), FontWeight.w600);
628+
expect(await pumpWithFontWeightInt(700), FontWeight.w700);
629+
expect(await pumpWithFontWeightInt(800), FontWeight.w800);
630+
expect(await pumpWithFontWeightInt(900), FontWeight.w900);
631+
});
632+
633+
testWidgets('fontWeight missing key returns null in textStyle', (WidgetTester tester) async {
634+
final runtime = Runtime()
635+
..update(const LibraryName(<String>['core']), createCoreWidgets())
636+
..update(const LibraryName(<String>['test']), parseLibraryFile('''
637+
import core;
638+
widget root = Directionality(
639+
textDirection: "ltr",
640+
child: Text(text: "hello", style: { fontSize: 16.0 }),
641+
);
642+
'''));
643+
addTearDown(runtime.dispose);
644+
await tester.pumpWidget(RemoteWidget(
645+
runtime: runtime,
646+
data: DynamicContent(),
647+
widget: const FullyQualifiedWidgetName(LibraryName(<String>['test']), 'root'),
648+
onEvent: (_, __) {},
649+
));
650+
await tester.pump();
651+
expect(tester.widget<Text>(find.byType(Text)).style?.fontWeight, isNull);
652+
});
653+
654+
testWidgets('fontWeight unknown string returns null in textStyle', (WidgetTester tester) async {
655+
final runtime = Runtime()
656+
..update(const LibraryName(<String>['core']), createCoreWidgets())
657+
..update(const LibraryName(<String>['test']), parseLibraryFile('''
658+
import core;
659+
widget root = Directionality(
660+
textDirection: "ltr",
661+
child: Text(text: "hello", style: { fontWeight: "heavy", fontSize: 16.0 }),
662+
);
663+
'''));
664+
addTearDown(runtime.dispose);
665+
await tester.pumpWidget(RemoteWidget(
666+
runtime: runtime,
667+
data: DynamicContent(),
668+
widget: const FullyQualifiedWidgetName(LibraryName(<String>['test']), 'root'),
669+
onEvent: (_, __) {},
670+
));
671+
await tester.pump();
672+
expect(tester.widget<Text>(find.byType(Text)).style?.fontWeight, isNull);
673+
});
674+
675+
testWidgets('fontWeight string values in strutStyle', (WidgetTester tester) async {
676+
final runtime = Runtime()
677+
..update(const LibraryName(<String>['core']), createCoreWidgets());
678+
addTearDown(runtime.dispose);
679+
680+
Future<FontWeight?> pumpWithStrutFontWeight(String value) async {
681+
runtime.update(
682+
const LibraryName(<String>['test']),
683+
parseLibraryFile('''
684+
import core;
685+
widget root = Directionality(
686+
textDirection: "ltr",
687+
child: Text(text: "hello", strutStyle: { fontWeight: "$value", fontSize: 16.0 }),
688+
);
689+
'''),
690+
);
691+
await tester.pumpWidget(RemoteWidget(
692+
runtime: runtime,
693+
data: DynamicContent(),
694+
widget: const FullyQualifiedWidgetName(LibraryName(<String>['test']), 'root'),
695+
onEvent: (_, __) {},
696+
));
697+
await tester.pump();
698+
return tester.widget<Text>(find.byType(Text)).strutStyle?.fontWeight;
699+
}
700+
701+
expect(await pumpWithStrutFontWeight('w100'), FontWeight.w100);
702+
expect(await pumpWithStrutFontWeight('w200'), FontWeight.w200);
703+
expect(await pumpWithStrutFontWeight('w300'), FontWeight.w300);
704+
expect(await pumpWithStrutFontWeight('w400'), FontWeight.w400);
705+
expect(await pumpWithStrutFontWeight('w500'), FontWeight.w500);
706+
expect(await pumpWithStrutFontWeight('w600'), FontWeight.w600);
707+
expect(await pumpWithStrutFontWeight('w700'), FontWeight.w700);
708+
expect(await pumpWithStrutFontWeight('w800'), FontWeight.w800);
709+
expect(await pumpWithStrutFontWeight('w900'), FontWeight.w900);
710+
expect(await pumpWithStrutFontWeight('normal'), FontWeight.w400);
711+
expect(await pumpWithStrutFontWeight('bold'), FontWeight.w700);
712+
});
713+
714+
testWidgets('fontWeight integer values in strutStyle', (WidgetTester tester) async {
715+
final runtime = Runtime()
716+
..update(const LibraryName(<String>['core']), createCoreWidgets());
717+
addTearDown(runtime.dispose);
718+
719+
Future<FontWeight?> pumpWithStrutFontWeightInt(int value) async {
720+
runtime.update(
721+
const LibraryName(<String>['test']),
722+
parseLibraryFile('''
723+
import core;
724+
widget root = Directionality(
725+
textDirection: "ltr",
726+
child: Text(text: "hello", strutStyle: { fontWeight: $value, fontSize: 16.0 }),
727+
);
728+
'''),
729+
);
730+
await tester.pumpWidget(RemoteWidget(
731+
runtime: runtime,
732+
data: DynamicContent(),
733+
widget: const FullyQualifiedWidgetName(LibraryName(<String>['test']), 'root'),
734+
onEvent: (_, __) {},
735+
));
736+
await tester.pump();
737+
return tester.widget<Text>(find.byType(Text)).strutStyle?.fontWeight;
738+
}
739+
740+
expect(await pumpWithStrutFontWeightInt(100), FontWeight.w100);
741+
expect(await pumpWithStrutFontWeightInt(200), FontWeight.w200);
742+
expect(await pumpWithStrutFontWeightInt(300), FontWeight.w300);
743+
expect(await pumpWithStrutFontWeightInt(400), FontWeight.w400);
744+
expect(await pumpWithStrutFontWeightInt(500), FontWeight.w500);
745+
expect(await pumpWithStrutFontWeightInt(600), FontWeight.w600);
746+
expect(await pumpWithStrutFontWeightInt(700), FontWeight.w700);
747+
expect(await pumpWithStrutFontWeightInt(800), FontWeight.w800);
748+
expect(await pumpWithStrutFontWeightInt(900), FontWeight.w900);
749+
});
567750
}

0 commit comments

Comments
 (0)