1
0
mirror of https://github.com/flutter/samples.git synced 2026-04-01 09:13:23 +00:00

[Gallery] Fix directory structure (#312)

This commit is contained in:
Pierre-Louis
2020-02-05 20:11:54 +01:00
committed by GitHub
parent 082592e9a9
commit cee267cf88
762 changed files with 12 additions and 12 deletions

View File

@@ -0,0 +1,54 @@
// Copyright 2019 The Flutter team. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:gallery/data/gallery_options.dart';
import 'package:gallery/l10n/gallery_localizations.dart';
import 'package:gallery/pages/backdrop.dart';
void main() {
testWidgets('Home page hides settings semantics when closed', (tester) async {
final animationController = AnimationController(
duration: Duration(milliseconds: 1),
vsync: const TestVSync(),
);
final isSettingsOpen = ValueNotifier(false);
await tester.pumpWidget(
MaterialApp(
localizationsDelegates: [GalleryLocalizations.delegate],
home: ModelBinding(
initialModel: GalleryOptions(
textScaleFactor: 1.0,
),
child: Backdrop(
frontLayer: Text('Front'),
backLayer: Text('Back'),
controller: animationController,
isSettingsOpenNotifier: isSettingsOpen,
openSettingsAnimation: animationController,
),
),
),
);
await tester.pump(Duration(seconds: 1));
expect(find.bySemanticsLabel('Settings'), findsOneWidget);
expect(find.bySemanticsLabel('Close settings'), findsNothing);
expect(tester.getSemantics(find.text('Back')).label, 'Back');
expect(tester.getSemantics(find.text('Front')).label, '');
await tester.tap(find.bySemanticsLabel('Settings'));
await tester.pump(Duration(seconds: 1));
// The test no longer finds Setting and Close settings since the semantics
// are excluded when settings mode is activated.
// This was done so people could ready the settings page from top to
// bottom by utilizing an invisible widget within the Settings Page.
expect(tester.getSemantics(find.text('Back')).owner, null);
expect(tester.getSemantics(find.text('Front')).label, 'Front');
animationController.dispose();
});
}

View File

@@ -0,0 +1,5 @@
// Copyright 2019 The Flutter team. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
void main() {}