From bfb92e3e3287fbb0ba280821abf0b21286f084a8 Mon Sep 17 00:00:00 2001 From: liuja <542689970@qq.com> Date: Tue, 26 Nov 2024 16:34:49 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E8=A7=A3=E6=9E=90DEMO?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liuja <542689970@qq.com> --- ohos/path_parsing_test/.gitignore | 44 +++ ohos/path_parsing_test/.metadata | 30 ++ ohos/path_parsing_test/README.md | 16 + ohos/path_parsing_test/android/.gitignore | 13 + .../android/app/build.gradle | 59 ++++ .../android/app/src/debug/AndroidManifest.xml | 8 + .../android/app/src/main/AndroidManifest.xml | 34 ++ .../lz_path_parsing_test/MainActivity.java | 6 + .../res/drawable-v21/launch_background.xml | 12 + .../main/res/drawable/launch_background.xml | 12 + .../src/main/res/mipmap-hdpi/ic_launcher.png | Bin 0 -> 544 bytes .../src/main/res/mipmap-mdpi/ic_launcher.png | Bin 0 -> 442 bytes .../src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 0 -> 721 bytes .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin 0 -> 1031 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.png | Bin 0 -> 1443 bytes .../app/src/main/res/values-night/styles.xml | 18 ++ .../app/src/main/res/values/styles.xml | 18 ++ .../app/src/profile/AndroidManifest.xml | 8 + ohos/path_parsing_test/android/build.gradle | 31 ++ .../android/gradle.properties | 3 + .../gradle/wrapper/gradle-wrapper.properties | 5 + .../path_parsing_test/android/settings.gradle | 11 + .../lib/common/base_page.dart | 39 +++ .../lib/common/item_widget.dart | 123 +++++++ .../lib/common/main_item_widget.dart | 36 +++ .../lib/common/test_model_app.dart | 37 +++ .../lib/common/test_page.dart | 301 ++++++++++++++++++ .../lib/common/test_route.dart | 34 ++ ohos/path_parsing_test/lib/main.dart | 62 ++++ ohos/path_parsing_test/lib/pages/example.dart | 178 +++++++++++ .../lib/pages/function_list.dart | 36 +++ .../lib/pages/parse_path_deep_test.dart | 90 ++++++ .../lib/pages/parse_path_test.dart | 248 +++++++++++++++ .../lib/pages/s_PathProxy_test.dart | 60 ++++ .../lib/pages/s_PathSegmentData_test.dart | 119 +++++++ .../lib/pages/s_SvgPathNormalizer_test.dart | 44 +++ .../lib/pages/s_SvgPathStringSource_test.dart | 52 +++ ohos/path_parsing_test/ohos/.gitignore | 19 ++ .../path_parsing_test/ohos/AppScope/app.json5 | 10 + .../resources/base/element/string.json | 8 + .../resources/base/media/app_icon.png | Bin 0 -> 6790 bytes .../ohos/build-profile.json5 | 56 ++++ ohos/path_parsing_test/ohos/entry/.gitignore | 7 + .../ohos/entry/build-profile.json5 | 29 ++ .../ohos/entry/hvigorfile.ts | 17 + .../ohos/entry/oh-package.json5 | 9 + .../main/ets/entryability/EntryAbility.ets | 24 ++ .../ohos/entry/src/main/ets/pages/Index.ets | 38 +++ .../ets/plugins/GeneratedPluginRegistrant.ets | 24 ++ .../ohos/entry/src/main/module.json5 | 53 +++ .../main/resources/base/element/color.json | 8 + .../main/resources/base/element/string.json | 16 + .../src/main/resources/base/media/icon.png | Bin 0 -> 6790 bytes .../resources/base/profile/main_pages.json | 5 + .../main/resources/en_US/element/string.json | 16 + .../main/resources/zh_CN/element/string.json | 16 + .../src/ohosTest/ets/test/Ability.test.ets | 50 +++ .../entry/src/ohosTest/ets/test/List.test.ets | 20 ++ .../ohosTest/ets/testability/TestAbility.ets | 63 ++++ .../ohosTest/ets/testability/pages/Index.ets | 49 +++ .../ets/testrunner/OpenHarmonyTestRunner.ts | 64 ++++ .../ohos/entry/src/ohosTest/module.json5 | 51 +++ .../resources/base/element/color.json | 8 + .../resources/base/element/string.json | 16 + .../ohosTest/resources/base/media/icon.png | Bin 0 -> 6790 bytes .../resources/base/profile/test_pages.json | 5 + .../ohos/hvigor/hvigor-config.json5 | 20 ++ ohos/path_parsing_test/ohos/hvigorfile.ts | 21 ++ ohos/path_parsing_test/ohos/oh-package.json5 | 33 ++ ohos/path_parsing_test/pubspec.yaml | 93 ++++++ .../test/parse_path_deep_test.dart | 71 +++++ .../test/parse_path_test.dart | 248 +++++++++++++++ 72 files changed, 2954 insertions(+) create mode 100644 ohos/path_parsing_test/.gitignore create mode 100644 ohos/path_parsing_test/.metadata create mode 100644 ohos/path_parsing_test/README.md create mode 100644 ohos/path_parsing_test/android/.gitignore create mode 100644 ohos/path_parsing_test/android/app/build.gradle create mode 100644 ohos/path_parsing_test/android/app/src/debug/AndroidManifest.xml create mode 100644 ohos/path_parsing_test/android/app/src/main/AndroidManifest.xml create mode 100644 ohos/path_parsing_test/android/app/src/main/java/com/example/lz_path_parsing_test/MainActivity.java create mode 100644 ohos/path_parsing_test/android/app/src/main/res/drawable-v21/launch_background.xml create mode 100644 ohos/path_parsing_test/android/app/src/main/res/drawable/launch_background.xml create mode 100644 ohos/path_parsing_test/android/app/src/main/res/mipmap-hdpi/ic_launcher.png create mode 100644 ohos/path_parsing_test/android/app/src/main/res/mipmap-mdpi/ic_launcher.png create mode 100644 ohos/path_parsing_test/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png create mode 100644 ohos/path_parsing_test/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png create mode 100644 ohos/path_parsing_test/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png create mode 100644 ohos/path_parsing_test/android/app/src/main/res/values-night/styles.xml create mode 100644 ohos/path_parsing_test/android/app/src/main/res/values/styles.xml create mode 100644 ohos/path_parsing_test/android/app/src/profile/AndroidManifest.xml create mode 100644 ohos/path_parsing_test/android/build.gradle create mode 100644 ohos/path_parsing_test/android/gradle.properties create mode 100644 ohos/path_parsing_test/android/gradle/wrapper/gradle-wrapper.properties create mode 100644 ohos/path_parsing_test/android/settings.gradle create mode 100644 ohos/path_parsing_test/lib/common/base_page.dart create mode 100644 ohos/path_parsing_test/lib/common/item_widget.dart create mode 100644 ohos/path_parsing_test/lib/common/main_item_widget.dart create mode 100644 ohos/path_parsing_test/lib/common/test_model_app.dart create mode 100644 ohos/path_parsing_test/lib/common/test_page.dart create mode 100644 ohos/path_parsing_test/lib/common/test_route.dart create mode 100644 ohos/path_parsing_test/lib/main.dart create mode 100644 ohos/path_parsing_test/lib/pages/example.dart create mode 100644 ohos/path_parsing_test/lib/pages/function_list.dart create mode 100644 ohos/path_parsing_test/lib/pages/parse_path_deep_test.dart create mode 100644 ohos/path_parsing_test/lib/pages/parse_path_test.dart create mode 100644 ohos/path_parsing_test/lib/pages/s_PathProxy_test.dart create mode 100644 ohos/path_parsing_test/lib/pages/s_PathSegmentData_test.dart create mode 100644 ohos/path_parsing_test/lib/pages/s_SvgPathNormalizer_test.dart create mode 100644 ohos/path_parsing_test/lib/pages/s_SvgPathStringSource_test.dart create mode 100644 ohos/path_parsing_test/ohos/.gitignore create mode 100644 ohos/path_parsing_test/ohos/AppScope/app.json5 create mode 100644 ohos/path_parsing_test/ohos/AppScope/resources/base/element/string.json create mode 100644 ohos/path_parsing_test/ohos/AppScope/resources/base/media/app_icon.png create mode 100644 ohos/path_parsing_test/ohos/build-profile.json5 create mode 100644 ohos/path_parsing_test/ohos/entry/.gitignore create mode 100644 ohos/path_parsing_test/ohos/entry/build-profile.json5 create mode 100644 ohos/path_parsing_test/ohos/entry/hvigorfile.ts create mode 100644 ohos/path_parsing_test/ohos/entry/oh-package.json5 create mode 100644 ohos/path_parsing_test/ohos/entry/src/main/ets/entryability/EntryAbility.ets create mode 100644 ohos/path_parsing_test/ohos/entry/src/main/ets/pages/Index.ets create mode 100644 ohos/path_parsing_test/ohos/entry/src/main/ets/plugins/GeneratedPluginRegistrant.ets create mode 100644 ohos/path_parsing_test/ohos/entry/src/main/module.json5 create mode 100644 ohos/path_parsing_test/ohos/entry/src/main/resources/base/element/color.json create mode 100644 ohos/path_parsing_test/ohos/entry/src/main/resources/base/element/string.json create mode 100644 ohos/path_parsing_test/ohos/entry/src/main/resources/base/media/icon.png create mode 100644 ohos/path_parsing_test/ohos/entry/src/main/resources/base/profile/main_pages.json create mode 100644 ohos/path_parsing_test/ohos/entry/src/main/resources/en_US/element/string.json create mode 100644 ohos/path_parsing_test/ohos/entry/src/main/resources/zh_CN/element/string.json create mode 100644 ohos/path_parsing_test/ohos/entry/src/ohosTest/ets/test/Ability.test.ets create mode 100644 ohos/path_parsing_test/ohos/entry/src/ohosTest/ets/test/List.test.ets create mode 100644 ohos/path_parsing_test/ohos/entry/src/ohosTest/ets/testability/TestAbility.ets create mode 100644 ohos/path_parsing_test/ohos/entry/src/ohosTest/ets/testability/pages/Index.ets create mode 100644 ohos/path_parsing_test/ohos/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts create mode 100644 ohos/path_parsing_test/ohos/entry/src/ohosTest/module.json5 create mode 100644 ohos/path_parsing_test/ohos/entry/src/ohosTest/resources/base/element/color.json create mode 100644 ohos/path_parsing_test/ohos/entry/src/ohosTest/resources/base/element/string.json create mode 100644 ohos/path_parsing_test/ohos/entry/src/ohosTest/resources/base/media/icon.png create mode 100644 ohos/path_parsing_test/ohos/entry/src/ohosTest/resources/base/profile/test_pages.json create mode 100644 ohos/path_parsing_test/ohos/hvigor/hvigor-config.json5 create mode 100644 ohos/path_parsing_test/ohos/hvigorfile.ts create mode 100644 ohos/path_parsing_test/ohos/oh-package.json5 create mode 100644 ohos/path_parsing_test/pubspec.yaml create mode 100644 ohos/path_parsing_test/test/parse_path_deep_test.dart create mode 100644 ohos/path_parsing_test/test/parse_path_test.dart diff --git a/ohos/path_parsing_test/.gitignore b/ohos/path_parsing_test/.gitignore new file mode 100644 index 00000000..24476c5d --- /dev/null +++ b/ohos/path_parsing_test/.gitignore @@ -0,0 +1,44 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.packages +.pub-cache/ +.pub/ +/build/ + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/ohos/path_parsing_test/.metadata b/ohos/path_parsing_test/.metadata new file mode 100644 index 00000000..9c2b3968 --- /dev/null +++ b/ohos/path_parsing_test/.metadata @@ -0,0 +1,30 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled. + +version: + revision: b041196e1cf84a3a7fd4df3d7b0a1e46a5c00a9f + channel: master + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: b041196e1cf84a3a7fd4df3d7b0a1e46a5c00a9f + base_revision: b041196e1cf84a3a7fd4df3d7b0a1e46a5c00a9f + - platform: android + create_revision: b041196e1cf84a3a7fd4df3d7b0a1e46a5c00a9f + base_revision: b041196e1cf84a3a7fd4df3d7b0a1e46a5c00a9f + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/ohos/path_parsing_test/README.md b/ohos/path_parsing_test/README.md new file mode 100644 index 00000000..70ea68bb --- /dev/null +++ b/ohos/path_parsing_test/README.md @@ -0,0 +1,16 @@ +# lz_path_parsing_test + +A new Flutter project. + +## Getting Started + +This project is a starting point for a Flutter application. + +A few resources to get you started if this is your first Flutter project: + +- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) +- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) + +For help getting started with Flutter development, view the +[online documentation](https://docs.flutter.dev/), which offers tutorials, +samples, guidance on mobile development, and a full API reference. diff --git a/ohos/path_parsing_test/android/.gitignore b/ohos/path_parsing_test/android/.gitignore new file mode 100644 index 00000000..6f568019 --- /dev/null +++ b/ohos/path_parsing_test/android/.gitignore @@ -0,0 +1,13 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java + +# Remember to never publicly share your keystore. +# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app +key.properties +**/*.keystore +**/*.jks diff --git a/ohos/path_parsing_test/android/app/build.gradle b/ohos/path_parsing_test/android/app/build.gradle new file mode 100644 index 00000000..287e2ade --- /dev/null +++ b/ohos/path_parsing_test/android/app/build.gradle @@ -0,0 +1,59 @@ +def localProperties = new Properties() +def localPropertiesFile = rootProject.file('local.properties') +if (localPropertiesFile.exists()) { + localPropertiesFile.withReader('UTF-8') { reader -> + localProperties.load(reader) + } +} + +def flutterRoot = localProperties.getProperty('flutter.sdk') +if (flutterRoot == null) { + throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") +} + +def flutterVersionCode = localProperties.getProperty('flutter.versionCode') +if (flutterVersionCode == null) { + flutterVersionCode = '1' +} + +def flutterVersionName = localProperties.getProperty('flutter.versionName') +if (flutterVersionName == null) { + flutterVersionName = '1.0' +} + +apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' +apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" + +android { + compileSdkVersion flutter.compileSdkVersion + ndkVersion flutter.ndkVersion + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId "com.example.lz_path_parsing_test" + // You can update the following values to match your application needs. + // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. + minSdkVersion flutter.minSdkVersion + targetSdkVersion flutter.targetSdkVersion + versionCode flutterVersionCode.toInteger() + versionName flutterVersionName + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig signingConfigs.debug + } + } +} + +flutter { + source '../..' +} diff --git a/ohos/path_parsing_test/android/app/src/debug/AndroidManifest.xml b/ohos/path_parsing_test/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 00000000..d3e835ba --- /dev/null +++ b/ohos/path_parsing_test/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,8 @@ + + + + diff --git a/ohos/path_parsing_test/android/app/src/main/AndroidManifest.xml b/ohos/path_parsing_test/android/app/src/main/AndroidManifest.xml new file mode 100644 index 00000000..01e3c653 --- /dev/null +++ b/ohos/path_parsing_test/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + diff --git a/ohos/path_parsing_test/android/app/src/main/java/com/example/lz_path_parsing_test/MainActivity.java b/ohos/path_parsing_test/android/app/src/main/java/com/example/lz_path_parsing_test/MainActivity.java new file mode 100644 index 00000000..281b618e --- /dev/null +++ b/ohos/path_parsing_test/android/app/src/main/java/com/example/lz_path_parsing_test/MainActivity.java @@ -0,0 +1,6 @@ +package com.example.lz_path_parsing_test; + +import io.flutter.embedding.android.FlutterActivity; + +public class MainActivity extends FlutterActivity { +} diff --git a/ohos/path_parsing_test/android/app/src/main/res/drawable-v21/launch_background.xml b/ohos/path_parsing_test/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 00000000..f74085f3 --- /dev/null +++ b/ohos/path_parsing_test/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/ohos/path_parsing_test/android/app/src/main/res/drawable/launch_background.xml b/ohos/path_parsing_test/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 00000000..304732f8 --- /dev/null +++ b/ohos/path_parsing_test/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/ohos/path_parsing_test/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/ohos/path_parsing_test/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..db77bb4b7b0906d62b1847e87f15cdcacf6a4f29 GIT binary patch literal 544 zcmeAS@N?(olHy`uVBq!ia0vp^9w5xY3?!3`olAj~WQl7;NpOBzNqJ&XDuZK6ep0G} zXKrG8YEWuoN@d~6R2!h8bpbvhu0Wd6uZuB!w&u2PAxD2eNXD>P5D~Wn-+_Wa#27Xc zC?Zj|6r#X(-D3u$NCt}(Ms06KgJ4FxJVv{GM)!I~&n8Bnc94O7-Hd)cjDZswgC;Qs zO=b+9!WcT8F?0rF7!Uys2bs@gozCP?z~o%U|N3vA*22NaGQG zlg@K`O_XuxvZ&Ks^m&R!`&1=spLvfx7oGDKDwpwW`#iqdw@AL`7MR}m`rwr|mZgU`8P7SBkL78fFf!WnuYWm$5Z0 zNXhDbCv&49sM544K|?c)WrFfiZvCi9h0O)B3Pgg&ebxsLQ05GG~ AQ2+n{ literal 0 HcmV?d00001 diff --git a/ohos/path_parsing_test/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/ohos/path_parsing_test/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..17987b79bb8a35cc66c3c1fd44f5a5526c1b78be GIT binary patch literal 442 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA3?vioaBc-sk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5Xx&nMcT!A!W`0S9QKQy;}1Cl^CgaH=;G9cpY;r$Q>i*pfB zP2drbID<_#qf;rPZx^FqH)F_D#*k@@q03KywUtLX8Ua?`H+NMzkczFPK3lFz@i_kW%1NOn0|D2I9n9wzH8m|-tHjsw|9>@K=iMBhxvkv6m8Y-l zytQ?X=U+MF$@3 zt`~i=@j|6y)RWMK--}M|=T`o&^Ni>IoWKHEbBXz7?A@mgWoL>!*SXo`SZH-*HSdS+ yn*9;$7;m`l>wYBC5bq;=U}IMqLzqbYCidGC!)_gkIk_C@Uy!y&wkt5C($~2D>~)O*cj@FGjOCM)M>_ixfudOh)?xMu#Fs z#}Y=@YDTwOM)x{K_j*Q;dPdJ?Mz0n|pLRx{4n|)f>SXlmV)XB04CrSJn#dS5nK2lM zrZ9#~WelCp7&e13Y$jvaEXHskn$2V!!DN-nWS__6T*l;H&Fopn?A6HZ-6WRLFP=R` zqG+CE#d4|IbyAI+rJJ`&x9*T`+a=p|0O(+s{UBcyZdkhj=yS1>AirP+0R;mf2uMgM zC}@~JfByORAh4SyRgi&!(cja>F(l*O+nd+@4m$|6K6KDn_&uvCpV23&>G9HJp{xgg zoq1^2_p9@|WEo z*X_Uko@K)qYYv~>43eQGMdbiGbo>E~Q& zrYBH{QP^@Sti!`2)uG{irBBq@y*$B zi#&(U-*=fp74j)RyIw49+0MRPMRU)+a2r*PJ$L5roHt2$UjExCTZSbq%V!HeS7J$N zdG@vOZB4v_lF7Plrx+hxo7(fCV&}fHq)$ literal 0 HcmV?d00001 diff --git a/ohos/path_parsing_test/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/ohos/path_parsing_test/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..d5f1c8d34e7a88e3f88bea192c3a370d44689c3c GIT binary patch literal 1031 zcmeAS@N?(olHy`uVBq!ia0vp^6F``Q8Ax83A=Cw=BuiW)N`mv#O3D+9QW+dm@{>{( zJaZG%Q-e|yQz{EjrrIztFa`(sgt!6~Yi|1%a`XoT0ojZ}lNrNjb9xjc(B0U1_% zz5^97Xt*%oq$rQy4?0GKNfJ44uvxI)gC`h-NZ|&0-7(qS@?b!5r36oQ}zyZrNO3 zMO=Or+<~>+A&uN&E!^Sl+>xE!QC-|oJv`ApDhqC^EWD|@=#J`=d#Xzxs4ah}w&Jnc z$|q_opQ^2TrnVZ0o~wh<3t%W&flvYGe#$xqda2bR_R zvPYgMcHgjZ5nSA^lJr%;<&0do;O^tDDh~=pIxA#coaCY>&N%M2^tq^U%3DB@ynvKo}b?yu-bFc-u0JHzced$sg7S3zqI(2 z#Km{dPr7I=pQ5>FuK#)QwK?Y`E`B?nP+}U)I#c1+FM*1kNvWG|a(TpksZQ3B@sD~b zpQ2)*V*TdwjFOtHvV|;OsiDqHi=6%)o4b!)x$)%9pGTsE z-JL={-Ffv+T87W(Xpooq<`r*VzWQcgBN$$`u}f>-ZQI1BB8ykN*=e4rIsJx9>z}*o zo~|9I;xof literal 0 HcmV?d00001 diff --git a/ohos/path_parsing_test/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/ohos/path_parsing_test/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..4d6372eebdb28e45604e46eeda8dd24651419bc0 GIT binary patch literal 1443 zcmb`G{WsKk6vsdJTdFg%tJav9_E4vzrOaqkWF|A724Nly!y+?N9`YV6wZ}5(X(D_N(?!*n3`|_r0Hc?=PQw&*vnU?QTFY zB_MsH|!j$PP;I}?dppoE_gA(4uc!jV&0!l7_;&p2^pxNo>PEcNJv za5_RT$o2Mf!<+r?&EbHH6nMoTsDOa;mN(wv8RNsHpG)`^ymG-S5By8=l9iVXzN_eG%Xg2@Xeq76tTZ*dGh~Lo9vl;Zfs+W#BydUw zCkZ$o1LqWQO$FC9aKlLl*7x9^0q%0}$OMlp@Kk_jHXOjofdePND+j!A{q!8~Jn+s3 z?~~w@4?egS02}8NuulUA=L~QQfm;MzCGd)XhiftT;+zFO&JVyp2mBww?;QByS_1w! zrQlx%{^cMj0|Bo1FjwY@Q8?Hx0cIPF*@-ZRFpPc#bBw{5@tD(5%sClzIfl8WU~V#u zm5Q;_F!wa$BSpqhN>W@2De?TKWR*!ujY;Yylk_X5#~V!L*Gw~;$%4Q8~Mad z@`-kG?yb$a9cHIApZDVZ^U6Xkp<*4rU82O7%}0jjHlK{id@?-wpN*fCHXyXh(bLt* zPc}H-x0e4E&nQ>y%B-(EL=9}RyC%MyX=upHuFhAk&MLbsF0LP-q`XnH78@fT+pKPW zu72MW`|?8ht^tz$iC}ZwLp4tB;Q49K!QCF3@!iB1qOI=?w z7In!}F~ij(18UYUjnbmC!qKhPo%24?8U1x{7o(+?^Zu0Hx81|FuS?bJ0jgBhEMzf< zCgUq7r2OCB(`XkKcN-TL>u5y#dD6D!)5W?`O5)V^>jb)P)GBdy%t$uUMpf$SNV31$ zb||OojAbvMP?T@$h_ZiFLFVHDmbyMhJF|-_)HX3%m=CDI+ID$0^C>kzxprBW)hw(v zr!Gmda);ICoQyhV_oP5+C%?jcG8v+D@9f?Dk*!BxY}dazmrT@64UrP3hlslANK)bq z$67n83eh}OeW&SV@HG95P|bjfqJ7gw$e+`Hxo!4cx`jdK1bJ>YDSpGKLPZ^1cv$ek zIB?0S<#tX?SJCLWdMd{-ME?$hc7A$zBOdIJ)4!KcAwb=VMov)nK;9z>x~rfT1>dS+ zZ6#`2v@`jgbqq)P22H)Tx2CpmM^o1$B+xT6`(v%5xJ(?j#>Q$+rx_R|7TzDZe{J6q zG1*EcU%tE?!kO%^M;3aM6JN*LAKUVb^xz8-Pxo#jR5(-KBeLJvA@-gxNHx0M-ZJLl z;#JwQoh~9V?`UVo#}{6ka@II>++D@%KqGpMdlQ}?9E*wFcf5(#XQnP$Dk5~%iX^>f z%$y;?M0BLp{O3a(-4A?ewryHrrD%cx#Q^%KY1H zNre$ve+vceSLZcNY4U(RBX&)oZn*Py()h)XkE?PL$!bNb{N5FVI2Y%LKEm%yvpyTP z(1P?z~7YxD~Rf<(a@_y` literal 0 HcmV?d00001 diff --git a/ohos/path_parsing_test/android/app/src/main/res/values-night/styles.xml b/ohos/path_parsing_test/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 00000000..06952be7 --- /dev/null +++ b/ohos/path_parsing_test/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/ohos/path_parsing_test/android/app/src/main/res/values/styles.xml b/ohos/path_parsing_test/android/app/src/main/res/values/styles.xml new file mode 100644 index 00000000..cb1ef880 --- /dev/null +++ b/ohos/path_parsing_test/android/app/src/main/res/values/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/ohos/path_parsing_test/android/app/src/profile/AndroidManifest.xml b/ohos/path_parsing_test/android/app/src/profile/AndroidManifest.xml new file mode 100644 index 00000000..d3e835ba --- /dev/null +++ b/ohos/path_parsing_test/android/app/src/profile/AndroidManifest.xml @@ -0,0 +1,8 @@ + + + + diff --git a/ohos/path_parsing_test/android/build.gradle b/ohos/path_parsing_test/android/build.gradle new file mode 100644 index 00000000..713d7f6e --- /dev/null +++ b/ohos/path_parsing_test/android/build.gradle @@ -0,0 +1,31 @@ +buildscript { + ext.kotlin_version = '1.7.10' + repositories { + google() + mavenCentral() + } + + dependencies { + classpath 'com.android.tools.build:gradle:7.2.0' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +allprojects { + repositories { + google() + mavenCentral() + } +} + +rootProject.buildDir = '../build' +subprojects { + project.buildDir = "${rootProject.buildDir}/${project.name}" +} +subprojects { + project.evaluationDependsOn(':app') +} + +tasks.register("clean", Delete) { + delete rootProject.buildDir +} diff --git a/ohos/path_parsing_test/android/gradle.properties b/ohos/path_parsing_test/android/gradle.properties new file mode 100644 index 00000000..94adc3a3 --- /dev/null +++ b/ohos/path_parsing_test/android/gradle.properties @@ -0,0 +1,3 @@ +org.gradle.jvmargs=-Xmx1536M +android.useAndroidX=true +android.enableJetifier=true diff --git a/ohos/path_parsing_test/android/gradle/wrapper/gradle-wrapper.properties b/ohos/path_parsing_test/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..3c472b99 --- /dev/null +++ b/ohos/path_parsing_test/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip diff --git a/ohos/path_parsing_test/android/settings.gradle b/ohos/path_parsing_test/android/settings.gradle new file mode 100644 index 00000000..44e62bcf --- /dev/null +++ b/ohos/path_parsing_test/android/settings.gradle @@ -0,0 +1,11 @@ +include ':app' + +def localPropertiesFile = new File(rootProject.projectDir, "local.properties") +def properties = new Properties() + +assert localPropertiesFile.exists() +localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } + +def flutterSdkPath = properties.getProperty("flutter.sdk") +assert flutterSdkPath != null, "flutter.sdk not set in local.properties" +apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" diff --git a/ohos/path_parsing_test/lib/common/base_page.dart b/ohos/path_parsing_test/lib/common/base_page.dart new file mode 100644 index 00000000..85f777cb --- /dev/null +++ b/ohos/path_parsing_test/lib/common/base_page.dart @@ -0,0 +1,39 @@ +import 'package:flutter/material.dart'; +import '../common/test_route.dart'; + +import '../main.dart'; +import 'main_item_widget.dart'; + +/// 全局静态数据存储 +abstract class GlobalData { + static String appName = ''; +} + +/// app基本首页 +class BasePage extends StatefulWidget { + const BasePage({super.key, required this.data}); + + final List data; + + @override + State createState() => _BasePageState(); +} + +class _BasePageState extends State { + int get _itemCount => widget.data.length; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Center(child: Text(GlobalData.appName, textAlign: TextAlign.center)), + ), + body: ListView.builder(itemBuilder: _itemBuilder, itemCount: _itemCount)); + } + + Widget _itemBuilder(BuildContext context, int index) { + return MainItemWidget(widget.data[index], (MainItem item) { + Navigator.of(context).pushNamed(item.route!); + }); + } +} diff --git a/ohos/path_parsing_test/lib/common/item_widget.dart b/ohos/path_parsing_test/lib/common/item_widget.dart new file mode 100644 index 00000000..71e934ae --- /dev/null +++ b/ohos/path_parsing_test/lib/common/item_widget.dart @@ -0,0 +1,123 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import '../common/test_page.dart'; + +/// Item widget. +class ItemWidget extends StatefulWidget { + /// Item widget. + const ItemWidget( + {required this.item, + required this.index, + required this.getGroupRange, + required this.runGroup, + required this.onTap, + this.summary, + Key? key}) + : super(key: key); + + /// item summary. + final String? summary; + + /// item data. + final Item item; + + /// 当前下标 + final int index; + + /// 获取对应的组信息 + final GroupRange Function() getGroupRange; + + /// 获取对应的组信息 + final void Function(int start, int end) runGroup; + + /// Action when pressed (typically run). + final void Function(Item item) onTap; + + @override + ItemWidgetState createState() => ItemWidgetState(); +} + +class ItemWidgetState extends State { + @override + Widget build(BuildContext context) { + IconData? icon; + Color? color; + + switch (widget.item.state) { + case ItemState.none: + icon = Icons.arrow_forward_ios; + break; + case ItemState.running: + icon = Icons.more_horiz; + break; + case ItemState.success: + icon = Icons.check; + color = Colors.green; + break; + case ItemState.failure: + icon = Icons.close; + color = Colors.red; + break; + } + + final Widget listTile = ListTile( + leading: SizedBox( + child: IconButton( + icon: Icon(icon, color: color), + onPressed: null, + )), + title: Text(widget.item.name), + subtitle: widget.summary != null ? Text(widget.summary!) : null, + onTap: () { + widget.onTap(widget.item); + }); + + final data = widget.getGroupRange(); + + return Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (data.groupName.isNotEmpty && data.startIndex == widget.index) + GestureDetector( + onTap: () {}, + child: Container( + height: 35, + decoration: BoxDecoration(color: CupertinoColors.extraLightBackgroundGray), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Text( + '测试组: ${data.groupName}', + style: TextStyle(fontSize: 18), + overflow: TextOverflow.ellipsis, + )), + // FilledButton( + // onPressed: () => widget.runGroup(data.startIndex, data.startIndex), + // child: Text( + // '整组测试', + // style: TextStyle(fontSize: 16), + // )) + ], + ), + ), + ), + Container( + margin: data.groupName.isNotEmpty && data.startIndex == widget.index ? EdgeInsets.only(bottom: 10) : null, + decoration: BoxDecoration( + border: data.groupName.isNotEmpty && data.endIndex == widget.index + ? Border(bottom: BorderSide(color: Colors.grey)) + : null, + ), + child: Padding( + padding: data.groupName.isNotEmpty && data.startIndex <= widget.index && data.endIndex >= widget.index + ? EdgeInsets.only(left: 35) + : EdgeInsets.zero, + child: listTile, + ), + ) + ], + ); + } +} diff --git a/ohos/path_parsing_test/lib/common/main_item_widget.dart b/ohos/path_parsing_test/lib/common/main_item_widget.dart new file mode 100644 index 00000000..da42308c --- /dev/null +++ b/ohos/path_parsing_test/lib/common/main_item_widget.dart @@ -0,0 +1,36 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import '../common/test_route.dart'; + +/// Main item widget. +class MainItemWidget extends StatefulWidget { + /// Main item widget. + const MainItemWidget(this.item, this.onTap, {Key? key}) : super(key: key); + + /// item data. + final MainItem item; + + /// onTap action (typically run or open). + final void Function(MainItem item) onTap; + + @override + MainItemWidgetState createState() => MainItemWidgetState(); +} + +class MainItemWidgetState extends State { + @override + Widget build(BuildContext context) { + return Container( + margin: const EdgeInsets.only(bottom: 10), + child: ListTile( + tileColor: CupertinoColors.extraLightBackgroundGray, + title: Text(widget.item.title), + subtitle: Text(widget.item.description), + onTap: _onTap), + ); + } + + void _onTap() { + widget.onTap(widget.item); + } +} diff --git a/ohos/path_parsing_test/lib/common/test_model_app.dart b/ohos/path_parsing_test/lib/common/test_model_app.dart new file mode 100644 index 00000000..1ef52db8 --- /dev/null +++ b/ohos/path_parsing_test/lib/common/test_model_app.dart @@ -0,0 +1,37 @@ +import 'package:flutter/material.dart'; + +import 'base_page.dart'; +import 'test_route.dart'; + +/// 基础app框架 +class TestModelApp extends StatefulWidget { + TestModelApp({super.key, required this.appName, required this.data}) { + GlobalData.appName = appName; + } + + /// 测试包名称 + final String appName; + + /// 路由数据 + final TestRoute data; + + @override + State createState() => TestModelState(); +} + +class TestModelState extends State { + @override + Widget build(BuildContext context) { + return MaterialApp( + title: widget.appName, + theme: ThemeData( + colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue), + appBarTheme: const AppBarTheme(backgroundColor: Colors.blue), + primarySwatch: Colors.blue, + useMaterial3: true, + ), + routes: widget.data.routes, + initialRoute: '/', + ); + } +} diff --git a/ohos/path_parsing_test/lib/common/test_page.dart b/ohos/path_parsing_test/lib/common/test_page.dart new file mode 100644 index 00000000..d65fe14d --- /dev/null +++ b/ohos/path_parsing_test/lib/common/test_page.dart @@ -0,0 +1,301 @@ +import 'dart:async'; + +import 'package:flutter/material.dart'; + +import 'item_widget.dart'; + +List contentList = []; + +class Test { + /// Test definition. + Test(this.name, this.fn, {bool? solo, bool? skip}) + : solo = solo == true, + skip = skip == true; + + /// Only run this test. + final bool solo; + + /// Skip this test. + final bool skip; + + /// Test name. + String name; + + /// Test body. + FutureOr Function() fn; +} + +/// Item states. +enum ItemState { + /// test not run yet. + none, + + /// test is running. + running, + + /// test succeeded. + success, + + /// test fails. + failure +} + +/// Menu item. +class Item { + /// Menu item. + Item(this.name); + + /// Menu item state. + ItemState state = ItemState.running; + + /// Menu item name/ + String name; +} + +class TestLength { + TestLength(this.oldLength, this.newLength); + + int oldLength; + int newLength; +} + +class GroupRange { + GroupRange(this.groupName, this.startIndex, this.endIndex); + + String groupName; + int startIndex; + int endIndex; +} + +/// 基础测试页面 +class TestPage extends StatefulWidget { + /// Base test page. + TestPage(this.title, {Key? key}) : super(key: key); + + /// The title. + final String title; + + /// Test list. + final List tests = []; + + /// 保存group的范围信息 + final Map groupTitle = {}; + + /// define a test. + void test(String name, FutureOr Function() fn) { + tests.add(Test(name, fn)); + } + + /// define a group test. + void group(String name, FutureOr Function() fn) { + int oldLength = tests.length; + fn(); + + int newLength = tests.length - 1; + groupTitle.addAll({name: TestLength(oldLength, newLength)}); + } + + /// Thrown an exception + void fail([String? message]) { + throw Exception(message ?? 'should fail'); + } + + @override + TestPageState createState() => TestPageState(); +} + +/// Group. +mixin Group { + /// List of tests. + List get tests { + // TODO: implement tests + throw UnimplementedError(); + } + + bool? _hasSolo; + final _tests = []; + + /// Add a test. + void add(Test test) { + if (!test.skip) { + if (test.solo) { + if (_hasSolo != true) { + _hasSolo = true; + _tests.clear(); + } + _tests.add(test); + } else if (_hasSolo != true) { + _tests.add(test); + } + } + } + + /// true if it has solo or contains item with solo feature + bool? get hasSolo => _hasSolo; +} + +class TestPageState extends State with Group { + List items = []; + + Future _run() async { + if (!mounted) { + return null; + } + + setState(() { + items.clear(); + }); + _tests.clear(); + for (var test in widget.tests) { + add(test); + } + for (var test in _tests) { + var item = Item(test.name); + contentList.add(Text(test.name, style: const TextStyle(fontSize: 18, color: Colors.green))); + + late int position; + setState(() { + position = items.length; + items.add(item); + }); + try { + await test.fn(); + item = Item(test.name)..state = ItemState.success; + print('ohFlutter: ${test.name}, result: success'); + } catch (e, st) { + contentList.add(Text('$e, $st', style: const TextStyle(fontSize: 18, color: Colors.red))); + print('ohFlutter: ${test.name}-error: $e, $st}'); + item = Item(test.name)..state = ItemState.failure; + } + + if (!mounted) { + return null; + } + + setState(() { + items[position] = item; + }); + } + } + + Future _runTest(int index) async { + if (!mounted) { + return null; + } + + final test = _tests[index]; + + var item = items[index]; + setState(() { + contentList = []; + item.state = ItemState.running; + }); + contentList.add(Text(test.name, style: const TextStyle(fontSize: 18, color: Colors.green))); + try { + await test.fn(); + + item = Item(test.name)..state = ItemState.success; + print('ohFlutter: ${test.name}, result: success'); + } catch (e, st) { + contentList.add(Text('$e, $st', style: const TextStyle(fontSize: 18, color: Colors.red))); + print('ohFlutter: ${test.name}-error: $e, $st}'); + try { + print(st); + } catch (_) {} + item = Item(test.name)..state = ItemState.failure; + } + + if (!mounted) { + return null; + } + + setState(() { + items[index] = item; + }); + } + + @override + void initState() { + super.initState(); + contentList = []; + _run(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(title: Text(widget.title)), + body: ListView(children: [ + ...items.asMap().keys.map((e) => _itemBuilder(context, e)).toList(), + ])); + } + + Widget _itemBuilder(BuildContext context, int index) { + final item = getItem(index); + return ItemWidget( + item: item, + index: index, + getGroupRange: () { + GroupRange data = GroupRange('', 0, 0); + widget.groupTitle.forEach((key, value) { + if (value.oldLength <= index && value.newLength >= index) { + data = GroupRange(key, value.oldLength, value.newLength); + } + }); + return data; + }, + runGroup: (start, end) async { + for (var i = start; i <= end; i++) { + await _runTest(i); + print('\n'); + } + }, + onTap: (Item item) { + _runTest(index); + showAlertDialog(context); + }); + } + + Item getItem(int index) { + return items[index]; + } + + @override + List get tests => widget.tests; +} + +void expect(var testModel, var object) { + try { + testModel; + contentList.add(Text(testModel.toString())); + } catch (e) { + contentList.add(Text( + '$e', + style: const TextStyle(color: Colors.red), + )); + print(e.toString()); + } +} + +void showAlertDialog(BuildContext context) { + showDialog( + context: context, + barrierDismissible: false, + builder: (BuildContext context) { + return AlertDialog( + content: SingleChildScrollView( + child: Column( + children: contentList, + ), + ), + actions: [ + MaterialButton( + child: const Text('确定'), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ], + ); + }); +} diff --git a/ohos/path_parsing_test/lib/common/test_route.dart b/ohos/path_parsing_test/lib/common/test_route.dart new file mode 100644 index 00000000..d7fbae55 --- /dev/null +++ b/ohos/path_parsing_test/lib/common/test_route.dart @@ -0,0 +1,34 @@ +import 'package:flutter/cupertino.dart'; + +import 'base_page.dart'; + +class MainItem { + /// Main item. + MainItem(this.title, this.description, {this.route}); + + /// Title. + String title; + + /// Description. + String description; + + /// Page route. + String? route; +} + +class TestRoute { + TestRoute({required Map routes, required this.items}) { + if (routes.containsKey('/')) { + throw Exception('不允许传入 / 路由'); + } + + this.routes.addAll({ + '/': (BuildContext context) => BasePage(data: items), + }); + this.routes.addAll(routes); + } + + Map routes = {}; + + List items = []; +} diff --git a/ohos/path_parsing_test/lib/main.dart b/ohos/path_parsing_test/lib/main.dart new file mode 100644 index 00000000..9a405050 --- /dev/null +++ b/ohos/path_parsing_test/lib/main.dart @@ -0,0 +1,62 @@ +import 'package:flutter/cupertino.dart'; + +import 'common/test_model_app.dart'; +import 'common/test_route.dart'; +import 'pages/example.dart'; +import 'pages/function_list.dart'; +import 'pages/parse_path_deep_test.dart'; +import 'pages/parse_path_test.dart'; +import 'pages/s_PathProxy_test.dart'; +import 'pages/s_PathSegmentData_test.dart'; +import 'pages/s_SvgPathNormalizer_test.dart'; +import 'pages/s_SvgPathStringSource_test.dart'; + +void main() { + final items = [ + MainItem('functions', "", route: "FunctionList"), + // MainItem('excample_test', "", route: "PathParsingPage"), + MainItem('s_PathProxy_test', "", route: "SPathProxyTestPage"), + MainItem('s_PathSegmentData_test', "", route: "SPathSegmentDataTestPage"), + MainItem('s_SvgPathNormalizer_test', "", route: "SSvgPathNormalizerTestPage"), + MainItem('s_SvgPathStringSource_test', "", route: "SSvgPathStringSourceTestPage"), + + //SSvgPathStringSourceTestPage + MainItem('parse_path_deep_test', "", route: "ParsePathDeepTestPage"), + MainItem('parse_path_test', "", route: "ParsePathTestPage"), + ]; + + runApp(TestModelApp( + appName: 'parse_path', + data: TestRoute( + items: items, + routes: { + "FunctionList": (context) { + return FunctionList(); + }, + // "PathParsingPage": (context) { + // return PathParsingPage(); + // }, + "SPathProxyTestPage": (context) { + return SPathProxyTestPage('SPathProxyTestPage'); + }, + "SPathSegmentDataTestPage": (context) { + return SPathSegmentDataTestPage('SPathSegmentDataTestPage'); + }, + "SSvgPathNormalizerTestPage": (context) { + return SSvgPathNormalizerTestPage('SSvgPathNormalizerTestPage'); + }, + "SSvgPathStringSourceTestPage": (context) { + return SSvgPathStringSourceTestPage('SSvgPathStringSourceTestPage'); + }, + + //SSvgPathStringSourceTestPage + "ParsePathDeepTestPage": (context) { + return ParsePathDeepTestPage("ParsePathDeepTestPage"); + }, + "ParsePathTestPage": (context) { + return ParsePathTestPage("ParsePathTestPage"); + }, + }, + //PathParsingExamp + ))); //BuilderTestPage +} diff --git a/ohos/path_parsing_test/lib/pages/example.dart b/ohos/path_parsing_test/lib/pages/example.dart new file mode 100644 index 00000000..9f672842 --- /dev/null +++ b/ohos/path_parsing_test/lib/pages/example.dart @@ -0,0 +1,178 @@ +import 'package:flutter/material.dart'; +import 'package:path_parsing/path_parsing.dart'; + +class PathParsingPage extends StatelessWidget { + const PathParsingPage({super.key}); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text('Path Parsing Example'), + ), + body: Center( + child: CustomPaint( + size: const Size(40, 40), + painter: TopDecoration(context), + ), + ), + ); + } +} + +class PathPrinter extends PathProxy { + Path path = Path(); + @override + void close() { + path.close(); + } + + @override + void moveTo(double x, double y) { + path.moveTo(x, y); + } + + @override + void cubicTo(double x1, double y1, double x2, double y2, double x3, double y3) { + path.cubicTo(x1, y1, x2, y2, x3, y3); + } + + @override + void lineTo(double x, double y) { + path.lineTo(x, y); + } +} + +class TopDecoration extends CustomPainter { + final BuildContext context; + TopDecoration(this.context); + + void showAlertDialog(BuildContext context, String text) { + showDialog( + context: context, + barrierDismissible: false, + builder: (BuildContext context) { + return AlertDialog( + content: SingleChildScrollView( + child: Column( + children: [ + Text( + text, + maxLines: 100, + overflow: TextOverflow.ellipsis, + ) + ], + ), + ), + actions: [ + MaterialButton( + child: const Text('确定'), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ], + ); + }); + } + + @override + void paint(Canvas canvas, Size size) { + final paint = Paint() + ..color = Colors.blue + ..style = PaintingStyle.stroke + ..strokeWidth = 2.0; + PathPrinter path = PathPrinter(); + + const String pathData = 'M22.1595 3.80852C19.6789 1.35254 16.3807 -4.80966e-07 12.8727 ' + '-4.80966e-07C9.36452 -4.80966e-07 6.06642 1.35254 3.58579 ' + '3.80852C1.77297 5.60333 0.53896 7.8599 0.0171889 10.3343C-0.0738999 ' + '10.7666 0.206109 11.1901 0.64265 11.2803C1.07908 11.3706 1.50711 11.0934 ' + '1.5982 10.661C2.05552 8.49195 3.13775 6.51338 4.72783 4.9391C9.21893 ' + '0.492838 16.5262 0.492728 21.0173 4.9391C25.5082 9.38548 25.5082 16.6202 ' + '21.0173 21.0667C16.5265 25.5132 9.21893 25.5133 4.72805 21.0669C3.17644 ' + '19.5307 2.10538 17.6035 1.63081 15.4937C1.53386 15.0627 1.10252 14.7908 ' + '0.66697 14.887C0.231645 14.983 -0.0427272 15.4103 0.0542205 ' + '15.8413C0.595668 18.2481 1.81686 20.4461 3.5859 22.1976C6.14623 ' + '24.7325 9.50955 26 12.8727 26C16.236 26 19.5991 24.7326 22.1595 ' + '22.1976C27.2802 17.1277 27.2802 8.87841 22.1595 3.80852Z'; + + // const String pathData = 'M50 0 Q70 20, 50 40, Q30 20, 50 0 M50 0 Q70 -20, 50 -40, Q30 -20, 50 0 M50 40 V100'; + // const String pathData = 'M7.6,7C0.4'; + try { + writeSvgPathDataToPath(pathData, path); + canvas.drawPath(path.path, paint); + } catch (e) { + print('路径错误:${e.toString()}'); + // CustomDialog(title: '发生错误', message: e.toString()); + } + } + + @override + bool shouldRepaint(CustomPainter oldDelegate) { + // TODO: implement shouldRepaint + return false; + } +} + +class CustomDialog extends StatelessWidget { + final String title; + final String message; + + CustomDialog({required this.title, required this.message}); + + @override + Widget build(BuildContext context) { + return Dialog( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(16), + ), + elevation: 0, + backgroundColor: Colors.transparent, + child: _buildDialogContent(context), + ); + } + + Widget _buildDialogContent(BuildContext context) { + return Container( + padding: EdgeInsets.all(16), + decoration: BoxDecoration( + color: Colors.white, + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(16), + boxShadow: [ + BoxShadow( + color: Colors.black26, + blurRadius: 10.0, + offset: const Offset(0.0, 10.0), + ), + ], + ), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Text( + title, + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold, + ), + ), + SizedBox(height: 16), + Text( + message, + style: TextStyle(fontSize: 16), + textAlign: TextAlign.center, + ), + SizedBox(height: 24), + ElevatedButton( + onPressed: () { + Navigator.of(context).pop(); + }, + child: Text('关闭'), + ), + ], + ), + ); + } +} diff --git a/ohos/path_parsing_test/lib/pages/function_list.dart b/ohos/path_parsing_test/lib/pages/function_list.dart new file mode 100644 index 00000000..c284fa94 --- /dev/null +++ b/ohos/path_parsing_test/lib/pages/function_list.dart @@ -0,0 +1,36 @@ +import 'package:flutter/material.dart'; + +import 'example.dart'; + +class FunctionList extends StatelessWidget { + final functionList = ["解析和处理SVG路径数据"]; + final pages = [ + PathParsingPage(), + ]; + + FunctionList({super.key}); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('path_parsing功能演示'), + ), + body: ListView.builder( + itemCount: functionList.length, + itemBuilder: (context, index) { + return GestureDetector( + onTap: () { + Navigator.push(context, MaterialPageRoute(builder: (_) { + return pages[index]; + })); + }, + child: ListTile( + title: Text(functionList[index]), + ), + ); + }, + ), + ); + } +} diff --git a/ohos/path_parsing_test/lib/pages/parse_path_deep_test.dart b/ohos/path_parsing_test/lib/pages/parse_path_deep_test.dart new file mode 100644 index 00000000..85df6c47 --- /dev/null +++ b/ohos/path_parsing_test/lib/pages/parse_path_deep_test.dart @@ -0,0 +1,90 @@ +import 'package:flutter/cupertino.dart'; +import 'package:path_parsing/path_parsing.dart'; + +import '../common/test_page.dart'; + +class DeepTestPathProxy extends PathProxy { + DeepTestPathProxy(this.expectedCommands); + + final List expectedCommands; + final List actualCommands = []; + + @override + void close() { + actualCommands.add('close()'); + } + + @override + void cubicTo( + double x1, + double y1, + double x2, + double y2, + double x3, + double y3, + ) { + actualCommands.add( + 'cubicTo(${x1.toStringAsFixed(4)}, ${y1.toStringAsFixed(4)}, ${x2.toStringAsFixed(4)}, ${y2.toStringAsFixed(4)}, ${x3.toStringAsFixed(4)}, ${y3.toStringAsFixed(4)})'); + } + + @override + void lineTo(double x, double y) { + actualCommands.add('lineTo(${x.toStringAsFixed(4)}, ${y.toStringAsFixed(4)})'); + } + + @override + void moveTo(double x, double y) { + actualCommands.add('moveTo(${x.toStringAsFixed(4)}, ${y.toStringAsFixed(4)})'); + } + + void validate() { + expect(areArraysEqual(expectedCommands, actualCommands), null); + expect(expectedCommands, null); + expect("---------------------", null); + expect(actualCommands, null); + } + + bool areArraysEqual(List array1, List array2) { + if (array1.length != array2.length) { + return false; + } + array1.sort(); + array2.sort(); + + for (int i = 0; i < array1.length; i++) { + if (array1[i] != array2[i]) { + return false; + } + } + return true; + } +} + +class ParsePathDeepTestPage extends TestPage { + ParsePathDeepTestPage(String title, {Key? key}) : super(title, key: key) { + void assertValidPath(String input, List commands) { + final DeepTestPathProxy proxy = DeepTestPathProxy(commands); + writeSvgPathDataToPath(input, proxy); + proxy.validate(); + } + + test('Deep path validation', () { + assertValidPath('M20,30 Q40,5 60,30 T100,30', [ + 'moveTo(20.0000, 30.0000)', + 'cubicTo(33.3333, 13.3333, 46.6667, 13.3333, 60.0000, 30.0000)', + 'cubicTo(73.3333, 46.6667, 86.6667, 46.6667, 100.0000, 30.0000)' + ]); + + assertValidPath('M5.5 5.5a.5 1.5 30 1 1-.866-.5.5 1.5 30 1 1 .866.5z', [ + 'moveTo(5.5000, 5.5000)', + 'cubicTo(5.2319, 5.9667, 4.9001, 6.3513, 4.6307, 6.5077)', + 'cubicTo(4.3612, 6.6640, 4.1953, 6.5683, 4.1960, 6.2567)', + 'cubicTo(4.1967, 5.9451, 4.3638, 5.4655, 4.6340, 5.0000)', + 'cubicTo(4.9021, 4.5333, 5.2339, 4.1487, 5.5033, 3.9923)', + 'cubicTo(5.7728, 3.8360, 5.9387, 3.9317, 5.9380, 4.2433)', + 'cubicTo(5.9373, 4.5549, 5.7702, 5.0345, 5.5000, 5.5000)', + 'close()' + ]); + }); + } +} diff --git a/ohos/path_parsing_test/lib/pages/parse_path_test.dart b/ohos/path_parsing_test/lib/pages/parse_path_test.dart new file mode 100644 index 00000000..bdeefe9a --- /dev/null +++ b/ohos/path_parsing_test/lib/pages/parse_path_test.dart @@ -0,0 +1,248 @@ +// Test paths taken from: +// * https://github.com/chromium/chromium/blob/master/third_party/blink/renderer/core/svg/svg_path_parser_test.cc + +import 'package:flutter/cupertino.dart'; +import 'package:path_parsing/path_parsing.dart'; +import 'package:path_parsing/src/path_segment_type.dart'; + +import '../common/test_page.dart'; + +// TODO(dnfield): a bunch of better tests could be written to track that commands are actually called with expected values/order +// For now we just want to know that something gets emitted and no exceptions are thrown (that's all the legacy tests really did anyway). +class TestPathProxy extends PathProxy { + bool called = false; + @override + void close() { + called = true; + } + + @override + void cubicTo( + double x1, + double y1, + double x2, + double y2, + double x3, + double y3, + ) { + called = true; + } + + @override + void lineTo(double x, double y) { + called = true; + } + + @override + void moveTo(double x, double y) { + called = true; + } +} + +class ParsePathTestPage extends TestPage { + ParsePathTestPage(String title, {Key? key}) : super(title, key: key) { + void assertValidPath(String input) { + final TestPathProxy proxy = TestPathProxy(); + // these shouldn't throw or assert + writeSvgPathDataToPath(input, proxy); + expect(proxy.called, true); + } + + void assertInvalidPath(String input) { + final TestPathProxy proxy = TestPathProxy(); + writeSvgPathDataToPath(input, proxy); + expect(proxy.called, true); + } + + test('Valid Paths', () { + assertValidPath('M1,2'); + assertValidPath('m1,2'); + assertValidPath('M100,200 m3,4'); + assertValidPath('M100,200 L3,4'); + assertValidPath('M100,200 l3,4'); + assertValidPath('M100,200 H3'); + assertValidPath('M100,200 h3'); + assertValidPath('M100,200 V3'); + assertValidPath('M100,200 v3'); + assertValidPath('M100,200 Z'); + assertValidPath('M100,200 z'); + assertValidPath('M100,200 C3,4,5,6,7,8'); + assertValidPath('M100,200 c3,4,5,6,7,8'); + assertValidPath('M100,200 S3,4,5,6'); + assertValidPath('M100,200 s3,4,5,6'); + assertValidPath('M100,200 Q3,4,5,6'); + assertValidPath('M100,200 q3,4,5,6'); + assertValidPath('M100,200 T3,4'); + assertValidPath('M100,200 t3,4'); + assertValidPath('M100,200 A3,4,5,0,0,6,7'); + assertValidPath('M100,200 A3,4,5,1,0,6,7'); + assertValidPath('M100,200 A3,4,5,0,1,6,7'); + assertValidPath('M100,200 A3,4,5,1,1,6,7'); + assertValidPath('M100,200 a3,4,5,0,0,6,7'); + assertValidPath('M100,200 a3,4,5,0,1,6,7'); + assertValidPath('M100,200 a3,4,5,1,0,6,7'); + assertValidPath('M100,200 a3,4,5,1,1,6,7'); + assertValidPath('M100,200 a3,4,5,006,7'); + assertValidPath('M100,200 a3,4,5,016,7'); + assertValidPath('M100,200 a3,4,5,106,7'); + assertValidPath('M100,200 a3,4,5,116,7'); + assertValidPath( + '''M19.0281,19.40466 20.7195,19.40466 20.7195,15.71439 24.11486,15.71439 24.11486,14.36762 20.7195,14.36762 +20.7195,11.68641 24.74134,11.68641 24.74134,10.34618 19.0281,10.34618 z'''); + + assertValidPath('M100,200 a0,4,5,0,0,10,0 a4,0,5,0,0,0,10 a0,0,5,0,0,-10,0 z'); + + assertValidPath('M1,2,3,4'); + assertValidPath('m100,200,3,4'); + + assertValidPath('M 100-200'); + assertValidPath('M 0.6.5'); + + assertValidPath(' M1,2'); + assertValidPath(' M1,2'); + assertValidPath('\tM1,2'); + assertValidPath('\nM1,2'); + assertValidPath('\rM1,2'); + assertValidPath('M1,2 '); + assertValidPath('M1,2\t'); + assertValidPath('M1,2\n'); + assertValidPath('M1,2\r'); + assertValidPath('M.1 .2 L.3 .4 .5 .6'); + assertValidPath('M1,1h2,3'); + assertValidPath('M1,1H2,3'); + assertValidPath('M1,1v2,3'); + assertValidPath('M1,1V2,3'); + assertValidPath('M1,1c2,3 4,5 6,7 8,9 10,11 12,13'); + assertValidPath('M1,1C2,3 4,5 6,7 8,9 10,11 12,13'); + assertValidPath('M1,1s2,3 4,5 6,7 8,9'); + assertValidPath('M1,1S2,3 4,5 6,7 8,9'); + assertValidPath('M1,1q2,3 4,5 6,7 8,9'); + assertValidPath('M1,1Q2,3 4,5 6,7 8,9'); + assertValidPath('M1,1t2,3 4,5'); + assertValidPath('M1,1T2,3 4,5'); + assertValidPath('M1,1a2,3,4,0,0,5,6 7,8,9,0,0,10,11'); + assertValidPath('M1,1A2,3,4,0,0,5,6 7,8,9,0,0,10,11'); + assertValidPath('M22.1595 3.80852C19.6789 1.35254 16.3807 -4.80966e-07 12.8727 ' + '-4.80966e-07C9.36452 -4.80966e-07 6.06642 1.35254 3.58579 3.80852C1.77297 5.60333 ' + '0.53896 7.8599 0.0171889 10.3343C-0.0738999 10.7666 0.206109 11.1901 0.64265 11.2803' + 'C1.07908 11.3706 1.50711 11.0934 1.5982 10.661C2.05552 8.49195 3.13775 6.51338 4.72783 ' + '4.9391C9.21893 0.492838 16.5262 0.492728 21.0173 4.9391C25.5082 9.38548 25.5082 16.6202 ' + '21.0173 21.0667C16.5265 25.5132 9.21893 25.5133 4.72805 21.0669C3.17644 19.5307 2.10538 ' + '17.6035 1.63081 15.4937C1.53386 15.0627 1.10252 14.7908 0.66697 14.887C0.231645 14.983 ' + '-0.0427272 15.4103 0.0542205 15.8413C0.595668 18.2481 1.81686 20.4461 3.5859 22.1976' + 'C6.14623 24.7325 9.50955 26 12.8727 26C16.236 26 19.5991 24.7326 22.1595 22.1976C27.2802 ' + '17.1277 27.2802 8.87841 22.1595 3.80852Z'); + assertValidPath('m18 11.8a.41.41 0 0 1 .24.08l.59.43h.05.72a.4.4 0 0 1 .39.28l.22.69a.08.08 0 ' + '0 0 0 0l.58.43a.41.41 0 0 1 .15.45l-.22.68a.09.09 0 0 0 0 .07l.22.68a.4.4 0 0 1 ' + '-.15.46l-.58.42a.1.1 0 0 0 0 0l-.22.68a.41.41 0 0 1 -.38.29h-.79l-.58.43a.41.41 0 ' + '0 1 -.24.08.46.46 0 0 1 -.24-.08l-.58-.43h-.06-.72a.41.41 0 0 1 -.39-.28l-.22-.68' + 'a.1.1 0 0 0 0 0l-.58-.43a.42.42 0 0 1 -.15-.46l.23-.67v-.02l-.29-.68a.43.43 0 0 1 ' + '.15-.46l.58-.42a.1.1 0 0 0 0-.05l.27-.69a.42.42 0 0 1 .39-.28h.78l.58-.43a.43.43 0 ' + '0 1 .25-.09m0-1a1.37 1.37 0 0 0 -.83.27l-.34.25h-.43a1.42 1.42 0 0 0 -1.34 1l-.13.4' + '-.35.25a1.42 1.42 0 0 0 -.51 1.58l.13.4-.13.4a1.39 1.39 0 0 0 .52 1.59l.34.25.13.4' + 'a1.41 1.41 0 0 0 1.34 1h.43l.34.26a1.44 1.44 0 0 0 .83.27 1.38 1.38 0 0 0 .83-.28' + 'l.35-.24h.43a1.4 1.4 0 0 0 1.33-1l.13-.4.35-.26a1.39 1.39 0 0 0 .51-1.57l-.13-.4.13-.41' + 'a1.4 1.4 0 0 0 -.51-1.56l-.35-.25-.13-.41a1.4 1.4 0 0 0 -1.34-1h-.42l-.34-.26a1.43 1.43 ' + '0 0 0 -.84-.28z'); + }); + + test('Malformed Paths, 此处应该为X', () { + assertInvalidPath('M100,200 a3,4,5,2,1,6,7'); + assertInvalidPath('M100,200 a3,4,5,1,2,6,7'); + + assertInvalidPath('\vM1,2'); + assertInvalidPath('xM1,2'); + assertInvalidPath('M1,2\v'); + assertInvalidPath('M1,2x'); + assertInvalidPath('M1,2 L40,0#90'); + + assertInvalidPath('x'); + assertInvalidPath('L1,2'); + + assertInvalidPath('M'); + assertInvalidPath('M\0'); + + assertInvalidPath('M1,1Z0'); + assertInvalidPath('M1,1z0'); + + assertInvalidPath('M1,1c2,3 4,5 6,7 8'); + assertInvalidPath('M1,1C2,3 4,5 6,7 8'); + assertInvalidPath('M1,1s2,3 4,5 6'); + assertInvalidPath('M1,1S2,3 4,5 6'); + assertInvalidPath('M1,1q2,3 4,5 6'); + assertInvalidPath('M1,1Q2,3 4,5 6'); + assertInvalidPath('M1,1t2,3 4'); + assertInvalidPath('M1,1T2,3 4'); + assertInvalidPath('M1,1a2,3,4,0,0,5,6 7'); + assertInvalidPath('M1,1A2,3,4,0,0,5,6 7'); + }); + + test('Missing commands/numbers/flags, 此处应该为X', () { + // Missing initial moveto. + assertInvalidPath(' 10 10'); + assertInvalidPath('L 10 10'); + // Invalid command letter. + assertInvalidPath('M 10 10 #'); + assertInvalidPath('M 10 10 E 100 100'); + // Invalid number. + assertInvalidPath('M 10 10 L100 '); + assertInvalidPath('M 10 10 L100 #'); + assertInvalidPath('M 10 10 L100#100'); + assertInvalidPath('M0,0 A#,10 0 0,0 20,20'); + assertInvalidPath('M0,0 A10,# 0 0,0 20,20'); + assertInvalidPath('M0,0 A10,10 # 0,0 20,20'); + assertInvalidPath('M0,0 A10,10 0 0,0 #,20'); + assertInvalidPath('M0,0 A10,10 0 0,0 20,#'); + // Invalid arc-flag. + assertInvalidPath('M0,0 A10,10 0 #,0 20,20'); + assertInvalidPath('M0,0 A10,10 0 0,# 20,20'); + assertInvalidPath('M0,0 A10,10 0 0,2 20,20'); + }); + + test('Check character constants', () { + expect(AsciiConstants.slashT, '\t'.codeUnitAt(0)); + expect(AsciiConstants.slashN, '\n'.codeUnitAt(0)); + expect(AsciiConstants.slashF, '\f'.codeUnitAt(0)); + expect(AsciiConstants.slashR, '\r'.codeUnitAt(0)); + expect(AsciiConstants.space, ' '.codeUnitAt(0)); + expect(AsciiConstants.period, '.'.codeUnitAt(0)); + expect(AsciiConstants.plus, '+'.codeUnitAt(0)); + expect(AsciiConstants.comma, ','.codeUnitAt(0)); + expect(AsciiConstants.minus, '-'.codeUnitAt(0)); + expect(AsciiConstants.number0, '0'.codeUnitAt(0)); + expect(AsciiConstants.number1, '1'.codeUnitAt(0)); + expect(AsciiConstants.number2, '2'.codeUnitAt(0)); + expect(AsciiConstants.number3, '3'.codeUnitAt(0)); + expect(AsciiConstants.number4, '4'.codeUnitAt(0)); + expect(AsciiConstants.number5, '5'.codeUnitAt(0)); + expect(AsciiConstants.number6, '6'.codeUnitAt(0)); + expect(AsciiConstants.number7, '7'.codeUnitAt(0)); + expect(AsciiConstants.number8, '8'.codeUnitAt(0)); + expect(AsciiConstants.number9, '9'.codeUnitAt(0)); + expect(AsciiConstants.upperA, 'A'.codeUnitAt(0)); + expect(AsciiConstants.upperC, 'C'.codeUnitAt(0)); + expect(AsciiConstants.upperE, 'E'.codeUnitAt(0)); + expect(AsciiConstants.upperH, 'H'.codeUnitAt(0)); + expect(AsciiConstants.upperL, 'L'.codeUnitAt(0)); + expect(AsciiConstants.upperM, 'M'.codeUnitAt(0)); + expect(AsciiConstants.upperQ, 'Q'.codeUnitAt(0)); + expect(AsciiConstants.upperS, 'S'.codeUnitAt(0)); + expect(AsciiConstants.upperT, 'T'.codeUnitAt(0)); + expect(AsciiConstants.upperV, 'V'.codeUnitAt(0)); + expect(AsciiConstants.upperZ, 'Z'.codeUnitAt(0)); + expect(AsciiConstants.lowerA, 'a'.codeUnitAt(0)); + expect(AsciiConstants.lowerC, 'c'.codeUnitAt(0)); + expect(AsciiConstants.lowerE, 'e'.codeUnitAt(0)); + expect(AsciiConstants.lowerH, 'h'.codeUnitAt(0)); + expect(AsciiConstants.lowerL, 'l'.codeUnitAt(0)); + expect(AsciiConstants.lowerM, 'm'.codeUnitAt(0)); + expect(AsciiConstants.lowerQ, 'q'.codeUnitAt(0)); + expect(AsciiConstants.lowerS, 's'.codeUnitAt(0)); + expect(AsciiConstants.lowerT, 't'.codeUnitAt(0)); + expect(AsciiConstants.lowerV, 'v'.codeUnitAt(0)); + expect(AsciiConstants.lowerX, 'x'.codeUnitAt(0)); + expect(AsciiConstants.lowerZ, 'z'.codeUnitAt(0)); + expect(AsciiConstants.tilde, '~'.codeUnitAt(0)); + }); + } +} diff --git a/ohos/path_parsing_test/lib/pages/s_PathProxy_test.dart b/ohos/path_parsing_test/lib/pages/s_PathProxy_test.dart new file mode 100644 index 00000000..24311780 --- /dev/null +++ b/ohos/path_parsing_test/lib/pages/s_PathProxy_test.dart @@ -0,0 +1,60 @@ +import 'package:flutter/cupertino.dart'; +import 'package:path_parsing/path_parsing.dart'; +import '../common/test_page.dart'; +import 'example.dart'; + +class SPathProxyTestPage extends TestPage { + SPathProxyTestPage(String title, {Key? key}) : super(title, key: key) { + PathPrinter path = PathPrinter(); +//-------------构造方法---------------------- + group('Constructors', () { + test('PathProxy()', () { + expect('PathProxy为抽象类,不能直接创建', null); + }); + }); + +//-------------属性---------------------- + group('Properties', () { + test('.hashCode → int', () { + expect(path.hashCode, null); + }); + test('.runtimeType → Type', () { + expect(path.runtimeType, null); + }); + }); + +//-------------对象方法---------------------- + group('Methods', () { + test('close() → void', () { + path.close(); + expect('', null); + }); + + test('cubicTo(double x1, double y1, double x2, double y2, double x3, double y3) → void', () { + path.cubicTo(1, 2, 3, 4, 5, 6); + expect('', null); + }); + + test(' lineTo(double x, double y) → void', () { + path.lineTo( + 1, + 2, + ); + expect('', null); + }); + + test('moveTo(double x, double y) → void', () { + path.moveTo( + 1, + 2, + ); + expect('', null); + }); + + test('toString() → String', () { + expect(path.toString.runtimeType, null); + expect(path.toString, null); + }); + }); + } +} diff --git a/ohos/path_parsing_test/lib/pages/s_PathSegmentData_test.dart b/ohos/path_parsing_test/lib/pages/s_PathSegmentData_test.dart new file mode 100644 index 00000000..c3765205 --- /dev/null +++ b/ohos/path_parsing_test/lib/pages/s_PathSegmentData_test.dart @@ -0,0 +1,119 @@ +import 'package:flutter/cupertino.dart'; +import 'package:path_parsing/path_parsing.dart'; +import '../common/test_page.dart'; + +class SPathSegmentDataTestPage extends TestPage { + SPathSegmentDataTestPage(String title, {Key? key}) : super(title, key: key) { + String svg = 'M50 0 Q70 20, 50 40, Q30 20, 50 0 M50 0 Q70 -20, 50 -40, Q30 -20, 50 0 M50 40 V100'; + final SvgPathStringSource parser = SvgPathStringSource(svg); + PathSegmentData pathSD = parser.parseSegments().first; + +//-------------构造方法---------------------- + group('Constructors', () { + test('PathSegmentData()', () { + expect(PathSegmentData().runtimeType, null); + expect(PathSegmentData(), null); + }); + }); + +//-------------属性---------------------- + group('Properties', () { + test('.arcAngle ↔ double', () { + expect(pathSD.arcAngle.runtimeType, null); + expect(pathSD.arcAngle, null); + }); + + test('.arcLarge ↔ bool', () { + expect(pathSD.arcLarge.runtimeType, null); + expect(pathSD.arcLarge, null); + }); + + test('.arcRadii → _PathOffset', () { + expect(pathSD.arcRadii.runtimeType, null); + expect(pathSD.arcRadii, null); + }); + + test('.arcSweep ↔ bool', () { + expect(pathSD.arcSweep.runtimeType, null); + expect(pathSD.arcSweep, null); + }); + + test('.command ↔ SvgPathSegType', () { + expect(pathSD.command.runtimeType, null); + expect(pathSD.command, null); + }); + + test('.largeArcFlag → bool', () { + expect(pathSD.largeArcFlag.runtimeType, null); + expect(pathSD.largeArcFlag, null); + }); + + test('.point1 ↔ _PathOffset', () { + expect(pathSD.point1.runtimeType, null); + expect(pathSD.point1, null); + }); + + test('.point2 ↔ _PathOffset', () { + expect(pathSD.point2.runtimeType, null); + expect(pathSD.point2, null); + }); + + test('.r1 → double', () { + expect(pathSD.r1.runtimeType, null); + expect(pathSD.r1, null); + }); + + test('.r2 → double', () { + expect(pathSD.r2.runtimeType, null); + expect(pathSD.r2, null); + }); + + test('.sweepFlag → bool', () { + expect(pathSD.sweepFlag.runtimeType, null); + expect(pathSD.sweepFlag, null); + }); + + test('.targetPoint ↔ _PathOffset', () { + expect(pathSD.targetPoint.runtimeType, null); + expect(pathSD.targetPoint, null); + }); + + test('.x → double', () { + expect(pathSD.x.runtimeType, null); + expect(pathSD.x, null); + }); + + test('.x1 → double', () { + expect(pathSD.x1.runtimeType, null); + expect(pathSD.x1, null); + }); + + test('.x2 → double', () { + expect(pathSD.x2.runtimeType, null); + expect(pathSD.x2, null); + }); + + test('.y → double', () { + expect(pathSD.y.runtimeType, null); + expect(pathSD.y, null); + }); + + test('.y1 → double', () { + expect(pathSD.y1.runtimeType, null); + expect(pathSD.y1, null); + }); + + test('.y2 → double', () { + expect(pathSD.y2.runtimeType, null); + expect(pathSD.y2, null); + }); + }); + +//-------------对象方法---------------------- + group('Methods', () { + test('toString() → String', () { + expect(pathSD.toString(), null); + }); + }); + } +} diff --git a/ohos/path_parsing_test/lib/pages/s_SvgPathNormalizer_test.dart b/ohos/path_parsing_test/lib/pages/s_SvgPathNormalizer_test.dart new file mode 100644 index 00000000..fb6120aa --- /dev/null +++ b/ohos/path_parsing_test/lib/pages/s_SvgPathNormalizer_test.dart @@ -0,0 +1,44 @@ +import 'package:flutter/cupertino.dart'; +import 'package:path_parsing/path_parsing.dart'; +import '../common/test_page.dart'; +import 'example.dart'; + +class SSvgPathNormalizerTestPage extends TestPage { + SSvgPathNormalizerTestPage(String title, {Key? key}) : super(title, key: key) { + SvgPathNormalizer pathNormalizer = SvgPathNormalizer(); +//-------------构造方法---------------------- + group('Constructors', () { + test('SvgPathNormalizer()', () { + expect(SvgPathNormalizer().runtimeType, null); + expect(SvgPathNormalizer(), null); + }); + }); + +//-------------属性---------------------- + group('Properties', () { + test('.runtimeType → Type', () { + expect(pathNormalizer.runtimeType, null); + }); + + test('.hashCode → int', () { + expect(pathNormalizer.hashCode.runtimeType, null); + expect(pathNormalizer.hashCode, null); + }); + }); + +//-------------对象方法---------------------- + group('Methods', () { + test('emitSegment(PathSegmentData segment, PathProxy path) → void', () { + String pathString = 'M100 100 L200 200 L300 100 Z'; + SvgPathStringSource source = SvgPathStringSource(pathString); + PathSegmentData pathSD = source.parseSegments().last; + print('它的值:${pathSD}--${source.parseSegments().length}'); + pathNormalizer.emitSegment(pathSD, PathPrinter()); + expect('', null); + }); + test('toString() → String', () { + expect(pathNormalizer.toString(), null); + }); + }); + } +} diff --git a/ohos/path_parsing_test/lib/pages/s_SvgPathStringSource_test.dart b/ohos/path_parsing_test/lib/pages/s_SvgPathStringSource_test.dart new file mode 100644 index 00000000..adc42921 --- /dev/null +++ b/ohos/path_parsing_test/lib/pages/s_SvgPathStringSource_test.dart @@ -0,0 +1,52 @@ +import 'package:flutter/cupertino.dart'; +import 'package:path_parsing/path_parsing.dart'; +import '../common/test_page.dart'; +import 'example.dart'; + +class SSvgPathStringSourceTestPage extends TestPage { + SSvgPathStringSourceTestPage(String title, {Key? key}) : super(title, key: key) { + String svg = 'M50 0 Q70 20, 50 40, Q30 20, 50 0 M50 0 Q70 -20, 50 -40, Q30 -20, 50 0 M50 40 V100'; + final SvgPathStringSource pathStringSource = SvgPathStringSource(svg); +//-------------构造方法---------------------- + group('Constructors', () { + test('SvgPathStringSource(String _string)', () { + expect( + SvgPathStringSource('M50 0 Q70 20, 50 40, Q30 20, 50 0 M50 0 Q70 -20, 50 -40, Q30 -20, 50 0 M50 40 V100').runtimeType, + null); + expect(SvgPathStringSource('M50 0 Q70 20, 50 40, Q30 20, 50 0 M50 0 Q70 -20, 50 -40, Q30 -20, 50 0 M50 40 V100'), null); + }); + }); + +//-------------属性--------------- + group('Properties', () { + test('.hasMoreData → bool', () { + expect(pathStringSource.hasMoreData.runtimeType, null); + expect(pathStringSource.hasMoreData, null); + }); + + test('.hashCode → int', () { + expect(pathStringSource.hashCode.runtimeType, null); + expect(pathStringSource.hashCode, null); + }); + }); + +//-------------对象方法---------------------- + group('Methods', () { + test('parseSegment() → PathSegmentData', () { + String svg = 'M50 0 Q70 20, 50 40, Q30 20, 50 0 M50 0 Q70 -20, 50 -40, Q30 -20, 50 0 M50 40 V100'; + final SvgPathStringSource pathStringSource = SvgPathStringSource(svg); + expect(pathStringSource.parseSegment(), null); + }); + test('parseSegments() → Iterable', () { + String svg = 'M50 0 Q70 20, 50 40, Q30 20, 50 0 M50 0 Q70 -20, 50 -40, Q30 -20, 50 0 M50 40 V100'; + final SvgPathStringSource pathStringSource = SvgPathStringSource(svg); + expect(pathStringSource.parseSegments(), null); + }); + + test('toString() → String', () { + expect(pathStringSource.toString.runtimeType, null); + expect(pathStringSource.toString, null); + }); + }); + } +} diff --git a/ohos/path_parsing_test/ohos/.gitignore b/ohos/path_parsing_test/ohos/.gitignore new file mode 100644 index 00000000..6ca13b31 --- /dev/null +++ b/ohos/path_parsing_test/ohos/.gitignore @@ -0,0 +1,19 @@ +/node_modules +/oh_modules +/local.properties +/.idea +**/build +/.hvigor +.cxx +/.clangd +/.clang-format +/.clang-tidy +**/.test +*.har +**/BuildProfile.ets +**/oh-package-lock.json5 + +**/src/main/resources/rawfile/flutter_assets/ +**/libs/arm64-v8a/libapp.so +**/libs/arm64-v8a/libflutter.so +**/libs/arm64-v8a/libvmservice_snapshot.so diff --git a/ohos/path_parsing_test/ohos/AppScope/app.json5 b/ohos/path_parsing_test/ohos/AppScope/app.json5 new file mode 100644 index 00000000..7f9bea98 --- /dev/null +++ b/ohos/path_parsing_test/ohos/AppScope/app.json5 @@ -0,0 +1,10 @@ +{ + "app": { + "bundleName": "com.example.app1", + "vendor": "example", + "versionCode": 1, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name" + } +} \ No newline at end of file diff --git a/ohos/path_parsing_test/ohos/AppScope/resources/base/element/string.json b/ohos/path_parsing_test/ohos/AppScope/resources/base/element/string.json new file mode 100644 index 00000000..73c7c5ca --- /dev/null +++ b/ohos/path_parsing_test/ohos/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "app1" + } + ] +} diff --git a/ohos/path_parsing_test/ohos/AppScope/resources/base/media/app_icon.png b/ohos/path_parsing_test/ohos/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c GIT binary patch literal 6790 zcmX|G1ymHk)?T_}Vd;>R?p|tHQo6fg38|$UVM!6BLrPFWk?s;$LOP{GmJpBl$qoSA!PUg~PA65-S00{{S`XKG6NkG0RgjEntPrmV+?0|00mu7;+5 zrdpa{2QLqPJ4Y{j7=Mrl{BaxrkdY69+c~(w{Fv-v&aR%aEI&JYSeRTLWm!zbv;?)_ ziZB;fwGbbeL5Q}YLx`J$lp~A09KK8t_z}PZ=4ZzgdeKtgoc+o5EvN9A1K1_<>M?MBqb#!ASf&# zEX?<)!RH(7>1P+j=jqG(58}TVN-$psA6K}atCuI!KTJD&FMmH-78ZejBm)0qc{ESp z|LuG1{QnBUJRg_E=h1#XMWt2%fcoN@l7eAS!Es?Q+;XsRNPhiiE=@AqlLkJzF`O18 zbsbSmKN=aaq8k3NFYZfDWpKmM!coBU0(XnL8R{4=i|wi{!uWYM2je{U{B*K2PVdu&=E zTq*-XsEsJ$u5H4g6DIm2Y!DN`>^v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QL;ax|x?Ncixmeo1=$ z{-);Au{*tfzOG?KQ~K|ak8-HQ?`Pekhe2WM(8s{xv-p>Zmu_6{G!-oE$7$mY`MOJorI=+mMx?H;`pr!;fVYz?5~yXBACruWB`Ph zZM}90_<^OBxIhyZ9BW$`>6JvO;%VFpqVr8|7t3~AmxYak6?`Pp#c;**_SYmi`&z23 z`p6_~ePvH)C6x-G9$hgL=eVALq`-AiamN>!3~Lxw&{H(b{B(7xSRm6<3<{%{yXiH# zos5Rv1L+8fUKJLo%P>4I&$}y { + if (err.code) { + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', + JSON.stringify(data) ?? ''); + }); + } + + onWindowStageDestroy() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy'); + } + + onForeground() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground'); + } + + onBackground() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground'); + } +} \ No newline at end of file diff --git a/ohos/path_parsing_test/ohos/entry/src/ohosTest/ets/testability/pages/Index.ets b/ohos/path_parsing_test/ohos/entry/src/ohosTest/ets/testability/pages/Index.ets new file mode 100644 index 00000000..cef0447c --- /dev/null +++ b/ohos/path_parsing_test/ohos/entry/src/ohosTest/ets/testability/pages/Index.ets @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import hilog from '@ohos.hilog'; + +@Entry +@Component +struct Index { + aboutToAppear() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); + } + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/ohos/path_parsing_test/ohos/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts b/ohos/path_parsing_test/ohos/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts new file mode 100644 index 00000000..1def08f2 --- /dev/null +++ b/ohos/path_parsing_test/ohos/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import hilog from '@ohos.hilog'; +import TestRunner from '@ohos.application.testRunner'; +import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +async function onAbilityCreateCallback() { + hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); +} + +async function addAbilityMonitorCallback(err: any) { + hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); + } + + async onRun() { + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName + var debug = abilityDelegatorArguments.parameters['-D'] + if (debug == 'true') + { + cmd += ' -D' + } + hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); + hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); + hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); + }) + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); + } +} \ No newline at end of file diff --git a/ohos/path_parsing_test/ohos/entry/src/ohosTest/module.json5 b/ohos/path_parsing_test/ohos/entry/src/ohosTest/module.json5 new file mode 100644 index 00000000..fab77ce2 --- /dev/null +++ b/ohos/path_parsing_test/ohos/entry/src/ohosTest/module.json5 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +{ + "module": { + "name": "entry_test", + "type": "feature", + "description": "$string:module_test_desc", + "mainElement": "TestAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:test_pages", + "abilities": [ + { + "name": "TestAbility", + "srcEntry": "./ets/testability/TestAbility.ets", + "description": "$string:TestAbility_desc", + "icon": "$media:icon", + "label": "$string:TestAbility_label", + "exported": true, + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "skills": [ + { + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + } + ] + } + ] + } +} diff --git a/ohos/path_parsing_test/ohos/entry/src/ohosTest/resources/base/element/color.json b/ohos/path_parsing_test/ohos/entry/src/ohosTest/resources/base/element/color.json new file mode 100644 index 00000000..3c712962 --- /dev/null +++ b/ohos/path_parsing_test/ohos/entry/src/ohosTest/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/ohos/path_parsing_test/ohos/entry/src/ohosTest/resources/base/element/string.json b/ohos/path_parsing_test/ohos/entry/src/ohosTest/resources/base/element/string.json new file mode 100644 index 00000000..65d8fa5a --- /dev/null +++ b/ohos/path_parsing_test/ohos/entry/src/ohosTest/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_test_desc", + "value": "test ability description" + }, + { + "name": "TestAbility_desc", + "value": "the test ability" + }, + { + "name": "TestAbility_label", + "value": "test label" + } + ] +} \ No newline at end of file diff --git a/ohos/path_parsing_test/ohos/entry/src/ohosTest/resources/base/media/icon.png b/ohos/path_parsing_test/ohos/entry/src/ohosTest/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c GIT binary patch literal 6790 zcmX|G1ymHk)?T_}Vd;>R?p|tHQo6fg38|$UVM!6BLrPFWk?s;$LOP{GmJpBl$qoS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BI2T#>2;tOxu{%D?kML476AErF(qN9hPva5Nkc@BF zC-tLF@3ZFb%Kpj)M<{)x*l|*Ia@ECeXo2E4h2f!aV=cHAhi_E_mfUth(sM4^hJq7B zQsGWqdZUm9S%F`$nQ*_#NcuD`&)Ek%_s{&^78{9Hm ztri&rYLOxgFdG>O@+XHy z9#;|&vBCPXH5Mon^I`jSuR$&~ZWtyB67ujzFSj!51>#C}C17~TffQ{c-!QFQkTQ%! zIR^b1`zHx|*1GU?tbBx23weFLz5H?y_Q%N&t$}k?w+``2A=aotj0;2v$~AL z{scF-cL{wsdrmPvf#a9OHyYLcwQD4Kcm)`LLwMh4WT~p29f7M!iafJSU`IV}QY5Wa z(n44-9oA}?J{a+ah*@31WTs#&J#o1`H98#6IQf;Wv0N_!);f&9g7o-k(lW5rWnDUR zQBFIRG+X=6NnsI@mxnwm;tf5;_Uxg?jZ8m-m0}&6+DA!qam(p$mN5R})yA_7m$q@| zFEd|dpS595rxQr-n#GjI5i-AhnUE>Cr;jpCqSrD~EwK_DqI^7%3#p5)%T_od!t3SOmH9MyXeeGO2(UQL;ax|x?Ncixmeo1=$ z{-);Au{*tfzOG?KQ~K|ak8-HQ?`Pekhe2WM(8s{xv-p>Zmu_6{G!-oE$7$mY`MOJorI=+mMx?H;`pr!;fVYz?5~yXBACruWB`Ph zZM}90_<^OBxIhyZ9BW$`>6JvO;%VFpqVr8|7t3~AmxYak6?`Pp#c;**_SYmi`&z23 z`p6_~ePvH)C6x-G9$hgL=eVALq`-AiamN>!3~Lxw&{H(b{B(7xSRm6<3<{%{yXiH# zos5Rv1L+8fUKJLo%P>4I&$}y=2.19.6 <3.0.0' + +# Dependencies specify other packages that your package needs in order to work. +# To automatically upgrade your package dependencies to the latest versions +# consider running `flutter pub upgrade --major-versions`. Alternatively, +# dependencies can be manually updated by changing the version numbers below to +# the latest version available on pub.dev. To see which dependencies have newer +# versions available, run `flutter pub outdated`. +dependencies: + flutter: + sdk: flutter + + + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^1.0.2 + path_parsing: ^1.0.1 + +dev_dependencies: + flutter_test: + sdk: flutter + path: ^1.8.0 + test: ^1.16.0 + + # The "flutter_lints" package below contains a set of recommended lints to + # encourage good coding practices. The lint set provided by the package is + # activated in the `analysis_options.yaml` file located at the root of your + # package. See that file for information about deactivating specific lint + # rules and activating additional ones. + flutter_lints: ^2.0.0 + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter packages. +flutter: + + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + + # To add assets to your application, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/assets-and-images/#resolution-aware + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/assets-and-images/#from-packages + + # To add custom fonts to your application, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/custom-fonts/#from-packages diff --git a/ohos/path_parsing_test/test/parse_path_deep_test.dart b/ohos/path_parsing_test/test/parse_path_deep_test.dart new file mode 100644 index 00000000..8839f068 --- /dev/null +++ b/ohos/path_parsing_test/test/parse_path_deep_test.dart @@ -0,0 +1,71 @@ +import 'package:path_parsing/path_parsing.dart'; +import 'package:test/test.dart'; + +class DeepTestPathProxy extends PathProxy { + DeepTestPathProxy(this.expectedCommands); + + final List expectedCommands; + final List actualCommands = []; + + @override + void close() { + actualCommands.add('close()'); + } + + @override + void cubicTo( + double x1, + double y1, + double x2, + double y2, + double x3, + double y3, + ) { + actualCommands.add( + 'cubicTo(${x1.toStringAsFixed(4)}, ${y1.toStringAsFixed(4)}, ${x2.toStringAsFixed(4)}, ${y2.toStringAsFixed(4)}, ${x3.toStringAsFixed(4)}, ${y3.toStringAsFixed(4)})'); + } + + @override + void lineTo(double x, double y) { + actualCommands + .add('lineTo(${x.toStringAsFixed(4)}, ${y.toStringAsFixed(4)})'); + } + + @override + void moveTo(double x, double y) { + actualCommands + .add('moveTo(${x.toStringAsFixed(4)}, ${y.toStringAsFixed(4)})'); + } + + void validate() { + expect(expectedCommands, orderedEquals(actualCommands)); + } +} + +void main() { + void assertValidPath(String input, List commands) { + final DeepTestPathProxy proxy = DeepTestPathProxy(commands); + writeSvgPathDataToPath(input, proxy); + proxy.validate(); + } + + test('Deep path validation', () { + assertValidPath('M20,30 Q40,5 60,30 T100,30', [ + 'moveTo(20.0000, 30.0000)', + 'cubicTo(33.3333, 13.3333, 46.6667, 13.3333, 60.0000, 30.0000)', + 'cubicTo(73.3333, 46.6667, 86.6667, 46.6667, 100.0000, 30.0000)' + ]); + + assertValidPath( + 'M5.5 5.5a.5 1.5 30 1 1-.866-.5.5 1.5 30 1 1 .866.5z', [ + 'moveTo(5.5000, 5.5000)', + 'cubicTo(5.2319, 5.9667, 4.9001, 6.3513, 4.6307, 6.5077)', + 'cubicTo(4.3612, 6.6640, 4.1953, 6.5683, 4.1960, 6.2567)', + 'cubicTo(4.1967, 5.9451, 4.3638, 5.4655, 4.6340, 5.0000)', + 'cubicTo(4.9021, 4.5333, 5.2339, 4.1487, 5.5033, 3.9923)', + 'cubicTo(5.7728, 3.8360, 5.9387, 3.9317, 5.9380, 4.2433)', + 'cubicTo(5.9373, 4.5549, 5.7702, 5.0345, 5.5000, 5.5000)', + 'close()' + ]); + }); +} diff --git a/ohos/path_parsing_test/test/parse_path_test.dart b/ohos/path_parsing_test/test/parse_path_test.dart new file mode 100644 index 00000000..72c4e370 --- /dev/null +++ b/ohos/path_parsing_test/test/parse_path_test.dart @@ -0,0 +1,248 @@ +// Test paths taken from: +// * https://github.com/chromium/chromium/blob/master/third_party/blink/renderer/core/svg/svg_path_parser_test.cc + +import 'package:path_parsing/path_parsing.dart'; +import 'package:path_parsing/src/path_segment_type.dart'; +import 'package:test/test.dart'; + +// TODO(dnfield): a bunch of better tests could be written to track that commands are actually called with expected values/order +// For now we just want to know that something gets emitted and no exceptions are thrown (that's all the legacy tests really did anyway). +class TestPathProxy extends PathProxy { + bool called = false; + @override + void close() { + called = true; + } + + @override + void cubicTo( + double x1, + double y1, + double x2, + double y2, + double x3, + double y3, + ) { + called = true; + } + + @override + void lineTo(double x, double y) { + called = true; + } + + @override + void moveTo(double x, double y) { + called = true; + } +} + +void main() { + void assertValidPath(String input) { + final TestPathProxy proxy = TestPathProxy(); + // these shouldn't throw or assert + writeSvgPathDataToPath(input, proxy); + expect(proxy.called, true); + } + + void assertInvalidPath(String input) { + expect( + () => writeSvgPathDataToPath(input, TestPathProxy()), throwsStateError); + } + + test('Valid Paths', () { + assertValidPath('M1,2'); + assertValidPath('m1,2'); + assertValidPath('M100,200 m3,4'); + assertValidPath('M100,200 L3,4'); + assertValidPath('M100,200 l3,4'); + assertValidPath('M100,200 H3'); + assertValidPath('M100,200 h3'); + assertValidPath('M100,200 V3'); + assertValidPath('M100,200 v3'); + assertValidPath('M100,200 Z'); + assertValidPath('M100,200 z'); + assertValidPath('M100,200 C3,4,5,6,7,8'); + assertValidPath('M100,200 c3,4,5,6,7,8'); + assertValidPath('M100,200 S3,4,5,6'); + assertValidPath('M100,200 s3,4,5,6'); + assertValidPath('M100,200 Q3,4,5,6'); + assertValidPath('M100,200 q3,4,5,6'); + assertValidPath('M100,200 T3,4'); + assertValidPath('M100,200 t3,4'); + assertValidPath('M100,200 A3,4,5,0,0,6,7'); + assertValidPath('M100,200 A3,4,5,1,0,6,7'); + assertValidPath('M100,200 A3,4,5,0,1,6,7'); + assertValidPath('M100,200 A3,4,5,1,1,6,7'); + assertValidPath('M100,200 a3,4,5,0,0,6,7'); + assertValidPath('M100,200 a3,4,5,0,1,6,7'); + assertValidPath('M100,200 a3,4,5,1,0,6,7'); + assertValidPath('M100,200 a3,4,5,1,1,6,7'); + assertValidPath('M100,200 a3,4,5,006,7'); + assertValidPath('M100,200 a3,4,5,016,7'); + assertValidPath('M100,200 a3,4,5,106,7'); + assertValidPath('M100,200 a3,4,5,116,7'); + assertValidPath( + '''M19.0281,19.40466 20.7195,19.40466 20.7195,15.71439 24.11486,15.71439 24.11486,14.36762 20.7195,14.36762 +20.7195,11.68641 24.74134,11.68641 24.74134,10.34618 19.0281,10.34618 z'''); + + assertValidPath( + 'M100,200 a0,4,5,0,0,10,0 a4,0,5,0,0,0,10 a0,0,5,0,0,-10,0 z'); + + assertValidPath('M1,2,3,4'); + assertValidPath('m100,200,3,4'); + + assertValidPath('M 100-200'); + assertValidPath('M 0.6.5'); + + assertValidPath(' M1,2'); + assertValidPath(' M1,2'); + assertValidPath('\tM1,2'); + assertValidPath('\nM1,2'); + assertValidPath('\rM1,2'); + assertValidPath('M1,2 '); + assertValidPath('M1,2\t'); + assertValidPath('M1,2\n'); + assertValidPath('M1,2\r'); + // assertValidPath(''); + // assertValidPath(' '); + assertValidPath('M.1 .2 L.3 .4 .5 .6'); + assertValidPath('M1,1h2,3'); + assertValidPath('M1,1H2,3'); + assertValidPath('M1,1v2,3'); + assertValidPath('M1,1V2,3'); + assertValidPath('M1,1c2,3 4,5 6,7 8,9 10,11 12,13'); + assertValidPath('M1,1C2,3 4,5 6,7 8,9 10,11 12,13'); + assertValidPath('M1,1s2,3 4,5 6,7 8,9'); + assertValidPath('M1,1S2,3 4,5 6,7 8,9'); + assertValidPath('M1,1q2,3 4,5 6,7 8,9'); + assertValidPath('M1,1Q2,3 4,5 6,7 8,9'); + assertValidPath('M1,1t2,3 4,5'); + assertValidPath('M1,1T2,3 4,5'); + assertValidPath('M1,1a2,3,4,0,0,5,6 7,8,9,0,0,10,11'); + assertValidPath('M1,1A2,3,4,0,0,5,6 7,8,9,0,0,10,11'); + assertValidPath( + 'M22.1595 3.80852C19.6789 1.35254 16.3807 -4.80966e-07 12.8727 ' + '-4.80966e-07C9.36452 -4.80966e-07 6.06642 1.35254 3.58579 3.80852C1.77297 5.60333 ' + '0.53896 7.8599 0.0171889 10.3343C-0.0738999 10.7666 0.206109 11.1901 0.64265 11.2803' + 'C1.07908 11.3706 1.50711 11.0934 1.5982 10.661C2.05552 8.49195 3.13775 6.51338 4.72783 ' + '4.9391C9.21893 0.492838 16.5262 0.492728 21.0173 4.9391C25.5082 9.38548 25.5082 16.6202 ' + '21.0173 21.0667C16.5265 25.5132 9.21893 25.5133 4.72805 21.0669C3.17644 19.5307 2.10538 ' + '17.6035 1.63081 15.4937C1.53386 15.0627 1.10252 14.7908 0.66697 14.887C0.231645 14.983 ' + '-0.0427272 15.4103 0.0542205 15.8413C0.595668 18.2481 1.81686 20.4461 3.5859 22.1976' + 'C6.14623 24.7325 9.50955 26 12.8727 26C16.236 26 19.5991 24.7326 22.1595 22.1976C27.2802 ' + '17.1277 27.2802 8.87841 22.1595 3.80852Z'); + assertValidPath( + 'm18 11.8a.41.41 0 0 1 .24.08l.59.43h.05.72a.4.4 0 0 1 .39.28l.22.69a.08.08 0 ' + '0 0 0 0l.58.43a.41.41 0 0 1 .15.45l-.22.68a.09.09 0 0 0 0 .07l.22.68a.4.4 0 0 1 ' + '-.15.46l-.58.42a.1.1 0 0 0 0 0l-.22.68a.41.41 0 0 1 -.38.29h-.79l-.58.43a.41.41 0 ' + '0 1 -.24.08.46.46 0 0 1 -.24-.08l-.58-.43h-.06-.72a.41.41 0 0 1 -.39-.28l-.22-.68' + 'a.1.1 0 0 0 0 0l-.58-.43a.42.42 0 0 1 -.15-.46l.23-.67v-.02l-.29-.68a.43.43 0 0 1 ' + '.15-.46l.58-.42a.1.1 0 0 0 0-.05l.27-.69a.42.42 0 0 1 .39-.28h.78l.58-.43a.43.43 0 ' + '0 1 .25-.09m0-1a1.37 1.37 0 0 0 -.83.27l-.34.25h-.43a1.42 1.42 0 0 0 -1.34 1l-.13.4' + '-.35.25a1.42 1.42 0 0 0 -.51 1.58l.13.4-.13.4a1.39 1.39 0 0 0 .52 1.59l.34.25.13.4' + 'a1.41 1.41 0 0 0 1.34 1h.43l.34.26a1.44 1.44 0 0 0 .83.27 1.38 1.38 0 0 0 .83-.28' + 'l.35-.24h.43a1.4 1.4 0 0 0 1.33-1l.13-.4.35-.26a1.39 1.39 0 0 0 .51-1.57l-.13-.4.13-.41' + 'a1.4 1.4 0 0 0 -.51-1.56l-.35-.25-.13-.41a1.4 1.4 0 0 0 -1.34-1h-.42l-.34-.26a1.43 1.43 ' + '0 0 0 -.84-.28z'); + }); + + test('Malformed Paths', () { + assertInvalidPath('M100,200 a3,4,5,2,1,6,7'); + assertInvalidPath('M100,200 a3,4,5,1,2,6,7'); + + assertInvalidPath('\vM1,2'); + assertInvalidPath('xM1,2'); + assertInvalidPath('M1,2\v'); + assertInvalidPath('M1,2x'); + assertInvalidPath('M1,2 L40,0#90'); + + assertInvalidPath('x'); + assertInvalidPath('L1,2'); + + assertInvalidPath('M'); + assertInvalidPath('M\0'); + + assertInvalidPath('M1,1Z0'); + assertInvalidPath('M1,1z0'); + + assertInvalidPath('M1,1c2,3 4,5 6,7 8'); + assertInvalidPath('M1,1C2,3 4,5 6,7 8'); + assertInvalidPath('M1,1s2,3 4,5 6'); + assertInvalidPath('M1,1S2,3 4,5 6'); + assertInvalidPath('M1,1q2,3 4,5 6'); + assertInvalidPath('M1,1Q2,3 4,5 6'); + assertInvalidPath('M1,1t2,3 4'); + assertInvalidPath('M1,1T2,3 4'); + assertInvalidPath('M1,1a2,3,4,0,0,5,6 7'); + assertInvalidPath('M1,1A2,3,4,0,0,5,6 7'); + }); + + test('Missing commands/numbers/flags', () { + // Missing initial moveto. + assertInvalidPath(' 10 10'); + assertInvalidPath('L 10 10'); + // Invalid command letter. + assertInvalidPath('M 10 10 #'); + assertInvalidPath('M 10 10 E 100 100'); + // Invalid number. + assertInvalidPath('M 10 10 L100 '); + assertInvalidPath('M 10 10 L100 #'); + assertInvalidPath('M 10 10 L100#100'); + assertInvalidPath('M0,0 A#,10 0 0,0 20,20'); + assertInvalidPath('M0,0 A10,# 0 0,0 20,20'); + assertInvalidPath('M0,0 A10,10 # 0,0 20,20'); + assertInvalidPath('M0,0 A10,10 0 0,0 #,20'); + assertInvalidPath('M0,0 A10,10 0 0,0 20,#'); + // Invalid arc-flag. + assertInvalidPath('M0,0 A10,10 0 #,0 20,20'); + assertInvalidPath('M0,0 A10,10 0 0,# 20,20'); + assertInvalidPath('M0,0 A10,10 0 0,2 20,20'); + }); + + test('Check character constants', () { + expect(AsciiConstants.slashT, '\t'.codeUnitAt(0)); + expect(AsciiConstants.slashN, '\n'.codeUnitAt(0)); + expect(AsciiConstants.slashF, '\f'.codeUnitAt(0)); + expect(AsciiConstants.slashR, '\r'.codeUnitAt(0)); + expect(AsciiConstants.space, ' '.codeUnitAt(0)); + expect(AsciiConstants.period, '.'.codeUnitAt(0)); + expect(AsciiConstants.plus, '+'.codeUnitAt(0)); + expect(AsciiConstants.comma, ','.codeUnitAt(0)); + expect(AsciiConstants.minus, '-'.codeUnitAt(0)); + expect(AsciiConstants.number0, '0'.codeUnitAt(0)); + expect(AsciiConstants.number1, '1'.codeUnitAt(0)); + expect(AsciiConstants.number2, '2'.codeUnitAt(0)); + expect(AsciiConstants.number3, '3'.codeUnitAt(0)); + expect(AsciiConstants.number4, '4'.codeUnitAt(0)); + expect(AsciiConstants.number5, '5'.codeUnitAt(0)); + expect(AsciiConstants.number6, '6'.codeUnitAt(0)); + expect(AsciiConstants.number7, '7'.codeUnitAt(0)); + expect(AsciiConstants.number8, '8'.codeUnitAt(0)); + expect(AsciiConstants.number9, '9'.codeUnitAt(0)); + expect(AsciiConstants.upperA, 'A'.codeUnitAt(0)); + expect(AsciiConstants.upperC, 'C'.codeUnitAt(0)); + expect(AsciiConstants.upperE, 'E'.codeUnitAt(0)); + expect(AsciiConstants.upperH, 'H'.codeUnitAt(0)); + expect(AsciiConstants.upperL, 'L'.codeUnitAt(0)); + expect(AsciiConstants.upperM, 'M'.codeUnitAt(0)); + expect(AsciiConstants.upperQ, 'Q'.codeUnitAt(0)); + expect(AsciiConstants.upperS, 'S'.codeUnitAt(0)); + expect(AsciiConstants.upperT, 'T'.codeUnitAt(0)); + expect(AsciiConstants.upperV, 'V'.codeUnitAt(0)); + expect(AsciiConstants.upperZ, 'Z'.codeUnitAt(0)); + expect(AsciiConstants.lowerA, 'a'.codeUnitAt(0)); + expect(AsciiConstants.lowerC, 'c'.codeUnitAt(0)); + expect(AsciiConstants.lowerE, 'e'.codeUnitAt(0)); + expect(AsciiConstants.lowerH, 'h'.codeUnitAt(0)); + expect(AsciiConstants.lowerL, 'l'.codeUnitAt(0)); + expect(AsciiConstants.lowerM, 'm'.codeUnitAt(0)); + expect(AsciiConstants.lowerQ, 'q'.codeUnitAt(0)); + expect(AsciiConstants.lowerS, 's'.codeUnitAt(0)); + expect(AsciiConstants.lowerT, 't'.codeUnitAt(0)); + expect(AsciiConstants.lowerV, 'v'.codeUnitAt(0)); + expect(AsciiConstants.lowerX, 'x'.codeUnitAt(0)); + expect(AsciiConstants.lowerZ, 'z'.codeUnitAt(0)); + expect(AsciiConstants.tilde, '~'.codeUnitAt(0)); + }); +} -- Gitee From 4236ce52e828c6148c1bc30d5215d6c6accd3039 Mon Sep 17 00:00:00 2001 From: liuja <542689970@qq.com> Date: Tue, 26 Nov 2024 16:52:08 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E8=A7=A3=E6=9E=90DEMO1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liuja <542689970@qq.com> --- .../lib/common/base_page.dart | 15 ++ .../lib/common/item_widget.dart | 15 ++ .../lib/common/main_item_widget.dart | 15 ++ .../lib/common/test_model_app.dart | 15 ++ .../lib/common/test_page.dart | 15 ++ .../lib/common/test_route.dart | 15 ++ ohos/path_parsing_test/lib/main.dart | 35 ++- ohos/path_parsing_test/lib/pages/example.dart | 15 ++ .../lib/pages/function_list.dart | 15 ++ .../lib/pages/parse_path_deep_test.dart | 15 ++ .../lib/pages/parse_path_test.dart | 17 +- .../lib/pages/s_PathProxy_test.dart | 60 ----- .../lib/pages/s_PathSegmentData_test.dart | 119 --------- .../lib/pages/s_SvgPathNormalizer_test.dart | 44 ---- .../lib/pages/s_SvgPathStringSource_test.dart | 52 ---- .../test/parse_path_deep_test.dart | 71 ----- .../test/parse_path_test.dart | 248 ------------------ 17 files changed, 165 insertions(+), 616 deletions(-) delete mode 100644 ohos/path_parsing_test/lib/pages/s_PathProxy_test.dart delete mode 100644 ohos/path_parsing_test/lib/pages/s_PathSegmentData_test.dart delete mode 100644 ohos/path_parsing_test/lib/pages/s_SvgPathNormalizer_test.dart delete mode 100644 ohos/path_parsing_test/lib/pages/s_SvgPathStringSource_test.dart delete mode 100644 ohos/path_parsing_test/test/parse_path_deep_test.dart delete mode 100644 ohos/path_parsing_test/test/parse_path_test.dart diff --git a/ohos/path_parsing_test/lib/common/base_page.dart b/ohos/path_parsing_test/lib/common/base_page.dart index 85f777cb..5fed4336 100644 --- a/ohos/path_parsing_test/lib/common/base_page.dart +++ b/ohos/path_parsing_test/lib/common/base_page.dart @@ -1,3 +1,18 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + import 'package:flutter/material.dart'; import '../common/test_route.dart'; diff --git a/ohos/path_parsing_test/lib/common/item_widget.dart b/ohos/path_parsing_test/lib/common/item_widget.dart index 71e934ae..40064ef2 100644 --- a/ohos/path_parsing_test/lib/common/item_widget.dart +++ b/ohos/path_parsing_test/lib/common/item_widget.dart @@ -1,3 +1,18 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../common/test_page.dart'; diff --git a/ohos/path_parsing_test/lib/common/main_item_widget.dart b/ohos/path_parsing_test/lib/common/main_item_widget.dart index da42308c..bad4f10d 100644 --- a/ohos/path_parsing_test/lib/common/main_item_widget.dart +++ b/ohos/path_parsing_test/lib/common/main_item_widget.dart @@ -1,3 +1,18 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../common/test_route.dart'; diff --git a/ohos/path_parsing_test/lib/common/test_model_app.dart b/ohos/path_parsing_test/lib/common/test_model_app.dart index 1ef52db8..6827ec1f 100644 --- a/ohos/path_parsing_test/lib/common/test_model_app.dart +++ b/ohos/path_parsing_test/lib/common/test_model_app.dart @@ -1,3 +1,18 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + import 'package:flutter/material.dart'; import 'base_page.dart'; diff --git a/ohos/path_parsing_test/lib/common/test_page.dart b/ohos/path_parsing_test/lib/common/test_page.dart index d65fe14d..2bcb810c 100644 --- a/ohos/path_parsing_test/lib/common/test_page.dart +++ b/ohos/path_parsing_test/lib/common/test_page.dart @@ -1,3 +1,18 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + import 'dart:async'; import 'package:flutter/material.dart'; diff --git a/ohos/path_parsing_test/lib/common/test_route.dart b/ohos/path_parsing_test/lib/common/test_route.dart index d7fbae55..f8c2adac 100644 --- a/ohos/path_parsing_test/lib/common/test_route.dart +++ b/ohos/path_parsing_test/lib/common/test_route.dart @@ -1,3 +1,18 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + import 'package:flutter/cupertino.dart'; import 'base_page.dart'; diff --git a/ohos/path_parsing_test/lib/main.dart b/ohos/path_parsing_test/lib/main.dart index 9a405050..60d14b74 100644 --- a/ohos/path_parsing_test/lib/main.dart +++ b/ohos/path_parsing_test/lib/main.dart @@ -1,3 +1,18 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + import 'package:flutter/cupertino.dart'; import 'common/test_model_app.dart'; @@ -6,10 +21,6 @@ import 'pages/example.dart'; import 'pages/function_list.dart'; import 'pages/parse_path_deep_test.dart'; import 'pages/parse_path_test.dart'; -import 'pages/s_PathProxy_test.dart'; -import 'pages/s_PathSegmentData_test.dart'; -import 'pages/s_SvgPathNormalizer_test.dart'; -import 'pages/s_SvgPathStringSource_test.dart'; void main() { final items = [ @@ -33,22 +44,6 @@ void main() { "FunctionList": (context) { return FunctionList(); }, - // "PathParsingPage": (context) { - // return PathParsingPage(); - // }, - "SPathProxyTestPage": (context) { - return SPathProxyTestPage('SPathProxyTestPage'); - }, - "SPathSegmentDataTestPage": (context) { - return SPathSegmentDataTestPage('SPathSegmentDataTestPage'); - }, - "SSvgPathNormalizerTestPage": (context) { - return SSvgPathNormalizerTestPage('SSvgPathNormalizerTestPage'); - }, - "SSvgPathStringSourceTestPage": (context) { - return SSvgPathStringSourceTestPage('SSvgPathStringSourceTestPage'); - }, - //SSvgPathStringSourceTestPage "ParsePathDeepTestPage": (context) { return ParsePathDeepTestPage("ParsePathDeepTestPage"); diff --git a/ohos/path_parsing_test/lib/pages/example.dart b/ohos/path_parsing_test/lib/pages/example.dart index 9f672842..992c1223 100644 --- a/ohos/path_parsing_test/lib/pages/example.dart +++ b/ohos/path_parsing_test/lib/pages/example.dart @@ -1,3 +1,18 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + import 'package:flutter/material.dart'; import 'package:path_parsing/path_parsing.dart'; diff --git a/ohos/path_parsing_test/lib/pages/function_list.dart b/ohos/path_parsing_test/lib/pages/function_list.dart index c284fa94..d9015f16 100644 --- a/ohos/path_parsing_test/lib/pages/function_list.dart +++ b/ohos/path_parsing_test/lib/pages/function_list.dart @@ -1,3 +1,18 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + import 'package:flutter/material.dart'; import 'example.dart'; diff --git a/ohos/path_parsing_test/lib/pages/parse_path_deep_test.dart b/ohos/path_parsing_test/lib/pages/parse_path_deep_test.dart index 85df6c47..f5a16bb0 100644 --- a/ohos/path_parsing_test/lib/pages/parse_path_deep_test.dart +++ b/ohos/path_parsing_test/lib/pages/parse_path_deep_test.dart @@ -1,3 +1,18 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + import 'package:flutter/cupertino.dart'; import 'package:path_parsing/path_parsing.dart'; diff --git a/ohos/path_parsing_test/lib/pages/parse_path_test.dart b/ohos/path_parsing_test/lib/pages/parse_path_test.dart index bdeefe9a..93aff6f3 100644 --- a/ohos/path_parsing_test/lib/pages/parse_path_test.dart +++ b/ohos/path_parsing_test/lib/pages/parse_path_test.dart @@ -1,5 +1,18 @@ -// Test paths taken from: -// * https://github.com/chromium/chromium/blob/master/third_party/blink/renderer/core/svg/svg_path_parser_test.cc +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + import 'package:flutter/cupertino.dart'; import 'package:path_parsing/path_parsing.dart'; diff --git a/ohos/path_parsing_test/lib/pages/s_PathProxy_test.dart b/ohos/path_parsing_test/lib/pages/s_PathProxy_test.dart deleted file mode 100644 index 24311780..00000000 --- a/ohos/path_parsing_test/lib/pages/s_PathProxy_test.dart +++ /dev/null @@ -1,60 +0,0 @@ -import 'package:flutter/cupertino.dart'; -import 'package:path_parsing/path_parsing.dart'; -import '../common/test_page.dart'; -import 'example.dart'; - -class SPathProxyTestPage extends TestPage { - SPathProxyTestPage(String title, {Key? key}) : super(title, key: key) { - PathPrinter path = PathPrinter(); -//-------------构造方法---------------------- - group('Constructors', () { - test('PathProxy()', () { - expect('PathProxy为抽象类,不能直接创建', null); - }); - }); - -//-------------属性---------------------- - group('Properties', () { - test('.hashCode → int', () { - expect(path.hashCode, null); - }); - test('.runtimeType → Type', () { - expect(path.runtimeType, null); - }); - }); - -//-------------对象方法---------------------- - group('Methods', () { - test('close() → void', () { - path.close(); - expect('', null); - }); - - test('cubicTo(double x1, double y1, double x2, double y2, double x3, double y3) → void', () { - path.cubicTo(1, 2, 3, 4, 5, 6); - expect('', null); - }); - - test(' lineTo(double x, double y) → void', () { - path.lineTo( - 1, - 2, - ); - expect('', null); - }); - - test('moveTo(double x, double y) → void', () { - path.moveTo( - 1, - 2, - ); - expect('', null); - }); - - test('toString() → String', () { - expect(path.toString.runtimeType, null); - expect(path.toString, null); - }); - }); - } -} diff --git a/ohos/path_parsing_test/lib/pages/s_PathSegmentData_test.dart b/ohos/path_parsing_test/lib/pages/s_PathSegmentData_test.dart deleted file mode 100644 index c3765205..00000000 --- a/ohos/path_parsing_test/lib/pages/s_PathSegmentData_test.dart +++ /dev/null @@ -1,119 +0,0 @@ -import 'package:flutter/cupertino.dart'; -import 'package:path_parsing/path_parsing.dart'; -import '../common/test_page.dart'; - -class SPathSegmentDataTestPage extends TestPage { - SPathSegmentDataTestPage(String title, {Key? key}) : super(title, key: key) { - String svg = 'M50 0 Q70 20, 50 40, Q30 20, 50 0 M50 0 Q70 -20, 50 -40, Q30 -20, 50 0 M50 40 V100'; - final SvgPathStringSource parser = SvgPathStringSource(svg); - PathSegmentData pathSD = parser.parseSegments().first; - -//-------------构造方法---------------------- - group('Constructors', () { - test('PathSegmentData()', () { - expect(PathSegmentData().runtimeType, null); - expect(PathSegmentData(), null); - }); - }); - -//-------------属性---------------------- - group('Properties', () { - test('.arcAngle ↔ double', () { - expect(pathSD.arcAngle.runtimeType, null); - expect(pathSD.arcAngle, null); - }); - - test('.arcLarge ↔ bool', () { - expect(pathSD.arcLarge.runtimeType, null); - expect(pathSD.arcLarge, null); - }); - - test('.arcRadii → _PathOffset', () { - expect(pathSD.arcRadii.runtimeType, null); - expect(pathSD.arcRadii, null); - }); - - test('.arcSweep ↔ bool', () { - expect(pathSD.arcSweep.runtimeType, null); - expect(pathSD.arcSweep, null); - }); - - test('.command ↔ SvgPathSegType', () { - expect(pathSD.command.runtimeType, null); - expect(pathSD.command, null); - }); - - test('.largeArcFlag → bool', () { - expect(pathSD.largeArcFlag.runtimeType, null); - expect(pathSD.largeArcFlag, null); - }); - - test('.point1 ↔ _PathOffset', () { - expect(pathSD.point1.runtimeType, null); - expect(pathSD.point1, null); - }); - - test('.point2 ↔ _PathOffset', () { - expect(pathSD.point2.runtimeType, null); - expect(pathSD.point2, null); - }); - - test('.r1 → double', () { - expect(pathSD.r1.runtimeType, null); - expect(pathSD.r1, null); - }); - - test('.r2 → double', () { - expect(pathSD.r2.runtimeType, null); - expect(pathSD.r2, null); - }); - - test('.sweepFlag → bool', () { - expect(pathSD.sweepFlag.runtimeType, null); - expect(pathSD.sweepFlag, null); - }); - - test('.targetPoint ↔ _PathOffset', () { - expect(pathSD.targetPoint.runtimeType, null); - expect(pathSD.targetPoint, null); - }); - - test('.x → double', () { - expect(pathSD.x.runtimeType, null); - expect(pathSD.x, null); - }); - - test('.x1 → double', () { - expect(pathSD.x1.runtimeType, null); - expect(pathSD.x1, null); - }); - - test('.x2 → double', () { - expect(pathSD.x2.runtimeType, null); - expect(pathSD.x2, null); - }); - - test('.y → double', () { - expect(pathSD.y.runtimeType, null); - expect(pathSD.y, null); - }); - - test('.y1 → double', () { - expect(pathSD.y1.runtimeType, null); - expect(pathSD.y1, null); - }); - - test('.y2 → double', () { - expect(pathSD.y2.runtimeType, null); - expect(pathSD.y2, null); - }); - }); - -//-------------对象方法---------------------- - group('Methods', () { - test('toString() → String', () { - expect(pathSD.toString(), null); - }); - }); - } -} diff --git a/ohos/path_parsing_test/lib/pages/s_SvgPathNormalizer_test.dart b/ohos/path_parsing_test/lib/pages/s_SvgPathNormalizer_test.dart deleted file mode 100644 index fb6120aa..00000000 --- a/ohos/path_parsing_test/lib/pages/s_SvgPathNormalizer_test.dart +++ /dev/null @@ -1,44 +0,0 @@ -import 'package:flutter/cupertino.dart'; -import 'package:path_parsing/path_parsing.dart'; -import '../common/test_page.dart'; -import 'example.dart'; - -class SSvgPathNormalizerTestPage extends TestPage { - SSvgPathNormalizerTestPage(String title, {Key? key}) : super(title, key: key) { - SvgPathNormalizer pathNormalizer = SvgPathNormalizer(); -//-------------构造方法---------------------- - group('Constructors', () { - test('SvgPathNormalizer()', () { - expect(SvgPathNormalizer().runtimeType, null); - expect(SvgPathNormalizer(), null); - }); - }); - -//-------------属性---------------------- - group('Properties', () { - test('.runtimeType → Type', () { - expect(pathNormalizer.runtimeType, null); - }); - - test('.hashCode → int', () { - expect(pathNormalizer.hashCode.runtimeType, null); - expect(pathNormalizer.hashCode, null); - }); - }); - -//-------------对象方法---------------------- - group('Methods', () { - test('emitSegment(PathSegmentData segment, PathProxy path) → void', () { - String pathString = 'M100 100 L200 200 L300 100 Z'; - SvgPathStringSource source = SvgPathStringSource(pathString); - PathSegmentData pathSD = source.parseSegments().last; - print('它的值:${pathSD}--${source.parseSegments().length}'); - pathNormalizer.emitSegment(pathSD, PathPrinter()); - expect('', null); - }); - test('toString() → String', () { - expect(pathNormalizer.toString(), null); - }); - }); - } -} diff --git a/ohos/path_parsing_test/lib/pages/s_SvgPathStringSource_test.dart b/ohos/path_parsing_test/lib/pages/s_SvgPathStringSource_test.dart deleted file mode 100644 index adc42921..00000000 --- a/ohos/path_parsing_test/lib/pages/s_SvgPathStringSource_test.dart +++ /dev/null @@ -1,52 +0,0 @@ -import 'package:flutter/cupertino.dart'; -import 'package:path_parsing/path_parsing.dart'; -import '../common/test_page.dart'; -import 'example.dart'; - -class SSvgPathStringSourceTestPage extends TestPage { - SSvgPathStringSourceTestPage(String title, {Key? key}) : super(title, key: key) { - String svg = 'M50 0 Q70 20, 50 40, Q30 20, 50 0 M50 0 Q70 -20, 50 -40, Q30 -20, 50 0 M50 40 V100'; - final SvgPathStringSource pathStringSource = SvgPathStringSource(svg); -//-------------构造方法---------------------- - group('Constructors', () { - test('SvgPathStringSource(String _string)', () { - expect( - SvgPathStringSource('M50 0 Q70 20, 50 40, Q30 20, 50 0 M50 0 Q70 -20, 50 -40, Q30 -20, 50 0 M50 40 V100').runtimeType, - null); - expect(SvgPathStringSource('M50 0 Q70 20, 50 40, Q30 20, 50 0 M50 0 Q70 -20, 50 -40, Q30 -20, 50 0 M50 40 V100'), null); - }); - }); - -//-------------属性--------------- - group('Properties', () { - test('.hasMoreData → bool', () { - expect(pathStringSource.hasMoreData.runtimeType, null); - expect(pathStringSource.hasMoreData, null); - }); - - test('.hashCode → int', () { - expect(pathStringSource.hashCode.runtimeType, null); - expect(pathStringSource.hashCode, null); - }); - }); - -//-------------对象方法---------------------- - group('Methods', () { - test('parseSegment() → PathSegmentData', () { - String svg = 'M50 0 Q70 20, 50 40, Q30 20, 50 0 M50 0 Q70 -20, 50 -40, Q30 -20, 50 0 M50 40 V100'; - final SvgPathStringSource pathStringSource = SvgPathStringSource(svg); - expect(pathStringSource.parseSegment(), null); - }); - test('parseSegments() → Iterable', () { - String svg = 'M50 0 Q70 20, 50 40, Q30 20, 50 0 M50 0 Q70 -20, 50 -40, Q30 -20, 50 0 M50 40 V100'; - final SvgPathStringSource pathStringSource = SvgPathStringSource(svg); - expect(pathStringSource.parseSegments(), null); - }); - - test('toString() → String', () { - expect(pathStringSource.toString.runtimeType, null); - expect(pathStringSource.toString, null); - }); - }); - } -} diff --git a/ohos/path_parsing_test/test/parse_path_deep_test.dart b/ohos/path_parsing_test/test/parse_path_deep_test.dart deleted file mode 100644 index 8839f068..00000000 --- a/ohos/path_parsing_test/test/parse_path_deep_test.dart +++ /dev/null @@ -1,71 +0,0 @@ -import 'package:path_parsing/path_parsing.dart'; -import 'package:test/test.dart'; - -class DeepTestPathProxy extends PathProxy { - DeepTestPathProxy(this.expectedCommands); - - final List expectedCommands; - final List actualCommands = []; - - @override - void close() { - actualCommands.add('close()'); - } - - @override - void cubicTo( - double x1, - double y1, - double x2, - double y2, - double x3, - double y3, - ) { - actualCommands.add( - 'cubicTo(${x1.toStringAsFixed(4)}, ${y1.toStringAsFixed(4)}, ${x2.toStringAsFixed(4)}, ${y2.toStringAsFixed(4)}, ${x3.toStringAsFixed(4)}, ${y3.toStringAsFixed(4)})'); - } - - @override - void lineTo(double x, double y) { - actualCommands - .add('lineTo(${x.toStringAsFixed(4)}, ${y.toStringAsFixed(4)})'); - } - - @override - void moveTo(double x, double y) { - actualCommands - .add('moveTo(${x.toStringAsFixed(4)}, ${y.toStringAsFixed(4)})'); - } - - void validate() { - expect(expectedCommands, orderedEquals(actualCommands)); - } -} - -void main() { - void assertValidPath(String input, List commands) { - final DeepTestPathProxy proxy = DeepTestPathProxy(commands); - writeSvgPathDataToPath(input, proxy); - proxy.validate(); - } - - test('Deep path validation', () { - assertValidPath('M20,30 Q40,5 60,30 T100,30', [ - 'moveTo(20.0000, 30.0000)', - 'cubicTo(33.3333, 13.3333, 46.6667, 13.3333, 60.0000, 30.0000)', - 'cubicTo(73.3333, 46.6667, 86.6667, 46.6667, 100.0000, 30.0000)' - ]); - - assertValidPath( - 'M5.5 5.5a.5 1.5 30 1 1-.866-.5.5 1.5 30 1 1 .866.5z', [ - 'moveTo(5.5000, 5.5000)', - 'cubicTo(5.2319, 5.9667, 4.9001, 6.3513, 4.6307, 6.5077)', - 'cubicTo(4.3612, 6.6640, 4.1953, 6.5683, 4.1960, 6.2567)', - 'cubicTo(4.1967, 5.9451, 4.3638, 5.4655, 4.6340, 5.0000)', - 'cubicTo(4.9021, 4.5333, 5.2339, 4.1487, 5.5033, 3.9923)', - 'cubicTo(5.7728, 3.8360, 5.9387, 3.9317, 5.9380, 4.2433)', - 'cubicTo(5.9373, 4.5549, 5.7702, 5.0345, 5.5000, 5.5000)', - 'close()' - ]); - }); -} diff --git a/ohos/path_parsing_test/test/parse_path_test.dart b/ohos/path_parsing_test/test/parse_path_test.dart deleted file mode 100644 index 72c4e370..00000000 --- a/ohos/path_parsing_test/test/parse_path_test.dart +++ /dev/null @@ -1,248 +0,0 @@ -// Test paths taken from: -// * https://github.com/chromium/chromium/blob/master/third_party/blink/renderer/core/svg/svg_path_parser_test.cc - -import 'package:path_parsing/path_parsing.dart'; -import 'package:path_parsing/src/path_segment_type.dart'; -import 'package:test/test.dart'; - -// TODO(dnfield): a bunch of better tests could be written to track that commands are actually called with expected values/order -// For now we just want to know that something gets emitted and no exceptions are thrown (that's all the legacy tests really did anyway). -class TestPathProxy extends PathProxy { - bool called = false; - @override - void close() { - called = true; - } - - @override - void cubicTo( - double x1, - double y1, - double x2, - double y2, - double x3, - double y3, - ) { - called = true; - } - - @override - void lineTo(double x, double y) { - called = true; - } - - @override - void moveTo(double x, double y) { - called = true; - } -} - -void main() { - void assertValidPath(String input) { - final TestPathProxy proxy = TestPathProxy(); - // these shouldn't throw or assert - writeSvgPathDataToPath(input, proxy); - expect(proxy.called, true); - } - - void assertInvalidPath(String input) { - expect( - () => writeSvgPathDataToPath(input, TestPathProxy()), throwsStateError); - } - - test('Valid Paths', () { - assertValidPath('M1,2'); - assertValidPath('m1,2'); - assertValidPath('M100,200 m3,4'); - assertValidPath('M100,200 L3,4'); - assertValidPath('M100,200 l3,4'); - assertValidPath('M100,200 H3'); - assertValidPath('M100,200 h3'); - assertValidPath('M100,200 V3'); - assertValidPath('M100,200 v3'); - assertValidPath('M100,200 Z'); - assertValidPath('M100,200 z'); - assertValidPath('M100,200 C3,4,5,6,7,8'); - assertValidPath('M100,200 c3,4,5,6,7,8'); - assertValidPath('M100,200 S3,4,5,6'); - assertValidPath('M100,200 s3,4,5,6'); - assertValidPath('M100,200 Q3,4,5,6'); - assertValidPath('M100,200 q3,4,5,6'); - assertValidPath('M100,200 T3,4'); - assertValidPath('M100,200 t3,4'); - assertValidPath('M100,200 A3,4,5,0,0,6,7'); - assertValidPath('M100,200 A3,4,5,1,0,6,7'); - assertValidPath('M100,200 A3,4,5,0,1,6,7'); - assertValidPath('M100,200 A3,4,5,1,1,6,7'); - assertValidPath('M100,200 a3,4,5,0,0,6,7'); - assertValidPath('M100,200 a3,4,5,0,1,6,7'); - assertValidPath('M100,200 a3,4,5,1,0,6,7'); - assertValidPath('M100,200 a3,4,5,1,1,6,7'); - assertValidPath('M100,200 a3,4,5,006,7'); - assertValidPath('M100,200 a3,4,5,016,7'); - assertValidPath('M100,200 a3,4,5,106,7'); - assertValidPath('M100,200 a3,4,5,116,7'); - assertValidPath( - '''M19.0281,19.40466 20.7195,19.40466 20.7195,15.71439 24.11486,15.71439 24.11486,14.36762 20.7195,14.36762 -20.7195,11.68641 24.74134,11.68641 24.74134,10.34618 19.0281,10.34618 z'''); - - assertValidPath( - 'M100,200 a0,4,5,0,0,10,0 a4,0,5,0,0,0,10 a0,0,5,0,0,-10,0 z'); - - assertValidPath('M1,2,3,4'); - assertValidPath('m100,200,3,4'); - - assertValidPath('M 100-200'); - assertValidPath('M 0.6.5'); - - assertValidPath(' M1,2'); - assertValidPath(' M1,2'); - assertValidPath('\tM1,2'); - assertValidPath('\nM1,2'); - assertValidPath('\rM1,2'); - assertValidPath('M1,2 '); - assertValidPath('M1,2\t'); - assertValidPath('M1,2\n'); - assertValidPath('M1,2\r'); - // assertValidPath(''); - // assertValidPath(' '); - assertValidPath('M.1 .2 L.3 .4 .5 .6'); - assertValidPath('M1,1h2,3'); - assertValidPath('M1,1H2,3'); - assertValidPath('M1,1v2,3'); - assertValidPath('M1,1V2,3'); - assertValidPath('M1,1c2,3 4,5 6,7 8,9 10,11 12,13'); - assertValidPath('M1,1C2,3 4,5 6,7 8,9 10,11 12,13'); - assertValidPath('M1,1s2,3 4,5 6,7 8,9'); - assertValidPath('M1,1S2,3 4,5 6,7 8,9'); - assertValidPath('M1,1q2,3 4,5 6,7 8,9'); - assertValidPath('M1,1Q2,3 4,5 6,7 8,9'); - assertValidPath('M1,1t2,3 4,5'); - assertValidPath('M1,1T2,3 4,5'); - assertValidPath('M1,1a2,3,4,0,0,5,6 7,8,9,0,0,10,11'); - assertValidPath('M1,1A2,3,4,0,0,5,6 7,8,9,0,0,10,11'); - assertValidPath( - 'M22.1595 3.80852C19.6789 1.35254 16.3807 -4.80966e-07 12.8727 ' - '-4.80966e-07C9.36452 -4.80966e-07 6.06642 1.35254 3.58579 3.80852C1.77297 5.60333 ' - '0.53896 7.8599 0.0171889 10.3343C-0.0738999 10.7666 0.206109 11.1901 0.64265 11.2803' - 'C1.07908 11.3706 1.50711 11.0934 1.5982 10.661C2.05552 8.49195 3.13775 6.51338 4.72783 ' - '4.9391C9.21893 0.492838 16.5262 0.492728 21.0173 4.9391C25.5082 9.38548 25.5082 16.6202 ' - '21.0173 21.0667C16.5265 25.5132 9.21893 25.5133 4.72805 21.0669C3.17644 19.5307 2.10538 ' - '17.6035 1.63081 15.4937C1.53386 15.0627 1.10252 14.7908 0.66697 14.887C0.231645 14.983 ' - '-0.0427272 15.4103 0.0542205 15.8413C0.595668 18.2481 1.81686 20.4461 3.5859 22.1976' - 'C6.14623 24.7325 9.50955 26 12.8727 26C16.236 26 19.5991 24.7326 22.1595 22.1976C27.2802 ' - '17.1277 27.2802 8.87841 22.1595 3.80852Z'); - assertValidPath( - 'm18 11.8a.41.41 0 0 1 .24.08l.59.43h.05.72a.4.4 0 0 1 .39.28l.22.69a.08.08 0 ' - '0 0 0 0l.58.43a.41.41 0 0 1 .15.45l-.22.68a.09.09 0 0 0 0 .07l.22.68a.4.4 0 0 1 ' - '-.15.46l-.58.42a.1.1 0 0 0 0 0l-.22.68a.41.41 0 0 1 -.38.29h-.79l-.58.43a.41.41 0 ' - '0 1 -.24.08.46.46 0 0 1 -.24-.08l-.58-.43h-.06-.72a.41.41 0 0 1 -.39-.28l-.22-.68' - 'a.1.1 0 0 0 0 0l-.58-.43a.42.42 0 0 1 -.15-.46l.23-.67v-.02l-.29-.68a.43.43 0 0 1 ' - '.15-.46l.58-.42a.1.1 0 0 0 0-.05l.27-.69a.42.42 0 0 1 .39-.28h.78l.58-.43a.43.43 0 ' - '0 1 .25-.09m0-1a1.37 1.37 0 0 0 -.83.27l-.34.25h-.43a1.42 1.42 0 0 0 -1.34 1l-.13.4' - '-.35.25a1.42 1.42 0 0 0 -.51 1.58l.13.4-.13.4a1.39 1.39 0 0 0 .52 1.59l.34.25.13.4' - 'a1.41 1.41 0 0 0 1.34 1h.43l.34.26a1.44 1.44 0 0 0 .83.27 1.38 1.38 0 0 0 .83-.28' - 'l.35-.24h.43a1.4 1.4 0 0 0 1.33-1l.13-.4.35-.26a1.39 1.39 0 0 0 .51-1.57l-.13-.4.13-.41' - 'a1.4 1.4 0 0 0 -.51-1.56l-.35-.25-.13-.41a1.4 1.4 0 0 0 -1.34-1h-.42l-.34-.26a1.43 1.43 ' - '0 0 0 -.84-.28z'); - }); - - test('Malformed Paths', () { - assertInvalidPath('M100,200 a3,4,5,2,1,6,7'); - assertInvalidPath('M100,200 a3,4,5,1,2,6,7'); - - assertInvalidPath('\vM1,2'); - assertInvalidPath('xM1,2'); - assertInvalidPath('M1,2\v'); - assertInvalidPath('M1,2x'); - assertInvalidPath('M1,2 L40,0#90'); - - assertInvalidPath('x'); - assertInvalidPath('L1,2'); - - assertInvalidPath('M'); - assertInvalidPath('M\0'); - - assertInvalidPath('M1,1Z0'); - assertInvalidPath('M1,1z0'); - - assertInvalidPath('M1,1c2,3 4,5 6,7 8'); - assertInvalidPath('M1,1C2,3 4,5 6,7 8'); - assertInvalidPath('M1,1s2,3 4,5 6'); - assertInvalidPath('M1,1S2,3 4,5 6'); - assertInvalidPath('M1,1q2,3 4,5 6'); - assertInvalidPath('M1,1Q2,3 4,5 6'); - assertInvalidPath('M1,1t2,3 4'); - assertInvalidPath('M1,1T2,3 4'); - assertInvalidPath('M1,1a2,3,4,0,0,5,6 7'); - assertInvalidPath('M1,1A2,3,4,0,0,5,6 7'); - }); - - test('Missing commands/numbers/flags', () { - // Missing initial moveto. - assertInvalidPath(' 10 10'); - assertInvalidPath('L 10 10'); - // Invalid command letter. - assertInvalidPath('M 10 10 #'); - assertInvalidPath('M 10 10 E 100 100'); - // Invalid number. - assertInvalidPath('M 10 10 L100 '); - assertInvalidPath('M 10 10 L100 #'); - assertInvalidPath('M 10 10 L100#100'); - assertInvalidPath('M0,0 A#,10 0 0,0 20,20'); - assertInvalidPath('M0,0 A10,# 0 0,0 20,20'); - assertInvalidPath('M0,0 A10,10 # 0,0 20,20'); - assertInvalidPath('M0,0 A10,10 0 0,0 #,20'); - assertInvalidPath('M0,0 A10,10 0 0,0 20,#'); - // Invalid arc-flag. - assertInvalidPath('M0,0 A10,10 0 #,0 20,20'); - assertInvalidPath('M0,0 A10,10 0 0,# 20,20'); - assertInvalidPath('M0,0 A10,10 0 0,2 20,20'); - }); - - test('Check character constants', () { - expect(AsciiConstants.slashT, '\t'.codeUnitAt(0)); - expect(AsciiConstants.slashN, '\n'.codeUnitAt(0)); - expect(AsciiConstants.slashF, '\f'.codeUnitAt(0)); - expect(AsciiConstants.slashR, '\r'.codeUnitAt(0)); - expect(AsciiConstants.space, ' '.codeUnitAt(0)); - expect(AsciiConstants.period, '.'.codeUnitAt(0)); - expect(AsciiConstants.plus, '+'.codeUnitAt(0)); - expect(AsciiConstants.comma, ','.codeUnitAt(0)); - expect(AsciiConstants.minus, '-'.codeUnitAt(0)); - expect(AsciiConstants.number0, '0'.codeUnitAt(0)); - expect(AsciiConstants.number1, '1'.codeUnitAt(0)); - expect(AsciiConstants.number2, '2'.codeUnitAt(0)); - expect(AsciiConstants.number3, '3'.codeUnitAt(0)); - expect(AsciiConstants.number4, '4'.codeUnitAt(0)); - expect(AsciiConstants.number5, '5'.codeUnitAt(0)); - expect(AsciiConstants.number6, '6'.codeUnitAt(0)); - expect(AsciiConstants.number7, '7'.codeUnitAt(0)); - expect(AsciiConstants.number8, '8'.codeUnitAt(0)); - expect(AsciiConstants.number9, '9'.codeUnitAt(0)); - expect(AsciiConstants.upperA, 'A'.codeUnitAt(0)); - expect(AsciiConstants.upperC, 'C'.codeUnitAt(0)); - expect(AsciiConstants.upperE, 'E'.codeUnitAt(0)); - expect(AsciiConstants.upperH, 'H'.codeUnitAt(0)); - expect(AsciiConstants.upperL, 'L'.codeUnitAt(0)); - expect(AsciiConstants.upperM, 'M'.codeUnitAt(0)); - expect(AsciiConstants.upperQ, 'Q'.codeUnitAt(0)); - expect(AsciiConstants.upperS, 'S'.codeUnitAt(0)); - expect(AsciiConstants.upperT, 'T'.codeUnitAt(0)); - expect(AsciiConstants.upperV, 'V'.codeUnitAt(0)); - expect(AsciiConstants.upperZ, 'Z'.codeUnitAt(0)); - expect(AsciiConstants.lowerA, 'a'.codeUnitAt(0)); - expect(AsciiConstants.lowerC, 'c'.codeUnitAt(0)); - expect(AsciiConstants.lowerE, 'e'.codeUnitAt(0)); - expect(AsciiConstants.lowerH, 'h'.codeUnitAt(0)); - expect(AsciiConstants.lowerL, 'l'.codeUnitAt(0)); - expect(AsciiConstants.lowerM, 'm'.codeUnitAt(0)); - expect(AsciiConstants.lowerQ, 'q'.codeUnitAt(0)); - expect(AsciiConstants.lowerS, 's'.codeUnitAt(0)); - expect(AsciiConstants.lowerT, 't'.codeUnitAt(0)); - expect(AsciiConstants.lowerV, 'v'.codeUnitAt(0)); - expect(AsciiConstants.lowerX, 'x'.codeUnitAt(0)); - expect(AsciiConstants.lowerZ, 'z'.codeUnitAt(0)); - expect(AsciiConstants.tilde, '~'.codeUnitAt(0)); - }); -} -- Gitee From b6c39b1a81c6ae287715232b14a58f2069ea1b9a Mon Sep 17 00:00:00 2001 From: liuja <542689970@qq.com> Date: Tue, 26 Nov 2024 17:40:29 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=89=88=E6=9D=83?= =?UTF-8?q?=E5=A4=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liuja <542689970@qq.com> --- ohos/path_parsing_test/.metadata | 7 ++++++ .../android/app/src/debug/AndroidManifest.xml | 4 ++++ .../lz_path_parsing_test/MainActivity.java | 17 +++++++++++++ .../res/drawable-v21/launch_background.xml | 5 ++++ .../app/src/main/res/values/styles.xml | 4 ++++ .../ets/plugins/GeneratedPluginRegistrant.ets | 24 ------------------- 6 files changed, 37 insertions(+), 24 deletions(-) delete mode 100644 ohos/path_parsing_test/ohos/entry/src/main/ets/plugins/GeneratedPluginRegistrant.ets diff --git a/ohos/path_parsing_test/.metadata b/ohos/path_parsing_test/.metadata index 9c2b3968..dc91ea91 100644 --- a/ohos/path_parsing_test/.metadata +++ b/ohos/path_parsing_test/.metadata @@ -1,3 +1,10 @@ +# +# 本代码遵循MIT许可证 +# 版权所有 (c) 2023 ciairobot +# +# 许可声明: +# 本软件遵循MIT许可证,详情见 https://opensource.org/licenses/MIT +# # This file tracks properties of this Flutter project. # Used by Flutter tool to assess capabilities and perform upgrades etc. # diff --git a/ohos/path_parsing_test/android/app/src/debug/AndroidManifest.xml b/ohos/path_parsing_test/android/app/src/debug/AndroidManifest.xml index d3e835ba..d7b7f3ab 100644 --- a/ohos/path_parsing_test/android/app/src/debug/AndroidManifest.xml +++ b/ohos/path_parsing_test/android/app/src/debug/AndroidManifest.xml @@ -1,3 +1,7 @@ + + + diff --git a/ohos/path_parsing_test/android/app/src/main/res/values/styles.xml b/ohos/path_parsing_test/android/app/src/main/res/values/styles.xml index cb1ef880..10aad3f4 100644 --- a/ohos/path_parsing_test/android/app/src/main/res/values/styles.xml +++ b/ohos/path_parsing_test/android/app/src/main/res/values/styles.xml @@ -1,3 +1,7 @@ + + diff --git a/ohos/path_parsing_test/ohos/entry/src/main/ets/plugins/GeneratedPluginRegistrant.ets b/ohos/path_parsing_test/ohos/entry/src/main/ets/plugins/GeneratedPluginRegistrant.ets deleted file mode 100644 index f28ced70..00000000 --- a/ohos/path_parsing_test/ohos/entry/src/main/ets/plugins/GeneratedPluginRegistrant.ets +++ /dev/null @@ -1,24 +0,0 @@ -import { FlutterEngine, Log } from '@ohos/flutter_ohos'; - -/** - * Generated file. Do not edit. - * This file is generated by the Flutter tool based on the - * plugins that support the Ohos platform. - */ - -const TAG = "GeneratedPluginRegistrant"; - -export class GeneratedPluginRegistrant { - - static registerWith(flutterEngine: FlutterEngine) { - try { - } catch (e) { - Log.e( - TAG, - "Tried to register plugins with FlutterEngine (" - + flutterEngine - + ") failed."); - Log.e(TAG, "Received exception while registering", e); - } - } -} -- Gitee From 66bd52f5fe5fc82e8a63ec1e410cdb20638e222b Mon Sep 17 00:00:00 2001 From: liuja <542689970@qq.com> Date: Tue, 26 Nov 2024 18:00:19 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=89=88=E6=9D=83?= =?UTF-8?q?=E5=A4=B41?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liuja <542689970@qq.com> --- ohos/path_parsing_test/.metadata | 7 ------- .../android/app/src/debug/AndroidManifest.xml | 4 ---- .../lz_path_parsing_test/MainActivity.java | 17 ----------------- .../main/res/drawable-v21/launch_background.xml | 5 ----- .../android/app/src/main/res/values/styles.xml | 4 ---- 5 files changed, 37 deletions(-) diff --git a/ohos/path_parsing_test/.metadata b/ohos/path_parsing_test/.metadata index dc91ea91..9c2b3968 100644 --- a/ohos/path_parsing_test/.metadata +++ b/ohos/path_parsing_test/.metadata @@ -1,10 +1,3 @@ -# -# 本代码遵循MIT许可证 -# 版权所有 (c) 2023 ciairobot -# -# 许可声明: -# 本软件遵循MIT许可证,详情见 https://opensource.org/licenses/MIT -# # This file tracks properties of this Flutter project. # Used by Flutter tool to assess capabilities and perform upgrades etc. # diff --git a/ohos/path_parsing_test/android/app/src/debug/AndroidManifest.xml b/ohos/path_parsing_test/android/app/src/debug/AndroidManifest.xml index d7b7f3ab..d3e835ba 100644 --- a/ohos/path_parsing_test/android/app/src/debug/AndroidManifest.xml +++ b/ohos/path_parsing_test/android/app/src/debug/AndroidManifest.xml @@ -1,7 +1,3 @@ - - - diff --git a/ohos/path_parsing_test/android/app/src/main/res/values/styles.xml b/ohos/path_parsing_test/android/app/src/main/res/values/styles.xml index 10aad3f4..cb1ef880 100644 --- a/ohos/path_parsing_test/android/app/src/main/res/values/styles.xml +++ b/ohos/path_parsing_test/android/app/src/main/res/values/styles.xml @@ -1,7 +1,3 @@ - - -- Gitee From 967ee2e910d3258b7d234aa0da304855be9d0cc5 Mon Sep 17 00:00:00 2001 From: liuja <542689970@qq.com> Date: Wed, 27 Nov 2024 09:16:36 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=89=88=E6=9D=83?= =?UTF-8?q?=E5=A4=B42?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liuja <542689970@qq.com> --- ohos/path_parsing_test/.metadata | 13 +++++++++++++ .../android/app/src/debug/AndroidManifest.xml | 15 +++++++++++++++ .../lz_path_parsing_test/MainActivity.java | 14 ++++++++++++++ .../main/res/drawable-v21/launch_background.xml | 14 ++++++++++++++ .../android/app/src/main/res/values/styles.xml | 15 +++++++++++++++ 5 files changed, 71 insertions(+) diff --git a/ohos/path_parsing_test/.metadata b/ohos/path_parsing_test/.metadata index 9c2b3968..cc6478bd 100644 --- a/ohos/path_parsing_test/.metadata +++ b/ohos/path_parsing_test/.metadata @@ -1,3 +1,16 @@ +# Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + # This file tracks properties of this Flutter project. # Used by Flutter tool to assess capabilities and perform upgrades etc. # diff --git a/ohos/path_parsing_test/android/app/src/debug/AndroidManifest.xml b/ohos/path_parsing_test/android/app/src/debug/AndroidManifest.xml index d3e835ba..a101abb5 100644 --- a/ohos/path_parsing_test/android/app/src/debug/AndroidManifest.xml +++ b/ohos/path_parsing_test/android/app/src/debug/AndroidManifest.xml @@ -1,3 +1,18 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + diff --git a/ohos/path_parsing_test/android/app/src/main/res/values/styles.xml b/ohos/path_parsing_test/android/app/src/main/res/values/styles.xml index cb1ef880..5716e25c 100644 --- a/ohos/path_parsing_test/android/app/src/main/res/values/styles.xml +++ b/ohos/path_parsing_test/android/app/src/main/res/values/styles.xml @@ -1,3 +1,18 @@ +/* +* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + -- Gitee From 8a555fe09dc2a31d8cb6edd1d697a1114f218a7e Mon Sep 17 00:00:00 2001 From: liuja <542689970@qq.com> Date: Wed, 27 Nov 2024 09:46:06 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=89=88=E6=9D=83?= =?UTF-8?q?=E5=A4=B43?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liuja <542689970@qq.com> --- ohos/path_parsing_test/analysis_options.yaml | 29 +++++++++ ohos/path_parsing_test/android/.gitignore | 13 ---- .../android/app/build.gradle | 59 ------------------ .../android/app/src/debug/AndroidManifest.xml | 23 ------- .../android/app/src/main/AndroidManifest.xml | 34 ---------- .../lz_path_parsing_test/MainActivity.java | 20 ------ .../res/drawable-v21/launch_background.xml | 26 -------- .../main/res/drawable/launch_background.xml | 12 ---- .../src/main/res/mipmap-hdpi/ic_launcher.png | Bin 544 -> 0 bytes .../src/main/res/mipmap-mdpi/ic_launcher.png | Bin 442 -> 0 bytes .../src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 721 -> 0 bytes .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin 1031 -> 0 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.png | Bin 1443 -> 0 bytes .../app/src/main/res/values-night/styles.xml | 18 ------ .../app/src/main/res/values/styles.xml | 33 ---------- .../app/src/profile/AndroidManifest.xml | 8 --- ohos/path_parsing_test/android/build.gradle | 31 --------- .../android/gradle.properties | 3 - .../gradle/wrapper/gradle-wrapper.properties | 5 -- .../path_parsing_test/android/settings.gradle | 11 ---- ohos/path_parsing_test/lib/main.dart | 5 -- .../path_parsing_test/ohos/AppScope/app.json5 | 2 +- .../resources/base/element/string.json | 2 +- .../ohos/build-profile.json5 | 16 +---- .../ets/plugins/GeneratedPluginRegistrant.ets | 24 +++++++ .../main/resources/base/element/string.json | 2 +- .../main/resources/en_US/element/string.json | 2 +- .../main/resources/zh_CN/element/string.json | 2 +- ohos/path_parsing_test/ohos/oh-package.json5 | 2 +- ohos/path_parsing_test/test/widget_test.dart | 30 +++++++++ 30 files changed, 90 insertions(+), 322 deletions(-) create mode 100644 ohos/path_parsing_test/analysis_options.yaml delete mode 100644 ohos/path_parsing_test/android/.gitignore delete mode 100644 ohos/path_parsing_test/android/app/build.gradle delete mode 100644 ohos/path_parsing_test/android/app/src/debug/AndroidManifest.xml delete mode 100644 ohos/path_parsing_test/android/app/src/main/AndroidManifest.xml delete mode 100644 ohos/path_parsing_test/android/app/src/main/java/com/example/lz_path_parsing_test/MainActivity.java delete mode 100644 ohos/path_parsing_test/android/app/src/main/res/drawable-v21/launch_background.xml delete mode 100644 ohos/path_parsing_test/android/app/src/main/res/drawable/launch_background.xml delete mode 100644 ohos/path_parsing_test/android/app/src/main/res/mipmap-hdpi/ic_launcher.png delete mode 100644 ohos/path_parsing_test/android/app/src/main/res/mipmap-mdpi/ic_launcher.png delete mode 100644 ohos/path_parsing_test/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png delete mode 100644 ohos/path_parsing_test/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png delete mode 100644 ohos/path_parsing_test/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png delete mode 100644 ohos/path_parsing_test/android/app/src/main/res/values-night/styles.xml delete mode 100644 ohos/path_parsing_test/android/app/src/main/res/values/styles.xml delete mode 100644 ohos/path_parsing_test/android/app/src/profile/AndroidManifest.xml delete mode 100644 ohos/path_parsing_test/android/build.gradle delete mode 100644 ohos/path_parsing_test/android/gradle.properties delete mode 100644 ohos/path_parsing_test/android/gradle/wrapper/gradle-wrapper.properties delete mode 100644 ohos/path_parsing_test/android/settings.gradle create mode 100644 ohos/path_parsing_test/ohos/entry/src/main/ets/plugins/GeneratedPluginRegistrant.ets create mode 100644 ohos/path_parsing_test/test/widget_test.dart diff --git a/ohos/path_parsing_test/analysis_options.yaml b/ohos/path_parsing_test/analysis_options.yaml new file mode 100644 index 00000000..61b6c4de --- /dev/null +++ b/ohos/path_parsing_test/analysis_options.yaml @@ -0,0 +1,29 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at + # https://dart-lang.github.io/linter/lints/index.html. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # 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: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/ohos/path_parsing_test/android/.gitignore b/ohos/path_parsing_test/android/.gitignore deleted file mode 100644 index 6f568019..00000000 --- a/ohos/path_parsing_test/android/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -gradle-wrapper.jar -/.gradle -/captures/ -/gradlew -/gradlew.bat -/local.properties -GeneratedPluginRegistrant.java - -# Remember to never publicly share your keystore. -# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app -key.properties -**/*.keystore -**/*.jks diff --git a/ohos/path_parsing_test/android/app/build.gradle b/ohos/path_parsing_test/android/app/build.gradle deleted file mode 100644 index 287e2ade..00000000 --- a/ohos/path_parsing_test/android/app/build.gradle +++ /dev/null @@ -1,59 +0,0 @@ -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterRoot = localProperties.getProperty('flutter.sdk') -if (flutterRoot == null) { - throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - -android { - compileSdkVersion flutter.compileSdkVersion - ndkVersion flutter.ndkVersion - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "com.example.lz_path_parsing_test" - // You can update the following values to match your application needs. - // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. - minSdkVersion flutter.minSdkVersion - targetSdkVersion flutter.targetSdkVersion - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - } - - buildTypes { - release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig signingConfigs.debug - } - } -} - -flutter { - source '../..' -} diff --git a/ohos/path_parsing_test/android/app/src/debug/AndroidManifest.xml b/ohos/path_parsing_test/android/app/src/debug/AndroidManifest.xml deleted file mode 100644 index a101abb5..00000000 --- a/ohos/path_parsing_test/android/app/src/debug/AndroidManifest.xml +++ /dev/null @@ -1,23 +0,0 @@ -/* -* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - - - - - diff --git a/ohos/path_parsing_test/android/app/src/main/AndroidManifest.xml b/ohos/path_parsing_test/android/app/src/main/AndroidManifest.xml deleted file mode 100644 index 01e3c653..00000000 --- a/ohos/path_parsing_test/android/app/src/main/AndroidManifest.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - diff --git a/ohos/path_parsing_test/android/app/src/main/java/com/example/lz_path_parsing_test/MainActivity.java b/ohos/path_parsing_test/android/app/src/main/java/com/example/lz_path_parsing_test/MainActivity.java deleted file mode 100644 index ffd844ec..00000000 --- a/ohos/path_parsing_test/android/app/src/main/java/com/example/lz_path_parsing_test/MainActivity.java +++ /dev/null @@ -1,20 +0,0 @@ -/* -* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -package com.example.lz_path_parsing_test; - -import io.flutter.embedding.android.FlutterActivity; - -public class MainActivity extends FlutterActivity { -} diff --git a/ohos/path_parsing_test/android/app/src/main/res/drawable-v21/launch_background.xml b/ohos/path_parsing_test/android/app/src/main/res/drawable-v21/launch_background.xml deleted file mode 100644 index a4353423..00000000 --- a/ohos/path_parsing_test/android/app/src/main/res/drawable-v21/launch_background.xml +++ /dev/null @@ -1,26 +0,0 @@ -/* -* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - - - - - - - - diff --git a/ohos/path_parsing_test/android/app/src/main/res/drawable/launch_background.xml b/ohos/path_parsing_test/android/app/src/main/res/drawable/launch_background.xml deleted file mode 100644 index 304732f8..00000000 --- a/ohos/path_parsing_test/android/app/src/main/res/drawable/launch_background.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - diff --git a/ohos/path_parsing_test/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/ohos/path_parsing_test/android/app/src/main/res/mipmap-hdpi/ic_launcher.png deleted file mode 100644 index db77bb4b7b0906d62b1847e87f15cdcacf6a4f29..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 544 zcmeAS@N?(olHy`uVBq!ia0vp^9w5xY3?!3`olAj~WQl7;NpOBzNqJ&XDuZK6ep0G} zXKrG8YEWuoN@d~6R2!h8bpbvhu0Wd6uZuB!w&u2PAxD2eNXD>P5D~Wn-+_Wa#27Xc zC?Zj|6r#X(-D3u$NCt}(Ms06KgJ4FxJVv{GM)!I~&n8Bnc94O7-Hd)cjDZswgC;Qs zO=b+9!WcT8F?0rF7!Uys2bs@gozCP?z~o%U|N3vA*22NaGQG zlg@K`O_XuxvZ&Ks^m&R!`&1=spLvfx7oGDKDwpwW`#iqdw@AL`7MR}m`rwr|mZgU`8P7SBkL78fFf!WnuYWm$5Z0 zNXhDbCv&49sM544K|?c)WrFfiZvCi9h0O)B3Pgg&ebxsLQ05GG~ AQ2+n{ diff --git a/ohos/path_parsing_test/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/ohos/path_parsing_test/android/app/src/main/res/mipmap-mdpi/ic_launcher.png deleted file mode 100644 index 17987b79bb8a35cc66c3c1fd44f5a5526c1b78be..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 442 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA3?vioaBc-sk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5Xx&nMcT!A!W`0S9QKQy;}1Cl^CgaH=;G9cpY;r$Q>i*pfB zP2drbID<_#qf;rPZx^FqH)F_D#*k@@q03KywUtLX8Ua?`H+NMzkczFPK3lFz@i_kW%1NOn0|D2I9n9wzH8m|-tHjsw|9>@K=iMBhxvkv6m8Y-l zytQ?X=U+MF$@3 zt`~i=@j|6y)RWMK--}M|=T`o&^Ni>IoWKHEbBXz7?A@mgWoL>!*SXo`SZH-*HSdS+ yn*9;$7;m`l>wYBC5bq;=U}IMqLzqbYCidGC!)_gkIk_C@Uy!y&wkt5C($~2D>~)O*cj@FGjOCM)M>_ixfudOh)?xMu#Fs z#}Y=@YDTwOM)x{K_j*Q;dPdJ?Mz0n|pLRx{4n|)f>SXlmV)XB04CrSJn#dS5nK2lM zrZ9#~WelCp7&e13Y$jvaEXHskn$2V!!DN-nWS__6T*l;H&Fopn?A6HZ-6WRLFP=R` zqG+CE#d4|IbyAI+rJJ`&x9*T`+a=p|0O(+s{UBcyZdkhj=yS1>AirP+0R;mf2uMgM zC}@~JfByORAh4SyRgi&!(cja>F(l*O+nd+@4m$|6K6KDn_&uvCpV23&>G9HJp{xgg zoq1^2_p9@|WEo z*X_Uko@K)qYYv~>43eQGMdbiGbo>E~Q& zrYBH{QP^@Sti!`2)uG{irBBq@y*$B zi#&(U-*=fp74j)RyIw49+0MRPMRU)+a2r*PJ$L5roHt2$UjExCTZSbq%V!HeS7J$N zdG@vOZB4v_lF7Plrx+hxo7(fCV&}fHq)$ diff --git a/ohos/path_parsing_test/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/ohos/path_parsing_test/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png deleted file mode 100644 index d5f1c8d34e7a88e3f88bea192c3a370d44689c3c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1031 zcmeAS@N?(olHy`uVBq!ia0vp^6F``Q8Ax83A=Cw=BuiW)N`mv#O3D+9QW+dm@{>{( zJaZG%Q-e|yQz{EjrrIztFa`(sgt!6~Yi|1%a`XoT0ojZ}lNrNjb9xjc(B0U1_% zz5^97Xt*%oq$rQy4?0GKNfJ44uvxI)gC`h-NZ|&0-7(qS@?b!5r36oQ}zyZrNO3 zMO=Or+<~>+A&uN&E!^Sl+>xE!QC-|oJv`ApDhqC^EWD|@=#J`=d#Xzxs4ah}w&Jnc z$|q_opQ^2TrnVZ0o~wh<3t%W&flvYGe#$xqda2bR_R zvPYgMcHgjZ5nSA^lJr%;<&0do;O^tDDh~=pIxA#coaCY>&N%M2^tq^U%3DB@ynvKo}b?yu-bFc-u0JHzced$sg7S3zqI(2 z#Km{dPr7I=pQ5>FuK#)QwK?Y`E`B?nP+}U)I#c1+FM*1kNvWG|a(TpksZQ3B@sD~b zpQ2)*V*TdwjFOtHvV|;OsiDqHi=6%)o4b!)x$)%9pGTsE z-JL={-Ffv+T87W(Xpooq<`r*VzWQcgBN$$`u}f>-ZQI1BB8ykN*=e4rIsJx9>z}*o zo~|9I;xof diff --git a/ohos/path_parsing_test/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/ohos/path_parsing_test/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png deleted file mode 100644 index 4d6372eebdb28e45604e46eeda8dd24651419bc0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1443 zcmb`G{WsKk6vsdJTdFg%tJav9_E4vzrOaqkWF|A724Nly!y+?N9`YV6wZ}5(X(D_N(?!*n3`|_r0Hc?=PQw&*vnU?QTFY zB_MsH|!j$PP;I}?dppoE_gA(4uc!jV&0!l7_;&p2^pxNo>PEcNJv za5_RT$o2Mf!<+r?&EbHH6nMoTsDOa;mN(wv8RNsHpG)`^ymG-S5By8=l9iVXzN_eG%Xg2@Xeq76tTZ*dGh~Lo9vl;Zfs+W#BydUw zCkZ$o1LqWQO$FC9aKlLl*7x9^0q%0}$OMlp@Kk_jHXOjofdePND+j!A{q!8~Jn+s3 z?~~w@4?egS02}8NuulUA=L~QQfm;MzCGd)XhiftT;+zFO&JVyp2mBww?;QByS_1w! zrQlx%{^cMj0|Bo1FjwY@Q8?Hx0cIPF*@-ZRFpPc#bBw{5@tD(5%sClzIfl8WU~V#u zm5Q;_F!wa$BSpqhN>W@2De?TKWR*!ujY;Yylk_X5#~V!L*Gw~;$%4Q8~Mad z@`-kG?yb$a9cHIApZDVZ^U6Xkp<*4rU82O7%}0jjHlK{id@?-wpN*fCHXyXh(bLt* zPc}H-x0e4E&nQ>y%B-(EL=9}RyC%MyX=upHuFhAk&MLbsF0LP-q`XnH78@fT+pKPW zu72MW`|?8ht^tz$iC}ZwLp4tB;Q49K!QCF3@!iB1qOI=?w z7In!}F~ij(18UYUjnbmC!qKhPo%24?8U1x{7o(+?^Zu0Hx81|FuS?bJ0jgBhEMzf< zCgUq7r2OCB(`XkKcN-TL>u5y#dD6D!)5W?`O5)V^>jb)P)GBdy%t$uUMpf$SNV31$ zb||OojAbvMP?T@$h_ZiFLFVHDmbyMhJF|-_)HX3%m=CDI+ID$0^C>kzxprBW)hw(v zr!Gmda);ICoQyhV_oP5+C%?jcG8v+D@9f?Dk*!BxY}dazmrT@64UrP3hlslANK)bq z$67n83eh}OeW&SV@HG95P|bjfqJ7gw$e+`Hxo!4cx`jdK1bJ>YDSpGKLPZ^1cv$ek zIB?0S<#tX?SJCLWdMd{-ME?$hc7A$zBOdIJ)4!KcAwb=VMov)nK;9z>x~rfT1>dS+ zZ6#`2v@`jgbqq)P22H)Tx2CpmM^o1$B+xT6`(v%5xJ(?j#>Q$+rx_R|7TzDZe{J6q zG1*EcU%tE?!kO%^M;3aM6JN*LAKUVb^xz8-Pxo#jR5(-KBeLJvA@-gxNHx0M-ZJLl z;#JwQoh~9V?`UVo#}{6ka@II>++D@%KqGpMdlQ}?9E*wFcf5(#XQnP$Dk5~%iX^>f z%$y;?M0BLp{O3a(-4A?ewryHrrD%cx#Q^%KY1H zNre$ve+vceSLZcNY4U(RBX&)oZn*Py()h)XkE?PL$!bNb{N5FVI2Y%LKEm%yvpyTP z(1P?z~7YxD~Rf<(a@_y` diff --git a/ohos/path_parsing_test/android/app/src/main/res/values-night/styles.xml b/ohos/path_parsing_test/android/app/src/main/res/values-night/styles.xml deleted file mode 100644 index 06952be7..00000000 --- a/ohos/path_parsing_test/android/app/src/main/res/values-night/styles.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - diff --git a/ohos/path_parsing_test/android/app/src/main/res/values/styles.xml b/ohos/path_parsing_test/android/app/src/main/res/values/styles.xml deleted file mode 100644 index 5716e25c..00000000 --- a/ohos/path_parsing_test/android/app/src/main/res/values/styles.xml +++ /dev/null @@ -1,33 +0,0 @@ -/* -* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - - - - - - - - diff --git a/ohos/path_parsing_test/android/app/src/profile/AndroidManifest.xml b/ohos/path_parsing_test/android/app/src/profile/AndroidManifest.xml deleted file mode 100644 index d3e835ba..00000000 --- a/ohos/path_parsing_test/android/app/src/profile/AndroidManifest.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - diff --git a/ohos/path_parsing_test/android/build.gradle b/ohos/path_parsing_test/android/build.gradle deleted file mode 100644 index 713d7f6e..00000000 --- a/ohos/path_parsing_test/android/build.gradle +++ /dev/null @@ -1,31 +0,0 @@ -buildscript { - ext.kotlin_version = '1.7.10' - repositories { - google() - mavenCentral() - } - - dependencies { - classpath 'com.android.tools.build:gradle:7.2.0' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - -allprojects { - repositories { - google() - mavenCentral() - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') -} - -tasks.register("clean", Delete) { - delete rootProject.buildDir -} diff --git a/ohos/path_parsing_test/android/gradle.properties b/ohos/path_parsing_test/android/gradle.properties deleted file mode 100644 index 94adc3a3..00000000 --- a/ohos/path_parsing_test/android/gradle.properties +++ /dev/null @@ -1,3 +0,0 @@ -org.gradle.jvmargs=-Xmx1536M -android.useAndroidX=true -android.enableJetifier=true diff --git a/ohos/path_parsing_test/android/gradle/wrapper/gradle-wrapper.properties b/ohos/path_parsing_test/android/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 3c472b99..00000000 --- a/ohos/path_parsing_test/android/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip diff --git a/ohos/path_parsing_test/android/settings.gradle b/ohos/path_parsing_test/android/settings.gradle deleted file mode 100644 index 44e62bcf..00000000 --- a/ohos/path_parsing_test/android/settings.gradle +++ /dev/null @@ -1,11 +0,0 @@ -include ':app' - -def localPropertiesFile = new File(rootProject.projectDir, "local.properties") -def properties = new Properties() - -assert localPropertiesFile.exists() -localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } - -def flutterSdkPath = properties.getProperty("flutter.sdk") -assert flutterSdkPath != null, "flutter.sdk not set in local.properties" -apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" diff --git a/ohos/path_parsing_test/lib/main.dart b/ohos/path_parsing_test/lib/main.dart index 60d14b74..a9486b5c 100644 --- a/ohos/path_parsing_test/lib/main.dart +++ b/ohos/path_parsing_test/lib/main.dart @@ -25,11 +25,6 @@ import 'pages/parse_path_test.dart'; void main() { final items = [ MainItem('functions', "", route: "FunctionList"), - // MainItem('excample_test', "", route: "PathParsingPage"), - MainItem('s_PathProxy_test', "", route: "SPathProxyTestPage"), - MainItem('s_PathSegmentData_test', "", route: "SPathSegmentDataTestPage"), - MainItem('s_SvgPathNormalizer_test', "", route: "SSvgPathNormalizerTestPage"), - MainItem('s_SvgPathStringSource_test', "", route: "SSvgPathStringSourceTestPage"), //SSvgPathStringSourceTestPage MainItem('parse_path_deep_test', "", route: "ParsePathDeepTestPage"), diff --git a/ohos/path_parsing_test/ohos/AppScope/app.json5 b/ohos/path_parsing_test/ohos/AppScope/app.json5 index 7f9bea98..a1c9fdad 100644 --- a/ohos/path_parsing_test/ohos/AppScope/app.json5 +++ b/ohos/path_parsing_test/ohos/AppScope/app.json5 @@ -1,6 +1,6 @@ { "app": { - "bundleName": "com.example.app1", + "bundleName": "com.example.path_parsing_test", "vendor": "example", "versionCode": 1, "versionName": "1.0.0", diff --git a/ohos/path_parsing_test/ohos/AppScope/resources/base/element/string.json b/ohos/path_parsing_test/ohos/AppScope/resources/base/element/string.json index 73c7c5ca..07759fa3 100644 --- a/ohos/path_parsing_test/ohos/AppScope/resources/base/element/string.json +++ b/ohos/path_parsing_test/ohos/AppScope/resources/base/element/string.json @@ -2,7 +2,7 @@ "string": [ { "name": "app_name", - "value": "app1" + "value": "path_parsing_test" } ] } diff --git a/ohos/path_parsing_test/ohos/build-profile.json5 b/ohos/path_parsing_test/ohos/build-profile.json5 index 31266109..0d8b167e 100644 --- a/ohos/path_parsing_test/ohos/build-profile.json5 +++ b/ohos/path_parsing_test/ohos/build-profile.json5 @@ -15,21 +15,7 @@ { "app": { - "signingConfigs": [ - { - "name": "default", - "type": "HarmonyOS", - "material": { - "certpath": "C:\\Users\\Administrator\\.ohos\\config\\default_ohos__5vBZ97Z2uuwnyb707sJN3U7rmJVWGLcrqDrcDVFBNQ=.cer", - "storePassword": "0000001B028C53BBE416C232B266009EF13C0295C33C5613823AD539B2DF25FF7F5842EDC34E48971BCB31", - "keyAlias": "debugKey", - "keyPassword": "0000001BF4CB6D870B8FFD7AB7114E52468F889BEE74F8228A9CFBFD992B3602A7FA12B6289B79BB357F50", - "profile": "C:\\Users\\Administrator\\.ohos\\config\\default_ohos__5vBZ97Z2uuwnyb707sJN3U7rmJVWGLcrqDrcDVFBNQ=.p7b", - "signAlg": "SHA256withECDSA", - "storeFile": "C:\\Users\\Administrator\\.ohos\\config\\default_ohos__5vBZ97Z2uuwnyb707sJN3U7rmJVWGLcrqDrcDVFBNQ=.p12" - } - } - ], + "signingConfigs": [], "products": [ { "name": "default", diff --git a/ohos/path_parsing_test/ohos/entry/src/main/ets/plugins/GeneratedPluginRegistrant.ets b/ohos/path_parsing_test/ohos/entry/src/main/ets/plugins/GeneratedPluginRegistrant.ets new file mode 100644 index 00000000..f28ced70 --- /dev/null +++ b/ohos/path_parsing_test/ohos/entry/src/main/ets/plugins/GeneratedPluginRegistrant.ets @@ -0,0 +1,24 @@ +import { FlutterEngine, Log } from '@ohos/flutter_ohos'; + +/** + * Generated file. Do not edit. + * This file is generated by the Flutter tool based on the + * plugins that support the Ohos platform. + */ + +const TAG = "GeneratedPluginRegistrant"; + +export class GeneratedPluginRegistrant { + + static registerWith(flutterEngine: FlutterEngine) { + try { + } catch (e) { + Log.e( + TAG, + "Tried to register plugins with FlutterEngine (" + + flutterEngine + + ") failed."); + Log.e(TAG, "Received exception while registering", e); + } + } +} diff --git a/ohos/path_parsing_test/ohos/entry/src/main/resources/base/element/string.json b/ohos/path_parsing_test/ohos/entry/src/main/resources/base/element/string.json index 845701a2..d2804bd0 100644 --- a/ohos/path_parsing_test/ohos/entry/src/main/resources/base/element/string.json +++ b/ohos/path_parsing_test/ohos/entry/src/main/resources/base/element/string.json @@ -10,7 +10,7 @@ }, { "name": "EntryAbility_label", - "value": "app1" + "value": "path_parsing_test" } ] } \ No newline at end of file diff --git a/ohos/path_parsing_test/ohos/entry/src/main/resources/en_US/element/string.json b/ohos/path_parsing_test/ohos/entry/src/main/resources/en_US/element/string.json index 845701a2..d2804bd0 100644 --- a/ohos/path_parsing_test/ohos/entry/src/main/resources/en_US/element/string.json +++ b/ohos/path_parsing_test/ohos/entry/src/main/resources/en_US/element/string.json @@ -10,7 +10,7 @@ }, { "name": "EntryAbility_label", - "value": "app1" + "value": "path_parsing_test" } ] } \ No newline at end of file diff --git a/ohos/path_parsing_test/ohos/entry/src/main/resources/zh_CN/element/string.json b/ohos/path_parsing_test/ohos/entry/src/main/resources/zh_CN/element/string.json index 5a37790d..a82f4698 100644 --- a/ohos/path_parsing_test/ohos/entry/src/main/resources/zh_CN/element/string.json +++ b/ohos/path_parsing_test/ohos/entry/src/main/resources/zh_CN/element/string.json @@ -10,7 +10,7 @@ }, { "name": "EntryAbility_label", - "value": "app1" + "value": "path_parsing_test" } ] } \ No newline at end of file diff --git a/ohos/path_parsing_test/ohos/oh-package.json5 b/ohos/path_parsing_test/ohos/oh-package.json5 index acbdb94e..81f3e5f1 100644 --- a/ohos/path_parsing_test/ohos/oh-package.json5 +++ b/ohos/path_parsing_test/ohos/oh-package.json5 @@ -15,7 +15,7 @@ { "modelVersion": "5.0.0", - "name": "app1", + "name": "path_parsing_test", "version": "1.0.0", "description": "Please describe the basic information.", "main": "", diff --git a/ohos/path_parsing_test/test/widget_test.dart b/ohos/path_parsing_test/test/widget_test.dart new file mode 100644 index 00000000..ab38e2da --- /dev/null +++ b/ohos/path_parsing_test/test/widget_test.dart @@ -0,0 +1,30 @@ +// 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:path_parsing_test/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); + }); +} -- Gitee From ab90270ec5a52f0f106748e2ea50d16be813b749 Mon Sep 17 00:00:00 2001 From: liuja <542689970@qq.com> Date: Wed, 27 Nov 2024 09:58:58 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=89=88=E6=9D=83?= =?UTF-8?q?=E5=A4=B45?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liuja <542689970@qq.com> --- .../ets/plugins/GeneratedPluginRegistrant.ets | 24 --------------- ohos/path_parsing_test/test/widget_test.dart | 30 ------------------- 2 files changed, 54 deletions(-) delete mode 100644 ohos/path_parsing_test/ohos/entry/src/main/ets/plugins/GeneratedPluginRegistrant.ets delete mode 100644 ohos/path_parsing_test/test/widget_test.dart diff --git a/ohos/path_parsing_test/ohos/entry/src/main/ets/plugins/GeneratedPluginRegistrant.ets b/ohos/path_parsing_test/ohos/entry/src/main/ets/plugins/GeneratedPluginRegistrant.ets deleted file mode 100644 index f28ced70..00000000 --- a/ohos/path_parsing_test/ohos/entry/src/main/ets/plugins/GeneratedPluginRegistrant.ets +++ /dev/null @@ -1,24 +0,0 @@ -import { FlutterEngine, Log } from '@ohos/flutter_ohos'; - -/** - * Generated file. Do not edit. - * This file is generated by the Flutter tool based on the - * plugins that support the Ohos platform. - */ - -const TAG = "GeneratedPluginRegistrant"; - -export class GeneratedPluginRegistrant { - - static registerWith(flutterEngine: FlutterEngine) { - try { - } catch (e) { - Log.e( - TAG, - "Tried to register plugins with FlutterEngine (" - + flutterEngine - + ") failed."); - Log.e(TAG, "Received exception while registering", e); - } - } -} diff --git a/ohos/path_parsing_test/test/widget_test.dart b/ohos/path_parsing_test/test/widget_test.dart deleted file mode 100644 index ab38e2da..00000000 --- a/ohos/path_parsing_test/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:path_parsing_test/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); - }); -} -- Gitee From 5e7dfeec27ce6d0231d9aa388b696d296aea1a27 Mon Sep 17 00:00:00 2001 From: liuja <542689970@qq.com> Date: Wed, 27 Nov 2024 10:20:29 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E8=B6=85=E8=BF=872000=E8=A1=8C=E5=88=86?= =?UTF-8?q?=E6=89=B9=E4=B8=8A=E4=BC=A01?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liuja <542689970@qq.com> --- ohos/path_parsing_test/README.md | 16 -- ohos/path_parsing_test/lib/main.dart | 4 - .../lib/pages/parse_path_test.dart | 261 ------------------ 3 files changed, 281 deletions(-) delete mode 100644 ohos/path_parsing_test/README.md delete mode 100644 ohos/path_parsing_test/lib/pages/parse_path_test.dart diff --git a/ohos/path_parsing_test/README.md b/ohos/path_parsing_test/README.md deleted file mode 100644 index 70ea68bb..00000000 --- a/ohos/path_parsing_test/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# lz_path_parsing_test - -A new Flutter project. - -## Getting Started - -This project is a starting point for a Flutter application. - -A few resources to get you started if this is your first Flutter project: - -- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) -- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) - -For help getting started with Flutter development, view the -[online documentation](https://docs.flutter.dev/), which offers tutorials, -samples, guidance on mobile development, and a full API reference. diff --git a/ohos/path_parsing_test/lib/main.dart b/ohos/path_parsing_test/lib/main.dart index a9486b5c..fce7e4ce 100644 --- a/ohos/path_parsing_test/lib/main.dart +++ b/ohos/path_parsing_test/lib/main.dart @@ -20,7 +20,6 @@ import 'common/test_route.dart'; import 'pages/example.dart'; import 'pages/function_list.dart'; import 'pages/parse_path_deep_test.dart'; -import 'pages/parse_path_test.dart'; void main() { final items = [ @@ -43,9 +42,6 @@ void main() { "ParsePathDeepTestPage": (context) { return ParsePathDeepTestPage("ParsePathDeepTestPage"); }, - "ParsePathTestPage": (context) { - return ParsePathTestPage("ParsePathTestPage"); - }, }, //PathParsingExamp ))); //BuilderTestPage diff --git a/ohos/path_parsing_test/lib/pages/parse_path_test.dart b/ohos/path_parsing_test/lib/pages/parse_path_test.dart deleted file mode 100644 index 93aff6f3..00000000 --- a/ohos/path_parsing_test/lib/pages/parse_path_test.dart +++ /dev/null @@ -1,261 +0,0 @@ -/* -* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - - -import 'package:flutter/cupertino.dart'; -import 'package:path_parsing/path_parsing.dart'; -import 'package:path_parsing/src/path_segment_type.dart'; - -import '../common/test_page.dart'; - -// TODO(dnfield): a bunch of better tests could be written to track that commands are actually called with expected values/order -// For now we just want to know that something gets emitted and no exceptions are thrown (that's all the legacy tests really did anyway). -class TestPathProxy extends PathProxy { - bool called = false; - @override - void close() { - called = true; - } - - @override - void cubicTo( - double x1, - double y1, - double x2, - double y2, - double x3, - double y3, - ) { - called = true; - } - - @override - void lineTo(double x, double y) { - called = true; - } - - @override - void moveTo(double x, double y) { - called = true; - } -} - -class ParsePathTestPage extends TestPage { - ParsePathTestPage(String title, {Key? key}) : super(title, key: key) { - void assertValidPath(String input) { - final TestPathProxy proxy = TestPathProxy(); - // these shouldn't throw or assert - writeSvgPathDataToPath(input, proxy); - expect(proxy.called, true); - } - - void assertInvalidPath(String input) { - final TestPathProxy proxy = TestPathProxy(); - writeSvgPathDataToPath(input, proxy); - expect(proxy.called, true); - } - - test('Valid Paths', () { - assertValidPath('M1,2'); - assertValidPath('m1,2'); - assertValidPath('M100,200 m3,4'); - assertValidPath('M100,200 L3,4'); - assertValidPath('M100,200 l3,4'); - assertValidPath('M100,200 H3'); - assertValidPath('M100,200 h3'); - assertValidPath('M100,200 V3'); - assertValidPath('M100,200 v3'); - assertValidPath('M100,200 Z'); - assertValidPath('M100,200 z'); - assertValidPath('M100,200 C3,4,5,6,7,8'); - assertValidPath('M100,200 c3,4,5,6,7,8'); - assertValidPath('M100,200 S3,4,5,6'); - assertValidPath('M100,200 s3,4,5,6'); - assertValidPath('M100,200 Q3,4,5,6'); - assertValidPath('M100,200 q3,4,5,6'); - assertValidPath('M100,200 T3,4'); - assertValidPath('M100,200 t3,4'); - assertValidPath('M100,200 A3,4,5,0,0,6,7'); - assertValidPath('M100,200 A3,4,5,1,0,6,7'); - assertValidPath('M100,200 A3,4,5,0,1,6,7'); - assertValidPath('M100,200 A3,4,5,1,1,6,7'); - assertValidPath('M100,200 a3,4,5,0,0,6,7'); - assertValidPath('M100,200 a3,4,5,0,1,6,7'); - assertValidPath('M100,200 a3,4,5,1,0,6,7'); - assertValidPath('M100,200 a3,4,5,1,1,6,7'); - assertValidPath('M100,200 a3,4,5,006,7'); - assertValidPath('M100,200 a3,4,5,016,7'); - assertValidPath('M100,200 a3,4,5,106,7'); - assertValidPath('M100,200 a3,4,5,116,7'); - assertValidPath( - '''M19.0281,19.40466 20.7195,19.40466 20.7195,15.71439 24.11486,15.71439 24.11486,14.36762 20.7195,14.36762 -20.7195,11.68641 24.74134,11.68641 24.74134,10.34618 19.0281,10.34618 z'''); - - assertValidPath('M100,200 a0,4,5,0,0,10,0 a4,0,5,0,0,0,10 a0,0,5,0,0,-10,0 z'); - - assertValidPath('M1,2,3,4'); - assertValidPath('m100,200,3,4'); - - assertValidPath('M 100-200'); - assertValidPath('M 0.6.5'); - - assertValidPath(' M1,2'); - assertValidPath(' M1,2'); - assertValidPath('\tM1,2'); - assertValidPath('\nM1,2'); - assertValidPath('\rM1,2'); - assertValidPath('M1,2 '); - assertValidPath('M1,2\t'); - assertValidPath('M1,2\n'); - assertValidPath('M1,2\r'); - assertValidPath('M.1 .2 L.3 .4 .5 .6'); - assertValidPath('M1,1h2,3'); - assertValidPath('M1,1H2,3'); - assertValidPath('M1,1v2,3'); - assertValidPath('M1,1V2,3'); - assertValidPath('M1,1c2,3 4,5 6,7 8,9 10,11 12,13'); - assertValidPath('M1,1C2,3 4,5 6,7 8,9 10,11 12,13'); - assertValidPath('M1,1s2,3 4,5 6,7 8,9'); - assertValidPath('M1,1S2,3 4,5 6,7 8,9'); - assertValidPath('M1,1q2,3 4,5 6,7 8,9'); - assertValidPath('M1,1Q2,3 4,5 6,7 8,9'); - assertValidPath('M1,1t2,3 4,5'); - assertValidPath('M1,1T2,3 4,5'); - assertValidPath('M1,1a2,3,4,0,0,5,6 7,8,9,0,0,10,11'); - assertValidPath('M1,1A2,3,4,0,0,5,6 7,8,9,0,0,10,11'); - assertValidPath('M22.1595 3.80852C19.6789 1.35254 16.3807 -4.80966e-07 12.8727 ' - '-4.80966e-07C9.36452 -4.80966e-07 6.06642 1.35254 3.58579 3.80852C1.77297 5.60333 ' - '0.53896 7.8599 0.0171889 10.3343C-0.0738999 10.7666 0.206109 11.1901 0.64265 11.2803' - 'C1.07908 11.3706 1.50711 11.0934 1.5982 10.661C2.05552 8.49195 3.13775 6.51338 4.72783 ' - '4.9391C9.21893 0.492838 16.5262 0.492728 21.0173 4.9391C25.5082 9.38548 25.5082 16.6202 ' - '21.0173 21.0667C16.5265 25.5132 9.21893 25.5133 4.72805 21.0669C3.17644 19.5307 2.10538 ' - '17.6035 1.63081 15.4937C1.53386 15.0627 1.10252 14.7908 0.66697 14.887C0.231645 14.983 ' - '-0.0427272 15.4103 0.0542205 15.8413C0.595668 18.2481 1.81686 20.4461 3.5859 22.1976' - 'C6.14623 24.7325 9.50955 26 12.8727 26C16.236 26 19.5991 24.7326 22.1595 22.1976C27.2802 ' - '17.1277 27.2802 8.87841 22.1595 3.80852Z'); - assertValidPath('m18 11.8a.41.41 0 0 1 .24.08l.59.43h.05.72a.4.4 0 0 1 .39.28l.22.69a.08.08 0 ' - '0 0 0 0l.58.43a.41.41 0 0 1 .15.45l-.22.68a.09.09 0 0 0 0 .07l.22.68a.4.4 0 0 1 ' - '-.15.46l-.58.42a.1.1 0 0 0 0 0l-.22.68a.41.41 0 0 1 -.38.29h-.79l-.58.43a.41.41 0 ' - '0 1 -.24.08.46.46 0 0 1 -.24-.08l-.58-.43h-.06-.72a.41.41 0 0 1 -.39-.28l-.22-.68' - 'a.1.1 0 0 0 0 0l-.58-.43a.42.42 0 0 1 -.15-.46l.23-.67v-.02l-.29-.68a.43.43 0 0 1 ' - '.15-.46l.58-.42a.1.1 0 0 0 0-.05l.27-.69a.42.42 0 0 1 .39-.28h.78l.58-.43a.43.43 0 ' - '0 1 .25-.09m0-1a1.37 1.37 0 0 0 -.83.27l-.34.25h-.43a1.42 1.42 0 0 0 -1.34 1l-.13.4' - '-.35.25a1.42 1.42 0 0 0 -.51 1.58l.13.4-.13.4a1.39 1.39 0 0 0 .52 1.59l.34.25.13.4' - 'a1.41 1.41 0 0 0 1.34 1h.43l.34.26a1.44 1.44 0 0 0 .83.27 1.38 1.38 0 0 0 .83-.28' - 'l.35-.24h.43a1.4 1.4 0 0 0 1.33-1l.13-.4.35-.26a1.39 1.39 0 0 0 .51-1.57l-.13-.4.13-.41' - 'a1.4 1.4 0 0 0 -.51-1.56l-.35-.25-.13-.41a1.4 1.4 0 0 0 -1.34-1h-.42l-.34-.26a1.43 1.43 ' - '0 0 0 -.84-.28z'); - }); - - test('Malformed Paths, 此处应该为X', () { - assertInvalidPath('M100,200 a3,4,5,2,1,6,7'); - assertInvalidPath('M100,200 a3,4,5,1,2,6,7'); - - assertInvalidPath('\vM1,2'); - assertInvalidPath('xM1,2'); - assertInvalidPath('M1,2\v'); - assertInvalidPath('M1,2x'); - assertInvalidPath('M1,2 L40,0#90'); - - assertInvalidPath('x'); - assertInvalidPath('L1,2'); - - assertInvalidPath('M'); - assertInvalidPath('M\0'); - - assertInvalidPath('M1,1Z0'); - assertInvalidPath('M1,1z0'); - - assertInvalidPath('M1,1c2,3 4,5 6,7 8'); - assertInvalidPath('M1,1C2,3 4,5 6,7 8'); - assertInvalidPath('M1,1s2,3 4,5 6'); - assertInvalidPath('M1,1S2,3 4,5 6'); - assertInvalidPath('M1,1q2,3 4,5 6'); - assertInvalidPath('M1,1Q2,3 4,5 6'); - assertInvalidPath('M1,1t2,3 4'); - assertInvalidPath('M1,1T2,3 4'); - assertInvalidPath('M1,1a2,3,4,0,0,5,6 7'); - assertInvalidPath('M1,1A2,3,4,0,0,5,6 7'); - }); - - test('Missing commands/numbers/flags, 此处应该为X', () { - // Missing initial moveto. - assertInvalidPath(' 10 10'); - assertInvalidPath('L 10 10'); - // Invalid command letter. - assertInvalidPath('M 10 10 #'); - assertInvalidPath('M 10 10 E 100 100'); - // Invalid number. - assertInvalidPath('M 10 10 L100 '); - assertInvalidPath('M 10 10 L100 #'); - assertInvalidPath('M 10 10 L100#100'); - assertInvalidPath('M0,0 A#,10 0 0,0 20,20'); - assertInvalidPath('M0,0 A10,# 0 0,0 20,20'); - assertInvalidPath('M0,0 A10,10 # 0,0 20,20'); - assertInvalidPath('M0,0 A10,10 0 0,0 #,20'); - assertInvalidPath('M0,0 A10,10 0 0,0 20,#'); - // Invalid arc-flag. - assertInvalidPath('M0,0 A10,10 0 #,0 20,20'); - assertInvalidPath('M0,0 A10,10 0 0,# 20,20'); - assertInvalidPath('M0,0 A10,10 0 0,2 20,20'); - }); - - test('Check character constants', () { - expect(AsciiConstants.slashT, '\t'.codeUnitAt(0)); - expect(AsciiConstants.slashN, '\n'.codeUnitAt(0)); - expect(AsciiConstants.slashF, '\f'.codeUnitAt(0)); - expect(AsciiConstants.slashR, '\r'.codeUnitAt(0)); - expect(AsciiConstants.space, ' '.codeUnitAt(0)); - expect(AsciiConstants.period, '.'.codeUnitAt(0)); - expect(AsciiConstants.plus, '+'.codeUnitAt(0)); - expect(AsciiConstants.comma, ','.codeUnitAt(0)); - expect(AsciiConstants.minus, '-'.codeUnitAt(0)); - expect(AsciiConstants.number0, '0'.codeUnitAt(0)); - expect(AsciiConstants.number1, '1'.codeUnitAt(0)); - expect(AsciiConstants.number2, '2'.codeUnitAt(0)); - expect(AsciiConstants.number3, '3'.codeUnitAt(0)); - expect(AsciiConstants.number4, '4'.codeUnitAt(0)); - expect(AsciiConstants.number5, '5'.codeUnitAt(0)); - expect(AsciiConstants.number6, '6'.codeUnitAt(0)); - expect(AsciiConstants.number7, '7'.codeUnitAt(0)); - expect(AsciiConstants.number8, '8'.codeUnitAt(0)); - expect(AsciiConstants.number9, '9'.codeUnitAt(0)); - expect(AsciiConstants.upperA, 'A'.codeUnitAt(0)); - expect(AsciiConstants.upperC, 'C'.codeUnitAt(0)); - expect(AsciiConstants.upperE, 'E'.codeUnitAt(0)); - expect(AsciiConstants.upperH, 'H'.codeUnitAt(0)); - expect(AsciiConstants.upperL, 'L'.codeUnitAt(0)); - expect(AsciiConstants.upperM, 'M'.codeUnitAt(0)); - expect(AsciiConstants.upperQ, 'Q'.codeUnitAt(0)); - expect(AsciiConstants.upperS, 'S'.codeUnitAt(0)); - expect(AsciiConstants.upperT, 'T'.codeUnitAt(0)); - expect(AsciiConstants.upperV, 'V'.codeUnitAt(0)); - expect(AsciiConstants.upperZ, 'Z'.codeUnitAt(0)); - expect(AsciiConstants.lowerA, 'a'.codeUnitAt(0)); - expect(AsciiConstants.lowerC, 'c'.codeUnitAt(0)); - expect(AsciiConstants.lowerE, 'e'.codeUnitAt(0)); - expect(AsciiConstants.lowerH, 'h'.codeUnitAt(0)); - expect(AsciiConstants.lowerL, 'l'.codeUnitAt(0)); - expect(AsciiConstants.lowerM, 'm'.codeUnitAt(0)); - expect(AsciiConstants.lowerQ, 'q'.codeUnitAt(0)); - expect(AsciiConstants.lowerS, 's'.codeUnitAt(0)); - expect(AsciiConstants.lowerT, 't'.codeUnitAt(0)); - expect(AsciiConstants.lowerV, 'v'.codeUnitAt(0)); - expect(AsciiConstants.lowerX, 'x'.codeUnitAt(0)); - expect(AsciiConstants.lowerZ, 'z'.codeUnitAt(0)); - expect(AsciiConstants.tilde, '~'.codeUnitAt(0)); - }); - } -} -- Gitee