mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-12-28 17:12:33 +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(
|
||||
() => runApp(PlatformInfos.isMobile
|
||||
? AppLock(
|
||||
builder: (args) => App(),
|
||||
builder: (args) => FluffyChatApp(),
|
||||
lockScreen: LockScreen(),
|
||||
enabled: false,
|
||||
)
|
||||
: App()),
|
||||
: FluffyChatApp()),
|
||||
SentryController.captureException,
|
||||
);
|
||||
}
|
||||
|
||||
class App extends StatelessWidget {
|
||||
class FluffyChatApp extends StatelessWidget {
|
||||
final Widget test;
|
||||
static final GlobalKey<AdaptivePageLayoutState> _apl =
|
||||
GlobalKey<AdaptivePageLayoutState>();
|
||||
|
||||
const FluffyChatApp({Key key, this.test}) : super(key: key);
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AdaptiveTheme(
|
||||
@ -76,7 +79,9 @@ class App extends StatelessWidget {
|
||||
builder: (context) => AdaptivePageLayout(
|
||||
key: _apl,
|
||||
safeAreaOnColumnView: false,
|
||||
onGenerateRoute: FluffyRoutes(context).onGenerateRoute,
|
||||
onGenerateRoute: test == null
|
||||
? FluffyRoutes(context).onGenerateRoute
|
||||
: (_) => ViewData(mainView: (_) => test),
|
||||
dividerColor: Theme.of(context).dividerColor,
|
||||
columnWidth: FluffyThemes.columnWidth,
|
||||
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