@@ -23,22 +23,6 @@ void main() {
2323
2424 debugDefaultTargetPlatformOverride = TargetPlatform .iOS;
2525
26- // testWidgets('Asserts.', (tester) async {
27- // expect(
28- // () => GFLoader(
29- //
30- // ),
31- // throwsAssertionError,
32- // );
33- //
34- // expect(
35- // () => GFLoader(
36- //
37- // ),
38- // throwsAssertionError,
39- // );
40- // });
41-
4226 testWidgets ('GF Loader can be constructed' , (tester) async {
4327 final GFLoader loader = GFLoader (
4428 loaderColorOne: firstColor,
@@ -102,19 +86,6 @@ void main() {
10286 expect (app.loader.loaderstrokeWidth, stroke);
10387 });
10488
105- // testWidgets('Asserts.', (tester) async {
106- // // when type is null
107- //
108- // expect(() => GFLoader(
109- // type: null,
110- // loaderIconOne : iconOne,
111- // loaderIconTwo: iconTwo,
112- // loaderIconThree: iconThree,
113- // ),
114- // throwsAssertionError,
115- // );
116- // });
117-
11889 testWidgets ('GF Loader with square type can be constructed' , (tester) async {
11990 const customType = GFLoaderType .square;
12091
@@ -181,40 +152,6 @@ void main() {
181152 expect (app.loader.androidLoaderColor, color);
182153 });
183154
184- // testWidgets('Asserts.', (tester) async {
185- // // when type is null
186- //
187- // // expect(() => GFLoader(
188- // // type: null,
189- // // loaderIconOne : iconOne,
190- // // loaderIconTwo: iconTwo,
191- // // loaderIconThree: iconThree,
192- // // ),
193- // // throwsAssertionError,
194- // //
195- // // );
196- //
197- // const GFLoader loader = GFLoader(
198- // type: null,
199- // loaderIconOne : iconOne,
200- // loaderIconTwo: iconTwo,
201- // loaderIconThree: iconThree,
202- // );
203- //
204- // const TestApp app = TestApp(loader);
205- //
206- // await tester.pumpWidget(app);
207- //
208- // expect(
209- // tester.takeException(),
210- // isA<FlutterError>().having(
211- // (error) => error.message,
212- // 'message',
213- // 'Type should be custom for icons loader to display',
214- // ),
215- // );
216- // });
217-
218155 testWidgets ('GF Loader with custom loader can be constructed using child' ,
219156 (tester) async {
220157 const customType = GFLoaderType .custom;
@@ -232,6 +169,34 @@ void main() {
232169 expect (app.loader.child, childWidget);
233170 expect (app.loader.type, customType);
234171 });
172+
173+ testWidgets ('Custom GF Loader can be constructed with wrong type' ,
174+ (tester) async {
175+ const GFLoader loader = GFLoader (
176+ type: GFLoaderType .custom,
177+ loaderIconOne: iconOne,
178+ );
179+
180+ const TestApp app = TestApp (loader);
181+
182+ await tester.pumpWidget (app);
183+ // expect(app.loader.type, GFLoaderType.android);
184+ expect (app.loader.type, GFLoaderType .custom, reason: 'custom icon' );
185+ expect (app.loader.loaderIconOne, iconOne);
186+ });
187+
188+ testWidgets ('GF Loader can be constructed without type' , (tester) async {
189+ // `GFLoader.type` null.
190+ expect (
191+ () => GFLoader (
192+ type: null ,
193+ loaderIconOne: iconOne,
194+ loaderIconTwo: iconTwo,
195+ loaderIconThree: iconThree,
196+ ),
197+ throwsAssertionError,
198+ );
199+ });
235200}
236201
237202class TestApp extends StatefulWidget {
0 commit comments