Commit c09cb81c authored by justin's avatar justin

Merge branch 'master' into v1.12.13-hotfixes

parents f197aa29 1869fd11
......@@ -9,7 +9,7 @@ addons:
- libstdc++6
# - fonts-droid
before_script:
- git clone https://github.com/flutter/flutter.git -b v1.9.1-hotfixes --depth 1
- git clone https://github.com/flutter/flutter.git -b v1.12.13-hotfixes --depth 1
- ./flutter/bin/flutter doctor
script:
- ./flutter/bin/flutter test --coverage --coverage-path=lcov.info
......
......@@ -30,7 +30,7 @@ bool isTopContainer = FlutterBoost.BoostContainer.of(context).onstage
回答:无障碍模式下目前Flutter Engine有bug,已经提交issue和PR给flutter啦。请参考这个issue:https://github.com/alibaba/flutter_boost/issues/488及其分析。提交给flutter的PR见这里:https://github.com/flutter/engine/pull/14155
### 5. 在ios模拟器下运行最新的flutter boost会闪退
回答:因为模拟器下flutter默认会将voice over模式打开,所以其实就是辅助模式,这回触发上面的bug:“在ios中voice over打开,demo在点击交互会crash”。
回答:如上面第4条所说的,最新的flutter engine在voice over下有bug,会导致crash。因为模拟器下flutter默认会将voice over模式打开,所以其实就是辅助模式,这回触发上面的bug:“在ios中voice over打开,demo在点击交互会crash”。
可参考Engine的代码注释:
```c++
#if TARGET_OS_SIMULATOR
......
......@@ -3,7 +3,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
TestWidgetsFlutterBinding.ensureInitialized();
const MethodChannel channel = MethodChannel('flutter_boost');
final List<MethodCall> log = <MethodCall>[];
dynamic response;
......
......@@ -3,6 +3,7 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_boost/flutter_boost.dart';
import 'package:flutter_boost/container/container_coordinator.dart';
final GlobalKey scaffoldKey = GlobalKey();
......@@ -94,9 +95,6 @@ class _MyAppState extends State<MyApp> {
},
home: Container());
}
void _onRoutePushed(
String pageName, String uniqueId, Map params, Route route, Future _) {}
}
void main() {
......@@ -108,4 +106,190 @@ void main() {
expect(find.text('First'), findsNothing);
});
group(
'Try to get the ContainerManagerState in the ancestor node',
() {
testWidgets(
'through the `BoostContainerManager.of(context)` method',
(WidgetTester tester) async {
var builderContext;
FlutterBoost.singleton.registerPageBuilders({
'context': (pageName, params, _) => Builder(
builder: (context) {
return FloatingActionButton(
onPressed: () {
builderContext = context;
},
);
},
),
});
await tester.pumpWidget(
MaterialApp(
builder: FlutterBoost.init(),
home: Container(),
),
);
//open context page
ContainerCoordinator.singleton
.nativeContainerDidShow("context", {}, "1000000");
await tester.pump(Duration(seconds: 1));
expect(find.byType(FloatingActionButton), findsOneWidget);
//get the context of the Builder
await tester.tap(find.byType(FloatingActionButton));
final isFind = BoostContainerManager.of(builderContext) != null;
expect(isFind, true,
reason: '`BoostContainerManager.of` should be able to '
'find `ContainerManagerState` in `FlutterBoost.init()` based on the context of the `Builder`');
},
);
// testWidgets(
// 'through the `BoostContainerManager.of(context)` method',
// (WidgetTester tester) async {
// var builderContext;
//
// await tester.pumpWidget(
// MaterialApp(
// home: Builder(
// builder: (context) {
// return FloatingActionButton(
// onPressed: () {
// builderContext = context;
// },
// );
// },
// ),
// ),
// );
//
// expect(find.byType(FloatingActionButton), findsOneWidget);
//
// //get the context of the Builder
// await tester.tap(find.byType(FloatingActionButton));
//
// expect(BoostContainerManager.of(builderContext), isAssertionError);
// },
// );
testWidgets(
'through the `BoostContainerManager.tryOf(context)` method',
(WidgetTester tester) async {
var builderContext;
FlutterBoost.singleton.registerPageBuilders({
'context': (pageName, params, _) => Builder(
builder: (context) {
return FloatingActionButton(
onPressed: () {
builderContext = context;
},
);
},
),
});
await tester.pumpWidget(
MaterialApp(
builder: FlutterBoost.init(),
home: Container(),
),
);
//open context page
ContainerCoordinator.singleton
.nativeContainerDidShow("context", {}, "1000000");
await tester.pump(Duration(seconds: 1));
expect(find.byType(FloatingActionButton), findsOneWidget);
//get the context of the Builder
await tester.tap(find.byType(FloatingActionButton));
final isFind = BoostContainerManager.tryOf(builderContext) != null;
expect(isFind, true,
reason: '`BoostContainerManager.tryOf` should be able to '
'find `ContainerManagerState` in `FlutterBoost.init()` based on the context of the `Builder`');
},
);
},
);
group('ContainerManagerState', () {
testWidgets(
'containerCounts should change based on the number of pages',
(WidgetTester tester) async {
var builderContext;
FlutterBoost.singleton.registerPageBuilders({
'context': (pageName, params, _) => Builder(
builder: (context) {
return FloatingActionButton(
onPressed: () {
builderContext = context;
},
);
},
),
});
await tester.pumpWidget(
MaterialApp(
builder: FlutterBoost.init(),
home: Container(),
),
);
//open first context page
ContainerCoordinator.singleton
.nativeContainerDidShow("context", {}, "1000000");
await tester.pump(Duration(seconds: 1));
//get the context of the Builder
await tester.tap(find.byType(FloatingActionButton));
final containerManagerState = BoostContainerManager.of(builderContext);
expect(containerManagerState.containerCounts, 1,
reason: '1 page shown');
//open second context page
ContainerCoordinator.singleton
.nativeContainerDidShow("context", {}, "2000000");
await tester.pump(Duration(seconds: 1));
expect(containerManagerState.containerCounts, 2,
reason: '2 page shown');
//pop second context page
containerManagerState.pop();
await tester.pump(Duration(seconds: 1));
expect(containerManagerState.containerCounts, 1,
reason: 'second context page closed, Only one page left');
//pop last context page
containerManagerState.pop();
await tester.pump(Duration(seconds: 1));
expect(containerManagerState.containerCounts, 0,
reason: 'last context page closed, no page left');
},
);
});
}
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