From 10f063afe4fb32a5cf377a7029e5741f6993bc28 Mon Sep 17 00:00:00 2001 From: Haitao Pan Date: Tue, 22 Oct 2024 10:35:52 +0800 Subject: [PATCH] Add unit tests for HomeScreen and SubscriptionScreen - Created home_screen_test.dart to test HomeScreen functionality. - Created subscription_screen_test.dart to test SubscriptionScreen functionality. - Update workflow to include Flutter test step. --- analysis_options.yaml | 2 +- android/app/build.gradle | 4 +- android/app/src/main/AndroidManifest.xml | 2 +- .../com/example/xstream_app/MainActivity.kt | 5 - android/xstream_app_android.iml | 29 ----- linux/CMakeLists.txt | 4 +- linux/my_application.cc | 4 +- macos/Podfile.lock | 23 ---- macos/Runner.xcodeproj/project.pbxproj | 114 ++---------------- .../xcshareddata/xcschemes/Runner.xcscheme | 8 +- .../contents.xcworkspacedata | 3 - macos/Runner/Configs/AppInfo.xcconfig | 4 +- test/home_screen_test.dart | 24 ++++ test/subscription_screen_test.dart | 25 ++++ test/widget_test.dart | 30 ----- web/index.html | 4 +- web/manifest.json | 4 +- windows/CMakeLists.txt | 4 +- windows/runner/Runner.rc | 8 +- windows/runner/main.cpp | 2 +- xstream_app.iml | 17 --- 21 files changed, 83 insertions(+), 237 deletions(-) delete mode 100644 android/app/src/main/kotlin/com/example/xstream_app/MainActivity.kt delete mode 100644 android/xstream_app_android.iml delete mode 100644 macos/Podfile.lock create mode 100644 test/home_screen_test.dart create mode 100644 test/subscription_screen_test.dart delete mode 100644 test/widget_test.dart delete mode 100644 xstream_app.iml diff --git a/analysis_options.yaml b/analysis_options.yaml index 57144e7..5680bb1 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -26,7 +26,7 @@ linter: # or a specific dart file by using the `// ignore: name_of_lint` and # `// ignore_for_file: name_of_lint` syntax on the line or in the file # producing the lint. - rules: + #rules: # avoid_print: false # Uncomment to disable the `avoid_print` rule # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule diff --git a/android/app/build.gradle b/android/app/build.gradle index 8e61f9e..ccd426b 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -6,7 +6,7 @@ plugins { } android { - namespace = "com.example.xstream_app" + namespace = "com.example.xstream" compileSdk = flutter.compileSdkVersion ndkVersion = flutter.ndkVersion @@ -21,7 +21,7 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId = "com.example.xstream_app" + applicationId = "com.example.xstream" // You can update the following values to match your application needs. // For more information, see: https://flutter.dev/to/review-gradle-config. minSdk = flutter.minSdkVersion diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index d7e98d1..87adad7 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,6 +1,6 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/linux/CMakeLists.txt b/linux/CMakeLists.txt index 578e59a..f87064e 100644 --- a/linux/CMakeLists.txt +++ b/linux/CMakeLists.txt @@ -4,10 +4,10 @@ project(runner LANGUAGES CXX) # The name of the executable created for the application. Change this to change # the on-disk name of your application. -set(BINARY_NAME "xstream_app") +set(BINARY_NAME "xstream") # The unique GTK application identifier for this application. See: # https://wiki.gnome.org/HowDoI/ChooseApplicationID -set(APPLICATION_ID "com.example.xstream_app") +set(APPLICATION_ID "com.example.xstream") # Explicitly opt in to modern CMake behaviors to avoid warnings with recent # versions of CMake. diff --git a/linux/my_application.cc b/linux/my_application.cc index 351c70b..d8cd0a2 100644 --- a/linux/my_application.cc +++ b/linux/my_application.cc @@ -40,11 +40,11 @@ static void my_application_activate(GApplication* application) { if (use_header_bar) { GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); gtk_widget_show(GTK_WIDGET(header_bar)); - gtk_header_bar_set_title(header_bar, "xstream_app"); + gtk_header_bar_set_title(header_bar, "xstream"); gtk_header_bar_set_show_close_button(header_bar, TRUE); gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); } else { - gtk_window_set_title(window, "xstream_app"); + gtk_window_set_title(window, "xstream"); } gtk_window_set_default_size(window, 1280, 720); diff --git a/macos/Podfile.lock b/macos/Podfile.lock deleted file mode 100644 index a83eba5..0000000 --- a/macos/Podfile.lock +++ /dev/null @@ -1,23 +0,0 @@ -PODS: - - FlutterMacOS (1.0.0) - - path_provider_foundation (0.0.1): - - Flutter - - FlutterMacOS - -DEPENDENCIES: - - FlutterMacOS (from `Flutter/ephemeral`) - - path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`) - -EXTERNAL SOURCES: - FlutterMacOS: - :path: Flutter/ephemeral - path_provider_foundation: - :path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin - -SPEC CHECKSUMS: - FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 - path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46 - -PODFILE CHECKSUM: 236401fc2c932af29a9fcf0e97baeeb2d750d367 - -COCOAPODS: 1.15.2 diff --git a/macos/Runner.xcodeproj/project.pbxproj b/macos/Runner.xcodeproj/project.pbxproj index 58bd8da..978004c 100644 --- a/macos/Runner.xcodeproj/project.pbxproj +++ b/macos/Runner.xcodeproj/project.pbxproj @@ -27,8 +27,6 @@ 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; - 38227E8AD5BD6CAF593A040C /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C7715D53E57365712E752ED2 /* Pods_Runner.framework */; }; - 68D53436D9AFCF3FB63E4D54 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6DEDDC289CC9879A2E5E1549 /* Pods_RunnerTests.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -66,7 +64,7 @@ 331C80D7294CF71000263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; - 33CC10ED2044A3C60003C045 /* xstream_app.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = xstream_app.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 33CC10ED2044A3C60003C045 /* xstream.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "xstream.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; }; 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; @@ -78,16 +76,8 @@ 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; - 41DA4AF58624F78107A0CE61 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; - 6DEDDC289CC9879A2E5E1549 /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 6EDDE6CF1D1F377B37C646C7 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; - 8327E9F44FFE9682AFE28F30 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; - 847147160C3CC627B08089F7 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; - C7715D53E57365712E752ED2 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - DDB426A9B81B82F9FA61CDEC /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; - EDA7BA73919C6D6AA255C601 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -95,7 +85,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 68D53436D9AFCF3FB63E4D54 /* Pods_RunnerTests.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -103,7 +92,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 38227E8AD5BD6CAF593A040C /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -137,14 +125,13 @@ 331C80D6294CF71000263BE5 /* RunnerTests */, 33CC10EE2044A3C60003C045 /* Products */, D73912EC22F37F3D000D13A0 /* Frameworks */, - F6D2349244FE877FEEC35A51 /* Pods */, ); sourceTree = ""; }; 33CC10EE2044A3C60003C045 /* Products */ = { isa = PBXGroup; children = ( - 33CC10ED2044A3C60003C045 /* xstream_app.app */, + 33CC10ED2044A3C60003C045 /* xstream.app */, 331C80D5294CF71000263BE5 /* RunnerTests.xctest */, ); name = Products; @@ -188,26 +175,10 @@ D73912EC22F37F3D000D13A0 /* Frameworks */ = { isa = PBXGroup; children = ( - C7715D53E57365712E752ED2 /* Pods_Runner.framework */, - 6DEDDC289CC9879A2E5E1549 /* Pods_RunnerTests.framework */, ); name = Frameworks; sourceTree = ""; }; - F6D2349244FE877FEEC35A51 /* Pods */ = { - isa = PBXGroup; - children = ( - 6EDDE6CF1D1F377B37C646C7 /* Pods-Runner.debug.xcconfig */, - 847147160C3CC627B08089F7 /* Pods-Runner.release.xcconfig */, - DDB426A9B81B82F9FA61CDEC /* Pods-Runner.profile.xcconfig */, - EDA7BA73919C6D6AA255C601 /* Pods-RunnerTests.debug.xcconfig */, - 8327E9F44FFE9682AFE28F30 /* Pods-RunnerTests.release.xcconfig */, - 41DA4AF58624F78107A0CE61 /* Pods-RunnerTests.profile.xcconfig */, - ); - name = Pods; - path = Pods; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -215,7 +186,6 @@ isa = PBXNativeTarget; buildConfigurationList = 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; buildPhases = ( - 3B7F125635ED4B2E56F442FF /* [CP] Check Pods Manifest.lock */, 331C80D1294CF70F00263BE5 /* Sources */, 331C80D2294CF70F00263BE5 /* Frameworks */, 331C80D3294CF70F00263BE5 /* Resources */, @@ -234,13 +204,11 @@ isa = PBXNativeTarget; buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( - 77071BFC4A866AD4602CB01C /* [CP] Check Pods Manifest.lock */, 33CC10E92044A3C60003C045 /* Sources */, 33CC10EA2044A3C60003C045 /* Frameworks */, 33CC10EB2044A3C60003C045 /* Resources */, 33CC110E2044A8840003C045 /* Bundle Framework */, 3399D490228B24CF009A79C7 /* ShellScript */, - 6145BE45085DCA8D712CE985 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -249,7 +217,7 @@ ); name = Runner; productName = Runner; - productReference = 33CC10ED2044A3C60003C045 /* xstream_app.app */; + productReference = 33CC10ED2044A3C60003C045 /* xstream.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ @@ -361,67 +329,6 @@ shellPath = /bin/sh; shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; }; - 3B7F125635ED4B2E56F442FF /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; - 6145BE45085DCA8D712CE985 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", - ); - name = "[CP] Embed Pods Frameworks"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; - 77071BFC4A866AD4602CB01C /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -473,46 +380,43 @@ /* Begin XCBuildConfiguration section */ 331C80DB294CF71000263BE5 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = EDA7BA73919C6D6AA255C601 /* Pods-RunnerTests.debug.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CURRENT_PROJECT_VERSION = 1; GENERATE_INFOPLIST_FILE = YES; MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.example.xstreamApp.RunnerTests; + PRODUCT_BUNDLE_IDENTIFIER = com.example.xstream.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/xstream_app.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/xstream_app"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/xstream.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/xstream"; }; name = Debug; }; 331C80DC294CF71000263BE5 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 8327E9F44FFE9682AFE28F30 /* Pods-RunnerTests.release.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CURRENT_PROJECT_VERSION = 1; GENERATE_INFOPLIST_FILE = YES; MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.example.xstreamApp.RunnerTests; + PRODUCT_BUNDLE_IDENTIFIER = com.example.xstream.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/xstream_app.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/xstream_app"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/xstream.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/xstream"; }; name = Release; }; 331C80DD294CF71000263BE5 /* Profile */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 41DA4AF58624F78107A0CE61 /* Pods-RunnerTests.profile.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CURRENT_PROJECT_VERSION = 1; GENERATE_INFOPLIST_FILE = YES; MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.example.xstreamApp.RunnerTests; + PRODUCT_BUNDLE_IDENTIFIER = com.example.xstream.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/xstream_app.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/xstream_app"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/xstream.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/xstream"; }; name = Profile; }; diff --git a/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 85cd16e..96b6b2b 100644 --- a/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -15,7 +15,7 @@ @@ -31,7 +31,7 @@ @@ -65,7 +65,7 @@ @@ -82,7 +82,7 @@ diff --git a/macos/Runner.xcworkspace/contents.xcworkspacedata b/macos/Runner.xcworkspace/contents.xcworkspacedata index 21a3cc1..1d526a1 100644 --- a/macos/Runner.xcworkspace/contents.xcworkspacedata +++ b/macos/Runner.xcworkspace/contents.xcworkspacedata @@ -4,7 +4,4 @@ - - diff --git a/macos/Runner/Configs/AppInfo.xcconfig b/macos/Runner/Configs/AppInfo.xcconfig index 5361656..408530f 100644 --- a/macos/Runner/Configs/AppInfo.xcconfig +++ b/macos/Runner/Configs/AppInfo.xcconfig @@ -5,10 +5,10 @@ // 'flutter create' template. // The application's name. By default this is also the title of the Flutter window. -PRODUCT_NAME = xstream_app +PRODUCT_NAME = xstream // The application's bundle identifier -PRODUCT_BUNDLE_IDENTIFIER = com.example.xstreamApp +PRODUCT_BUNDLE_IDENTIFIER = com.example.xstream // The copyright displayed in application information PRODUCT_COPYRIGHT = Copyright © 2024 com.example. All rights reserved. diff --git a/test/home_screen_test.dart b/test/home_screen_test.dart new file mode 100644 index 0000000..8673519 --- /dev/null +++ b/test/home_screen_test.dart @@ -0,0 +1,24 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:xstream/screens/home_screen.dart'; + +void main() { + testWidgets('HomeScreen shows service status and launch button', (WidgetTester tester) async { + // Build the HomeScreen widget. + await tester.pumpWidget(MaterialApp(home: HomeScreen())); + + // Verify that the service status is displayed. + expect(find.text('服务状态'), findsOneWidget); + expect(find.text('服务未运行'), findsOneWidget); + + // Verify that the launch button is displayed. + expect(find.text('启动服务'), findsOneWidget); + + // Verify that the custom list tiles are displayed. + expect(find.text('VLESS'), findsOneWidget); + expect(find.text('VMess'), findsOneWidget); + expect(find.text('Shadowsocks'), findsOneWidget); + expect(find.text('Trojan'), findsOneWidget); + expect(find.text('Socks'), findsOneWidget); + }); +} diff --git a/test/subscription_screen_test.dart b/test/subscription_screen_test.dart new file mode 100644 index 0000000..37f531d --- /dev/null +++ b/test/subscription_screen_test.dart @@ -0,0 +1,25 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:xstream/screens/subscription_screen.dart'; + +void main() { + testWidgets('SubscriptionScreen generates config file', (WidgetTester tester) async { + // Build the SubscriptionScreen widget. + await tester.pumpWidget(MaterialApp(home: SubscriptionScreen())); + + // Verify that the text fields and button are displayed. + expect(find.byType(TextField), findsNWidgets(2)); // 2 text fields + expect(find.text('生成配置文件'), findsOneWidget); + + // Enter text in the text fields. + await tester.enterText(find.byType(TextField).at(0), 'example.com'); + await tester.enterText(find.byType(TextField).at(1), '123e4567-e89b-12d3-a456-426614174000'); + + // Tap the generate button. + await tester.tap(find.text('生成配置文件')); + await tester.pumpAndSettle(); // Wait for any animations to finish. + + // Verify that a success message is displayed (you may want to adjust this to match your logic). + expect(find.textContaining('配置文件生成成功'), findsOneWidget); + }); +} diff --git a/test/widget_test.dart b/test/widget_test.dart deleted file mode 100644 index 10360f4..0000000 --- a/test/widget_test.dart +++ /dev/null @@ -1,30 +0,0 @@ -// This is a basic Flutter widget test. -// -// To perform an interaction with a widget in your test, use the WidgetTester -// utility in the flutter_test package. 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:xstream_app/main.dart'; - -void main() { - testWidgets('Counter increments smoke test', (WidgetTester tester) async { - // Build our app and trigger a frame. - await tester.pumpWidget(const MyApp()); - - // Verify that our counter starts at 0. - expect(find.text('0'), findsOneWidget); - expect(find.text('1'), findsNothing); - - // Tap the '+' icon and trigger a frame. - await tester.tap(find.byIcon(Icons.add)); - await tester.pump(); - - // Verify that our counter has incremented. - expect(find.text('0'), findsNothing); - expect(find.text('1'), findsOneWidget); - }); -} diff --git a/web/index.html b/web/index.html index b89361b..5e60024 100644 --- a/web/index.html +++ b/web/index.html @@ -23,13 +23,13 @@ - + - xstream_app + xstream diff --git a/web/manifest.json b/web/manifest.json index bc4b2a0..7b79b58 100644 --- a/web/manifest.json +++ b/web/manifest.json @@ -1,6 +1,6 @@ { - "name": "xstream_app", - "short_name": "xstream_app", + "name": "xstream", + "short_name": "xstream", "start_url": ".", "display": "standalone", "background_color": "#0175C2", diff --git a/windows/CMakeLists.txt b/windows/CMakeLists.txt index 70feaa0..f4cda9d 100644 --- a/windows/CMakeLists.txt +++ b/windows/CMakeLists.txt @@ -1,10 +1,10 @@ # Project-level configuration. cmake_minimum_required(VERSION 3.14) -project(xstream_app LANGUAGES CXX) +project(xstream LANGUAGES CXX) # The name of the executable created for the application. Change this to change # the on-disk name of your application. -set(BINARY_NAME "xstream_app") +set(BINARY_NAME "xstream") # Explicitly opt in to modern CMake behaviors to avoid warnings with recent # versions of CMake. diff --git a/windows/runner/Runner.rc b/windows/runner/Runner.rc index a8f9a25..adea9d4 100644 --- a/windows/runner/Runner.rc +++ b/windows/runner/Runner.rc @@ -90,12 +90,12 @@ BEGIN BLOCK "040904e4" BEGIN VALUE "CompanyName", "com.example" "\0" - VALUE "FileDescription", "xstream_app" "\0" + VALUE "FileDescription", "xstream" "\0" VALUE "FileVersion", VERSION_AS_STRING "\0" - VALUE "InternalName", "xstream_app" "\0" + VALUE "InternalName", "xstream" "\0" VALUE "LegalCopyright", "Copyright (C) 2024 com.example. All rights reserved." "\0" - VALUE "OriginalFilename", "xstream_app.exe" "\0" - VALUE "ProductName", "xstream_app" "\0" + VALUE "OriginalFilename", "xstream.exe" "\0" + VALUE "ProductName", "xstream" "\0" VALUE "ProductVersion", VERSION_AS_STRING "\0" END END diff --git a/windows/runner/main.cpp b/windows/runner/main.cpp index 66e75f9..3ede7c1 100644 --- a/windows/runner/main.cpp +++ b/windows/runner/main.cpp @@ -27,7 +27,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, FlutterWindow window(project); Win32Window::Point origin(10, 10); Win32Window::Size size(1280, 720); - if (!window.Create(L"xstream_app", origin, size)) { + if (!window.Create(L"xstream", origin, size)) { return EXIT_FAILURE; } window.SetQuitOnClose(true); diff --git a/xstream_app.iml b/xstream_app.iml deleted file mode 100644 index f66303d..0000000 --- a/xstream_app.iml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - -