mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-19 10:39:26 +01:00
tests: Add tests for homeserver picker
This commit is contained in:
parent
f5f02c62d8
commit
d4d2c88330
@ -41,18 +41,21 @@ void main() async {
|
|||||||
runZonedGuarded(
|
runZonedGuarded(
|
||||||
() => runApp(PlatformInfos.isMobile
|
() => runApp(PlatformInfos.isMobile
|
||||||
? AppLock(
|
? AppLock(
|
||||||
builder: (args) => App(),
|
builder: (args) => FluffyChatApp(),
|
||||||
lockScreen: LockScreen(),
|
lockScreen: LockScreen(),
|
||||||
enabled: false,
|
enabled: false,
|
||||||
)
|
)
|
||||||
: App()),
|
: FluffyChatApp()),
|
||||||
SentryController.captureException,
|
SentryController.captureException,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
class App extends StatelessWidget {
|
class FluffyChatApp extends StatelessWidget {
|
||||||
|
final Widget test;
|
||||||
static final GlobalKey<AdaptivePageLayoutState> _apl =
|
static final GlobalKey<AdaptivePageLayoutState> _apl =
|
||||||
GlobalKey<AdaptivePageLayoutState>();
|
GlobalKey<AdaptivePageLayoutState>();
|
||||||
|
|
||||||
|
const FluffyChatApp({Key key, this.test}) : super(key: key);
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return AdaptiveTheme(
|
return AdaptiveTheme(
|
||||||
@ -76,7 +79,9 @@ class App extends StatelessWidget {
|
|||||||
builder: (context) => AdaptivePageLayout(
|
builder: (context) => AdaptivePageLayout(
|
||||||
key: _apl,
|
key: _apl,
|
||||||
safeAreaOnColumnView: false,
|
safeAreaOnColumnView: false,
|
||||||
onGenerateRoute: FluffyRoutes(context).onGenerateRoute,
|
onGenerateRoute: test == null
|
||||||
|
? FluffyRoutes(context).onGenerateRoute
|
||||||
|
: (_) => ViewData(mainView: (_) => test),
|
||||||
dividerColor: Theme.of(context).dividerColor,
|
dividerColor: Theme.of(context).dividerColor,
|
||||||
columnWidth: FluffyThemes.columnWidth,
|
columnWidth: FluffyThemes.columnWidth,
|
||||||
dividerWidth: 1.0,
|
dividerWidth: 1.0,
|
||||||
|
14
test/homeserver_picker_test.dart
Normal file
14
test/homeserver_picker_test.dart
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import 'package:fluffychat/controllers/homeserver_picker_controller.dart';
|
||||||
|
import 'package:fluffychat/main.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
testWidgets('Test if the widget can be created', (WidgetTester tester) async {
|
||||||
|
await tester.pumpWidget(FluffyChatApp(test: HomeserverPicker()));
|
||||||
|
|
||||||
|
await tester.tap(find.byType(TextField));
|
||||||
|
await tester.tap(find.byType(ElevatedButton));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
});
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user