diff options
| author | Akshay Nair <phenax5@gmail.com> | 2020-06-05 19:51:04 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2020-06-05 19:51:04 +0530 |
| commit | 33c95a97f756e7c30b28319e365897b3b7b1e037 (patch) | |
| tree | 508dc4b3014925cdfe65a00de365492a9f87c906 | |
| parent | 421d19c758eb1151bff38438e4fe6efb2bf43f78 (diff) | |
| download | daft-launcher-33c95a97f756e7c30b28319e365897b3b7b1e037.tar.gz daft-launcher-33c95a97f756e7c30b28319e365897b3b7b1e037.zip | |
Test changes
| -rw-r--r-- | TODO.md | 5 | ||||
| -rw-r--r-- | test/components/AppList_test.dart | 2 | ||||
| -rw-r--r-- | test/components/SearchableAppList_test.dart | 35 | ||||
| -rw-r--r-- | test/utils.dart | 2 |
4 files changed, 41 insertions, 3 deletions
@@ -1,8 +1,10 @@ # TODO ## Global - - [ ] Add icons in context menu - [ ] Some good docs with a gif of ui + - [ ] Add a refresh button + - [ ] Make dark mode config boolean + - [X] Add icons in context menu - [X] Start writing tests - [X] Transision between pages between pages - [X] Find a way to preload both pages and stop from "loading" @@ -29,6 +31,7 @@ ## Applications list - [ ] Sort the list according to frequently used - [ ] Make app list load faster + - [ ] Clear button for search - [X] Create app list - [X] Make app list searchable - [X] Create options menu on long press diff --git a/test/components/AppList_test.dart b/test/components/AppList_test.dart index 69bf211..dabc616 100644 --- a/test/components/AppList_test.dart +++ b/test/components/AppList_test.dart @@ -21,7 +21,7 @@ void main() { expect(find.byType(ListTile), findsNothing); }); - testWidgets('Should render nothing for empty list', (WidgetTester tester) async { + testWidgets('Should render nothing for list of 4 items', (WidgetTester tester) async { await tester.pumpWidget(wrapper(AppList(appList: appList))); expect(find.byType(ListTile), findsNWidgets(4)); diff --git a/test/components/SearchableAppList_test.dart b/test/components/SearchableAppList_test.dart new file mode 100644 index 0000000..c4f520c --- /dev/null +++ b/test/components/SearchableAppList_test.dart @@ -0,0 +1,35 @@ +import 'dart:async'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:device_apps/device_apps.dart'; + +import 'package:owyn/components/SearchableAppList.dart'; +import 'package:owyn/components/AppList.dart'; + +import '../utils.dart'; + +void main() { + List<Application> appList = <Application>[ + makeApp('Reddit', 'org.example.reddit'), + makeApp('Spotify', 'org.example.spotify'), + makeApp('Twitter', 'org.example.twitter'), + makeApp('Youtube', 'org.example.youtube'), + ]; + var appListF = Future.value(appList); + + testWidgets('Should render nothing for empty list', (WidgetTester tester) async { + await tester.pumpWidget(wrapper(SearchableAppList(appListF: Future.value(<Application>[])))); + await tester.pump(); + + expect(find.byType(AppList), findsOneWidget); + expect(find.byType(ListTile), findsNothing); + }); + + //testWidgets('Should render nothing for a of list 4 items', (WidgetTester tester) async { + //await tester.pumpWidget(wrapper(SearchableAppList(appListF: appListF))); + //await tester.pumpAndSettle(); + + //expect(find.byType(AppList), findsOneWidget); + //expect(find.byType(ListTile), findsNWidgets(4)); + //}); +} diff --git a/test/utils.dart b/test/utils.dart index e85fde8..05e09bb 100644 --- a/test/utils.dart +++ b/test/utils.dart @@ -13,7 +13,7 @@ Widget wrapper(Widget view) { ); } -Future<void> waitFor(Duration duration) { return Future.delayed(duration, () {}); } +Future<int> waitFor(Duration duration) { return Future.delayed(duration, () => 1); } Application makeApp(String name, String pkgName) { return Application({ |
