Commit 88cd043d authored by Ian Hickson's avatar Ian Hickson Committed by GitHub

Fix tests (#12132)

Fixes some tests that weren't aggressively catching exceptions.
Fixes some actual failures that were found because of this.
Tries to fix an intermittent failure with crash1_test.dart which could be a race condition.
parent 39cfaa72
......@@ -11,6 +11,13 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
test('test smoke test -- this test should fail', () async {
system.Process.killPid(system.pid, system.ProcessSignal.SIGSEGV);
if (system.Process.killPid(system.pid, system.ProcessSignal.SIGSEGV)) {
print('system.Process.killPid returned before the process ended!');
print('Sleeping for a few seconds just in case signal delivery is delayed or our signal handler is being slow...');
system.sleep(const Duration(seconds: 10)); // don't sleep too much, we must not time out
} else {
print('system.Process.killPid reports that the SIGSEGV signal was not delivered!');
}
print('crash1_test.dart will now probably not crash, which will ruin the test.');
});
}
\ No newline at end of file
}
......@@ -5,6 +5,8 @@
import 'package:flutter/widgets.dart';
class LifecycleWatcher extends StatefulWidget {
const LifecycleWatcher({ Key key }) : super(key: key);
@override
_LifecycleWatcherState createState() => new _LifecycleWatcherState();
}
......@@ -42,7 +44,12 @@ class _LifecycleWatcherState extends State<LifecycleWatcher>
void main() {
runApp(new Center(
child: new LifecycleWatcher()
));
runApp(
const Directionality(
textDirection: TextDirection.ltr,
child: const Center(
child: const LifecycleWatcher(),
),
),
);
}
......@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:test/test.dart';
import 'package:flutter_test/flutter_test.dart';
import '../../../lib/main.dart' as demo;
void main() {
test('layers smoketest for lib/main.dart', () {
testWidgets('layers smoketest for lib/main.dart', (WidgetTester tester) {
demo.main();
});
}
......@@ -2,12 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/foundation.dart';
import 'package:test/test.dart';
import '../../../rendering/custom_coordinate_systems.dart' as demo;
void main() {
test('layers smoketest for rendering/custom_coordinate_systems.dart', () {
FlutterError.onError = (FlutterErrorDetails details) { throw details.exception; };
demo.main();
});
}
......@@ -2,12 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/foundation.dart';
import 'package:test/test.dart';
import '../../../rendering/flex_layout.dart' as demo;
void main() {
test('layers smoketest for rendering/flex_layout.dart', () {
FlutterError.onError = (FlutterErrorDetails details) { throw details.exception; };
demo.main();
});
}
......@@ -2,12 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/foundation.dart';
import 'package:test/test.dart';
import '../../../rendering/hello_world.dart' as demo;
void main() {
test('layers smoketest for rendering/hello_world.dart', () {
FlutterError.onError = (FlutterErrorDetails details) { throw details.exception; };
demo.main();
});
}
......@@ -2,12 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/foundation.dart';
import 'package:test/test.dart';
import '../../../rendering/spinning_square.dart' as demo;
void main() {
test('layers smoketest for rendering/spinning_square.dart', () {
FlutterError.onError = (FlutterErrorDetails details) { throw details.exception; };
demo.main();
});
}
......@@ -2,12 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/foundation.dart';
import 'package:test/test.dart';
import '../../../rendering/touch_input.dart' as demo;
void main() {
test('layers smoketest for rendering/touch_input.dart', () {
FlutterError.onError = (FlutterErrorDetails details) { throw details.exception; };
demo.main();
});
}
......@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:test/test.dart';
import 'package:flutter_test/flutter_test.dart';
import '../../../services/isolate.dart' as demo;
void main() {
test('layers smoketest for services/isolate.dart', () {
testWidgets('layers smoketest for services/isolate.dart', (WidgetTester tester) {
demo.main();
});
}
......@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:test/test.dart';
import 'package:flutter_test/flutter_test.dart';
import '../../../services/lifecycle.dart' as demo;
void main() {
test('layers smoketest for services/lifecycle.dart', () {
testWidgets('layers smoketest for services/lifecycle.dart', (WidgetTester tester) {
demo.main();
});
}
......@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:test/test.dart';
import 'package:flutter_test/flutter_test.dart';
import '../../../widgets/custom_render_box.dart' as demo;
void main() {
test('layers smoketest for widgets/custom_render_box.dart', () {
testWidgets('layers smoketest for widgets/custom_render_box.dart', (WidgetTester tester) {
demo.main();
});
}
......@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:test/test.dart';
import 'package:flutter_test/flutter_test.dart';
import '../../../widgets/gestures.dart' as demo;
void main() {
test('layers smoketest for widgets/gestures.dart', () {
testWidgets('layers smoketest for widgets/gestures.dart', (WidgetTester tester) {
demo.main();
});
}
......@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:test/test.dart';
import 'package:flutter_test/flutter_test.dart';
import '../../../widgets/hello_world.dart' as demo;
void main() {
test('layers smoketest for widgets/hello_world.dart', () {
testWidgets('layers smoketest for widgets/hello_world.dart', (WidgetTester tester) {
demo.main();
});
}
......@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:test/test.dart';
import 'package:flutter_test/flutter_test.dart';
import '../../../widgets/media_query.dart' as demo;
void main() {
test('layers smoketest for widgets/media_query.dart', () {
testWidgets('layers smoketest for widgets/media_query.dart', (WidgetTester tester) {
demo.main();
});
}
......@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:test/test.dart';
import 'package:flutter_test/flutter_test.dart';
import '../../../widgets/sectors.dart' as demo;
void main() {
test('layers smoketest for widgets/sectors.dart', () {
testWidgets('layers smoketest for widgets/sectors.dart', (WidgetTester tester) {
demo.main();
});
}
......@@ -2,12 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/foundation.dart';
import 'package:test/test.dart';
import '../../../widgets/spinning_mixed.dart' as demo;
void main() {
test('layers smoketest for widgets/spinning_mixed.dart', () {
FlutterError.onError = (FlutterErrorDetails details) { throw details.exception; };
demo.main();
});
}
......@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:test/test.dart';
import 'package:flutter_test/flutter_test.dart';
import '../../../widgets/spinning_square.dart' as demo;
void main() {
test('layers smoketest for widgets/spinning_square.dart', () {
testWidgets('layers smoketest for widgets/spinning_square.dart', (WidgetTester tester) {
demo.main();
});
}
......@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:test/test.dart';
import 'package:flutter_test/flutter_test.dart';
import '../../../widgets/styled_text.dart' as demo;
void main() {
test('layers smoketest for widgets/styled_text.dart', () {
testWidgets('layers smoketest for widgets/styled_text.dart', (WidgetTester tester) {
demo.main();
});
}
......@@ -46,5 +46,14 @@ class Dots extends SingleChildRenderObjectWidget {
}
void main() {
runApp(const Dots(child: const Center(child: const Text('Touch me!'))));
runApp(
const Directionality(
textDirection: TextDirection.ltr,
child: const Dots(
child: const Center(
child: const Text('Touch me!'),
),
),
),
);
}
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