mirror of
https://github.com/flutter/samples.git
synced 2025-11-10 06:48:26 +00:00
Compass app (#2446)
This commit is contained in:
40
compass_app/app/testing/app.dart
Normal file
40
compass_app/app/testing/app.dart
Normal file
@@ -0,0 +1,40 @@
|
||||
// Copyright 2024 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:compass_app/ui/core/localization/applocalization.dart';
|
||||
import 'package:compass_app/ui/core/themes/theme.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:mocktail_image_network/mocktail_image_network.dart';
|
||||
|
||||
import 'mocks.dart';
|
||||
|
||||
testApp(
|
||||
WidgetTester tester,
|
||||
Widget body, {
|
||||
GoRouter? goRouter,
|
||||
}) async {
|
||||
tester.view.devicePixelRatio = 1.0;
|
||||
await tester.binding.setSurfaceSize(const Size(1200, 800));
|
||||
await mockNetworkImages(() async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
localizationsDelegates: [
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
AppLocalizationDelegate(),
|
||||
],
|
||||
theme: AppTheme.lightTheme,
|
||||
home: InheritedGoRouter(
|
||||
goRouter: goRouter ?? MockGoRouter(),
|
||||
child: Scaffold(
|
||||
body: body,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user