From 4f64856ac10e34c375e9fe791e0bbb4b8596dc2e Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Mon, 19 Apr 2021 12:17:45 -0400 Subject: [PATCH] Replace path_provider_linux widget tests with simple unit tests --- .../example/test/widget_test.dart | 97 ------------------- .../test/path_provider_linux_test.dart | 15 +++ 2 files changed, 15 insertions(+), 97 deletions(-) delete mode 100644 packages/path_provider/path_provider_linux/example/test/widget_test.dart diff --git a/packages/path_provider/path_provider_linux/example/test/widget_test.dart b/packages/path_provider/path_provider_linux/example/test/widget_test.dart deleted file mode 100644 index 59f839d431fa..000000000000 --- a/packages/path_provider/path_provider_linux/example/test/widget_test.dart +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// This is a basic Flutter widget test. -// -// To perform an interaction with a widget in your test, use the WidgetTester -// utility that Flutter provides. For example, you can send tap and scroll -// gestures. You can also use WidgetTester to find child widgets in the widget -// tree, read text, and verify that the values of widget properties are correct. - -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; - -import 'package:pathproviderexample/main.dart'; - -void main() { - group('Test linux path provider example', () { - setUpAll(() async { - WidgetsFlutterBinding.ensureInitialized(); - }); - - testWidgets('Finds tmp directory', (WidgetTester tester) async { - // Build our app and trigger a frame. - await tester.runAsync(() async { - await tester.pumpWidget(MyApp()); - await Future.delayed(const Duration(milliseconds: 20)); - await tester.pump(); - - // Verify that temporary directory is retrieved. - expect( - find.byWidgetPredicate( - (Widget widget) => - widget is Text && - widget.data!.startsWith('Temp Directory: /tmp'), - ), - findsOneWidget, - ); - }); - }); - testWidgets('Finds documents directory', (WidgetTester tester) async { - // Build our app and trigger a frame. - await tester.runAsync(() async { - await tester.pumpWidget(MyApp()); - await Future.delayed(const Duration(milliseconds: 20)); - await tester.pump(); - - // Verify that documents directory is retrieved. - expect( - find.byWidgetPredicate( - (Widget widget) => - widget is Text && - widget.data!.startsWith('Documents Directory: /'), - ), - findsOneWidget, - ); - }); - }); - testWidgets('Finds downloads directory', (WidgetTester tester) async { - // Build our app and trigger a frame. - await tester.runAsync(() async { - await tester.pumpWidget(MyApp()); - await Future.delayed(const Duration(milliseconds: 20)); - await tester.pump(); - - // Verify that downloads directory is retrieved. - expect( - find.byWidgetPredicate( - (Widget widget) => - widget is Text && - widget.data!.startsWith('Downloads Directory: /'), - ), - findsOneWidget, - ); - }); - }); - testWidgets('Finds application support directory', - (WidgetTester tester) async { - // Build our app and trigger a frame. - await tester.runAsync(() async { - await tester.pumpWidget(MyApp()); - await Future.delayed(const Duration(milliseconds: 20)); - await tester.pump(); - - // Verify that Application Support Directory is retrieved. - expect( - find.byWidgetPredicate( - (Widget widget) => - widget is Text && - widget.data!.startsWith('Application Support Directory: /'), - ), - findsOneWidget, - ); - }); - }); - }); -} diff --git a/packages/path_provider/path_provider_linux/test/path_provider_linux_test.dart b/packages/path_provider/path_provider_linux/test/path_provider_linux_test.dart index 9ab75ff477de..3384a3d2f963 100644 --- a/packages/path_provider/path_provider_linux/test/path_provider_linux_test.dart +++ b/packages/path_provider/path_provider_linux/test/path_provider_linux_test.dart @@ -17,4 +17,19 @@ void main() { final PathProviderPlatform plugin = PathProviderPlatform.instance; expect(await plugin.getTemporaryPath(), '/tmp'); }); + + test('getApplicationSupportPath', () async { + final PathProviderPlatform plugin = PathProviderPlatform.instance; + expect(await plugin.getApplicationSupportPath(), startsWith('/')); + }); + + test('getApplicationDocumentsPath', () async { + final PathProviderPlatform plugin = PathProviderPlatform.instance; + expect(await plugin.getApplicationDocumentsPath(), startsWith('/')); + }); + + test('getDownloadsPath', () async { + final PathProviderPlatform plugin = PathProviderPlatform.instance; + expect(await plugin.getDownloadsPath(), startsWith('/')); + }); }