Skip to content

Commit

Permalink
Revert flutter#57588 because it causes problems with packages that ha…
Browse files Browse the repository at this point in the history
…ve zero licenses.
  • Loading branch information
gspencergoog committed Jun 29, 2020
1 parent 163a09a commit f1b9fdf
Show file tree
Hide file tree
Showing 91 changed files with 61 additions and 1,947 deletions.
1,139 changes: 50 additions & 1,089 deletions packages/flutter/lib/src/material/about.dart

Large diffs are not rendered by default.

14 changes: 0 additions & 14 deletions packages/flutter/lib/src/material/material_localizations.dart
Expand Up @@ -122,9 +122,6 @@ abstract class MaterialLocalizations {
/// Title for the [LicensePage] widget.
String get licensesPageTitle;

/// Subtitle for a package in the [LicensePage] widget.
String licensesPackageDetailText(int licenseCount);

/// Title for the [PaginatedDataTable]'s row info footer.
String pageRowsInfoTitle(int firstRow, int lastRow, int rowCount, bool rowCountIsApproximate);

Expand Down Expand Up @@ -910,17 +907,6 @@ class DefaultMaterialLocalizations implements MaterialLocalizations {
@override
String get licensesPageTitle => 'Licenses';

@override
String licensesPackageDetailText(int licenseCount) {
assert (licenseCount >= 1);
switch (licenseCount) {
case 1:
return '1 license';
default:
return '$licenseCount licenses';
}
}

@override
String pageRowsInfoTitle(int firstRow, int lastRow, int rowCount, bool rowCountIsApproximate) {
return rowCountIsApproximate
Expand Down
58 changes: 11 additions & 47 deletions packages/flutter/test/material/about_test.dart
Expand Up @@ -92,8 +92,6 @@ void main() {
find.text('I am the very model of a modern major general.'),
findsOneWidget,
);
await tester.tap(find.text('Pirate package '));
await tester.pumpAndSettle(const Duration(milliseconds: 100));
expect(find.text('Pirate license'), findsOneWidget);
}, skip: isBrowser); // https://github.com/flutter/flutter/issues/54385

Expand Down Expand Up @@ -138,23 +136,9 @@ void main() {

await tester.pumpAndSettle();

// Check for packages.
expect(find.text('AAA'), findsOneWidget);
expect(find.text('Another package'), findsOneWidget);

// Check license is displayed after entering into license page for 'AAA'.
await tester.tap(find.text('AAA'));
await tester.pumpAndSettle(const Duration(milliseconds: 100));
expect(find.text('BBB'), findsOneWidget);

/// Go back to list of packages.
await tester.pageBack();
await tester.pumpAndSettle();

/// Check license is displayed after entering into license page for
/// 'Another package'.
await tester.tap(find.text('Another package'));
await tester.pumpAndSettle(const Duration(milliseconds: 100));
expect(find.text('Another package'), findsOneWidget);
expect(find.text('Another license'), findsOneWidget);
}, skip: isBrowser); // https://github.com/flutter/flutter/issues/54385

Expand Down Expand Up @@ -213,24 +197,9 @@ void main() {
find.text('I am the very model of a modern major general.'),
findsOneWidget,
);

// Check for packages.
expect(find.text('AAA'), findsOneWidget);
expect(find.text('Another package'), findsOneWidget);

// Check license is displayed after entering into license page for 'AAA'.
await tester.tap(find.text('AAA'));
await tester.pumpAndSettle(const Duration(milliseconds: 100));
expect(find.text('BBB'), findsOneWidget);

/// Go back to list of packages.
await tester.pageBack();
await tester.pumpAndSettle();

/// Check license is displayed after entering into license page for
/// 'Another package'.
await tester.tap(find.text('Another package'));
await tester.pumpAndSettle(const Duration(milliseconds: 100));
expect(find.text('Another package'), findsOneWidget);
expect(find.text('Another license'), findsOneWidget);
}, skip: isBrowser); // https://github.com/flutter/flutter/issues/54385

Expand All @@ -256,12 +225,7 @@ void main() {

await tester.pumpAndSettle();

// The position of the top left of app bar title should indicate whether
// the safe area is sufficiently respected.
expect(
tester.getTopLeft(find.text('Licenses')),
const Offset(16.0 + safeareaPadding, 18.0 + safeareaPadding),
);
expect(tester.getTopLeft(find.text('DEF')), const Offset(8.0 + safeareaPadding, 287.0));
}, skip: isBrowser); // https://github.com/flutter/flutter/issues/54385

testWidgets('LicensePage returns early if unmounted', (WidgetTester tester) async {
Expand All @@ -286,7 +250,7 @@ void main() {
await tester.pumpAndSettle();
final FakeLicenseEntry licenseEntry = FakeLicenseEntry();
licenseCompleter.complete(licenseEntry);
expect(licenseEntry.packagesCalled, false);
expect(licenseEntry.paragraphsCalled, false);
});

testWidgets('LicensePage returns late if unmounted', (WidgetTester tester) async {
Expand All @@ -311,7 +275,7 @@ void main() {
);

await tester.pumpAndSettle();
expect(licenseEntry.packagesCalled, true);
expect(licenseEntry.paragraphsCalled, true);
});

testWidgets('LicensePage logic defaults to executable name for app name', (WidgetTester tester) async {
Expand Down Expand Up @@ -560,16 +524,16 @@ void main() {
class FakeLicenseEntry extends LicenseEntry {
FakeLicenseEntry();

bool get packagesCalled => _packagesCalled;
bool _packagesCalled = false;
bool get paragraphsCalled => _paragraphsCalled;
bool _paragraphsCalled = false;

@override
Iterable<LicenseParagraph> paragraphs = <LicenseParagraph>[];
Iterable<String> packages = <String>[];

@override
Iterable<String> get packages {
_packagesCalled = true;
return <String>[];
Iterable<LicenseParagraph> get paragraphs {
_paragraphsCalled = true;
return <LicenseParagraph>[];
}
}

Expand Down
8 changes: 0 additions & 8 deletions packages/flutter/test/material/localizations_test.dart
Expand Up @@ -95,13 +95,5 @@ void main() {
expect(localizations.pageRowsInfoTitle(1, 10, 100, false).contains(r'$firstRow'), isFalse);
expect(localizations.pageRowsInfoTitle(1, 10, 100, false).contains(r'$lastRow'), isFalse);
expect(localizations.pageRowsInfoTitle(1, 10, 100, false).contains(r'$rowCount'), isFalse);

expect(() => localizations.licensesPackageDetailText(0), throwsAssertionError);
expect(localizations.licensesPackageDetailText(1), isNotNull);
expect(localizations.licensesPackageDetailText(2), isNotNull);
expect(localizations.licensesPackageDetailText(100), isNotNull);
expect(localizations.licensesPackageDetailText(1).contains(r'$licensesCount'), isFalse);
expect(localizations.licensesPackageDetailText(2).contains(r'$licensesCount'), isFalse);
expect(localizations.licensesPackageDetailText(100).contains(r'$licensesCount'), isFalse);
});
}

0 comments on commit f1b9fdf

Please sign in to comment.