From ffc29920026c70fe5836f93d7027f46e669d5dac Mon Sep 17 00:00:00 2001 From: Ellet Date: Fri, 10 Nov 2023 18:12:31 +0300 Subject: [PATCH] Update platform_test.dart --- test/utils/platform_test.dart | 75 +++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/test/utils/platform_test.dart b/test/utils/platform_test.dart index 5ac8c61f..aafda16e 100644 --- a/test/utils/platform_test.dart +++ b/test/utils/platform_test.dart @@ -14,6 +14,81 @@ void main() { ), false, ); + + for (final desktopPlatform in [ + TargetPlatform.macOS, + TargetPlatform.linux, + TargetPlatform.windows + ]) { + expect( + isDesktop( + supportWeb: false, + platform: desktopPlatform, + overrideIsWeb: false, + ), + true, + ); + + expect( + isDesktop( + supportWeb: false, + overrideIsWeb: true, + platform: desktopPlatform, + ), + false, + ); + + expect( + isDesktop( + supportWeb: true, + overrideIsWeb: true, + platform: desktopPlatform, + ), + true, + ); + } + }); + test('Check isMobile()', () { + platform = TargetPlatform.macOS; + expect( + isMobile( + platform: platform, + supportWeb: true, + ), + false, + ); + + for (final mobilePlatform in [ + TargetPlatform.android, + TargetPlatform.iOS, + ]) { + expect( + isMobile( + supportWeb: false, + platform: mobilePlatform, + overrideIsWeb: false, + ), + true, + ); + + expect( + isMobile( + supportWeb: false, + overrideIsWeb: true, + platform: mobilePlatform, + ), + false, + ); + + expect( + isMobile( + supportWeb: true, + overrideIsWeb: true, + platform: mobilePlatform, + ), + true, + ); + } }); test( 'Check supportWeb parameter when using desktop platform on web',