forked from matthewrice345/betterplayer
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added tests for issue jhomlala#1168 - DC
- Loading branch information
1 parent
c290a5f
commit 4c9e0cc
Showing
6 changed files
with
170 additions
and
2 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,96 @@ | ||
import 'package:flutter/foundation.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
import 'mock_render_box.dart'; | ||
|
||
class MockBuildContext extends BuildContext { | ||
@override | ||
bool get debugDoingBuild => throw UnimplementedError(); | ||
|
||
@override | ||
InheritedWidget dependOnInheritedElement(InheritedElement ancestor, | ||
{Object? aspect}) { | ||
throw UnimplementedError(); | ||
} | ||
|
||
@override | ||
T? dependOnInheritedWidgetOfExactType<T extends InheritedWidget>( | ||
{Object? aspect}) { | ||
throw UnimplementedError(); | ||
} | ||
|
||
@override | ||
DiagnosticsNode describeElement(String name, | ||
{DiagnosticsTreeStyle style = DiagnosticsTreeStyle.errorProperty}) { | ||
throw UnimplementedError(); | ||
} | ||
|
||
@override | ||
List<DiagnosticsNode> describeMissingAncestor( | ||
{required Type expectedAncestorType}) { | ||
throw UnimplementedError(); | ||
} | ||
|
||
@override | ||
DiagnosticsNode describeOwnershipChain(String name) { | ||
throw UnimplementedError(); | ||
} | ||
|
||
@override | ||
DiagnosticsNode describeWidget(String name, | ||
{DiagnosticsTreeStyle style = DiagnosticsTreeStyle.errorProperty}) { | ||
throw UnimplementedError(); | ||
} | ||
|
||
@override | ||
void dispatchNotification(Notification notification) {} | ||
|
||
@override | ||
T? findAncestorRenderObjectOfType<T extends RenderObject>() { | ||
throw UnimplementedError(); | ||
} | ||
|
||
@override | ||
T? findAncestorStateOfType<T extends State<StatefulWidget>>() { | ||
throw UnimplementedError(); | ||
} | ||
|
||
@override | ||
T? findAncestorWidgetOfExactType<T extends Widget>() { | ||
throw UnimplementedError(); | ||
} | ||
|
||
@override | ||
RenderObject? findRenderObject() { | ||
return MockRenderBox(); | ||
} | ||
|
||
@override | ||
T? findRootAncestorStateOfType<T extends State<StatefulWidget>>() { | ||
throw UnimplementedError(); | ||
} | ||
|
||
@override | ||
InheritedElement? | ||
getElementForInheritedWidgetOfExactType<T extends InheritedWidget>() { | ||
throw UnimplementedError(); | ||
} | ||
|
||
@override | ||
bool get mounted => throw UnimplementedError(); | ||
|
||
@override | ||
BuildOwner? get owner => throw UnimplementedError(); | ||
|
||
@override | ||
Size? get size => throw UnimplementedError(); | ||
|
||
@override | ||
void visitAncestorElements(bool Function(Element element) visitor) {} | ||
|
||
@override | ||
void visitChildElements(ElementVisitor visitor) {} | ||
|
||
@override | ||
Widget get widget => 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'mock_build_context.dart'; | ||
|
||
class MockGlobalKey extends GlobalKey { | ||
MockGlobalKey() : super.constructor(); | ||
|
||
@override | ||
BuildContext? get currentContext => MockBuildContext(); | ||
} |
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,11 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class MockRenderBox extends RenderBox { | ||
@override | ||
Offset localToGlobal(Offset point, {RenderObject? ancestor}) { | ||
return Offset(0, 0); | ||
} | ||
|
||
@override | ||
Size get size => Size.zero; | ||
} |
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