-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Took 1 hour 52 minutes
- Loading branch information
Showing
6 changed files
with
90 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// Copyright 2024 Andrious Solutions Ltd. 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:example/src/view.dart'; | ||
|
||
import 'package:flutter_test/flutter_test.dart'; | ||
|
||
const _location = '========================== test_run_mixins.dart'; | ||
|
||
Future<void> testRunMixins(WidgetTester tester) async { | ||
// | ||
final testMixins = _TestMixins(); | ||
|
||
final details = FlutterErrorDetails( | ||
exception: Exception('fake exception'), | ||
library: 'test_run_mixins.dart', | ||
context: ErrorDescription('Used fot testing.'), | ||
); | ||
|
||
testMixins.onAsyncError(details); | ||
|
||
await testMixins.didPushRoute('/'); | ||
|
||
await testMixins.didPushRouteInformation( | ||
RouteInformation( | ||
uri: Uri( | ||
scheme: 'mailto', | ||
path: '[email protected]', | ||
queryParameters: {'subject': 'Example'}, | ||
), | ||
), | ||
); | ||
|
||
testMixins.detachedAppLifecycleState(); | ||
|
||
testMixins.onError(details); | ||
|
||
testMixins.logErrorDetails(details); | ||
|
||
final testStateMixins = | ||
_TestStateMixins(runAsync: true, useInherited: true, printEvents: true); | ||
|
||
await testStateMixins.initAsync(); | ||
|
||
// Find its StatefulWidget first then the 'type' of State object. | ||
final AppStateX? appState = tester.firstState<AppStateX>(find.byType(MyApp)); | ||
|
||
final context = appState?.context; | ||
|
||
if (context != null) { | ||
// | ||
testStateMixins.buildF(context); | ||
|
||
// testStateMixins.builder(context); | ||
} | ||
} | ||
|
||
/// Supply the Mixins using this class | ||
class _TestMixins with AsyncOps, StateListener, StateXonErrorMixin { | ||
// Merely call the mixin's functions and methods to satisfy CodeCov | ||
} | ||
|
||
/// Supply the Mixins using this class | ||
class _TestStateMixins extends StateX { | ||
_TestStateMixins({ | ||
super.controller, | ||
super.runAsync, | ||
super.useInherited, | ||
super.printEvents, | ||
}); | ||
@override | ||
Widget build(BuildContext context) { | ||
// TODO: implement build | ||
throw UnimplementedError(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters