Commit 26e82a00 authored by yangwu.jia's avatar yangwu.jia

Add test case

parent 2ef3870f
import 'package:flutter_boost/container/container_manager.dart'; import 'package:flutter_boost/container/container_manager.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter_boost/flutter_boost.dart'; import 'package:flutter_boost/flutter_boost.dart';
......
...@@ -71,7 +71,6 @@ void main() { ...@@ -71,7 +71,6 @@ void main() {
MyApp(), MyApp(),
); );
//open firt page //open firt page
ContainerCoordinator.singleton ContainerCoordinator.singleton
.nativeContainerDidShow("first", {}, "1000000"); .nativeContainerDidShow("first", {}, "1000000");
...@@ -80,8 +79,7 @@ void main() { ...@@ -80,8 +79,7 @@ void main() {
expect(find.text('First'), findsOneWidget); expect(find.text('First'), findsOneWidget);
//open second page firt(1000000)->second(2000000)
//open second page
ContainerCoordinator.singleton ContainerCoordinator.singleton
.nativeContainerDidShow("second", {}, "2000000"); .nativeContainerDidShow("second", {}, "2000000");
...@@ -91,17 +89,14 @@ void main() { ...@@ -91,17 +89,14 @@ void main() {
await tester.pump(const Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
//close sencod page firt(1000000)
//close sencod page
FlutterBoost.containerManager?.remove("2000000"); FlutterBoost.containerManager?.remove("2000000");
await tester.pump(const Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
expect(find.text('First'), findsOneWidget); expect(find.text('First'), findsOneWidget);
// second page ,but pageId is 2000001 firt(1000000)->second(2000001)
// second page ,but pageId is 2000001
ContainerCoordinator.singleton ContainerCoordinator.singleton
.nativeContainerDidShow("second", {}, "2000001"); .nativeContainerDidShow("second", {}, "2000001");
...@@ -111,8 +106,7 @@ void main() { ...@@ -111,8 +106,7 @@ void main() {
await tester.pump(const Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
//reopen firt page second(2000001)->firt(1000000)
//reopen firt page
ContainerCoordinator.singleton ContainerCoordinator.singleton
.nativeContainerDidShow("first", {}, "1000000"); .nativeContainerDidShow("first", {}, "1000000");
...@@ -120,10 +114,9 @@ void main() { ...@@ -120,10 +114,9 @@ void main() {
expect(find.text('First'), findsOneWidget); expect(find.text('First'), findsOneWidget);
//reopen firt page second(2000001)->firt(1000000)
// reopen second page and pageId is 2000001 firt(1000000)->second(2000001)
// close second page and pageId is 2000001
ContainerCoordinator.singleton ContainerCoordinator.singleton
.nativeContainerDidShow("second", {}, "2000001"); .nativeContainerDidShow("second", {}, "2000001");
...@@ -133,6 +126,24 @@ void main() { ...@@ -133,6 +126,24 @@ void main() {
await tester.pump(const Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
//close firt(1000000) page second(2000001)
FlutterBoost.containerManager?.remove("1000000");
await tester.pump(const Duration(seconds: 1));
expect(find.text('Second'), findsOneWidget);
// open second(2000003)
ContainerCoordinator.singleton
.nativeContainerDidShow("second", {}, "2000003");
await tester.idle();
expect(find.text('Second'), findsOneWidget);
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment