diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..359bb5307e8535ab7d59faf27a7377033291821e
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,3 @@
+# 默认忽略的文件
+/shelf/
+/workspace.xml
diff --git a/.idea/BestPracticeSnippets.iml b/.idea/BestPracticeSnippets.iml
new file mode 100644
index 0000000000000000000000000000000000000000..61021940449bdc69db005bbd04a05380f5629b2c
--- /dev/null
+++ b/.idea/BestPracticeSnippets.iml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/git_toolbox_blame.xml b/.idea/git_toolbox_blame.xml
new file mode 100644
index 0000000000000000000000000000000000000000..7dc124965d28403ec2545a24d7d1cd1fec1f57d8
--- /dev/null
+++ b/.idea/git_toolbox_blame.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/git_toolbox_prj.xml b/.idea/git_toolbox_prj.xml
new file mode 100644
index 0000000000000000000000000000000000000000..02b915b85f9fb22b6e51491729131d93c18d906e
--- /dev/null
+++ b/.idea/git_toolbox_prj.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000000000000000000000000000000000000..891e6bbf8a8464839ecc108f4cb7c0a6e6ac0f5a
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000000000000000000000000000000000000..35eb1ddfbbc029bcab630581847471d7f238ec53
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/.idea/.gitignore b/ImageWhiteLumpSolution/.idea/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..359bb5307e8535ab7d59faf27a7377033291821e
--- /dev/null
+++ b/ImageWhiteLumpSolution/.idea/.gitignore
@@ -0,0 +1,3 @@
+# 默认忽略的文件
+/shelf/
+/workspace.xml
diff --git a/ImageWhiteLumpSolution/.idea/ImageWhiteLumpSolution.iml b/ImageWhiteLumpSolution/.idea/ImageWhiteLumpSolution.iml
new file mode 100644
index 0000000000000000000000000000000000000000..61021940449bdc69db005bbd04a05380f5629b2c
--- /dev/null
+++ b/ImageWhiteLumpSolution/.idea/ImageWhiteLumpSolution.iml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/.idea/git_toolbox_blame.xml b/ImageWhiteLumpSolution/.idea/git_toolbox_blame.xml
new file mode 100644
index 0000000000000000000000000000000000000000..7dc124965d28403ec2545a24d7d1cd1fec1f57d8
--- /dev/null
+++ b/ImageWhiteLumpSolution/.idea/git_toolbox_blame.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/.idea/modules.xml b/ImageWhiteLumpSolution/.idea/modules.xml
new file mode 100644
index 0000000000000000000000000000000000000000..a65f51afcf13810f00977c3519382f6873104c90
--- /dev/null
+++ b/ImageWhiteLumpSolution/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/.idea/vcs.xml b/ImageWhiteLumpSolution/.idea/vcs.xml
new file mode 100644
index 0000000000000000000000000000000000000000..6c0b8635858dc7ad44b93df54b762707ce49eefc
--- /dev/null
+++ b/ImageWhiteLumpSolution/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/.clang-format b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/.clang-format
new file mode 100644
index 0000000000000000000000000000000000000000..48439ed68073b99be118d374d1ebd43d04d4c4eb
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/.clang-format
@@ -0,0 +1,64 @@
+Language: Cpp
+# BasedOnStyle: LLVM
+ColumnLimit: 120
+SortIncludes: CaseSensitive
+TabWidth: 4
+IndentWidth: 4
+UseTab: Never
+AccessModifierOffset: -4
+ContinuationIndentWidth: 4
+IndentCaseBlocks: false
+IndentCaseLabels: false
+IndentGotoLabels: true
+IndentWrappedFunctionNames: false
+SortUsingDeclarations: false
+NamespaceIndentation: None
+SpaceAfterCStyleCast: false
+SpaceAfterLogicalNot: false
+SpaceAfterTemplateKeyword: true
+SpaceBeforeAssignmentOperators: true
+SpaceBeforeCaseColon: false
+SpaceBeforeCpp11BracedList: false
+SpaceBeforeCtorInitializerColon: true
+SpaceBeforeInheritanceColon: true
+SpaceBeforeRangeBasedForLoopColon: true
+SpaceBeforeSquareBrackets: false
+SpaceInEmptyBlock: false
+SpaceInEmptyParentheses: false
+SpacesInAngles: false
+SpacesInCStyleCastParentheses: false
+SpacesInConditionalStatement: false
+SpacesInParentheses: false
+SpacesInSquareBrackets: false
+AlignTrailingComments: true
+AlignAfterOpenBracket: true
+AllowShortCaseLabelsOnASingleLine: false
+AllowShortEnumsOnASingleLine: true
+AllowShortFunctionsOnASingleLine: All
+AllowShortIfStatementsOnASingleLine: Never
+AllowShortLambdasOnASingleLine: All
+AllowShortLoopsOnASingleLine: false
+AlwaysBreakTemplateDeclarations: MultiLine
+BinPackArguments: true
+BinPackParameters: true
+BreakBeforeTernaryOperators: true
+BreakConstructorInitializers: BeforeColon
+BreakInheritanceList: BeforeColon
+BreakStringLiterals: true
+InsertBraces: false
+IndentExternBlock: NoIndent
+BreakBeforeBraces: Custom
+BraceWrapping:
+ AfterCaseLabel: false
+ AfterClass: false
+ AfterControlStatement: Never
+ AfterEnum: false
+ AfterFunction: false
+ AfterNamespace: false
+ AfterStruct: false
+ AfterUnion: false
+ AfterExternBlock: false
+ BeforeCatch: false
+ BeforeElse: false
+ReflowComments: true
+MaxEmptyLinesToKeep: 2
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/.hvigor/cache/meta.json b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/.hvigor/cache/meta.json
new file mode 100644
index 0000000000000000000000000000000000000000..18f86af95573be1ca58a8494f7aac0c780d0dfac
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/.hvigor/cache/meta.json
@@ -0,0 +1 @@
+{"compileSdkVersion":"5.0.4(16)","hvigorVersion":"5.16.2","toolChainsVersion":"5.0.4.150"}
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/.hvigor/dependencyMap/dependencyMap.json5 b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/.hvigor/dependencyMap/dependencyMap.json5
new file mode 100644
index 0000000000000000000000000000000000000000..3bcde101704867f08a9024b724d4c9599d48deb9
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/.hvigor/dependencyMap/dependencyMap.json5
@@ -0,0 +1 @@
+{"basePath":"D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\.hvigor\\dependencyMap\\dependencyMap.json5","rootDependency":"./oh-package.json5","dependencyMap":{"entry":"./entry/oh-package.json5"},"modules":[{"name":"entry","srcPath":"..\\..\\..\\entry"}]}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/.hvigor/dependencyMap/entry/oh-package.json5 b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/.hvigor/dependencyMap/entry/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..50a51753855fc6efdf037d5db6ab2cc001f17bbc
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/.hvigor/dependencyMap/entry/oh-package.json5
@@ -0,0 +1 @@
+{"name":"entry","version":"1.0.0","description":"Please describe the basic information.","main":"","author":"","license":"","dependencies":{}}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/.hvigor/dependencyMap/oh-package.json5 b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/.hvigor/dependencyMap/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..204921fe30efc5e9abf09e97497d0c7735ed5ef4
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/.hvigor/dependencyMap/oh-package.json5
@@ -0,0 +1 @@
+{"modelVersion":"5.0.0","description":"Please describe the basic information.","dependencies":{},"devDependencies":{"@ohos/hypium":"1.0.18","@ohos/hamock":"1.0.0"}}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/.hvigor/outputs/build-logs/build.log b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/.hvigor/outputs/build-logs/build.log
new file mode 100644
index 0000000000000000000000000000000000000000..d05d9ba1f438a08150be55a875cf603e8159312e
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/.hvigor/outputs/build-logs/build.log
@@ -0,0 +1,252 @@
+[2025-05-12T16:01:53.622] [DEBUG] debug-file - env: nodejsVersion=v18.20.1
+[2025-05-12T16:01:54.120] [DEBUG] debug-file - Hvigor init with startParameters:{
+ hvigorfileTypeCheck: false,
+ parallelExecution: true,
+ incrementalExecution: true,
+ printStackTrace: false,
+ daemon: false,
+ analyze: 0,
+ logLevel: Level { level: 20000, levelStr: 'INFO', colour: 'green' }
+}
+[2025-05-12T16:01:54.138] [DEBUG] debug-file - hvigorfile, resolving D:\git_developmentPractice\DevelopmentPractice\ImageWhiteLumpSolution\PreHttpRequestUseFiles\hvigorfile.ts
+[2025-05-12T16:01:55.653] [DEBUG] debug-file - hvigorfile, require result: { default: { system: [Function: appTasks], plugins: [] } }
+[2025-05-12T16:01:55.857] [DEBUG] debug-file - Start initialize project's product build option map with build mode debug.
+[2025-05-12T16:01:55.862] [DEBUG] debug-file - Product 'default' using build option: {
+ "debuggable": true
+} in this build.
+[2025-05-12T16:01:55.887] [DEBUG] debug-file - Local scan or download hmscore sdk components toolchains,ets,native
+[2025-05-12T16:01:55.883] [DEBUG] debug-file - Local scan or download HarmonyOS sdk components toolchains,ets,js,native,previewer
+[2025-05-12T16:01:55.896] [DEBUG] debug-file - Start recording SDK configuration permission data.
+[2025-05-12T16:01:55.929] [DEBUG] debug-file - Sdk init in 50 ms
+[2025-05-12T16:01:55.956] [DEBUG] debug-file - Project task initialization takes 25 ms
+[2025-05-12T16:01:55.965] [DEBUG] debug-file - hvigorfile, resolving D:\git_developmentPractice\DevelopmentPractice\ImageWhiteLumpSolution\PreHttpRequestUseFiles\entry\hvigorfile.ts
+[2025-05-12T16:01:55.995] [DEBUG] debug-file - Start initialize module-target build option map, moduleName=entry, buildMode=debug
+[2025-05-12T16:01:56.004] [DEBUG] debug-file - Module entry task initialization takes 6 ms
+[2025-05-12T16:01:56.007] [DEBUG] debug-file - project has submodules:entry
+[2025-05-12T16:01:56.049] [DEBUG] debug-file - Configuration task cost before running: 1 s 945 ms
+[2025-05-12T16:01:56.052] [DEBUG] debug-file - Executing task :entry:clean
+[2025-05-12T16:01:56.055] [DEBUG] debug-file - entry : clean cost memory 0.25336456298828125
+[2025-05-12T16:01:56.072] [DEBUG] debug-file - Module 'entry' target 'default' using build option: {
+ "debuggable": true,
+ "copyFrom": "default",
+ "name": "debug"
+} in this build.
+[2025-05-12T16:01:53.624] [DEBUG] debug-file - env: hvigor-config.json5 content = {
+ modelVersion: '5.0.0',
+ dependencies: {},
+ execution: {},
+ logging: {},
+ debugging: {},
+ nodeOptions: {}
+}
+[2025-05-12T16:01:54.122] [DEBUG] debug-file - Since current hvigor version 5.16.2 differs from last hvigor version
+ undefined, delete file-cache.json and task-cache.json.
+[2025-05-12T16:01:55.654] [DEBUG] debug-file - hvigorfile, binding system plugins [Function: appTasks]
+[2025-05-12T16:01:55.857] [DEBUG] debug-file - Picking option from product 'default' with build mode 'debug'.
+[2025-05-12T16:01:55.863] [DEBUG] debug-file - not found resModel json file in : D:\git_developmentPractice\DevelopmentPractice\ImageWhiteLumpSolution\PreHttpRequestUseFiles\entry\src\ohosTest\module.json5
+[2025-05-12T16:01:55.956] [DEBUG] debug-file - hvigorfile, binding custom plugins []
+[2025-05-12T16:01:55.977] [DEBUG] debug-file - hvigorfile, require result: { default: { system: [Function: hapTasks], plugins: [] } }
+[2025-05-12T16:01:55.995] [DEBUG] debug-file - Target 'default' config: {}
+[2025-05-12T16:01:56.004] [DEBUG] debug-file - hvigorfile, binding custom plugins []
+[2025-05-12T16:01:56.009] [DEBUG] debug-file - start to load updatedOhPackageInfo to the disk
+[2025-05-12T16:01:56.052] [DEBUG] debug-file - clean: Worker pool is inactive.
+[2025-05-12T16:01:56.055] [DEBUG] debug-file - runTaskFromQueue task cost before running: 1 s 951 ms
+[2025-05-12T16:01:56.076] [DEBUG] debug-file - Module 'entry' target 'ohosTest' using build option: {
+ "debuggable": true,
+ "name": "default"
+} in this build.
+[2025-05-12T16:01:56.095] [DEBUG] debug-file - Create resident worker with id: 0.
+[2025-05-12T16:01:53.626] [DEBUG] debug-file - env: daemon=false
+[2025-05-12T16:01:54.122] [DEBUG] debug-file - Cache service initialization finished in 2 ms
+[2025-05-12T16:01:55.858] [DEBUG] debug-file - Product 'default' build option: {}
+[2025-05-12T16:01:55.871] [DEBUG] debug-file - No signingConfig found, initRemoteHspCache failed.
+[2025-05-12T16:01:55.956] [DEBUG] debug-file - hvigorfile, no custom plugins were found in D:\git_developmentPractice\DevelopmentPractice\ImageWhiteLumpSolution\PreHttpRequestUseFiles\hvigorfile.ts
+[2025-05-12T16:01:55.978] [DEBUG] debug-file - hvigorfile, binding system plugins [Function: hapTasks]
+[2025-05-12T16:01:55.995] [DEBUG] debug-file - Target 'ohosTest' config: {}
+[2025-05-12T16:01:56.004] [DEBUG] debug-file - hvigorfile, no custom plugins were found in D:\git_developmentPractice\DevelopmentPractice\ImageWhiteLumpSolution\PreHttpRequestUseFiles\entry\hvigorfile.ts
+[2025-05-12T16:01:56.013] [DEBUG] debug-file - load to the disk finished
+[2025-05-12T16:01:56.057] [INFO] debug-file - Finished :entry:clean... after 4 ms
+[2025-05-12T16:01:56.093] [DEBUG] debug-file - Since there is no instance or instance is terminated, create a new worker pool.
+[2025-05-12T16:01:56.098] [DEBUG] debug-file - Create resident worker with id: 1.
+[2025-05-12T16:01:53.626] [DEBUG] debug-file - no-daemon, use the parent process.execArgv --max-old-space-size=8192,--expose-gc
+[2025-05-12T16:01:55.858] [DEBUG] debug-file - End initialize project's product build option map with build mode 'debug'.
+[2025-05-12T16:01:55.956] [DEBUG] debug-file - hvigorfile, resolve finished D:\git_developmentPractice\DevelopmentPractice\ImageWhiteLumpSolution\PreHttpRequestUseFiles\hvigorfile.ts
+[2025-05-12T16:01:55.996] [DEBUG] debug-file - Module 'entry' target 'default' build option: {
+ "debuggable": true,
+ "copyFrom": "default",
+ "name": "debug"
+}
+[2025-05-12T16:01:56.004] [DEBUG] debug-file - hvigorfile, resolve finished D:\git_developmentPractice\DevelopmentPractice\ImageWhiteLumpSolution\PreHttpRequestUseFiles\entry\hvigorfile.ts
+[2025-05-12T16:01:56.014] [DEBUG] debug-file - Start to initialize dependency information.
+[2025-05-12T16:01:56.057] [DEBUG] debug-file - Executing task ::clean
+[2025-05-12T16:01:56.093] [DEBUG] debug-file - Worker pool is initialized with config: {
+ minPoolNum: 2,
+ maxPoolNum: undefined,
+ maxCoreSize: undefined,
+ cacheCapacity: undefined,
+ cacheTtl: undefined
+}
+[2025-05-12T16:01:56.100] [DEBUG] debug-file - Current worker pool is stopped or closed.
+[2025-05-12T16:01:55.996] [DEBUG] debug-file - Module 'entry' target 'ohosTest' build option: {
+ "debuggable": true,
+ "name": "default"
+}
+[2025-05-12T16:01:56.037] [DEBUG] debug-file - Module PreHttpRequestUseFiles Collected Dependency:
+[2025-05-12T16:01:56.057] [DEBUG] debug-file - clean: Worker pool is inactive.
+[2025-05-12T16:01:56.100] [DEBUG] debug-file - Clear worker 0.
+[2025-05-12T16:01:55.996] [DEBUG] debug-file - End initialize module-target build option map, moduleName=entry
+[2025-05-12T16:01:56.037] [DEBUG] debug-file - Module PreHttpRequestUseFiles's total dependency: 0
+[2025-05-12T16:01:56.057] [DEBUG] debug-file - PreHttpRequestUseFiles : clean cost memory 0.03292083740234375
+[2025-05-12T16:01:56.100] [DEBUG] debug-file - Worker 0 has been cleared.
+[2025-05-12T16:01:55.996] [DEBUG] debug-file - Module 'entry' target 'default' using build option: {
+ "debuggable": true,
+ "copyFrom": "default",
+ "name": "debug"
+} in this build.
+[2025-05-12T16:01:56.038] [DEBUG] debug-file - Start to initialize dependency information.
+[2025-05-12T16:01:56.057] [DEBUG] debug-file - runTaskFromQueue task cost before running: 1 s 953 ms
+[2025-05-12T16:01:56.100] [DEBUG] debug-file - Current idle worker size: 1.
+[2025-05-12T16:01:56.040] [DEBUG] debug-file - Module entry Collected Dependency:
+[2025-05-12T16:01:56.058] [INFO] debug-file - Finished ::clean... after 1 ms
+[2025-05-12T16:01:56.100] [DEBUG] debug-file - Current busy worker size: 0.
+[2025-05-12T16:01:56.040] [DEBUG] debug-file - Module entry's total dependency: 0
+[2025-05-12T16:01:56.058] [DEBUG] debug-file - Executing task :entry:init
+[2025-05-12T16:01:56.100] [DEBUG] debug-file - Clear worker 1.
+[2025-05-12T16:01:56.045] [DEBUG] debug-file - Configuration phase cost:1 s 917 ms
+[2025-05-12T16:01:56.058] [DEBUG] debug-file - entry : init cost memory 0.01021575927734375
+[2025-05-12T16:01:56.100] [DEBUG] debug-file - Worker 1 has been cleared.
+[2025-05-12T16:01:56.058] [DEBUG] debug-file - runTaskFromQueue task cost before running: 1 s 954 ms
+[2025-05-12T16:01:56.100] [DEBUG] debug-file - Current idle worker size: 0.
+[2025-05-12T16:01:56.058] [INFO] debug-file - Finished :entry:init... after 1 ms
+[2025-05-12T16:01:56.100] [DEBUG] debug-file - Current busy worker size: 0.
+[2025-05-12T16:01:56.058] [DEBUG] debug-file - Executing task ::init
+[2025-05-12T16:01:56.101] [DEBUG] debug-file - hvigor build process will be closed.
+[2025-05-12T16:01:56.058] [DEBUG] debug-file - PreHttpRequestUseFiles : init cost memory 0.00899505615234375
+[2025-05-12T16:01:56.107] [DEBUG] debug-file - worker[0] exits with exit code 0.
+[2025-05-12T16:01:56.059] [DEBUG] debug-file - runTaskFromQueue task cost before running: 1 s 955 ms
+[2025-05-12T16:01:56.107] [DEBUG] debug-file - worker[1] exits with exit code 0.
+[2025-05-12T16:01:56.059] [INFO] debug-file - Finished ::init... after 1 ms
+[2025-05-12T16:01:56.108] [DEBUG] debug-file - Current worker pool is terminated.
+[2025-05-16T14:16:03.779] [DEBUG] debug-file - env: nodejsVersion=v18.20.1
+[2025-05-16T14:16:03.923] [DEBUG] debug-file - env: daemon=true
+[2025-05-16T14:16:03.781] [DEBUG] debug-file - env: hvigor-config.json5 content = {
+ modelVersion: '5.0.0',
+ dependencies: {},
+ execution: {},
+ logging: {},
+ debugging: {},
+ nodeOptions: {}
+}
+[2025-05-16T14:16:05.513] [DEBUG] debug-file - java daemon tryConnect failed Error: connect ECONNREFUSED 127.0.0.1:45050
+[2025-05-16T14:16:05.517] [DEBUG] debug-file - java daemon started at port 45050 pid 18104
+[2025-05-16T14:16:05.561] [DEBUG] debug-file - session manager: set active socket. socketId=zWMoopzkNRXGtUJkAAAB
+[2025-05-16T14:16:06.136] [DEBUG] debug-file - watch worker: worker id should be larger than 0. Nothing will be sent to any worker thread.
+[2025-05-16T14:16:06.154] [DEBUG] debug-file - Hvigor init with startParameters:{
+ hvigorfileTypeCheck: false,
+ parallelExecution: true,
+ incrementalExecution: true,
+ printStackTrace: false,
+ daemon: true,
+ analyze: 0,
+ logLevel: Level { level: 20000, levelStr: 'INFO', colour: 'green' }
+}
+[2025-05-16T14:16:06.156] [DEBUG] debug-file - Cache service initialization finished in 2 ms
+[2025-05-16T14:16:06.167] [DEBUG] debug-file - hvigorfile, resolving D:\git_developmentPractice\BestPracticeSnippets\ImageWhiteLumpSolution\PreHttpRequestUseFiles\hvigorfile.ts
+[2025-05-16T14:16:07.536] [DEBUG] debug-file - hvigorfile, require result: { default: { plugins: [] } }
+[2025-05-16T14:16:07.537] [DEBUG] debug-file - hvigorfile, binding system plugins null
+[2025-05-16T14:16:07.730] [DEBUG] debug-file - Start initialize project's product build option map with build mode debug.
+[2025-05-16T14:16:07.730] [DEBUG] debug-file - Picking option from product 'default' with build mode 'debug'.
+[2025-05-16T14:16:07.730] [DEBUG] debug-file - Product 'default' build option: {}
+[2025-05-16T14:16:07.730] [DEBUG] debug-file - End initialize project's product build option map with build mode 'debug'.
+[2025-05-16T14:16:07.733] [DEBUG] debug-file - Product 'default' using build option: {
+ "debuggable": true
+} in this build.
+[2025-05-16T14:16:07.735] [DEBUG] debug-file - not found resModel json file in : D:\git_developmentPractice\BestPracticeSnippets\ImageWhiteLumpSolution\PreHttpRequestUseFiles\entry\src\ohosTest\module.json5
+[2025-05-16T14:16:07.742] [DEBUG] debug-file - No signingConfig found, initRemoteHspCache failed.
+[2025-05-16T14:16:07.746] [DEBUG] debug-file - Local scan or download HarmonyOS sdk components toolchains,ets,js,native,previewer
+[2025-05-16T14:16:07.749] [DEBUG] debug-file - Local scan or download hmscore sdk components toolchains,ets,native
+[2025-05-16T14:16:07.755] [DEBUG] debug-file - Start recording SDK configuration permission data.
+[2025-05-16T14:16:07.785] [DEBUG] debug-file - Sdk init in 42 ms
+[2025-05-16T14:16:07.805] [DEBUG] debug-file - Project task initialization takes 18 ms
+[2025-05-16T14:16:07.805] [DEBUG] debug-file - hvigorfile, binding custom plugins []
+[2025-05-16T14:16:07.805] [DEBUG] debug-file - hvigorfile, no custom plugins were found in D:\git_developmentPractice\BestPracticeSnippets\ImageWhiteLumpSolution\PreHttpRequestUseFiles\hvigorfile.ts
+[2025-05-16T14:16:07.805] [DEBUG] debug-file - hvigorfile, resolve finished D:\git_developmentPractice\BestPracticeSnippets\ImageWhiteLumpSolution\PreHttpRequestUseFiles\hvigorfile.ts
+[2025-05-16T14:16:07.811] [DEBUG] debug-file - hvigorfile, resolving D:\git_developmentPractice\BestPracticeSnippets\ImageWhiteLumpSolution\PreHttpRequestUseFiles\entry\hvigorfile.ts
+[2025-05-16T14:16:07.816] [DEBUG] debug-file - hvigorfile, require result: { default: { plugins: [] } }
+[2025-05-16T14:16:07.816] [DEBUG] debug-file - hvigorfile, binding system plugins null
+[2025-05-16T14:16:07.829] [DEBUG] debug-file - Start initialize module-target build option map, moduleName=entry, buildMode=debug
+[2025-05-16T14:16:07.829] [DEBUG] debug-file - Target 'default' config: {}
+[2025-05-16T14:16:07.829] [DEBUG] debug-file - Target 'ohosTest' config: {}
+[2025-05-16T14:16:07.830] [DEBUG] debug-file - Module 'entry' target 'default' build option: {
+ "debuggable": true,
+ "copyFrom": "default",
+ "name": "debug"
+}
+[2025-05-16T14:16:07.830] [DEBUG] debug-file - Module 'entry' target 'ohosTest' build option: {
+ "debuggable": true,
+ "name": "default"
+}
+[2025-05-16T14:16:07.830] [DEBUG] debug-file - End initialize module-target build option map, moduleName=entry
+[2025-05-16T14:16:07.830] [DEBUG] debug-file - Module 'entry' target 'default' using build option: {
+ "debuggable": true,
+ "copyFrom": "default",
+ "name": "debug"
+} in this build.
+[2025-05-16T14:16:07.837] [DEBUG] debug-file - Module entry task initialization takes 5 ms
+[2025-05-16T14:16:07.837] [DEBUG] debug-file - hvigorfile, binding custom plugins []
+[2025-05-16T14:16:07.837] [DEBUG] debug-file - hvigorfile, no custom plugins were found in D:\git_developmentPractice\BestPracticeSnippets\ImageWhiteLumpSolution\PreHttpRequestUseFiles\entry\hvigorfile.ts
+[2025-05-16T14:16:07.837] [DEBUG] debug-file - hvigorfile, resolve finished D:\git_developmentPractice\BestPracticeSnippets\ImageWhiteLumpSolution\PreHttpRequestUseFiles\entry\hvigorfile.ts
+[2025-05-16T14:16:07.860] [DEBUG] debug-file - hvigorfile, resolve hvigorfile dependencies in 22 ms
+[2025-05-16T14:16:07.861] [DEBUG] debug-file - project has submodules:entry
+[2025-05-16T14:16:07.863] [DEBUG] debug-file - start to load updatedOhPackageInfo to the disk
+[2025-05-16T14:16:07.868] [DEBUG] debug-file - load to the disk finished
+[2025-05-16T14:16:07.869] [DEBUG] debug-file - Start to initialize dependency information.
+[2025-05-16T14:16:07.876] [DEBUG] debug-file - Module PreHttpRequestUseFiles Collected Dependency:
+[2025-05-16T14:16:07.877] [DEBUG] debug-file - Module PreHttpRequestUseFiles's total dependency: 0
+[2025-05-16T14:16:07.878] [DEBUG] debug-file - Start to initialize dependency information.
+[2025-05-16T14:16:07.880] [DEBUG] debug-file - Module entry Collected Dependency:
+[2025-05-16T14:16:07.880] [DEBUG] debug-file - Module entry's total dependency: 0
+[2025-05-16T14:16:07.885] [DEBUG] debug-file - Configuration phase cost:1 s 725 ms
+[2025-05-16T14:16:07.888] [DEBUG] debug-file - Configuration task cost before running: 1 s 748 ms
+[2025-05-16T14:16:07.889] [DEBUG] debug-file - Executing task :entry:init
+[2025-05-16T14:16:07.889] [DEBUG] debug-file - entry : init cost memory 0.01548004150390625
+[2025-05-16T14:16:07.889] [DEBUG] debug-file - runTaskFromQueue task cost before running: 1 s 749 ms
+[2025-05-16T14:16:07.890] [INFO] debug-file - Finished :entry:init... after 1 ms
+[2025-05-16T14:16:07.890] [DEBUG] debug-file - Executing task ::init
+[2025-05-16T14:16:07.890] [DEBUG] debug-file - PreHttpRequestUseFiles : init cost memory 0.01280975341796875
+[2025-05-16T14:16:07.890] [DEBUG] debug-file - runTaskFromQueue task cost before running: 1 s 750 ms
+[2025-05-16T14:16:07.890] [INFO] debug-file - Finished ::init... after 1 ms
+[2025-05-16T14:16:07.902] [DEBUG] debug-file - Module 'entry' target 'default' using build option: {
+ "debuggable": true,
+ "copyFrom": "default",
+ "name": "debug"
+} in this build.
+[2025-05-16T14:16:07.906] [DEBUG] debug-file - Module 'entry' target 'ohosTest' using build option: {
+ "debuggable": true,
+ "name": "default"
+} in this build.
+[2025-05-16T14:16:07.913] [DEBUG] debug-file - Since there is no instance or instance is terminated, create a new worker pool.
+[2025-05-16T14:16:07.914] [DEBUG] debug-file - session manager: send message to worker process.
+[2025-05-16T14:16:07.914] [DEBUG] debug-file - session manager: send message to worker process.
+[2025-05-16T14:16:07.913] [DEBUG] debug-file - Worker pool is initialized with config: {
+ minPoolNum: 2,
+ maxPoolNum: undefined,
+ maxCoreSize: undefined,
+ cacheCapacity: undefined,
+ cacheTtl: undefined
+}
+[2025-05-16T14:16:07.914] [DEBUG] debug-file - Create resident worker with id: 0.
+[2025-05-16T14:16:07.917] [DEBUG] debug-file - Create resident worker with id: 1.
+[2025-05-16T14:16:07.919] [DEBUG] debug-file - Cleanup worker 0.
+[2025-05-16T14:16:07.920] [DEBUG] debug-file - Worker 0 has been cleaned up.
+[2025-05-16T14:16:07.920] [DEBUG] debug-file - Current idle worker size: 1.
+[2025-05-16T14:16:07.920] [DEBUG] debug-file - Current resident worker size: 2.
+[2025-05-16T14:16:07.920] [DEBUG] debug-file - Cleanup worker 1.
+[2025-05-16T14:16:07.920] [DEBUG] debug-file - Worker 1 has been cleaned up.
+[2025-05-16T14:16:07.920] [DEBUG] debug-file - Current idle worker size: 0.
+[2025-05-16T14:16:07.920] [DEBUG] debug-file - Current resident worker size: 2.
+[2025-05-16T14:16:07.921] [DEBUG] debug-file - hvigor build process will be closed.
+[2025-05-16T14:16:07.923] [DEBUG] debug-file - watch worker: worker id should be larger than 0. Nothing will be sent to any worker thread.
+[2025-05-16T14:16:07.923] [DEBUG] debug-file - watch worker: worker id should be larger than 0. Nothing will be sent to any worker thread.
+[2025-05-16T14:16:07.927] [DEBUG] debug-file - worker[0] exits with exit code 0.
+[2025-05-16T14:16:07.931] [DEBUG] debug-file - worker[1] exits with exit code 0.
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/.hvigor/outputs/sync/fileCache.json b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/.hvigor/outputs/sync/fileCache.json
new file mode 100644
index 0000000000000000000000000000000000000000..6aeba1bdf112ad92a2752b41228e5d47c24ffb19
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/.hvigor/outputs/sync/fileCache.json
@@ -0,0 +1 @@
+{"CACHE_SYNC_FILE_HASH":{"D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\hvigor\\hvigor-config.json5":"057be94be6804686b2c105a8fe4d249b070640fc332d584d35d22c98a9e3a019","D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\build-profile.json5":"c43e5230df717b2ef2d152a260ca7573b7b29b5d20132c1b2c605c0712955ac8","D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\hvigorfile.ts":"70c1aa0c84c7e792217cd09f2b25b41889744270bddbfd24ec3364c26c545f74","D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\oh-package.json5":"cf681f216f9863d9c588f9558c3cca70edea1f915786a3f14267dd269a16a2c2","D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\build-profile.json5":"ec20300d2f0c0aeeba4e8646b54be4de9f3fd4829e150043c5d519af683bf04a","D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\hvigorfile.ts":"a99acb4fe3fda56c77a2e23b90b60c137e19d3a4fcee4cc67312797c06fbeda1","D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\oh-package.json5":"0cf0b4e9c42c5d5bbf6873bef6a32ac0b86f8ee49736a119469cc53ca49b2afd","D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\.hvigor\\outputs\\sync\\output.json":"9ad42f69b65ae8016e97c63cc2b730630d05471bdc576efa122a44ccab51713c","SDK_LOCATION":"D:/dev-5.0.11/DevEco Studio/sdk"},"OHPM_INSTALL_FILE_HASH":{"D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\oh-package.json5":"cf681f216f9863d9c588f9558c3cca70edea1f915786a3f14267dd269a16a2c2","D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\oh_modules\\.ohpm\\lock.json5":"7c891fb29f80184d66853388731fe1840ed6c9cfeefc61281aeb83f6e99f34bb","D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\oh-package.json5":"0cf0b4e9c42c5d5bbf6873bef6a32ac0b86f8ee49736a119469cc53ca49b2afd","D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\oh_modules":true,"D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\oh_modules":false}}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/.hvigor/outputs/sync/output.json b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/.hvigor/outputs/sync/output.json
new file mode 100644
index 0000000000000000000000000000000000000000..1fa9ffacf9875c72b3cb1e33ad60ee66d4d83ae3
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/.hvigor/outputs/sync/output.json
@@ -0,0 +1,164 @@
+{
+ "ohos-module-entry": {
+ "SELECT_TARGET": "default",
+ "MODULE_BUILD_DIR": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\build",
+ "DEPENDENCY_INFO": {},
+ "TARGETS": {
+ "default": {
+ "SOURCE_ROOT": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\src\\main",
+ "RESOURCES_PATH": [
+ "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\src\\main\\resources"
+ ],
+ "BUILD_PATH": {
+ "OUTPUT_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\build\\default\\outputs\\default",
+ "INTERMEDIA_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\build\\default\\intermediates",
+ "JS_ASSETS_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\build\\default\\intermediates\\loader_out\\default",
+ "JS_LITE_ASSETS_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\build\\default\\intermediates\\loader_out_lite\\default",
+ "RES_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\build\\default\\intermediates\\res\\default",
+ "RES_PROFILE_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\build\\default\\intermediates\\res\\default\\resources\\base\\profile",
+ "ETS_SUPER_VISUAL_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\build\\default\\cache\\default\\default@CompileArkTS\\esmodule",
+ "JS_SUPER_VISUAL_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\build\\default\\cache\\default\\default@CompileJS\\jsbundle",
+ "WORKER_LOADER": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\build\\default\\intermediates\\loader\\default\\loader.json",
+ "MANIFEST_JSON": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\build\\default\\intermediates\\manifest\\default",
+ "OUTPUT_METADATA_JSON": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\build\\default\\intermediates\\hap_metadata\\default\\output_metadata.json",
+ "SOURCE_MAP_DIR": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\build\\default\\intermediates\\source_map\\default"
+ },
+ "BUILD_OPTION": {
+ "debuggable": true
+ }
+ },
+ "ohosTest": {
+ "SOURCE_ROOT": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\src\\ohosTest",
+ "RESOURCES_PATH": [
+ "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\src\\ohosTest\\resources"
+ ],
+ "BUILD_PATH": {
+ "OUTPUT_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\build\\default\\outputs\\ohosTest",
+ "INTERMEDIA_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\build\\default\\intermediates",
+ "JS_ASSETS_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\build\\default\\intermediates\\loader_out\\ohosTest",
+ "JS_LITE_ASSETS_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\build\\default\\intermediates\\loader_out_lite\\ohosTest",
+ "RES_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\build\\default\\intermediates\\res\\ohosTest",
+ "RES_PROFILE_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\build\\default\\intermediates\\res\\ohosTest\\resources\\base\\profile",
+ "ETS_SUPER_VISUAL_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\build\\default\\cache\\ohosTest\\ohosTest@OhosTestCompileArkTS\\esmodule",
+ "JS_SUPER_VISUAL_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\build\\default\\cache\\ohosTest\\ohosTest@OhosTestCompileJS\\jsbundle",
+ "WORKER_LOADER": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\build\\default\\intermediates\\loader\\ohosTest\\loader.json",
+ "MANIFEST_JSON": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\build\\default\\intermediates\\manifest\\ohosTest",
+ "OUTPUT_METADATA_JSON": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\build\\default\\intermediates\\hap_metadata\\ohosTest\\output_metadata.json",
+ "SOURCE_MAP_DIR": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\build\\default\\intermediates\\source_map\\ohosTest"
+ },
+ "BUILD_OPTION": {
+ "debuggable": true
+ }
+ }
+ },
+ "BUILD_OPTION": {
+ "default-default": {
+ "debuggable": true,
+ "copyFrom": "default",
+ "name": "debug"
+ }
+ },
+ "BUILD_PROFILE_OPT": {
+ "apiType": "stageMode",
+ "buildOption": {},
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": true,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ }
+ }
+ }
+ },
+ {
+ "name": "default"
+ },
+ {
+ "name": "debug"
+ }
+ ],
+ "targets": [
+ {
+ "name": "default"
+ },
+ {
+ "name": "ohosTest"
+ }
+ ]
+ },
+ "BUILD_CACHE_DIR": ""
+ },
+ "ohos-project": {
+ "SELECT_PRODUCT_NAME": "default",
+ "MODULE_BUILD_DIR": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\build",
+ "BUNDLE_NAME": "com.example.useimagehttprequest",
+ "BUILD_PATH": {
+ "OUTPUT_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\build\\outputs\\default"
+ },
+ "MODULES": [
+ {
+ "name": "entry",
+ "srcPath": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry",
+ "targets": [
+ {
+ "name": "default",
+ "applyToProducts": [
+ "default"
+ ]
+ }
+ ],
+ "belongProjectPath": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles"
+ }
+ ],
+ "PROFILE_OPT": {
+ "app": {
+ "signingConfigs": [],
+ "products": [
+ {
+ "name": "default",
+ "signingConfig": "default",
+ "compatibleSdkVersion": "5.0.0(12)",
+ "runtimeOS": "HarmonyOS"
+ }
+ ],
+ "buildModeSet": [
+ {
+ "name": "debug"
+ },
+ {
+ "name": "release"
+ }
+ ]
+ },
+ "modules": [
+ {
+ "name": "entry",
+ "srcPath": "./entry",
+ "targets": [
+ {
+ "name": "default",
+ "applyToProducts": [
+ "default"
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ "CONFIG_PROPERTIES": {
+ "enableSignTask": true,
+ "skipNativeIncremental": false,
+ "hvigor.keepDependency": true
+ },
+ "OVERALL_PROJECT_PATHS": [
+ "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles"
+ ],
+ "BUILD_CACHE_DIR": ""
+ },
+ "version": 1
+}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/.idea/.deveco/module/entry.cache.json b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/.idea/.deveco/module/entry.cache.json
new file mode 100644
index 0000000000000000000000000000000000000000..00e7fa64d6ba3a940daf9252a7a3c8b64af72aec
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/.idea/.deveco/module/entry.cache.json
@@ -0,0 +1,22 @@
+{
+ "CommonInfo":{
+ "current.select.target":"default"
+ },
+ "BuildOptions":{
+ "SELECT_BUILD_TARGET":"default",
+ "BUILD_PATH":{
+ "OUTPUT_METADATA_JSON":"D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\build\\default\\intermediates\\hap_metadata\\default\\output_metadata.json",
+ "OUTPUT_PATH":"D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\build\\default\\outputs\\default",
+ "RES_PATH":"D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\build\\default\\intermediates\\res\\default",
+ "ETS_SUPER_VISUAL_PATH":"D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\build\\default\\cache\\default\\default@CompileArkTS\\esmodule",
+ "JS_ASSETS_PATH":"D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\build\\default\\intermediates\\loader_out\\default",
+ "SOURCE_MAP_DIR":"D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\build\\default\\intermediates\\source_map\\default",
+ "INTERMEDIA_PATH":"D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\build\\default\\intermediates",
+ "RES_PROFILE_PATH":"D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\build\\default\\intermediates\\res\\default\\resources\\base\\profile",
+ "WORKER_LOADER":"D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\build\\default\\intermediates\\loader\\default\\loader.json",
+ "MANIFEST_JSON":"D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\build\\default\\intermediates\\manifest\\default",
+ "JS_LITE_ASSETS_PATH":"D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\build\\default\\intermediates\\loader_out_lite\\default",
+ "JS_SUPER_VISUAL_PATH":"D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\entry\\build\\default\\cache\\default\\default@CompileJS\\jsbundle"
+ }
+ }
+}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/.idea/.deveco/project.cache.json b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/.idea/.deveco/project.cache.json
new file mode 100644
index 0000000000000000000000000000000000000000..7b6303e76d50b17264391dc33f4a728401cad839
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/.idea/.deveco/project.cache.json
@@ -0,0 +1,16 @@
+{
+ "CommonInfo":{
+ "project.ide.version":"5.0.11.100",
+ "current.select.product":"default",
+ "current.select.buildMode":"",
+ "crossplatform.projectType":""
+ },
+ "BuildOptions":{
+ "SELECT_BUILD_PRODUCT":"default",
+ "BUNDLE_NAME":"com.example.useimagehttprequest",
+ "BUILD_PATH":{
+ "OUTPUT_PATH":"D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\PreHttpRequestUseFiles\\build\\outputs\\default"
+ },
+ "SELECT_BUILD_MODE":""
+ }
+}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/.idea/.gitignore b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/.idea/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..359bb5307e8535ab7d59faf27a7377033291821e
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/.idea/.gitignore
@@ -0,0 +1,3 @@
+# 默认忽略的文件
+/shelf/
+/workspace.xml
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/.idea/git_toolbox_blame.xml b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/.idea/git_toolbox_blame.xml
new file mode 100644
index 0000000000000000000000000000000000000000..7dc124965d28403ec2545a24d7d1cd1fec1f57d8
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/.idea/git_toolbox_blame.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/.idea/modules.xml b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/.idea/modules.xml
new file mode 100644
index 0000000000000000000000000000000000000000..32c801e3a2a629eb74e785557404da5a77960abe
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/.idea/modules.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/.idea/modules/PreHttpRequestUseFiles.iml b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/.idea/modules/PreHttpRequestUseFiles.iml
new file mode 100644
index 0000000000000000000000000000000000000000..c0be1d7c491147540d199ce55f0721012b7ff7b5
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/.idea/modules/PreHttpRequestUseFiles.iml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/.idea/modules/entry/entry.iml b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/.idea/modules/entry/entry.iml
new file mode 100644
index 0000000000000000000000000000000000000000..b630fe7f2a024b997f55fc5a52dea6c90a18c45d
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/.idea/modules/entry/entry.iml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/AppScope/app.json5 b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/AppScope/app.json5
new file mode 100644
index 0000000000000000000000000000000000000000..076d01dd66673c840554b285a2bf39f08b59a8e0
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/AppScope/app.json5
@@ -0,0 +1,10 @@
+{
+ "app": {
+ "bundleName": "com.example.useimagehttprequest",
+ "vendor": "example",
+ "versionCode": 1000000,
+ "versionName": "1.0.0",
+ "icon": "$media:app_icon",
+ "label": "$string:app_name"
+ }
+}
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/AppScope/resources/base/element/string.json b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/AppScope/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..98a14fff89a8e3b7134c05c5383e4f642b9639eb
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/AppScope/resources/base/element/string.json
@@ -0,0 +1,8 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "UseImageHttpRequest"
+ }
+ ]
+}
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/AppScope/resources/base/media/app_icon.png b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/AppScope/resources/base/media/app_icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..a39445dc87828b76fed6d2ec470dd455c45319e3
Binary files /dev/null and b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/AppScope/resources/base/media/app_icon.png differ
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/README.md b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..5c0843794007036fea155b1ed54b49e52f532bd6
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/README.md
@@ -0,0 +1,2 @@
+最佳实践"Image白块解决指导"目录
+ImageWhiteLumpSolution-PreHttpRequestUseFiles 使用预下载解决Image长时间白块 正例
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/build-profile.json5 b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..c033ce4278fb0641d84107c3c134047ac487368e
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/build-profile.json5
@@ -0,0 +1,35 @@
+{
+ "app": {
+ "signingConfigs": [],
+ "products": [
+ {
+ "name": "default",
+ "signingConfig": "default",
+ "compatibleSdkVersion": "5.0.0(12)",
+ "runtimeOS": "HarmonyOS",
+ }
+ ],
+ "buildModeSet": [
+ {
+ "name": "debug",
+ },
+ {
+ "name": "release"
+ }
+ ]
+ },
+ "modules": [
+ {
+ "name": "entry",
+ "srcPath": "./entry",
+ "targets": [
+ {
+ "name": "default",
+ "applyToProducts": [
+ "default"
+ ]
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/build-profile.json5 b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..b695582d3680556f4cce2ec518f65720a9413ca3
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/build-profile.json5
@@ -0,0 +1,28 @@
+{
+ "apiType": "stageMode",
+ "buildOption": {
+ },
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": true,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ }
+ }
+ }
+ },
+ ],
+ "targets": [
+ {
+ "name": "default"
+ },
+ {
+ "name": "ohosTest",
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/hvigorfile.ts b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..c6edcd90486dd5a853cf7d34c8647f08414ca7a3
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/hvigorfile.ts
@@ -0,0 +1,6 @@
+import { hapTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/obfuscation-rules.txt b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/obfuscation-rules.txt
new file mode 100644
index 0000000000000000000000000000000000000000..69c4d6a8a5531548e4886fa766090c5c157a87d9
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/obfuscation-rules.txt
@@ -0,0 +1,18 @@
+# Define project specific obfuscation rules here.
+# You can include the obfuscation configuration files in the current module's build-profile.json5.
+#
+# For more details, see
+# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
+
+# Obfuscation options:
+# -disable-obfuscation: disable all obfuscations
+# -enable-property-obfuscation: obfuscate the property names
+# -enable-toplevel-obfuscation: obfuscate the names in the global scope
+# -compact: remove unnecessary blank spaces and all line feeds
+# -remove-log: remove all console.* statements
+# -print-namecache: print the name cache that contains the mapping from the old names to new names
+# -apply-namecache: reuse the given cache file
+
+# Keep options:
+# -keep-property-name: specifies property names that you want to keep
+# -keep-global-name: specifies names that you want to keep in the global scope
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/oh-package.json5 b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..248c3b7541a589682a250f86a6d3ecf7414d2d6a
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/oh-package.json5
@@ -0,0 +1,10 @@
+{
+ "name": "entry",
+ "version": "1.0.0",
+ "description": "Please describe the basic information.",
+ "main": "",
+ "author": "",
+ "license": "",
+ "dependencies": {}
+}
+
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/ets/entryability/EntryAbility.ets b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/ets/entryability/EntryAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..ee788b9979aa6392081744b6ec12fceaad8994f8
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/ets/entryability/EntryAbility.ets
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2024 Huawei Device 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 { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { window } from '@kit.ArkUI';
+
+export default class EntryAbility extends UIAbility {
+ onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
+ }
+
+ onDestroy(): void {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
+ }
+
+ onWindowStageCreate(windowStage: window.WindowStage): void {
+ // Main window is created, set main page for this ability
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
+
+ windowStage.loadContent('pages/MainPage', (err) => {
+ AppStorage.setOrCreate('uiContext', windowStage.getMainWindowSync().getUIContext());
+ 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.');
+ });
+ }
+
+ onWindowStageDestroy(): void {
+ // Main window is destroyed, release UI related resources
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
+ }
+
+ onForeground(): void {
+ // Ability has brought to foreground
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
+ }
+
+ onBackground(): void {
+ // Ability has back to background
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
+ }
+}
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..6b744d7eaa66e51e79fc4e0896e251292ee767c5
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2024 Huawei Device 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 '@kit.PerformanceAnalysisKit';
+import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit';
+
+export default class EntryBackupAbility extends BackupExtensionAbility {
+ async onBackup() {
+ hilog.info(0x0000, 'testTag', 'onBackup ok');
+ }
+
+ async onRestore(bundleVersion: BundleVersion) {
+ hilog.info(0x0000, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion));
+ }
+}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/ets/pages/MainPage.ets b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/ets/pages/MainPage.ets
new file mode 100644
index 0000000000000000000000000000000000000000..c8085255bd47971bfbffcb4da66cd8b8343c37c7
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/ets/pages/MainPage.ets
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2024 Huawei Device 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.
+ */
+
+/*
+ * 最佳实践:Image白块解决问题指导
+ *
+ * 使用预下载解决Image长时间白块 正例
+ */
+
+// DocsCode 1
+// [Start Main_page]
+import { fileIo as fs } from '@kit.CoreFileKit';
+import { image } from '@kit.ImageKit';
+import { common } from '@kit.AbilityKit';
+import { httpRequest } from '../utils/NetRequest';
+
+// Get the application file path
+const uiContext: UIContext | undefined = AppStorage.get('uiContext');
+let context = uiContext?.getHostContext() as common.UIAbilityContext;
+let filesDir = context.filesDir;
+let fileUrl = filesDir + '/xxx.png'; // 当使用实际网络地址时,需填入实际地址的后缀。
+let para: Record = { 'imageData': undefined };
+let localStorage: LocalStorage = new LocalStorage(para);
+
+@Entry(localStorage)
+@Component
+struct MainPage {
+ @State childNavStack: NavPathStack = new NavPathStack();
+ @LocalStorageLink('imageData') imageData: PixelMap | undefined = undefined;
+
+ getPixMap() { // Read files from the application sandbox.
+ try {
+ let file = fs.openSync(fileUrl, fs.OpenMode.READ_WRITE); // Open the file using synchronous method
+ const imageSource: image.ImageSource = image.createImageSource(file.fd);
+ const options: image.InitializationOptions = {
+ 'alphaType': 0, // opacity
+ 'editable': false, // Is it editable
+ 'pixelFormat': 3, // Pixel format
+ 'scaleMode': 1, // Abbreviation
+ 'size': { height: 100, width: 100 }
+ };
+ fs.close(file);
+ imageSource.createPixelMap(options).then((pixelMap: PixelMap) => {
+ this.imageData = pixelMap;
+ });
+ } catch (e) {
+ console.error('资源加载错误,文件或不存在!');
+ }
+ }
+
+ aboutToAppear(): void {
+ httpRequest(); // Initiate network requests in the parent component in advance.
+ }
+
+ build() {
+ Navigation(this.childNavStack) {
+ Column() {
+ Button('push Path to pageOne', { stateEffect: true, type: ButtonType.Capsule })
+ .width('80%')
+ .height(40)
+ .margin({ bottom: '36vp' })
+ .onClick(() => {
+ if (!localStorage.get('imageData')) { // Do not call getPixMap() repeatedly for non-first clicks to avoid reading files from the sandbox every time.
+ this.getPixMap();
+ }
+ this.childNavStack.pushPath({ name: 'pageOne' });
+ })
+ }
+ .width('100%')
+ .height('100%')
+ .justifyContent(FlexAlign.End)
+ }
+ .backgroundColor(Color.Transparent)
+ .title('ParentNavigation')
+ }
+}
+//[End Main_page]
+// DocsCode 1
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/ets/pages/PageOne.ets b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/ets/pages/PageOne.ets
new file mode 100644
index 0000000000000000000000000000000000000000..ae5547e231c9166016f68ef98cbc133644350c7f
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/ets/pages/PageOne.ets
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2024 Huawei Device 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.
+ */
+
+// DocsCode 1
+// [Start PageOne_builder]
+@Builder
+export function PageOneBuilder(name: string,param: Object) {
+ PageOne()
+}
+
+@Component
+export struct PageOne {
+ pageInfo: NavPathStack = new NavPathStack();
+ @State name: string = 'pageOne';
+ @LocalStorageLink('imageData') imageData: PixelMap | undefined = undefined;
+
+ build() {
+ NavDestination() {
+ Row() {
+ Image(this.imageData) // Positive example: At this time, the Image has obtained the preloaded network image, reducing the duration of white blocks appearing.
+ .objectFit(ImageFit.Auto)
+ .width('100%')
+ .height('100%')
+ }
+ .width('100%')
+ .height('100%')
+ .justifyContent(FlexAlign.Center)
+ }
+ .title(this.name)
+ }
+}
+// [End PageOne_builder]
+// DocsCode 1
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/ets/utils/NetRequest.ets b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/ets/utils/NetRequest.ets
new file mode 100644
index 0000000000000000000000000000000000000000..bbb74ec7fc1177c3e6154fb8760e87f45f89b5c1
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/ets/utils/NetRequest.ets
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2024 Huawei Device 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.
+ */
+
+// DocsCode 1
+// [Start http_request]
+import { http } from '@kit.NetworkKit';
+import { BusinessError } from '@kit.BasicServicesKit';
+import { fileIo as fs } from '@kit.CoreFileKit';
+import { common } from '@kit.AbilityKit';
+
+// Get the application file path
+const uiContext: UIContext | undefined = AppStorage.get('uiContext');
+let context = uiContext?.getHostContext() as common.UIAbilityContext;
+let filesDir = context.filesDir;
+let fileUrl = filesDir + '/xxx.png'; // When using the actual network address, the suffix of the actual address must be filled in.
+
+export async function httpRequest() {
+ fs.access(fileUrl, fs.AccessModeType.READ).then((res) => { // Check if the file exists
+ if (!res) { // If there is no address in the sandbox, re-request the network image resources.
+ http.createHttp()
+ .request('https://www.example.com/xxx.png', // Please fill in a specific URL of the online image here.
+ (error: BusinessError, data: http.HttpResponse) => {
+ if (error) {
+ // Do not execute subsequent logic when the download fails.
+ return;
+ }
+ // Process the data returned from the network request.
+ if (http.ResponseCode.OK === data.responseCode) {
+ const imageData: ArrayBuffer = data.result as ArrayBuffer;
+ // Save the image to the application sandbox.
+ readWriteFileWithStream(imageData);
+ }
+ }
+ )
+ }
+ })
+}
+
+// Write to the sandbox
+async function readWriteFileWithStream(imageData: ArrayBuffer): Promise {
+ let outputStream = fs.createStreamSync(fileUrl, 'w+');
+ await outputStream.write(imageData);
+ outputStream.closeSync();
+}
+// [End http_request]
+// DocsCode 1
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/module.json5 b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..3612f9a60b2c655882f368a81c008fa64fe49cc1
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/module.json5
@@ -0,0 +1,58 @@
+{
+ "module": {
+ "name": "entry",
+ "type": "entry",
+ "description": "$string:module_desc",
+ "mainElement": "EntryAbility",
+ "routerMap": "$profile:router_map",
+ "deviceTypes": [
+ "phone",
+ "tablet",
+ "2in1"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false,
+ "pages": "$profile:main_pages",
+ "abilities": [
+ {
+ "name": "EntryAbility",
+ "srcEntry": "./ets/entryability/EntryAbility.ets",
+ "description": "$string:EntryAbility_desc",
+ "icon": "$media:layered_image",
+ "label": "$string:EntryAbility_label",
+ "startWindowIcon": "$media:startIcon",
+ "startWindowBackground": "$color:start_window_background",
+ "exported": true,
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ]
+ }
+ ],
+ "extensionAbilities": [
+ {
+ "name": "EntryBackupAbility",
+ "srcEntry": "./ets/entrybackupability/EntryBackupAbility.ets",
+ "type": "backup",
+ "exported": false,
+ "metadata": [
+ {
+ "name": "ohos.extension.backup",
+ "resource": "$profile:backup_config"
+ }
+ ],
+ }
+ ],
+ "requestPermissions": [
+ {
+ "name": "ohos.permission.INTERNET",
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/resources/base/element/color.json b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/resources/base/element/color.json
new file mode 100644
index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/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/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/resources/base/element/string.json b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..f94595515a99e0c828807e243494f57f09251930
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,16 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "label"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/resources/base/media/background.png b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/resources/base/media/background.png
new file mode 100644
index 0000000000000000000000000000000000000000..f939c9fa8cc8914832e602198745f592a0dfa34d
Binary files /dev/null and b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/resources/base/media/background.png differ
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/resources/base/media/foreground.png b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/resources/base/media/foreground.png
new file mode 100644
index 0000000000000000000000000000000000000000..4483ddad1f079e1089d685bd204ee1cfe1d01902
Binary files /dev/null and b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/resources/base/media/foreground.png differ
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/resources/base/media/layered_image.json b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/resources/base/media/layered_image.json
new file mode 100644
index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/resources/base/media/layered_image.json
@@ -0,0 +1,7 @@
+{
+ "layered-image":
+ {
+ "background" : "$media:background",
+ "foreground" : "$media:foreground"
+ }
+}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/resources/base/media/startIcon.png b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/resources/base/media/startIcon.png
new file mode 100644
index 0000000000000000000000000000000000000000..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b
Binary files /dev/null and b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/resources/base/media/startIcon.png differ
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/resources/base/profile/backup_config.json b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/resources/base/profile/backup_config.json
new file mode 100644
index 0000000000000000000000000000000000000000..78f40ae7c494d71e2482278f359ec790ca73471a
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/resources/base/profile/backup_config.json
@@ -0,0 +1,3 @@
+{
+ "allowToBackupRestore": true
+}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/resources/base/profile/main_pages.json b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/resources/base/profile/main_pages.json
new file mode 100644
index 0000000000000000000000000000000000000000..f4241ef2f72e78047b4c449d92bd1a92accc39fb
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/resources/base/profile/main_pages.json
@@ -0,0 +1,5 @@
+{
+ "src": [
+ "pages/MainPage"
+ ]
+}
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/resources/base/profile/router_map.json b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/resources/base/profile/router_map.json
new file mode 100644
index 0000000000000000000000000000000000000000..d54fa89e19edf4e9bba311784818c084ed961105
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/entry/src/main/resources/base/profile/router_map.json
@@ -0,0 +1,12 @@
+{
+ "routerMap": [
+ {
+ "name": "pageOne",
+ "pageSourceFile": "src/main/ets/pages/PageOne.ets",
+ "buildFunction": "PageOneBuilder",
+ "data": {
+ "description": "this is pageOne"
+ }
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/hvigor/hvigor-config.json5 b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/hvigor/hvigor-config.json5
new file mode 100644
index 0000000000000000000000000000000000000000..06b2783670a348f95533b352c1ceda909a842bbc
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/hvigor/hvigor-config.json5
@@ -0,0 +1,22 @@
+{
+ "modelVersion": "5.0.0",
+ "dependencies": {
+ },
+ "execution": {
+ // "analyze": "normal", /* Define the build analyze mode. Value: [ "normal" | "advanced" | false ]. Default: "normal" */
+ // "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */
+ // "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */
+ // "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */
+ // "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */
+ },
+ "logging": {
+ // "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */
+ },
+ "debugging": {
+ // "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */
+ },
+ "nodeOptions": {
+ // "maxOldSpaceSize": 8192 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process. Default: 8192*/
+ // "exposeGC": true /* Enable to trigger garbage collection explicitly. Default: true*/
+ }
+}
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/hvigorfile.ts b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..f3cb9f1a87a81687554a76283af8df27d8bda775
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/hvigorfile.ts
@@ -0,0 +1,6 @@
+import { appTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh-package-lock.json5 b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh-package-lock.json5
new file mode 100644
index 0000000000000000000000000000000000000000..d3e54c94dcaeaa389813c16ca70e69f962cdefd8
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh-package-lock.json5
@@ -0,0 +1,27 @@
+{
+ "meta": {
+ "stableOrder": true
+ },
+ "lockfileVersion": 3,
+ "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
+ "specifiers": {
+ "@ohos/hamock@1.0.0": "@ohos/hamock@1.0.0",
+ "@ohos/hypium@1.0.18": "@ohos/hypium@1.0.18"
+ },
+ "packages": {
+ "@ohos/hamock@1.0.0": {
+ "name": "@ohos/hamock",
+ "version": "1.0.0",
+ "integrity": "sha512-K6lDPYc6VkKe6ZBNQa9aoG+ZZMiwqfcR/7yAVFSUGIuOAhPvCJAo9+t1fZnpe0dBRBPxj2bxPPbKh69VuyAtDg==",
+ "resolved": "https://repo.harmonyos.com/ohpm/@ohos/hamock/-/hamock-1.0.0.har",
+ "registryType": "ohpm"
+ },
+ "@ohos/hypium@1.0.18": {
+ "name": "@ohos/hypium",
+ "version": "1.0.18",
+ "integrity": "sha512-RGe/iLGdeywdQilMWZsHKUoiE9OJ+9QxQsorF92R2ImLNVHVhbpSePNITGpW7TnvLgOIP/jscOqfIOhk6X7XRQ==",
+ "resolved": "https://repo.harmonyos.com/ohpm/@ohos/hypium/-/hypium-1.0.18.har",
+ "registryType": "ohpm"
+ }
+ }
+}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh-package.json5 b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..ebdda7e54d1c41e952f1c7f6993c6d15ea3d146d
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh-package.json5
@@ -0,0 +1,10 @@
+{
+ "modelVersion": "5.0.0",
+ "description": "Please describe the basic information.",
+ "dependencies": {
+ },
+ "devDependencies": {
+ "@ohos/hypium": "1.0.18",
+ "@ohos/hamock": "1.0.0"
+ }
+}
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/CHANGELOG.md b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/CHANGELOG.md
new file mode 100644
index 0000000000000000000000000000000000000000..22a35bda8a1fab36dd81c1c7ae86addcc1f111cc
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/CHANGELOG.md
@@ -0,0 +1,4 @@
+## 1.0.0
+- 修复once断言问题
+## 1.0.0-rc
+- 提供DevEco Studio预览器场景使能的MockSetup装饰器
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/LICENSE b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..4947287f7b5ccb5d1e8b7b2d3aa5d89f322c160d
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/README.md b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..c46981eb6b9163cb82723dd4c410b69b5e6a66cd
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/README.md
@@ -0,0 +1,82 @@
+# Hamock
+
+## 简介
+
+Hamock 是 OpenHarmony 上的模拟框架,提供预览场景的模拟功能。
+
+## 下载安装
+
+```bash
+ohpm install @ohos/hamock
+```
+
+OpenHarmony ohpm 环境配置等更多内容,请参考[如何安装 OpenHarmony ohpm 包](https://gitee.com/openharmony-tpc/docs/blob/master/OpenHarmony_har_usage.md)
+
+## 使用示例
+
+Hamock 提供了 @MockSetup 用于修饰 Mock 方法,仅支持声明式范式的组件。当开发者预览该组件时,预览运行时将在组件初始化时执行被 @MockSetup 修饰的方法。因此,开发者可以在这个被修饰的方法内重定义组件的方法或重赋值组件的属性,其将在预览时生效。
+
+> 说明:
+> @MockSetup 修饰的方法仅在预览场景会自动触发,并先于组件的 aboutToAppear 执行。
+
+### UI组件的方法
+
+在 ArkTS 页面代码中引入 Hamock。在目标组件中定义一个方法,并用 @MockSetup 修饰该方法。在这个方法中,使用 MockKit 模拟目标方法。
+
+```typescript
+import { MockKit, when, MockSetup } from '@ohos/hamock';
+
+@Entry
+@Component
+struct Index {
+ ...
+ @MockSetup
+ randomName() {
+ let mocker: MockKit = new MockKit();
+ let mockfunc: Object = mocker.mockFunc(this, this.method1);
+ // mock 指定的方法在指定入参的返回值
+ when(mockfunc)('test').afterReturn(1);
+ }
+ ...
+ // 业务场景调用方法
+ const result: number = this.method1('test'); // in previewer, result = 1
+}
+```
+
+### UI组件的属性
+
+在 ArkTS 页面代码中引入 Hamock。在目标组件中定义一个方法,并用 @MockSetup 修饰该方法。在这个方法中,对于需要 Mock 的属性,可以重新赋值。
+
+```typescript
+import { MockSetup } from '@ohos/hamock';
+
+@Component
+struct Person {
+ @Prop species: string;
+ ...
+ // 在 @MockSetup 片段中,定义对象属性
+ @MockSetup
+ randomName() {
+ this.species = 'primates';
+ }
+ ...
+ // 业务场景调用属性(如果从初始化到调用期间,该属性无变化)
+ const result: string = this.species; // in previewer, result = primates
+}
+```
+
+## 约束与限制
+
+在下述版本验证通过:
+
+DevEco Studio: 4.1 (4.1.3.400), SDK: API11 (4.1.0.36)
+
+MockSetup 仅在 API11 支持。
+
+## 贡献代码
+
+使用过程中发现任何问题都可以提[Issue](https://gitee.com/openharmony/testfwk_arkxtest/issues) 给我们,当然,我们也非常欢迎你给我们提[PR](https://gitee.com/openharmony/testfwk_arkxtest/pulls) 。
+
+## 开源协议
+
+本项目基于 [Apache License 2.0](https://gitee.com/openharmony/testfwk_arkxtest/blob/master/hamock/LICENSE) ,请自由地享受和参与开源。
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/build-profile.json5 b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..12fe2d844bdb69584fd05ebaa3e1cb197a25c3f1
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/build-profile.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2023 Huawei Device 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.
+ */
+
+{
+ "apiType": "stageMode",
+ "buildOption": {
+ },
+ "targets": [
+ {
+ "name": "default"
+ }
+ ]
+}
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/hvigorfile.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/hvigorfile.js
new file mode 100644
index 0000000000000000000000000000000000000000..d7bda561c9bf09b92a7fac485141cc8648907388
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/hvigorfile.js
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2023 Huawei Device 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.
+ */
+
+// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
+export { harTasks } from '@ohos/hvigor-ohos-plugin';
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/hvigorfile.ts b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..960be7d7df0790853d6bdab1f52a3ec8c8e4a1ca
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/hvigorfile.ts
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2023 Huawei Device 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.
+ */
+
+// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
+export { harTasks } from '@ohos/hvigor-ohos-plugin';
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/index.d.ts b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/index.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..6bc7929ba5718da0e459721be04e903ec59289c0
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/index.d.ts
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2023 Huawei Device 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.
+ */
+
+export class ArgumentMatchers {
+ static any;
+ static anyString;
+ static anyBoolean;
+ static anyNumber;
+ static anyObj;
+ static anyFunction;
+ static matchRegexs(Regex: RegExp): void
+}
+
+declare interface when {
+ afterReturn(value: any): any
+ afterReturnNothing(): undefined
+ afterAction(action: any): any
+ afterThrow(e_msg: string): string
+ (argMatchers?: any): when;
+}
+
+export const when: when;
+
+export interface VerificationMode {
+ times(count: Number): void
+ never(): void
+ once(): void
+ atLeast(count: Number): void
+ atMost(count: Number): void
+}
+
+export class MockKit {
+ constructor()
+ mockFunc(obj: Object, func: Function): Function
+ mockObject(obj: Object): Object
+ verify(methodName: String, argsArray: Array): VerificationMode
+ ignoreMock(obj: Object, func: Function): void
+ clear(obj: Object): void
+ clearAll(): void
+}
+
+export declare function MockSetup(
+ target: Object,
+ propertyName: string | Symbol,
+ descriptor: TypedPropertyDescriptor<() => void>
+): void;
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/index.ets b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..c3a47320c2b674216cccde0fe217dbb8423625cc
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/index.ets
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2023 Huawei Device 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.
+ */
+
+export { MockSetup, MockKit, when } from './src/main/mock/MockKit';
+export { ArgumentMatchers } from './src/main/mock/ArgumentMatchers';
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/index.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..1cb2b5e0256e00aa9276867f0753a89a7ac5e16f
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/index.js
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2021-2023 Huawei Device 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.
+ */
+export { MockSetup, MockKit, when } from './src/main/mock/MockKit.js';
+export { ArgumentMatchers } from './src/main/mock/ArgumentMatchers.js';
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/index.ts b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/index.ts
new file mode 100644
index 0000000000000000000000000000000000000000..608eb4fe72aaf0f6cca0ccb3baad94e9b6101de0
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/index.ts
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2021-2023 Huawei Device 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.
+ */
+
+export { MockSetup, MockKit, when } from './src/main/mock/MockKit.js';
+export { ArgumentMatchers } from './src/main/mock/ArgumentMatchers.js';
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/oh-package.json5 b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..0ef4eeed251a93463c2abf85b262c3e1fb6733bc
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/oh-package.json5
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2023 Huawei Device 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.
+ */
+
+{
+ name: '@ohos/hamock',
+ version: '1.0.0',
+ description: 'A mock framework for OpenHarmony application.',
+ main: 'index.ets',
+ author: 'huawei',
+ license: 'Apache-2.0',
+ dependencies: {},
+ ohos: {
+ org: 'ohos',
+ },
+ types: 'index.d.ts'
+}
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/ArgumentMatchers.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/ArgumentMatchers.js
new file mode 100644
index 0000000000000000000000000000000000000000..f06bbca0b287aac612f42f9263c064c0157ae03a
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/ArgumentMatchers.js
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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.
+ */
+export class ArgumentMatchers {
+ constructor() {
+ this.ANY = "";
+ this.ANY_STRING = "";
+ this.ANY_BOOLEAN = "";
+ this.ANY_NUMBER = "";
+ this.ANY_OBJECT = "";
+ this.ANY_FUNCTION = "";
+ this.MATCH_REGEXS = "";
+ }
+ static any() {
+ }
+ static anyString() {
+ }
+ static anyBoolean() {
+ }
+ static anyNumber() {
+ }
+ static anyObj() {
+ }
+ static anyFunction() {
+ }
+ static matchRegexs(regex) {
+ if (ArgumentMatchers.isRegExp(regex)) {
+ return regex;
+ }
+ throw Error("not a regex");
+ }
+ static isRegExp(value) {
+ return Object.prototype.toString.call(value) === "[object RegExp]";
+ }
+ matcheReturnKey(...args) {
+ let arg = args[0];
+ let regex = args[1];
+ let stubSetKey = args[2];
+ if (stubSetKey && stubSetKey == this.ANY) {
+ return this.ANY;
+ }
+ if (typeof arg === "string" && !regex) {
+ return this.ANY_STRING;
+ }
+ if (typeof arg === "boolean" && !regex) {
+ return this.ANY_BOOLEAN;
+ }
+ if (typeof arg === "number" && !regex) {
+ return this.ANY_NUMBER;
+ }
+ if (typeof arg === "object" && !regex) {
+ return this.ANY_OBJECT;
+ }
+ if (typeof arg === "function" && !regex) {
+ return this.ANY_FUNCTION;
+ }
+ if (typeof arg === "string" && regex) {
+ return regex.test(arg);
+ }
+ return null;
+ }
+ matcheStubKey(key) {
+ if (key === ArgumentMatchers.any) {
+ return this.ANY;
+ }
+ if (key === ArgumentMatchers.anyString) {
+ return this.ANY_STRING;
+ }
+ if (key === ArgumentMatchers.anyBoolean) {
+ return this.ANY_BOOLEAN;
+ }
+ if (key === ArgumentMatchers.anyNumber) {
+ return this.ANY_NUMBER;
+ }
+ if (key === ArgumentMatchers.anyObj) {
+ return this.ANY_OBJECT;
+ }
+ if (key === ArgumentMatchers.anyFunction) {
+ return this.ANY_FUNCTION;
+ }
+ if (ArgumentMatchers.isRegExp(key)) {
+ return key;
+ }
+ return null;
+ }
+}
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/ArgumentMatchers.ts b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/ArgumentMatchers.ts
new file mode 100644
index 0000000000000000000000000000000000000000..262bea1afbeb611029db0cfaeb65767b92f97b91
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/ArgumentMatchers.ts
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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.
+ */
+
+export class ArgumentMatchers {
+ ANY = "";
+ ANY_STRING = "";
+ ANY_BOOLEAN = "";
+ ANY_NUMBER = "";
+ ANY_OBJECT = "";
+ ANY_FUNCTION = "";
+ MATCH_REGEXS = "";
+
+ static any() {
+ }
+
+ static anyString() {
+ }
+
+ static anyBoolean() {
+ }
+
+ static anyNumber() {
+ }
+
+ static anyObj() {
+ }
+
+ static anyFunction() {
+ }
+
+ static matchRegexs(regex: any) {
+ if (ArgumentMatchers.isRegExp(regex)) {
+ return regex;
+ }
+ throw Error("not a regex");
+ }
+
+ static isRegExp(value: string) {
+ return Object.prototype.toString.call(value) === "[object RegExp]";
+ }
+
+ matcheReturnKey(...args: Array) {
+ let arg = args[0];
+ let regex = args[1];
+ let stubSetKey = args[2];
+
+ if (stubSetKey && stubSetKey == this.ANY) {
+ return this.ANY;
+ }
+
+ if (typeof arg === "string" && !regex) {
+ return this.ANY_STRING;
+ }
+
+ if (typeof arg === "boolean" && !regex) {
+ return this.ANY_BOOLEAN;
+ }
+
+ if (typeof arg === "number" && !regex) {
+ return this.ANY_NUMBER;
+ }
+
+ if (typeof arg === "object" && !regex) {
+ return this.ANY_OBJECT;
+ }
+
+ if (typeof arg === "function" && !regex) {
+ return this.ANY_FUNCTION;
+ }
+
+ if (typeof arg === "string" && regex) {
+ return regex.test(arg);
+ }
+
+ return null;
+ }
+
+ matcheStubKey(key: any) {
+
+ if (key === ArgumentMatchers.any) {
+ return this.ANY;
+ }
+
+ if (key === ArgumentMatchers.anyString) {
+ return this.ANY_STRING;
+ }
+ if (key === ArgumentMatchers.anyBoolean) {
+ return this.ANY_BOOLEAN;
+ }
+ if (key === ArgumentMatchers.anyNumber) {
+ return this.ANY_NUMBER;
+ }
+ if (key === ArgumentMatchers.anyObj) {
+ return this.ANY_OBJECT;
+ }
+ if (key === ArgumentMatchers.anyFunction) {
+ return this.ANY_FUNCTION;
+ }
+
+ if (ArgumentMatchers.isRegExp(key)) {
+ return key;
+ }
+
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/ExtendInterface.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/ExtendInterface.js
new file mode 100644
index 0000000000000000000000000000000000000000..52f9dff07f7b719900ca47d56c3020586db31d5b
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/ExtendInterface.js
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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.
+ */
+class ExtendInterface {
+ constructor(mocker) {
+ this.mocker = mocker;
+ }
+ stub() {
+ this.params = arguments;
+ return this;
+ }
+ stubMockedCall(returnInfo) {
+ this.mocker.stubApply(this, this.params, returnInfo);
+ }
+ afterReturn(value) {
+ this.stubMockedCall(function () {
+ return value;
+ });
+ }
+ afterReturnNothing() {
+ this.stubMockedCall(function () {
+ return undefined;
+ });
+ }
+ afterAction(action) {
+ this.stubMockedCall(action);
+ }
+ afterThrow(msg) {
+ this.stubMockedCall(function () {
+ throw msg;
+ });
+ }
+ clear(obj) {
+ this.mocker.clear(obj);
+ }
+}
+export default ExtendInterface;
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/ExtendInterface.ts b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/ExtendInterface.ts
new file mode 100644
index 0000000000000000000000000000000000000000..55f7a0b36bc2895e17a2e6b32a6c1980853cbce9
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/ExtendInterface.ts
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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 { MockKit } from "./MockKit.js";
+
+class ExtendInterface {
+
+ private mocker: MockKit
+ private params: any
+
+ constructor(mocker: MockKit) {
+ this.mocker = mocker;
+ }
+
+ stub() {
+ this.params = arguments;
+ return this;
+ }
+
+ stubMockedCall(returnInfo: any) {
+ this.mocker.stubApply(this, this.params, returnInfo);
+ }
+
+ afterReturn(value: any) {
+ this.stubMockedCall(function () {
+ return value;
+ });
+ }
+
+ afterReturnNothing() {
+ this.stubMockedCall(function () {
+ return undefined;
+ });
+ }
+
+ afterAction(action: Function) {
+ this.stubMockedCall(action);
+ }
+
+ afterThrow(msg: string) {
+ this.stubMockedCall(function () {
+ throw msg;
+ });
+ }
+
+ clear(obj?: any) {
+ this.mocker.clear(obj);
+ }
+}
+
+export default ExtendInterface;
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/MockKit.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/MockKit.js
new file mode 100644
index 0000000000000000000000000000000000000000..c1ca51614abe9f9c149094f5186eeb750b00a074
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/MockKit.js
@@ -0,0 +1,253 @@
+/*
+ * Copyright (c) 2022-2023 Huawei Device 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 ExtendInterface from "./ExtendInterface.js";
+import VerificationMode from "./VerificationMode.js";
+import { ArgumentMatchers } from "./ArgumentMatchers.js";
+class MockKit {
+ constructor() {
+ this.mFunctions = [];
+ this.stubs = new Map();
+ this.recordCalls = new Map();
+ this.currentSetKey = new Map();
+ this.mockObj = null;
+ this.recordMockedMethod = new Map();
+ this.mFunctions = [];
+ this.stubs = new Map();
+ this.recordCalls = new Map();
+ this.currentSetKey = new Map();
+ this.mockObj = null;
+ this.recordMockedMethod = new Map();
+ }
+ init() {
+ this.reset();
+ }
+ reset() {
+ this.mFunctions = [];
+ this.stubs = new Map();
+ this.recordCalls = new Map();
+ this.currentSetKey = new Map();
+ this.mockObj = null;
+ this.recordMockedMethod = new Map();
+ }
+ clearAll() {
+ this.reset();
+ }
+ clear(obj) {
+ if (!obj) throw Error("Please enter an object to be cleaned");
+ if (typeof (obj) !== 'object' && typeof (obj) !== 'function') throw new Error('Not a object or static class');
+ this.recordMockedMethod.forEach(function (value, key, map) {
+ if (key) {
+ obj[key] = value;
+ }
+ });
+ }
+ ignoreMock(obj, method) {
+ if (typeof (obj) !== 'object' && typeof (obj) !== 'function') throw new Error('Not a object or static class');
+ if (typeof (method) !== 'function') throw new Error('Not a function');
+ let og = this.recordMockedMethod.get(method.propName);
+ if (og) {
+ obj[method.propName] = og;
+ this.recordMockedMethod.set(method.propName, undefined);
+ }
+ }
+ extend(dest, source) {
+ dest["stub"] = source["stub"];
+ dest["afterReturn"] = source["afterReturn"];
+ dest["afterReturnNothing"] = source["afterReturnNothing"];
+ dest["afterAction"] = source["afterAction"];
+ dest["afterThrow"] = source["afterThrow"];
+ dest["stubMockedCall"] = source["stubMockedCall"];
+ dest["clear"] = source["clear"];
+ return dest;
+ }
+ stubApply(f, params, returnInfo) {
+ let values = this.stubs.get(f);
+ if (!values) {
+ values = new Map();
+ }
+ let key = params[0];
+ if (typeof key === "undefined") {
+ key = "anonymous-mock-" + f.propName;
+ }
+ let matcher = new ArgumentMatchers();
+ if (matcher.matcheStubKey(key)) {
+ key = matcher.matcheStubKey(key);
+ if (key) {
+ this.currentSetKey.set(f, key);
+ }
+ }
+ values.set(key, returnInfo);
+ this.stubs.set(f, values);
+ }
+ getReturnInfo(f, params) {
+ let values = this.stubs.get(f);
+ if (!values) {
+ return undefined;
+ }
+ let retrunKet = params[0];
+ if (typeof retrunKet === "undefined") {
+ retrunKet = "anonymous-mock-" + f.propName;
+ }
+ let stubSetKey = this.currentSetKey.get(f);
+
+ if (stubSetKey && (typeof (retrunKet) !== "undefined")) {
+ retrunKet = stubSetKey;
+ }
+ let matcher = new ArgumentMatchers();
+ if (matcher.matcheReturnKey(params[0], undefined, stubSetKey) && matcher.matcheReturnKey(params[0], undefined, stubSetKey) !== stubSetKey) {
+ retrunKet = params[0];
+ }
+ values.forEach(function (value, key, map) {
+ if (ArgumentMatchers.isRegExp(key) && matcher.matcheReturnKey(params[0], key)) {
+ retrunKet = key;
+ }
+ });
+ return values.get(retrunKet);
+ }
+ findName(obj, value) {
+ let properties = this.findProperties(obj);
+ let name = '';
+ properties.filter((item) => (item !== 'caller' && item !== 'arguments')).forEach(function (va1, idx, array) {
+ if (obj[va1] === value) {
+ name = va1;
+ }
+ });
+ return name;
+ }
+ isFunctionFromPrototype(f, container, propName) {
+ if (container.constructor !== Object && container.constructor.prototype !== container) {
+ return container.constructor.prototype[propName] === f;
+ }
+ return false;
+ }
+ findProperties(obj, ...arg) {
+ function getProperty(new_obj) {
+ if (new_obj.__proto__ === null) {
+ return [];
+ }
+ let properties = Object.getOwnPropertyNames(new_obj);
+ return [...properties, ...getProperty(new_obj.__proto__)];
+ }
+ return getProperty(obj);
+ }
+ recordMethodCall(originalMethod, args) {
+ originalMethod['getName'] = function () {
+ return this.name || this.toString().match(/function\s*([^(]*)\(/)[1];
+ };
+ let name = originalMethod.getName();
+ let arglistString = name + '(' + Array.from(args).toString() + ')';
+ let records = this.recordCalls.get(arglistString);
+ if (!records) {
+ records = 0;
+ }
+ records++;
+ this.recordCalls.set(arglistString, records);
+ }
+ mockFunc(originalObject, originalMethod) {
+ let tmp = this;
+ this.originalMethod = originalMethod;
+ const _this = this;
+ let f = function () {
+ let args = arguments;
+ let action = tmp.getReturnInfo(f, args);
+ if (originalMethod) {
+ tmp.recordMethodCall(originalMethod, args);
+ }
+ if (action) {
+ return action.apply(_this, args);
+ }
+ };
+ f.container = null || originalObject;
+ f.original = originalMethod || null;
+ if (originalObject && originalMethod) {
+ if (typeof (originalMethod) != 'function')
+ throw new Error('Not a function');
+ var name = this.findName(originalObject, originalMethod);
+ originalObject[name] = f;
+ this.recordMockedMethod.set(name, originalMethod);
+ f.propName = name;
+ f.originalFromPrototype = this.isFunctionFromPrototype(f.original, originalObject, f.propName);
+ }
+ f.mocker = this;
+ this.mFunctions.push(f);
+ this.extend(f, new ExtendInterface(this));
+ return f;
+ }
+ verify(methodName, argsArray) {
+ if (!methodName) {
+ throw Error("not a function name");
+ }
+ let a = this.recordCalls.get(methodName + '(' + argsArray.toString() + ')');
+ return new VerificationMode(a ? a : 0);
+ }
+ mockObject(object) {
+ if (!object || typeof object === "string") {
+ throw Error(`this ${object} cannot be mocked`);
+ }
+ const _this = this;
+ let mockedObject = {};
+ let keys = Reflect.ownKeys(object);
+ keys.filter(key => (typeof Reflect.get(object, key)) === 'function')
+ .forEach((key) => {
+ mockedObject[key] = object[key];
+ mockedObject[key] = _this.mockFunc(mockedObject, mockedObject[key]);
+ });
+ return mockedObject;
+ }
+}
+function ifMockedFunction(f) {
+ if (Object.prototype.toString.call(f) != "[object Function]" &&
+ Object.prototype.toString.call(f) != "[object AsyncFunction]") {
+ throw Error("not a function");
+ }
+ if (!f.stub) {
+ throw Error("not a mock function");
+ }
+ return true;
+}
+function when(f) {
+ if (ifMockedFunction(f)) {
+ return f.stub.bind(f);
+ }
+}
+function MockSetup(target, propertyName, descriptor) {
+ const aboutToAppearOrigin = target.aboutToAppear;
+ const setup = descriptor.value;
+ target.aboutToAppear = function (...args) {
+ if (target.__Param) { // copy attributes and params of the original context
+ try {
+ const map = target.__Param;
+ for (const [key, val] of map) {
+ this[key] = val; // 'this' refers to context of current function
+ }
+ }
+ catch (e) {
+ throw new Error(`Mock setup param error: ${e}`);
+ }
+ }
+ if (setup) { // apply the mock content
+ try {
+ setup.apply(this);
+ }
+ catch (e) {
+ throw new Error(`Mock setup apply error: ${e}`);
+ }
+ }
+ if (aboutToAppearOrigin) { // append to aboutToAppear function of the original context
+ aboutToAppearOrigin.apply(this, args);
+ }
+ };
+}
+export { MockSetup, MockKit, when };
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/MockKit.ts b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/MockKit.ts
new file mode 100644
index 0000000000000000000000000000000000000000..2807643e29d6da16ee7061ce5674b696a4fc3ca6
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/MockKit.ts
@@ -0,0 +1,294 @@
+/*
+ * Copyright (c) 2023 Huawei Device 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 ExtendInterface from "./ExtendInterface.js";
+import VerificationMode from "./VerificationMode.js";
+import { ArgumentMatchers } from "./ArgumentMatchers.js";
+
+interface IFunction extends Function {
+ container: any;
+ original: any;
+ propName: string;
+ originalFromPrototype: boolean
+ mocker: MockKit
+}
+
+class MockKit {
+
+ private mFunctions:Array = [];
+ private stubs = new Map();
+ private recordCalls = new Map();
+ private currentSetKey = new Map();
+ private mockObj = null;
+ private recordMockedMethod = new Map();
+ private originalMethod: any;
+
+ constructor() {
+ this.mFunctions = [];
+ this.stubs = new Map();
+ this.recordCalls = new Map();
+ this.currentSetKey = new Map();
+ this.mockObj = null;
+ this.recordMockedMethod = new Map();
+ }
+
+ init() {
+ this.reset();
+ }
+
+ reset() {
+ this.mFunctions = [];
+ this.stubs = new Map()
+ this.recordCalls = new Map();
+ this.currentSetKey = new Map();
+ this.mockObj = null;
+ this.recordMockedMethod = new Map();
+ }
+
+ clearAll() {
+ this.reset();
+ }
+
+ clear(obj: any) {
+ if (!obj) throw Error("Please enter an object to be cleaned");
+ if (typeof (obj) != 'object') throw new Error('Not a object');
+ this.recordMockedMethod.forEach(function (value, key, map) {
+ if (key) {
+ obj[key] = value;
+ }
+ });
+ }
+
+ ignoreMock(obj:any, method: any) {
+ if (typeof (obj) != 'object') throw new Error('Not a object');
+ if (typeof (method) != 'function') throw new Error('Not a function');
+ let og = this.recordMockedMethod.get(method.propName);
+ if (og) {
+ obj[method.propName] = og;
+ this.recordMockedMethod.set(method.propName, undefined);
+ }
+ }
+
+ extend(dest: any, source:any) {
+ dest["stub"] = source["stub"];
+ dest["afterReturn"] = source["afterReturn"];
+ dest["afterReturnNothing"] = source["afterReturnNothing"];
+ dest["afterAction"] = source["afterAction"];
+ dest["afterThrow"] = source["afterThrow"];
+ dest["stubMockedCall"] = source["stubMockedCall"];
+ dest["clear"] = source["clear"];
+ return dest;
+ }
+
+ stubApply(f: any, params:any, returnInfo:any) {
+ let values = this.stubs.get(f);
+ if (!values) {
+ values = new Map();
+ }
+ let key = params[0];
+ if (typeof key == "undefined") {
+ key = "anonymous-mock-" + f.propName;
+ }
+ let matcher = new ArgumentMatchers();
+ if (matcher.matcheStubKey(key)) {
+ key = matcher.matcheStubKey(key);
+ if (key) {
+ this.currentSetKey.set(f, key);
+ }
+ }
+ values.set(key, returnInfo);
+ this.stubs.set(f, values);
+ }
+
+ getReturnInfo(f: any, params:any) {
+ let values = this.stubs.get(f);
+ if (!values) {
+ return undefined;
+ }
+ let retrunKet = params[0];
+ if (typeof retrunKet == "undefined") {
+ retrunKet = "anonymous-mock-" + f.propName;
+ }
+ let stubSetKey = this.currentSetKey.get(f);
+
+ if (stubSetKey && (typeof (retrunKet) != "undefined")) {
+ retrunKet = stubSetKey;
+ }
+ let matcher = new ArgumentMatchers();
+ if (matcher.matcheReturnKey(params[0], undefined, stubSetKey) && matcher.matcheReturnKey(params[0], undefined, stubSetKey) != stubSetKey) {
+ retrunKet = params[0];
+ }
+
+ values.forEach(function (value: any, key: any, map: any) {
+ if (ArgumentMatchers.isRegExp(key) && matcher.matcheReturnKey(params[0], key)) {
+ retrunKet = key;
+ }
+ });
+
+ return values.get(retrunKet);
+ }
+
+ findName(obj: any, value: any) {
+ let properties = this.findProperties(obj);
+ let name = '';
+ properties.filter((item:any) => (item !== 'caller' && item !== 'arguments')).forEach(
+ function (va1:any, idx:any, array:any) {
+ if (obj[va1] === value) {
+ name = va1;
+ }
+ }
+ );
+ return name;
+ }
+
+ isFunctionFromPrototype(f: Function, container:Function, propName: string) {
+ if (container.constructor != Object && container.constructor.prototype !== container) {
+ return container.constructor.prototype[propName] === f;
+ }
+ return false;
+ }
+
+ findProperties(obj: any, ...arg: Array) {
+ function getProperty(new_obj:any): Array {
+ if (new_obj.__proto__ === null) {
+ return [];
+ }
+ let properties = Object.getOwnPropertyNames(new_obj);
+ return [...properties, ...getProperty(new_obj.__proto__)];
+ }
+ return getProperty(obj);
+ }
+
+ recordMethodCall(originalMethod: any, args: any) {
+ originalMethod['getName'] = function () {
+ return this.name || this.toString().match(/function\s*([^(]*)\(/)[1];
+ }
+ let name = originalMethod.getName();
+ let arglistString = name + '(' + Array.from(args).toString() + ')';
+ let records = this.recordCalls.get(arglistString);
+ if (!records) {
+ records = 0;
+ }
+ records++;
+ this.recordCalls.set(arglistString, records);
+ }
+
+ mockFunc(originalObject:any, originalMethod:any) {
+ let tmp = this;
+ this.originalMethod = originalMethod;
+ const _this = this;
+ let f:any = function () {
+ let args = arguments;
+ let action = tmp.getReturnInfo(f, args);
+ if (originalMethod) {
+ tmp.recordMethodCall(originalMethod, args);
+ }
+ if (action) {
+ return action.apply(_this, args);
+ }
+ };
+
+ f.container = null || originalObject;
+ f.original = originalMethod || null;
+
+ if (originalObject && originalMethod) {
+ if (typeof (originalMethod) != 'function') throw new Error('Not a function');
+ var name = this.findName(originalObject, originalMethod);
+ originalObject[name] = f;
+ this.recordMockedMethod.set(name, originalMethod);
+ f.propName = name;
+ f.originalFromPrototype = this.isFunctionFromPrototype(f.original, originalObject, f.propName);
+ }
+ f.mocker = this;
+ this.mFunctions.push(f);
+ this.extend(f, new ExtendInterface(this));
+ return f;
+ }
+
+ verify(methodName:any, argsArray:any) {
+ if (!methodName) {
+ throw Error("not a function name");
+ }
+ let a = this.recordCalls.get(methodName + '(' + argsArray.toString() + ')');
+ return new VerificationMode(a ? a : 0);
+ }
+
+ mockObject(object: any) {
+ if (!object || typeof object === "string") {
+ throw Error(`this ${object} cannot be mocked`);
+ }
+ const _this = this;
+ let mockedObject:any = {};
+ let keys = Reflect.ownKeys(object);
+ keys.filter(key => (typeof Reflect.get(object, key)) === 'function')
+ .forEach((key:any) => {
+ mockedObject[key] = object[key];
+ mockedObject[key] = _this.mockFunc(mockedObject, mockedObject[key]);
+ });
+ return mockedObject;
+ }
+}
+
+function ifMockedFunction(f: any) {
+ if (Object.prototype.toString.call(f) != "[object Function]" &&
+ Object.prototype.toString.call(f) != "[object AsyncFunction]") {
+ throw Error("not a function");
+ }
+ if (!f.stub) {
+ throw Error("not a mock function");
+ }
+ return true;
+}
+
+function when(f: any) {
+ if (ifMockedFunction(f)) {
+ return f.stub.bind(f);
+ }
+}
+
+function MockSetup(target: Object, propertyName: string | Symbol, descriptor: TypedPropertyDescriptor<() => void>): void {
+ const aboutToAppearOrigin = target.aboutToAppear;
+ const setup = descriptor.value;
+ target.aboutToAppear = function (...args: any[]) {
+ if (target.__Param) { // copy attributes and params of the original context
+ try {
+ const map = target.__Param as Map;
+ for (const [key, val] of map) {
+ this[key] = val; // 'this' refers to context of current function
+ }
+ } catch (e) {
+ throw new Error(`Mock setup param error: ${e}`);
+ }
+ }
+
+ if (setup) { // apply the mock content
+ try {
+ setup.apply(this);
+ } catch (e) {
+ throw new Error(`Mock setup apply error: ${e}`);
+ }
+ }
+
+ if (aboutToAppearOrigin) { // append to aboutToAppear function of the original context
+ aboutToAppearOrigin.apply(this, args);
+ }
+ }
+}
+
+export {
+ MockSetup,
+ MockKit,
+ when
+};
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/VerificationMode.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/VerificationMode.js
new file mode 100644
index 0000000000000000000000000000000000000000..21e10fb8037f59475510b2821fcf7432c9459a4a
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/VerificationMode.js
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2022-2023 Huawei Device 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.
+ */
+class VerificationMode {
+ constructor(times) {
+ this.doTimes = times;
+ }
+ times(count) {
+ if (count !== this.doTimes) {
+ throw Error(`expect ${count} actual ${this.doTimes}`);
+ }
+ }
+ never() {
+ if (this.doTimes !== 0) {
+ throw Error(`expect 0 actual ${this.doTimes}`);
+ }
+ }
+ once() {
+ if (this.doTimes !== 1) {
+ throw Error(`expect 1 actual ${this.doTimes}`);
+ }
+ }
+ atLeast(count) {
+ if (count > this.doTimes) {
+ throw Error('failed ' + count + ' greater than the actual execution times of method');
+ }
+ }
+ atMost(count) {
+ if (count < this.doTimes) {
+ throw Error('failed ' + count + ' less than the actual execution times of method');
+ }
+ }
+}
+export default VerificationMode;
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/VerificationMode.ts b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/VerificationMode.ts
new file mode 100644
index 0000000000000000000000000000000000000000..93d976ce73b2fbde199d31b3efd30eb3544179d8
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/VerificationMode.ts
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2022-2023 Huawei Device 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.
+ */
+
+
+class VerificationMode {
+
+ private doTimes: number
+
+ constructor(times: number) {
+ this.doTimes = times;
+ }
+
+ times(count: number) {
+ if(count !== this.doTimes) {
+ throw Error(`expect ${count} actual ${this.doTimes}`);
+ }
+ }
+
+ never() {
+ if (this.doTimes !== 0) {
+ throw Error(`expect 0 actual ${this.doTimes}`);
+ }
+ }
+
+ once() {
+ if (this.doTimes !== 1) {
+ throw Error(`expect 1 actual ${this.doTimes}`);
+ }
+ }
+
+ atLeast(count: number) {
+ if (count > this.doTimes) {
+ throw Error('failed ' + count + ' greater than the actual execution times of method');
+ }
+ }
+
+ atMost(count: number) {
+ if (count < this.doTimes) {
+ throw Error('failed ' + count + ' less than the actual execution times of method');
+ }
+ }
+}
+
+export default VerificationMode;
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/module.json b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/module.json
new file mode 100644
index 0000000000000000000000000000000000000000..384ae72f9bd2353fea8a5c9c5d6696ab5e67cb21
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/module.json
@@ -0,0 +1,22 @@
+{
+ "app": {
+ "bundleName": "com.example.hamock",
+ "debug": true,
+ "versionCode": 1000000,
+ "versionName": "1.0.0",
+ "minAPIVersion": 9,
+ "targetAPIVersion": 9,
+ "apiReleaseType": "Release"
+ },
+ "module": {
+ "name": "hamock",
+ "type": "har",
+ "deviceTypes": [
+ "default",
+ "tablet",
+ "tv",
+ "wearable",
+ "car"
+ ]
+ }
+}
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/res/schemas/mock-config-json5-schema.json b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/res/schemas/mock-config-json5-schema.json
new file mode 100644
index 0000000000000000000000000000000000000000..96036325a316d827cb9fcb6908b3de23c53b4b79
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/res/schemas/mock-config-json5-schema.json
@@ -0,0 +1,25 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "title": "JSON schema for mock-config.json5 file",
+ "definitions": {
+ "sourceRedirection": {
+ "description": "A source redirection for mocked module.",
+ "type": "object",
+ "required": [
+ "source"
+ ],
+ "properties": {
+ "source": {
+ "type": "string",
+ "maxLength": 128,
+ "minLength": 1
+ }
+ }
+ }
+ },
+ "patternProperties": {
+ ".+": {
+ "$ref": "#/definitions/sourceRedirection"
+ }
+ }
+}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/BuildProfile.ets b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/BuildProfile.ets
new file mode 100644
index 0000000000000000000000000000000000000000..e84ee338f70bbfe5512c648fc7cc88b019557243
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/BuildProfile.ets
@@ -0,0 +1,5 @@
+export default class BuildProfile {
+ static readonly HAR_VERSION = '1.0.18';
+ static readonly BUILD_MODE_NAME = 'debug';
+ static readonly DEBUG = true;
+}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/CHANGELOG.md b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/CHANGELOG.md
new file mode 100644
index 0000000000000000000000000000000000000000..b7e0113af1ceafe3ba8abc35ecf69aa9746088be
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/CHANGELOG.md
@@ -0,0 +1,18 @@
+## 1.0.14
+- 堆栈信息打印到cmd
+## 1.0.15
+- 支持获取测试代码的失败堆栈信息
+- mock代码迁移至harmock包
+- 适配arkts语法
+- 修复覆盖率数据容易截断的bug
+## 1.0.16
+- 修改覆盖率文件生成功能
+- 修改静态方法无法ignoreMock函数
+- ## 1.0.17
+- 修改not断言失败提示日志
+- 自定义错误message信息
+- 添加xdescribe, xit API功能
+- ## 1.0.18
+- 添加全局变量存储API get set
+- 自定义断言功能
+
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/LICENSE b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..4947287f7b5ccb5d1e8b7b2d3aa5d89f322c160d
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/README.md b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..50cdf9dc5e11bba059f2147354273225bd3781b0
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/README.md
@@ -0,0 +1,220 @@
+
Hypium
+
A unit test framework for OpenHarmonyOS application
+
+## Hypium是什么?
+***
+- Hypium是OpenHarmony上的测试框架,提供测试用例编写、执行、结果显示能力,用于OpenHarmony系统应用接口以及应用界面测试。
+- Hypium结构化模型:hypium工程主要由List.test.js与TestCase.test.js组成。
+```
+rootProject // Hypium工程根目录
+├── moduleA
+│ ├── src
+│ ├── main // 被测试应用目录
+│ ├── ohosTest // 测试用例目录
+│ ├── js/ets
+│ └── test
+│ └── List.test.js // 测试用例加载脚本,ets目录下为.ets后缀
+│ └── TestCase.test.js // 测试用例脚本,ets目录下为.ets后缀
+└── moduleB
+ ...
+│ └── List.test.js // 测试用例加载脚本,ets目录下为.ets后缀
+│ └── TestCase.test.js // 测试用例脚本,ets目录下为.ets后缀
+```
+
+## 安装使用
+***
+- 在DevEco Studio内使用Hypium
+- 工程级package.json内配置:
+```json
+"dependencies": {
+ "@ohos/hypium": "1.0.18"
+}
+```
+注:
+hypium服务于OpenHarmonyOS应用对外接口测试、系统对外接口测试(SDK中接口),完成HAP自动化测试。详细指导:
+[Deveco Studio](https://developer.harmonyos.com/cn/develop/deveco-studio)
+
+#### 通用语法
+
+- 测试用例采用业内通用语法,describe代表一个测试套, it代表一条用例。
+
+| No. | API | 功能说明 |
+|-----| ---------- | ---------------------------------------------------------------------------------------------------------------------- |
+| 1 | describe | 定义一个测试套,支持两个参数:测试套名称和测试套函数 |
+| 2 | beforeAll | 在测试套内定义一个预置条件,在所有测试用例开始前执行且仅执行一次,支持一个参数:预置动作函数 |
+| 3 | beforeEach | 在测试套内定义一个单元预置条件,在每条测试用例开始前执行,执行次数与it定义的测试用例数一致,支持一个参数:预置动作函数 |
+| 4 | afterEach | 在测试套内定义一个单元清理条件,在每条测试用例结束后执行,执行次数与it定义的测试用例数一致,支持一个参数:清理动作函数 |
+| 5 | afterAll | 在测试套内定义一个清理条件,在所有测试用例结束后执行且仅执行一次,支持一个参数:清理动作函数 |
+| 6 | it | 定义一条测试用例,支持三个参数:用例名称,过滤参数和用例函数 |
+| 7 | expect | 支持bool类型判断等多种断言方法 |
+| 8 | xdescribe | @since1.0.17定义一个跳过的测试套,支持两个参数:测试套名称和测试套函数。 |
+| 9 | xit | @since1.0.17定义一条跳过的测试用例,支持三个参数:用例名称,过滤参数和用例函数。 |
+#### 断言库
+
+- 示例代码:
+
+```javascript
+ expect(${actualvalue}).assertX(${expectvalue})
+```
+
+- 断言功能列表:
+
+| No. | API | 功能说明 |
+| :--- | :------------------------------- | ---------------------------------------------------------------------------------------------- |
+| 1 | assertClose | 检验actualvalue和expectvalue(0)的接近程度是否是expectValue(1) |
+| 2 | assertContain | 检验actualvalue中是否包含expectvalue |
+| 3 | assertDeepEquals | @since1.0.4 检验actualvalue和expectvalue(0)是否是同一个对象 |
+| 4 | assertEqual | 检验actualvalue是否等于expectvalue[0] |
+| 5 | assertFail | 抛出一个错误 |
+| 6 | assertFalse | 检验actualvalue是否是false |
+| 7 | assertTrue | 检验actualvalue是否是true |
+| 8 | assertInstanceOf | 检验actualvalue是否是expectvalue类型 |
+| 9 | assertLarger | 检验actualvalue是否大于expectvalue |
+| 10 | assertLess | 检验actualvalue是否小于expectvalue |
+| 11 | assertNaN | @since1.0.4 检验actualvalue是否是NaN |
+| 12 | assertNegUnlimited | @since1.0.4 检验actualvalue是否等于Number.NEGATIVE_INFINITY |
+| 13 | assertNull | 检验actualvalue是否是null |
+| 14 | assertPosUnlimited | @since1.0.4 检验actualvalue是否等于Number.POSITIVE_INFINITY |
+| 15 | assertPromiseIsPending | @since1.0.4 检验actualvalue是否处于Pending状态【actualvalue为promse对象】 |
+| 16 | assertPromiseIsRejected | @since1.0.4 检验actualvalue是否处于Rejected状态【同15】 |
+| 17 | assertPromiseIsRejectedWith | @since1.0.4 检验actualvalue是否处于Rejected状态,并且比较执行的结果值【同15】 |
+| 18 | assertPromiseIsRejectedWithError | @since1.0.4 检验actualvalue是否处于Rejected状态并有异常,同时比较异常的类型和message值【同15】 |
+| 19 | assertPromiseIsResolved | @since1.0.4 检验actualvalue是否处于Resolved状态【同15】 |
+| 20 | assertPromiseIsResolvedWith | @since1.0.4 检验actualvalue是否处于Resolved状态,并且比较执行的结果值【同15】 |
+| 21 | assertThrowError | 检验actualvalue抛出Error内容是否是expectValue |
+| 22 | assertUndefined | 检验actualvalue是否是undefined |
+| 23 | not | @since1.0.4 断言结果取反 |
+| 24 | message | @since1.0.17自定义断言异常信息 |
+
+示例代码:
+
+```javascript
+ import { describe, it, expect } from '@ohos/hypium';
+
+ export default async function assertCloseTest() {
+ describe('assertClose', function () {
+ it('assertClose_success', 0, function () {
+ let a = 100;
+ let b = 0.1;
+ expect(a).assertClose(99, b);
+ })
+ })
+ }
+```
+
+#### 公共系统能力
+
+| No. | API | 功能描述 |
+| ---- | ------------------------------------------------------- | ------------------------------------------------------------ |
+| 1 | existKeyword(keyword: string, timeout: number): boolean | @since1.0.3 hilog日志中查找指定字段是否存在,keyword是待查找关键字,timeout为设置的查找时间 |
+| 2 | actionStart(tag: string): void | @since1.0.3 cmd窗口输出开始tag |
+| 3 | actionEnd(tag: string): void | @since1.0.3 cmd窗口输出结束tag |
+
+示例代码:
+
+```javascript
+import { describe, it, expect, SysTestKit} from '@ohos/hypium';
+
+export default function existKeywordTest() {
+ describe('existKeywordTest', function () {
+ it('existKeyword',DEFAULT, async function () {
+ console.info("HelloTest");
+ let isExist = await SysTestKit.existKeyword('HelloTest');
+ console.info('isExist ------>' + isExist);
+ })
+ })
+}
+```
+```javascript
+import { describe, it, expect, SysTestKit} from '@ohos/hypium';
+
+export default function actionTest() {
+ describe('actionTest', function () {
+ it('existKeyword',DEFAULT, async function () {
+ let tag = '[MyTest]';
+ SysTestKit.actionStart(tag);
+ //do something
+ SysTestKit.actionEnd(tag);
+ })
+ })
+}
+```
+
+#### 专项能力
+
+- 测试用例属性筛选能力:hypium支持根据用例属性筛选执行指定测试用例,使用方式是先在测试用例上标记用例属性后,再在测试应用的启动shell命令后新增" -s ${Key} ${Value}"。
+
+| Key | 含义说明 | Value取值范围 |
+| -------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
+| level | 用例级别 | "0","1","2","3","4", 例如:-s level 1 |
+| size | 用例粒度 | "small","medium","large", 例如:-s size small |
+| testType | 用例测试类型 | "function","performance","power","reliability","security","global","compatibility","user","standard","safety","resilience", 例如:-s testType function |
+
+示例代码
+
+```javascript
+import { describe, it, expect, TestType, Size, Level } from '@ohos/hypium';
+
+export default function attributeTest() {
+ describe('attributeTest', function () {
+ it("testAttributeIt", TestType.FUNCTION | Size.SMALLTEST | Level.LEVEL0, function () {
+ console.info('Hello Test');
+ })
+ })
+}
+```
+
+示例命令
+```shell
+XX -s level 1 -s size small -s testType function
+```
+该命令的作用是:筛选测试应用中同时满足a)用例级别是1 b)用例粒度是small c)用例测试类型是function 三个条件的用例执行。
+
+- 测试套/测试用例名称筛选能力(测试套与用例名称用“#”号连接,多个用“,”英文逗号分隔)
+
+| Key | 含义说明 | Value取值范围 |
+| -------- | ----------------------- | -------------------------------------------------------------------------------------------- |
+| class | 指定要执行的测试套&用例 | ${describeName}#${itName},${describeName} , 例如:-s class attributeTest#testAttributeIt |
+| notClass | 指定不执行的测试套&用例 | ${describeName}#${itName},${describeName} , 例如:-s notClass attributeTest#testAttributeIt |
+
+示例命令
+```shell
+XX -s class attributeTest#testAttributeIt,abilityTest#testAbilityIt
+```
+该命令的作用是:筛选测试应用中attributeTest测试套下的testAttributeIt测试用例,abilityTest测试套下的testAbilityIt测试用例,只执行这两条用例。
+
+- 其他能力
+
+| 能力项 | Key | 含义说明 | Value取值范围 |
+| ------------ | ------- | ---------------------------- | ---------------------------------------------- |
+| 随机执行能力 | random | 测试套&测试用例随机执行 | true, 不传参默认为false, 例如:-s random true |
+| 空跑能力 | dryRun | 显示要执行的测试用例信息全集 | true , 不传参默认为false,例如:-s dryRun true |
+| 异步超时能力 | timeout | 异步用例执行的超时时间 | 正整数 , 单位ms,例如:-s timeout 5000 |
+
+##### 约束限制
+随机执行能力和空跑能力从npm包1.0.3版本开始支持
+
+#### Mock能力
+
+##### 约束限制
+
+单元测试框架Mock能力从npm包[1.0.1版本](https://repo.harmonyos.com/#/cn/application/atomService/@ohos%2Fhypium/v/1.0.1)开始支持
+
+## 约束
+
+***
+ 本模块首批接口从OpenHarmony SDK API version 8开始支持。
+
+## Hypium开放能力隐私声明
+
+- 我们如何收集和使用您的个人信息
+ 您在使用集成了Hypium开放能力的测试应用时,Hypium不会处理您的个人信息。
+- SDK处理的个人信息
+ 不涉及。
+- SDK集成第三方服务声明
+ 不涉及。
+- SDK数据安全保护
+ 不涉及。
+- SDK版本更新声明
+ 为了向您提供最新的服务,我们会不时更新Hypium版本。我们强烈建议开发者集成使用最新版本的Hypium。
+
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/build-profile.json5 b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..312d38eb08629793b3484c7373213f22840c8d82
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/build-profile.json5
@@ -0,0 +1,28 @@
+{
+ "apiType": "stageMode",
+ "buildOption": {
+ },
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": true,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ },
+ "consumerFiles": [
+ "./consumer-rules.txt"
+ ]
+ }
+ },
+ },
+ ],
+ "targets": [
+ {
+ "name": "default"
+ }
+ ]
+}
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/hvigorfile.ts b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..42187071482d292588ad40babeda74f7b8d97a23
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/hvigorfile.ts
@@ -0,0 +1,6 @@
+import { harTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/index.d.ts b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/index.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..54fc0420f7b872b8ffd6f9e6c3623e32be6ff606
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/index.d.ts
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2021-2024 Huawei Device 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.
+ */
+
+export const DEFAULT = 0B0000
+
+export const when: when;
+
+export enum TestType {
+ FUNCTION = 0B1,
+ PERFORMANCE = 0B1 << 1,
+ POWER = 0B1 << 2,
+ RELIABILITY = 0B1 << 3,
+ SECURITY = 0B1 << 4,
+ GLOBAL = 0B1 << 5,
+ COMPATIBILITY = 0B1 << 6,
+ USER = 0B1 << 7,
+ STANDARD = 0B1 << 8,
+ SAFETY = 0B1 << 9,
+ RESILIENCE = 0B1 << 10
+}
+
+export enum Size {
+ SMALLTEST = 0B1 << 16,
+ MEDIUMTEST = 0B1 << 17,
+ LARGETEST = 0B1 << 18
+}
+
+export enum Level {
+ LEVEL0 = 0B1 << 24,
+ LEVEL1 = 0B1 << 25,
+ LEVEL2 = 0B1 << 26,
+ LEVEL3 = 0B1 << 27,
+ LEVEL4 = 0B1 << 28
+}
+export { xdescribe, xit, describe, it } from './index';
+
+
+
+export function beforeItSpecified(testCaseNames: Array | string, callback: Function): void
+
+export function afterItSpecified(testCaseNames: Array | string, callback: Function): void
+
+export function beforeEach(callback: Function): void
+
+export function afterEach(callback: Function): void
+
+export function beforeAll(callback: Function): void
+
+export function afterAll(callback: Function): void
+
+
+export interface Assert {
+ assertClose(expectValue: number, precision: number): void
+ assertContain(expectValue: any): void
+ assertEqual(expectValue: any): void
+ assertFail(): void
+ assertFalse(): void
+ assertTrue(): void
+ assertInstanceOf(expectValue: string): void
+ assertLarger(expectValue: number): void
+ assertLess(expectValue: number): void
+ assertNull(): void
+ assertThrowError(expectValue: string): void
+ assertUndefined(): void
+ assertLargerOrEqual(expectValue: number): void
+ assertLessOrEqual(expectValue: number): void
+ assertNaN(): void
+ assertNegUnlimited(): void
+ assertPosUnlimited(): void
+ not(): Assert;
+ assertDeepEquals(expectValue: any): void
+ assertPromiseIsPending(): void
+ assertPromiseIsRejected(): void
+ assertPromiseIsRejectedWith(expectValue?: any): void
+ assertPromiseIsRejectedWithError(...expectValue): void
+ assertPromiseIsResolved(): void
+ assertPromiseIsResolvedWith(expectValue?: any): void
+ message(msg: string): Assert
+}
+
+export function expect(actualValue?: any): Assert
+
+export class ArgumentMatchers {
+ static any;
+ static anyString;
+ static anyBoolean;
+ static anyNumber;
+ static anyObj;
+ static anyFunction;
+ static matchRegexs(Regex: RegExp): void
+}
+
+declare interface when {
+ afterReturn(value: any): any
+ afterReturnNothing(): undefined
+ afterAction(action: any): any
+ afterThrow(e_msg: string): string
+ (argMatchers?: any): when;
+}
+
+export interface VerificationMode {
+ times(count: Number): void
+ never(): void
+ once(): void
+ atLeast(count: Number): void
+ atMost(count: Number): void
+}
+
+export class MockKit {
+ constructor()
+ mockFunc(obj: Object, func: Function): Function
+ mockObject(obj: Object): Object
+ verify(methodName: String, argsArray: Array): VerificationMode
+ ignoreMock(obj: Object, func: Function): void
+ clear(obj: Object): void
+ clearAll(): void
+}
+
+export class SysTestKit {
+ static getDescribeName(): string;
+ static getItName(): string;
+ static getItAttribute(): TestType | Size | Level
+ static actionStart(tag: string): void
+ static actionEnd(tag: string): void
+ static existKeyword(keyword: string, timeout?: number): boolean
+}
+
+export class Hypium {
+ static setData(data: { [key: string]: any }): void
+ static setTimeConfig(systemTime: any)
+ static hypiumTest(abilityDelegator: any, abilityDelegatorArguments: any, testsuite: Function): void
+ static set(key: string, value: any): void
+ static get(key: string): any
+ static registerAssert(customAssertion: Function): void
+ static unregisterAssert(customAssertion: string | Function): void
+}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/index.ets b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..1a9b707e35e58e5819594321bac6e36997a90713
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/index.ets
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2021-2024 Huawei Device 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 Core from './src/main/core';
+import {TestType, Size, Level, DEFAULT} from './src/main/Constant';
+import DataDriver from './src/main/module/config/DataDriver';
+import ExpectExtend from './src/main/module/assert/ExpectExtend';
+import OhReport from './src/main/module/report/OhReport';
+export { xdescribe, xit, describe, it } from './index.ts';
+
+export declare class Hypium {
+ static setData(data: Object): void
+ static setTimeConfig(systemTime: Object): void
+ static hypiumTest(abilityDelegator: Object, abilityDelegatorArguments: Object, testsuite: Function): void
+ static set(key: string, value: Object): void
+ static get(key: string): Object
+ static registerAssert(customAssertion: Function): void
+ static unregisterAssert(customAssertion: string | Function): void
+}
+
+export {
+ Core,
+ DataDriver,
+ ExpectExtend,
+ OhReport,
+ TestType,
+ Size,
+ Level,
+ DEFAULT
+};
+
+type allExpectType = Object | undefined | null
+
+export declare function beforeItSpecified(testCaseNames: Array | string, callback: Function): void
+
+export declare function afterItSpecified(testCaseNames: Array | string, callback: Function): void
+
+export declare function beforeEach(callback: Function): void
+
+export declare function afterEach(callback: Function): void
+
+export declare function beforeAll(callback: Function): void
+
+export declare function afterAll(callback: Function): void
+
+export declare interface Assert {
+ assertClose(expectValue: number, precision: number): void
+ assertContain(expectValue: allExpectType): void
+ assertEqual(expectValue: allExpectType): void
+ assertFail(): void
+ assertFalse(): void
+ assertTrue(): void
+ assertInstanceOf(expectValue: string): void
+ assertLarger(expectValue: number): void
+ assertLess(expectValue: number): void
+ assertNull(): void
+ assertThrowError(expectValue: string): void
+ assertUndefined(): void
+ assertLargerOrEqual(expectValue: number):void
+ assertLessOrEqual(expectValue: number):void
+ assertNaN():void
+ assertNegUnlimited(): void
+ assertPosUnlimited(): void
+ not(): Assert;
+ assertDeepEquals(expectValue: allExpectType):void
+ assertPromiseIsPending(): void
+ assertPromiseIsRejected(): void
+ assertPromiseIsRejectedWith(expectValue?: allExpectType): void
+ assertPromiseIsRejectedWithError(...expectValue: allExpectType[]): void
+ assertPromiseIsResolved(): void
+ assertPromiseIsResolvedWith(expectValue?: allExpectType): void
+ message(msg: string): Assert
+}
+
+export declare function expect(actualValue?: allExpectType): Assert
+
+export declare class ArgumentMatchers {
+ static any: allExpectType;
+ static anyString: string;
+ static anyBoolean: Boolean;
+ static anyNumber: Number;
+ static anyObj: Object;
+ static anyFunction: Function;
+ static matchRegexs(Regex: RegExp): void
+}
+
+declare interface whenResult {
+ afterReturn: (value: allExpectType) => allExpectType
+ afterReturnNothing: () => undefined
+ afterAction: (action: allExpectType) => allExpectType
+ afterThrow: (e_msg: string) => string
+}
+
+export declare function when(f:Function): (f?: allExpectType | void) => whenResult
+
+export declare interface VerificationMode {
+ times(count: Number): void
+ never(): void
+ once(): void
+ atLeast(count: Number): void
+ atMost(count: Number): void
+}
+
+export declare class MockKit {
+ constructor()
+ mockFunc(obj: Object, func: Function): Function
+ mockObject(obj: Object): Object
+ verify(methodName: String, argsArray: Array): VerificationMode
+ ignoreMock(obj: Object, func: Function): void
+ clear(obj: Object): void
+ clearAll(): void
+}
+
+export declare class SysTestKit {
+ static actionStart(tag: string): void
+ static actionEnd(tag: string): void
+ static existKeyword(keyword: string, timeout?: number): boolean
+}
+
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/index.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..320cff5bd99bfe6c13665e558f0845b98b2c8619
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/index.js
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2021-2024 Huawei Device 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 Core from './src/main/core';
+import { DEFAULT, TestType, Size, Level, TAG } from './src/main/Constant';
+import DataDriver from './src/main/module/config/DataDriver';
+import ExpectExtend from './src/main/module/assert/ExpectExtend';
+import OhReport from './src/main/module/report/OhReport';
+import SysTestKit from './src/main/module/kit/SysTestKit';
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, beforeItSpecified, afterItSpecified, xdescribe, xit } from './src/main/interface';
+import { MockKit, when } from './src/main/module/mock/MockKit';
+import ArgumentMatchers from './src/main/module/mock/ArgumentMatchers';
+
+class Hypium {
+ static context = new Map();
+ static setData(data) {
+ const core = Core.getInstance();
+ const dataDriver = new DataDriver({ data });
+ core.addService('dataDriver', dataDriver);
+ }
+
+ static setTimeConfig(systemTime) {
+ SysTestKit.systemTime = systemTime;
+ }
+
+ static set(key, value) {
+ Hypium.context.set(key, value);
+ }
+
+ static get(key) {
+ return Hypium.context.get(key);
+ }
+
+ static hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) {
+ const core = Core.getInstance();
+ const expectExtend = new ExpectExtend({
+ 'id': 'extend'
+ });
+ core.addService('expect', expectExtend);
+ const ohReport = new OhReport({
+ 'delegator': abilityDelegator,
+ 'abilityDelegatorArguments': abilityDelegatorArguments
+ });
+ SysTestKit.delegator = abilityDelegator;
+ core.addService('report', ohReport);
+ core.init();
+ core.subscribeEvent('spec', ohReport);
+ core.subscribeEvent('suite', ohReport);
+ core.subscribeEvent('task', ohReport);
+ const configService = core.getDefaultService('config');
+ if (abilityDelegatorArguments !== null) {
+ let testParameters = configService.translateParams(abilityDelegatorArguments.parameters);
+ console.info(`${TAG}parameters:${JSON.stringify(testParameters)}`);
+ configService.setConfig(testParameters);
+ }
+ testsuite();
+ core.execute(abilityDelegator);
+ }
+
+ static registerAssert(customAssertion) {
+ const core = Core.getInstance();
+ const expectService = core.getDefaultService('expect');
+ let matchers = {};
+ matchers[customAssertion.name] = customAssertion;
+ expectService.addMatchers(matchers);
+ expectService.customMatchers.push(customAssertion.name);
+ console.log(`${TAG}success to register the ${customAssertion.name}`);
+ }
+
+ static unregisterAssert(customAssertion) {
+ const core = Core.getInstance();
+ const expectService = core.getDefaultService('expect');
+ let customAssertionName = typeof customAssertion === 'function' ? customAssertion.name : customAssertion;
+ expectService.removeMatchers(customAssertionName);
+ console.log(`${TAG}success to unregister the ${customAssertionName}`);
+ }
+
+}
+
+export {
+ Hypium,
+ Core,
+ DEFAULT,
+ TestType,
+ Size,
+ Level,
+ DataDriver,
+ ExpectExtend,
+ OhReport,
+ SysTestKit,
+ describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, beforeItSpecified, afterItSpecified, xdescribe, xit,
+ MockKit, when,
+ ArgumentMatchers
+};
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/index.ts b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/index.ts
new file mode 100644
index 0000000000000000000000000000000000000000..b7082ebc98214b58d41e8681791809f1aee48f12
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/index.ts
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2024 Huawei Device 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 { TestType, Size, Level } from "./src/main/Constant";
+
+export declare function xdescribe(testSuiteName: string, func: Function): void;
+
+export declare namespace xdescribe {
+ function reason(reason: string): any;
+};
+
+export declare function describe(testSuiteName: string, func: Function): void;
+
+export declare function xit(testCaseName: string, attribute: TestType | Size | Level, func: Function): void;
+
+export declare namespace xit {
+ function reason(reason: string): any;
+};
+
+export declare function it(testCaseName: string, attribute: TestType | Size | Level, func: Function): void;
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/oh-package.json5 b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..9cd9da2c41f9f31a6c14b8fe792c87bcf4183554
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/oh-package.json5
@@ -0,0 +1 @@
+{"name":"@ohos/hypium","version":"1.0.18","description":"A unit test framework for OpenHarmony application","main":"index.js","keywords":["测试框架","except","mock"],"author":"huawei","license":"Apache-2.0","repository":"https://gitee.com/openharmony/testfwk_arkxtest","homepage":"https://gitee.com/openharmony/testfwk_arkxtest","dependencies":{}}
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/Constant.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/Constant.js
new file mode 100644
index 0000000000000000000000000000000000000000..7a24b2130e3c6e3f2f7bc75d425247e9b355c6b6
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/Constant.js
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2021-2024 Huawei Device 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.
+ */
+
+/**
+ * define the testcase type : TestType, Size , Level
+ */
+export const TAG = '[Hypium]';
+
+export const DEFAULT = 0B0000;
+
+export class TestType {
+ static FUNCTION = 0B1;
+ static PERFORMANCE = 0B1 << 1;
+ static POWER = 0B1 << 2;
+ static RELIABILITY = 0B1 << 3;
+ static SECURITY = 0B1 << 4;
+ static GLOBAL = 0B1 << 5;
+ static COMPATIBILITY = 0B1 << 6;
+ static USER = 0B1 << 7;
+ static STANDARD = 0B1 << 8;
+ static SAFETY = 0B1 << 9;
+ static RESILIENCE = 0B1 << 10;
+}
+
+export class Size {
+ static SMALLTEST = 0B1 << 16;
+ static MEDIUMTEST = 0B1 << 17;
+ static LARGETEST = 0B1 << 18;
+}
+
+export class Level {
+ static LEVEL0 = 0B1 << 24;
+ static LEVEL1 = 0B1 << 25;
+ static LEVEL2 = 0B1 << 26;
+ static LEVEL3 = 0B1 << 27;
+ static LEVEL4 = 0B1 << 28;
+}
+
+export const TESTTYPE = {
+ 'function': 1,
+ 'performance': 1 << 1,
+ 'power': 1 << 2,
+ 'reliability': 1 << 3,
+ 'security': 1 << 4,
+ 'global': 1 << 5,
+ 'compatibility': 1 << 6,
+ 'user': 1 << 7,
+ 'standard': 1 << 8,
+ 'safety': 1 << 9,
+ 'resilience': 1 << 10,
+}
+
+export const LEVEL = {
+ '0': 1 << 24,
+ '1': 1 << 25,
+ '2': 1 << 26,
+ '3': 1 << 27,
+ '4': 1 << 28,
+}
+
+export const SIZE = {
+ 'small': 1 << 16,
+ 'medium': 1 << 17,
+ 'large': 1 << 18,
+}
+
+export const KEYSET = [
+ '-s class', '-s notClass', '-s suite', '-s itName',
+ '-s level', '-s testType', '-s size', '-s timeout',
+ '-s dryRun', '-s random', '-s breakOnError', '-s stress',
+ '-s coverage', '-s skipMessage', '-s runSkipped',
+ 'class', 'notClass', 'suite', 'itName',
+ 'level', 'testType', 'size', 'timeout', 'dryRun', 'random',
+ 'breakOnError', 'stress', 'coverage', 'skipMessage', 'runSkipped'
+]
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/core.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/core.js
new file mode 100644
index 0000000000000000000000000000000000000000..cfcb5f17287208f5e6869b4248faf6c9093002d9
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/core.js
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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 {SuiteService, SpecService, ExpectService, ReportService} from './service';
+import {ConfigService} from './module/config/configService';
+import {SpecEvent, TaskEvent, SuiteEvent} from './event';
+
+/**
+ * core service for execute testcase.
+ */
+class Core {
+ static getInstance() {
+ if (!this.instance) {
+ this.instance = new Core();
+ }
+ return this.instance;
+ }
+
+ constructor() {
+ this.instance = null;
+ this.services = {
+ suite: {},
+ spec: {},
+ config: {},
+ expect: {},
+ log: {},
+ report: {}
+
+ };
+ this.events = {
+ suite: {},
+ spec: {},
+ task: {}
+ };
+ }
+
+ addService(name, service) {
+ let serviceObj = {};
+ if (!this.services[name]) {
+ this.services[name] = serviceObj;
+ } else {
+ serviceObj = this.services[name];
+ }
+ serviceObj[service.id] = service;
+ }
+
+ getDefaultService(name) {
+ return this.services[name].default;
+ }
+
+ getServices(name) {
+ return this.services[name];
+ }
+
+ registerEvent(serviceName, event) {
+ let eventObj = {};
+ if (!this.events[serviceName]) {
+ this.events[serviceName] = eventObj;
+ } else {
+ eventObj = this.events[serviceName];
+ }
+ eventObj[event.id] = event;
+ }
+
+ unRegisterEvent(serviceName, eventID) {
+ const eventObj = this.events[serviceName];
+ if (eventObj) {
+ delete eventObj[eventID];
+ }
+ }
+
+ subscribeEvent(serviceName, serviceObj) {
+ const eventObj = this.events[serviceName];
+ if (eventObj) {
+ for (const attr in eventObj) {
+ eventObj[attr]['subscribeEvent'](serviceObj);
+ }
+ }
+ }
+
+ async fireEvents(serviceName, eventName) {
+ const eventObj = this.events[serviceName];
+ if (!eventObj) {
+ return;
+ }
+ for (const attr in eventObj) {
+ await eventObj[attr][eventName]();
+ }
+ }
+
+ addToGlobal(apis) {
+ if (typeof globalThis !== 'undefined') {
+ for (let api in apis) {
+ globalThis[api] = apis[api];
+ }
+ }
+ for (const api in apis) {
+ this[api] = apis[api];
+ }
+ }
+
+ init() {
+ this.addService('suite', new SuiteService({id: 'default'}));
+ this.addService('spec', new SpecService({id: 'default'}));
+ this.addService('expect', new ExpectService({id: 'default'}));
+ this.addService('report', new ReportService({id: 'default'}));
+ this.addService('config', new ConfigService({id: 'default'}));
+ this.registerEvent('task', new TaskEvent({id: 'default', coreContext: this}));
+ this.registerEvent('suite', new SuiteEvent({id: 'default', coreContext: this}));
+ this.registerEvent('spec', new SpecEvent({id: 'default', coreContext: this}));
+ this.subscribeEvent('spec', this.getDefaultService('report'));
+ this.subscribeEvent('suite', this.getDefaultService('report'));
+ this.subscribeEvent('task', this.getDefaultService('report'));
+ const context = this;
+ for (const key in this.services) {
+ const serviceObj = this.services[key];
+ for (const serviceID in serviceObj) {
+ const service = serviceObj[serviceID];
+ service.init(context);
+
+ if (typeof service.apis !== 'function') {
+ continue;
+ }
+ const apis = service.apis();
+ if (apis) {
+ this.addToGlobal(apis);
+ }
+ }
+ }
+ }
+
+ execute(abilityDelegator) {
+ const suiteService = this.getDefaultService('suite');
+ const configService = this.getDefaultService('config');
+ if (configService['dryRun'] === 'true') {
+ (async function () {
+ await suiteService.dryRun(abilityDelegator);
+ })();
+ return;
+ }
+ setTimeout(() => {
+ suiteService.execute();
+ }, 10);
+ }
+}
+
+export default Core;
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/event.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/event.js
new file mode 100644
index 0000000000000000000000000000000000000000..3be0211f01646c9c269c2425cbee82c87ac6d9ea
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/event.js
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2021-2024 Huawei Device 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.
+ */
+
+class SpecEvent {
+ constructor(attr) {
+ this.id = attr.id;
+ this.coreContext = attr.context;
+ this.eventMonitors = [];
+ }
+
+ subscribeEvent(service) {
+ this.eventMonitors.push(service);
+ }
+
+ async specStart() {
+ for (const monitor of this.eventMonitors) {
+ await monitor['specStart']();
+ }
+ }
+
+ async specDone() {
+ for (const monitor of this.eventMonitors) {
+ await monitor['specDone']();
+ }
+ }
+}
+
+class SuiteEvent {
+ constructor(attr) {
+ this.id = attr.id;
+ this.suiteContext = attr.coreContext;
+ this.eventMonitors = [];
+ }
+
+ subscribeEvent(service) {
+ this.eventMonitors.push(service);
+ }
+
+ async suiteStart() {
+ for (const monitor of this.eventMonitors) {
+ await monitor['suiteStart']();
+ }
+ }
+
+ async suiteDone() {
+ for (const monitor of this.eventMonitors) {
+ await monitor['suiteDone']();
+ }
+ }
+}
+
+class TaskEvent {
+ constructor(attr) {
+ this.id = attr.id;
+ this.coreContext = attr.coreContext;
+ this.eventMonitors = [];
+ }
+
+ subscribeEvent(service) {
+ this.eventMonitors.push(service);
+ }
+
+ async taskStart() {
+ for (const monitor of this.eventMonitors) {
+ await monitor['taskStart']();
+ }
+ }
+
+ async taskDone() {
+ for (const monitor of this.eventMonitors) {
+ await monitor['taskDone']();
+ }
+ }
+
+ incorrectFormat() {
+ for (const monitor of this.eventMonitors) {
+ monitor['incorrectFormat']();
+ }
+ }
+
+ incorrectTestSuiteFormat() {
+ for (const monitor of this.eventMonitors) {
+ monitor.incorrectTestSuiteFormat();
+ }
+ }
+}
+
+export { SpecEvent, TaskEvent, SuiteEvent };
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/interface.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/interface.js
new file mode 100644
index 0000000000000000000000000000000000000000..44c345543313b6bad3108a8fa8824dfd92c39c79
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/interface.js
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2021-2024 Huawei Device 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 Core from './core';
+
+const core = Core.getInstance();
+
+const describe = function (desc, func) {
+ return Reflect.has(core, 'describe') ? core.describe(desc, func) : (desc, func) => { };
+};
+const it = function (desc, filter, func) {
+ return Reflect.has(core, 'it') ? core.it(desc, filter, func) : (desc, filter, func) => { };
+};
+const beforeItSpecified = function (itDescs, func) {
+ return Reflect.has(core, 'beforeItSpecified') ? core.beforeItSpecified(itDescs, func) : (itDescs, func) => { };
+};
+
+const afterItSpecified = function (itDescs, func) {
+ return Reflect.has(core, 'afterItSpecified') ? core.afterItSpecified(itDescs, func) : (itDescs, func) => { };
+};
+const beforeEach = function (func) {
+ return Reflect.has(core, 'beforeEach') ? core.beforeEach(func) : (func) => { };
+};
+const afterEach = function (func) {
+ return Reflect.has(core, 'afterEach') ? core.afterEach(func) : (func) => { };
+};
+const beforeAll = function (func) {
+ return Reflect.has(core, 'beforeAll') ? core.beforeAll(func) : (func) => { };
+};
+const afterAll = function (func) {
+ return Reflect.has(core, 'afterAll') ? core.afterAll(func) : (func) => { };
+};
+const expect = function (actualValue) {
+ return Reflect.has(core, 'expect') ? core.expect(actualValue) : (actualValue) => { };
+};
+
+const xdescribe = function (desc, func) {
+ return Reflect.has(core, 'xdescribe') ? core.xdescribe(desc, func, null) : (desc, func, reason) => { };
+};
+xdescribe.reason = (reason) => {
+ return (desc, func) => {
+ return Reflect.has(core, 'xdescribe') ? core.xdescribe(desc, func, reason) : (desc, func, reason) => { };
+ }
+}
+const xit = function (desc, filter, func) {
+ return Reflect.has(core, 'xit') ? core.xit(desc, filter, func, null) : (desc, filter, func, reason) => { };
+};
+xit.reason = (reason) => {
+ return (desc, filter, func) => {
+ return Reflect.has(core, 'xit') ? core.xit(desc, filter, func, reason) : (desc, filter, func, reason) => { };
+ }
+}
+
+export {
+ describe, it, beforeAll, beforeEach, afterEach, afterAll, expect, beforeItSpecified, afterItSpecified, xdescribe, xit
+};
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module.json b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module.json
new file mode 100644
index 0000000000000000000000000000000000000000..1fd46ff69422297a5b9139cf75e4a5ab55e38c19
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module.json
@@ -0,0 +1,26 @@
+{
+ "app": {
+ "bundleName": "com.ohos.hypium",
+ "debug": true,
+ "versionCode": 1000000,
+ "versionName": "1.0.0",
+ "minAPIVersion": 40100011,
+ "targetAPIVersion": 40100011,
+ "apiReleaseType": "Beta1",
+ "compileSdkVersion": "4.1.0.55",
+ "compileSdkType": "HarmonyOS",
+ "bundleType": "app"
+ },
+ "module": {
+ "name": "hypium",
+ "type": "har",
+ "deviceTypes": [
+ "default",
+ "tablet",
+ "tv",
+ "wearable",
+ "car"
+ ],
+ "installationFree": false
+ }
+}
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/ExpectExtend.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/ExpectExtend.js
new file mode 100644
index 0000000000000000000000000000000000000000..d10d15e6f9955c6d04610101f8766c951ee1a35d
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/ExpectExtend.js
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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 assertNull from './assertNull';
+import assertClose from './assertClose';
+import assertContain from './assertContain';
+import assertLess from './assertLess';
+import assertLarger from './assertLarger';
+import assertFail from './assertFail';
+import assertUndefined from './assertUndefined';
+import assertFalse from './assertFalse';
+import assertInstanceOf from './assertInstanceOf';
+import assertThrowError from './assertThrowError';
+import assertLargerOrEqual from './assertLargerOrEqual'
+import assertLessOrEqual from './assertLessOrEqual'
+import assertNaN from './assertNaN'
+import assertNegUnlimited from './assertNegUnlimited'
+import assertPosUnlimited from './assertPosUnlimited'
+import assertDeepEquals from './deepEquals/assertDeepEquals'
+import assertPromiseIsPending from './assertPromiseIsPending';
+import assertPromiseIsRejected from './assertPromiseIsRejected';
+import assertPromiseIsRejectedWith from './assertPromiseIsRejectedWith';
+import assertPromiseIsRejectedWithError from './assertPromiseIsRejectedWithError';
+import assertPromiseIsResolved from './assertPromiseIsResolved';
+import assertPromiseIsResolvedWith from './assertPromiseIsResolvedWith';
+class ExpectExtend {
+ constructor(attr) {
+ this.id = attr.id;
+ this.matchers = {};
+ }
+
+ extendsMatchers() {
+ this.matchers.assertNull = assertNull;
+ this.matchers.assertClose = assertClose;
+ this.matchers.assertContain = assertContain;
+ this.matchers.assertLess = assertLess;
+ this.matchers.assertLarger = assertLarger;
+ this.matchers.assertFail = assertFail;
+ this.matchers.assertUndefined = assertUndefined;
+ this.matchers.assertFalse = assertFalse;
+ this.matchers.assertInstanceOf = assertInstanceOf;
+ this.matchers.assertThrowError = assertThrowError;
+ this.matchers.assertLargerOrEqual = assertLargerOrEqual;
+ this.matchers.assertLessOrEqual = assertLessOrEqual;
+ this.matchers.assertNaN = assertNaN;
+ this.matchers.assertNegUnlimited = assertNegUnlimited;
+ this.matchers.assertPosUnlimited = assertPosUnlimited;
+ this.matchers.assertDeepEquals = assertDeepEquals;
+ this.matchers.assertPromiseIsPending = assertPromiseIsPending;
+ this.matchers.assertPromiseIsRejected = assertPromiseIsRejected;
+ this.matchers.assertPromiseIsRejectedWith = assertPromiseIsRejectedWith;
+ this.matchers.assertPromiseIsRejectedWithError = assertPromiseIsRejectedWithError;
+ this.matchers.assertPromiseIsResolved = assertPromiseIsResolved;
+ this.matchers.assertPromiseIsResolvedWith = assertPromiseIsResolvedWith;
+ }
+
+ init(coreContext) {
+ this.coreContext = coreContext;
+ this.extendsMatchers();
+ const expectService = this.coreContext.getDefaultService('expect');
+ expectService.addMatchers(this.matchers);
+ }
+
+ apis() {
+ return {
+ 'expect': function (actualValue) {
+ return this.coreContext.getDefaultService('expect').expect(actualValue);
+ }
+ };
+ }
+}
+
+export default ExpectExtend;
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertClose.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertClose.js
new file mode 100644
index 0000000000000000000000000000000000000000..63635bea5bf1298776de565260e0e0babae56857
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertClose.js
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+function assertClose(actualValue, expected) {
+ console.log('expected:' + expected[0] + ',precision:' + expected[1]);
+ if (actualValue === null && expected[0] === null) {
+ throw new Error('actualValue and expected can not be both null!!!');
+ }
+ let result;
+ let diff = Math.abs(expected[0] - actualValue);
+ let actualAbs = Math.abs(actualValue);
+ if ((actualAbs - 0) === 0) {
+ if ((diff - 0) === 0) {
+ result = true;
+ } else {
+ result = false;
+ }
+ } else if (diff / actualAbs < expected[1]) {
+ result = true;
+ } else {
+ result = false;
+ }
+ return {
+ pass: result,
+ message: '|' + actualValue + ' - ' + expected[0] + '|/' + actualValue + ' is not less than ' + expected[1]
+ };
+}
+
+export default assertClose;
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertContain.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertContain.js
new file mode 100644
index 0000000000000000000000000000000000000000..7fba0d9755503e5e926f6c1a4e425e0d1cf47570
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertContain.js
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+function assertContain(actualValue, expect) {
+ let result = false;
+ if (Object.prototype.toString.call(actualValue).indexOf('Array')) {
+ for (let i in actualValue) {
+ if (actualValue[i] == expect[0]) {
+ result = true;
+ }
+ }
+ }
+ let type = Object.prototype.toString.call(actualValue);
+ if (type === '[object String]') {
+ result = actualValue.indexOf(expect[0]) >= 0;
+ }
+ return {
+ pass: result,
+ message: 'expect false, ' + actualValue + ' do not have ' + expect[0]
+ };
+}
+
+export default assertContain;
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertFail.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertFail.js
new file mode 100644
index 0000000000000000000000000000000000000000..8ab4ac5caef712c75c4eac49dfbbb91d33669d9a
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertFail.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+function assertFail() {
+ return {
+ pass: false,
+ message: 'fail '
+ };
+}
+
+export default assertFail;
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertFalse.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertFalse.js
new file mode 100644
index 0000000000000000000000000000000000000000..c5008e94f4b2ce13ed35b604811793c76b542347
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertFalse.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+function assertFalse(actualValue) {
+ return {
+ pass: (actualValue) === false,
+ message: 'expect false, actualValue is ' + actualValue
+ };
+}
+
+export default assertFalse;
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertInstanceOf.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertInstanceOf.js
new file mode 100644
index 0000000000000000000000000000000000000000..1e11b93f7251c67f5455c5007cd7be268aa53b32
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertInstanceOf.js
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+function assertInstanceOf(actualValue, expected) {
+ if (Object.prototype.toString.call(actualValue) == '[object ' + expected[0] + ']') {
+ return {
+ pass: true
+ };
+ } else {
+ return {
+ pass: false,
+ message: actualValue + ' is ' + Object.prototype.toString.call(actualValue) + 'not ' + expected[0]
+ };
+ }
+}
+
+export default assertInstanceOf;
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertLarger.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertLarger.js
new file mode 100644
index 0000000000000000000000000000000000000000..a74f4a8cedaf3add9c2dc2d3799081a83198732f
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertLarger.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+function assertLarger(actualValue, expected) {
+ return {
+ pass: (actualValue) > expected[0],
+ message: (actualValue) + ' is not larger than ' + expected[0]
+ };
+}
+
+export default assertLarger;
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertLargerOrEqual.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertLargerOrEqual.js
new file mode 100644
index 0000000000000000000000000000000000000000..e847e6c217364b7f69c173c66fb98d10efc45ef1
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertLargerOrEqual.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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.
+ */
+
+function assertLargerOrEqual(actualValue, expected) {
+ return {
+ pass: (actualValue) >= expected[0],
+ message: (actualValue) + ' is not larger than ' + expected[0]
+ };
+}
+
+export default assertLargerOrEqual;
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertLess.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertLess.js
new file mode 100644
index 0000000000000000000000000000000000000000..17e84b0abaeb20804048a5a15c19e0603634846d
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertLess.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+function assertLess(actualValue, expected) {
+ return {
+ pass: (actualValue) < expected[0],
+ message: (actualValue) + ' is not less than ' + expected[0]
+ };
+}
+
+export default assertLess;
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertLessOrEqual.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertLessOrEqual.js
new file mode 100644
index 0000000000000000000000000000000000000000..f754f97ffa9d24e7852efe2423a1dd35d448af82
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertLessOrEqual.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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.
+ */
+
+function assertLessOrEqual(actualValue, expected) {
+ return {
+ pass: (actualValue) <= expected[0],
+ message: (actualValue) + ' is not less than ' + expected[0]
+ };
+}
+
+export default assertLessOrEqual;
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertNaN.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertNaN.js
new file mode 100644
index 0000000000000000000000000000000000000000..8d45d6a93b86c5ed325a68b32ff014835993a58e
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertNaN.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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.
+ */
+
+function assertNaN(actualValue) {
+ return {
+ pass: actualValue !== actualValue,
+ message: 'expect NaN, actualValue is ' + actualValue
+ };
+}
+
+export default assertNaN;
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertNegUnlimited.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertNegUnlimited.js
new file mode 100644
index 0000000000000000000000000000000000000000..ceac555afc826e057970e6cfe9c73b322c672aa2
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertNegUnlimited.js
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2022 Huawei Device 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.
+*/
+
+function assertNegUnlimited(actualValue) {
+ return {
+ pass: actualValue === Number.NEGATIVE_INFINITY,
+ message: 'Expected actualValue not to be -Infinity. actualValue is,' + actualValue
+ };
+}
+
+export default assertNegUnlimited;
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertNull.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertNull.js
new file mode 100644
index 0000000000000000000000000000000000000000..53a7bad827323a98d3302a4e7eea679551b459c5
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertNull.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+function assertNull(actualValue) {
+ return {
+ pass: (actualValue) === null,
+ message: 'expect null, actualValue is ' + (actualValue)
+ };
+}
+
+export default assertNull;
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPosUnlimited.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPosUnlimited.js
new file mode 100644
index 0000000000000000000000000000000000000000..6e68c0e2b6c499f4dc3dd56c13e9ea1073a3c54c
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPosUnlimited.js
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2022 Huawei Device 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.
+*/
+
+function assertPosUnlimited(actualValue) {
+ return {
+ pass: actualValue === Number.POSITIVE_INFINITY,
+ message: 'Expected actualValue is POSITIVE_INFINITY. actualValue is,' + actualValue
+ };
+}
+
+export default assertPosUnlimited;
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsPending.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsPending.js
new file mode 100644
index 0000000000000000000000000000000000000000..7e2ca2ce14d50c39554fc1157d6d4eb9329d5c39
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsPending.js
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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 isPromiseLike from './isPromiseLike';
+
+function assertPromiseIsPending(actualPromise) {
+ if (!isPromiseLike(actualPromise)) {
+ return Promise.reject().then(function () {
+ }, function () {
+ return {pass: false, message: 'Expected not be called on a promise.'};
+ });
+ }
+ const helper = {};
+ return Promise.race([actualPromise, Promise.resolve(helper)]).then(
+ function (got) {
+ return helper === got ? {pass: true, message: 'actualValue is isPending'}
+ : {
+ pass: false,
+ message: 'expect isPending, actualValue is resolve'
+ };
+ },
+ function () {
+ return {
+ pass: false
+ , message: 'expect isPending, actualValue is reject'
+ };
+ });
+}
+
+export default assertPromiseIsPending;
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsRejected.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsRejected.js
new file mode 100644
index 0000000000000000000000000000000000000000..eb8e65c7d70d5750a9ccebb55c2cf5049cf144fc
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsRejected.js
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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 isPromiseLike from './isPromiseLike';
+
+function assertPromiseIsRejected(actualPromise) {
+ if (!isPromiseLike(actualPromise)) {
+ return Promise.reject().then(function () {
+ }, function () {
+ return {pass: false, message: 'Expected not be called on a promise.'};
+ });
+ }
+ const helper = {};
+ return Promise.race([actualPromise, Promise.resolve(helper)]).then(
+ function (got) {
+ return {
+ pass: false,
+ message: 'expect isRejected, but actualValue is '
+ + (helper === got ? 'isPending' : 'resolve')
+ };
+ },
+ function () {
+ return {pass: true, message: 'actualValue is isRejected'};
+ }
+ );
+}
+
+export default assertPromiseIsRejected;
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsRejectedWith.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsRejectedWith.js
new file mode 100644
index 0000000000000000000000000000000000000000..48eaf7859279a70ea2ad85509296b5da1c7b69f9
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsRejectedWith.js
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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 isPromiseLike from './isPromiseLike';
+
+function assertPromiseIsRejectedWith(actualPromise, expectedValue) {
+
+ if (!isPromiseLike(actualPromise)) {
+ return Promise.reject().then(function () {
+ }, function () {
+ return {pass: false, message: 'Expected not be called on a promise.'};
+ });
+ }
+
+ function tips(passed) {
+ return ('Expected a promise ' + (passed ? 'not ' : '') +
+ 'to be rejected with ' + JSON.stringify(expectedValue[0]));
+ }
+
+ const helper = {};
+ return Promise.race([actualPromise, Promise.resolve(helper)]).then(
+ function (got) {
+ return {
+ pass: false,
+ message: tips(false) + ' but actualValue is '
+ + (helper === got ? 'isPending' : 'resolve')
+ };
+ },
+ function (actualValue) {
+ if (JSON.stringify(actualValue) == JSON.stringify(expectedValue[0])) {
+ return {
+ pass: true,
+ message: 'actualValue was rejected with ' + JSON.stringify(actualValue) + '.'
+ };
+ } else {
+ return {
+ pass: false,
+ message: tips(false) + ' but it was rejected with ' + JSON.stringify(actualValue) + '.'
+ };
+ }
+ }
+ );
+}
+
+export default assertPromiseIsRejectedWith;
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsRejectedWithError.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsRejectedWithError.js
new file mode 100644
index 0000000000000000000000000000000000000000..20f236fc11dd66f270322efa12a1b3f6b543407c
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsRejectedWithError.js
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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 isPromiseLike from './isPromiseLike';
+
+function assertPromiseIsRejectedWithError(actualPromise, expectedValue) {
+ if (!isPromiseLike(actualPromise)) {
+ return Promise.reject().then(function () {
+ }, function () {
+ return {pass: false, message: 'Expected not be called on a promise.'};
+ });
+ }
+ const helper = {};
+ return Promise.race([actualPromise, Promise.resolve(helper)]).then(
+ function (got) {
+ return {
+ pass: false,
+ message: 'Expected a promise to be rejected but actualValue is '
+ + (helper === got ? 'isPending' : 'resolve')
+ };
+ },
+ function (actualValue) {
+ return matchError(actualValue, expectedValue);
+ }
+ );
+
+}
+
+function matchError(actualValue, expectedValue) {
+ if (expectedValue.length == 1 && typeof expectedValue[0] === 'function') {
+ if (expectedValue[0].name === actualValue.__proto__.name) {
+ return {pass: true, message: 'actual error type is ' + actualValue.name + '.'};
+ }
+ return {pass: false, message: `except error type is ${expectedValue[0].name},but actual is ${actualValue.name}.`};
+ }
+
+ if (expectedValue.length == 1 && typeof expectedValue[0] === 'string') {
+ if (expectedValue[0] === actualValue.message) {
+ return {pass: true, message: `actual error message is ${actualValue.message}.`};
+ }
+ return {pass: false, message: `except error message ${expectedValue[0]},but actual is ${actualValue.message}.`};
+ }
+
+ if (expectedValue.length == 1) {
+ return {pass: false, message: 'When only one parameter, it should be error type or error message.'};
+ }
+
+ if (expectedValue.length == 2 && typeof expectedValue[0] === 'function' && expectedValue[0].name === actualValue.name) {
+ if (typeof expectedValue[1] === 'string' && actualValue.message === expectedValue[1]) {
+ return {pass: true, message: 'actual error message is ' + actualValue.message + '.'};
+ }
+ return {pass: false, message: `except error message is ${expectedValue[1]},but actual is ${actualValue.message}.`};
+ }
+
+ if (expectedValue.length == 2 && typeof expectedValue[0] === 'function' && expectedValue[0].name !== actualValue.name) {
+ if (typeof expectedValue[1] === 'string' && actualValue.message === expectedValue[1]) {
+ return {pass: false, message: `except error type is ${expectedValue[0].name},but actual is ${actualValue.name}.`};
+ }
+ return {pass: false, message: 'except error type and message are incorrect.'};
+ }
+ if (expectedValue.length > 2) {
+ return {pass: false, message: 'Up to two parameters are supported.'};
+ }
+}
+
+export default assertPromiseIsRejectedWithError;
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsResolved.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsResolved.js
new file mode 100644
index 0000000000000000000000000000000000000000..855426ca79e5002428e53d4fcb5f843cdf7119f7
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsResolved.js
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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 isPromiseLike from './isPromiseLike';
+
+function assertPromiseIsResolved(actualPromise) {
+ if (!isPromiseLike(actualPromise)) {
+ return Promise.reject().then(function () {
+ }, function () {
+ return {pass: false, message: 'Expected not be called on a promise.'};
+ });
+ }
+
+ const helper = {};
+ return Promise.race([actualPromise, Promise.resolve(helper)]).then(
+ function (got) {
+ return helper === got ? {
+ pass: false,
+ message: 'expect resolve, actualValue is isPending'
+ }
+ : {pass: true, message: 'actualValue is isResolved'};
+ },
+ function (rej) {
+ return {
+ pass: false,
+ message: 'Expected a promise to be resolved but it was ' +
+ 'rejected with ' + JSON.stringify(rej) + '.'
+ };
+ }
+ );
+}
+
+export default assertPromiseIsResolved;
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsResolvedWith.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsResolvedWith.js
new file mode 100644
index 0000000000000000000000000000000000000000..d5eb01e32491b281a1e1d650a307723253a61e39
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsResolvedWith.js
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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 isPromiseLike from './isPromiseLike';
+
+function assertPromiseIsResolvedWith(actualPromise, expectedValue) {
+ if (!isPromiseLike(actualPromise)) {
+ return Promise.reject().then(function () {
+ }, function () {
+ return {pass: false, message: 'Expected not be called on a promise.'};
+ });
+ }
+
+ function tips(passed) {
+ return (
+ 'Expected a promise ' + (passed ? 'not ' : '') +
+ 'to be resolved with ' + JSON.stringify(expectedValue[0]));
+ }
+
+ const helper = {};
+ return Promise.race([actualPromise, Promise.resolve(helper)]).then(
+ function (got) {
+ if (helper === got) {
+ return {pass: false, message: 'expect resolve, actualValue is isPending'};
+ }
+ if (JSON.stringify(got) == JSON.stringify(expectedValue[0])) {
+ return {
+ pass: true,
+ message: 'actualValue was resolved with ' + JSON.stringify(got) + '.'
+ };
+ }
+ return {
+ pass: false,
+ message: tips(false) + ' but it was resolved with ' +
+ JSON.stringify(got) + '.'
+ };
+ },
+ function (rej) {
+ return {
+ pass: false,
+ message: tips(false) + ' but it was rejected with ' + JSON.stringify(rej) + '.'
+ };
+ }
+ );
+}
+
+export default assertPromiseIsResolvedWith;
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertThrowError.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertThrowError.js
new file mode 100644
index 0000000000000000000000000000000000000000..749cab0daee3f156909f60c9375146c23d7aa322
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertThrowError.js
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+function assertThrowError(actualValue, expected) {
+ let result = false;
+ let err;
+ if (typeof actualValue !== 'function') {
+ throw new Error('actualValue is not a function');
+ }
+ try {
+ actualValue();
+ return {
+ pass: result,
+ message: ' An error is not thrown while it is expected!'
+ };
+ } catch (e) {
+ err = e;
+ }
+
+ if (err instanceof Error) {
+ console.log(err.message);
+ if (err.message == expected[0]) {
+ result = true;
+ }
+ }
+ return {
+ pass: result,
+ message: 'expected throw failed , ' + err.message + ' is not ' + expected[0]
+ };
+}
+
+export default assertThrowError;
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertUndefined.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertUndefined.js
new file mode 100644
index 0000000000000000000000000000000000000000..61f092d715dd1630297518b59ff13ef0940991e1
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertUndefined.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+function assertUndefined(actualValue) {
+ return {
+ pass: undefined === (actualValue),
+ message: 'expect Undefined, actualValue is ' + (actualValue)
+ };
+}
+
+export default assertUndefined;
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/deepEquals/DeepTypeUtils.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/deepEquals/DeepTypeUtils.js
new file mode 100644
index 0000000000000000000000000000000000000000..627fb3b3ae7e315808b5ee2927d4bfbf17cc64b2
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/deepEquals/DeepTypeUtils.js
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2022-2023 Huawei Device 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.
+ */
+
+class DeepTypeUtils {
+ static getType_(value) {
+ return Object.prototype.toString.apply(value);
+ }
+ static isA_(typeName, value) {
+ return this.getType_(value) === '[object ' + typeName + ']';
+ }
+ static isAsymmetricEqualityTester_(obj) {
+ return obj ? this.isA_('Function', obj.asymmetricMatch) : false;
+ }
+
+ /**
+ * 是否是function
+ * @param value
+ */
+ static isFunction_(value) {
+ return this.isA_('Function', value);
+ }
+
+ /**
+ * 是否是undefined
+ * @param obj
+ */
+ static isUndefined(obj) {
+ return obj === void 0;
+ }
+
+ /**
+ * 是否是Node
+ * @param obj
+ */
+ static isDomNode(obj) {
+ return obj !== null &&
+ typeof obj === 'object' &&
+ typeof obj.nodeType === 'number' &&
+ typeof obj.nodeName === 'string';
+ }
+
+ /**
+ * 是否是promise对象
+ * @param obj
+ */
+ static isPromise (obj) {
+ return !!obj && obj.constructor === Promise;
+ };
+ /**
+ * 是否是map对象
+ * @param obj
+ */
+ static isMap(obj) {
+ return (
+ obj !== null &&
+ typeof obj !== 'undefined' &&
+ obj.constructor === Map
+ );
+ }
+
+ /**
+ * 是否是set对象
+ * @param obj 对象
+ */
+ static isSet(obj) {
+ return (
+ obj !== null &&
+ typeof obj !== 'undefined' &&
+ obj.constructor === Set
+ );
+ }
+
+ /**
+ * 对象是否有key属性
+ * @param obj 对象
+ * @param key 对象属性名称
+ */
+ static has(obj, key) {
+ return Object.prototype.hasOwnProperty.call(obj, key);
+ }
+
+ /**
+ * 获取对象的自有属性
+ * @param obj 对象
+ * @param isArray 是否是数组,[object Array]
+ */
+ static keys(obj, isArray) {
+ const extraKeys = [];
+ // 获取对象所有属性
+ const allKeys = this.getAllKeys(obj);
+ if (!isArray) {
+ return allKeys;
+ }
+ if (allKeys.length === 0) {
+ return allKeys;
+ }
+ for (const k of allKeys) {
+ if (typeof k === 'symbol' || !/^[0-9]+$/.test(k)) {
+ extraKeys.push(k);
+ }
+ }
+ return extraKeys;
+ }
+
+ /**
+ * 获取obj对象的所有属性
+ * @param obj obj对象
+ */
+ static getAllKeys(obj) {
+ const keys = [];
+ for (let key in obj) {
+ if(this.has(obj, key)) {
+ keys.push(key);
+ }
+ }
+ const symbols = Object.getOwnPropertySymbols(obj);
+ for (const sym of symbols) {
+ if (obj.propertyIsEnumerable(sym)) {
+ keys.push(sym);
+ }
+ }
+ return keys;
+ }
+
+}
+export default DeepTypeUtils;
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/deepEquals/assertDeepEquals.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/deepEquals/assertDeepEquals.js
new file mode 100644
index 0000000000000000000000000000000000000000..482e28e6af45482f8c2d9d0f61130730b07eba70
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/deepEquals/assertDeepEquals.js
@@ -0,0 +1,315 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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 DeepTypeUtils from './DeepTypeUtils'
+function assertDeepEquals(actualValue, expected) {
+ console.log('actualValue:' + actualValue + ',expected:' + expected[0]);
+ let result = eq(actualValue, expected[0],[], [])
+ let msg = logMsg(actualValue, expected[0]);
+ return {
+ pass: result,
+ message: msg
+ };
+}
+
+/**
+ * 获取失败显示日志
+ * @param actualValue 实际对象
+ * @param expected 期待比较对象
+ */
+function logMsg(actualValue, expected) {
+ // 获取a的对象名称
+ const aClassName = Object.prototype.toString.call(actualValue);
+ const bClassName = Object.prototype.toString.call(expected);
+ let actualMsg;
+ let expectMsg;
+ if(aClassName == "[object Function]") {
+ actualMsg = "actualValue Function"
+ }else if(aClassName == "[object Promise]") {
+ actualMsg = "actualValue Promise"
+ }else if(aClassName == "[object Set]" || aClassName == "[object Map]") {
+ actualMsg = JSON.stringify(Array.from(actualValue));;
+ }else if(aClassName == "[object RegExp]") {
+ actualMsg = JSON.stringify(actualValue.source.replace("\\",""));;
+ }else if(aClassName == "[object BigInt]") {
+ actualMsg = actualValue;
+ }
+ else{
+ actualMsg = JSON.stringify(actualValue);
+ }
+ if(bClassName == "[object Function]") {
+ expectMsg = "expected Function"
+ }else if(bClassName == "[object Promise]") {
+ expectMsg = "expected Promise"
+ }else if(bClassName == "[object Set]" || bClassName == "[object Map]") {
+ expectMsg = JSON.stringify(Array.from(expected));
+ }else if(bClassName == "[object RegExp]") {
+ expectMsg = JSON.stringify(expected.source.replace("\\",""));;
+ }else if(bClassName == "[object BigInt]") {
+ expectMsg = expected;
+ }
+ else{
+ expectMsg = JSON.stringify(expected);
+ }
+ return actualMsg + " is not deep equal " + expectMsg;
+}
+
+function eq(a, b, aStack, bStack) {
+ let result = true;
+ console.log('a is:' + a + ',b is:' + b);
+ const asymmetricResult = asymmetricMatch_(a,b);
+ if (!DeepTypeUtils.isUndefined(asymmetricResult)) {
+ return asymmetricResult;
+ }
+
+ if (a instanceof Error && b instanceof Error) {
+ result = a.message == b.message;
+ return result;
+ }
+
+ if (a === b) {
+ result = a !== 0 || 1 / a == 1 / b;
+ return result;
+ }
+
+ if (a === null || b === null) {
+ result = a === b;
+ return result;
+ }
+ // 获取a的对象名称
+ const aClassName = Object.prototype.toString.call(a);
+ const bClassName = Object.prototype.toString.call(b);
+ console.log('aClassName is:' + aClassName);
+ console.log('bClassName is:' + bClassName);
+ // 不同类型不同对象
+ if (aClassName != bClassName) {
+ return false;
+ }
+ // 俩个string对象
+ if(aClassName === '[object String]') {
+ result = a == String(b);
+ return result;
+ }
+ // 俩个Number对象
+ if(aClassName === '[object Number]') {
+ result = a != +a ? b != +b : a === 0 && b === 0 ? 1 / a == 1 / b : a == +b;
+ return result;
+ }
+
+ if(aClassName === '[object Date]' || aClassName === '[object Boolean]') {
+ result = +a == +b;
+ return result;
+ }
+
+ // 数组
+ if(aClassName === '[object ArrayBuffer]') {
+ return eq(new Uint8Array(a), new Uint8Array(b), aStack, bStack);
+ }
+
+ // 正则表达式
+ if(aClassName === '[object RegExp]') {
+ return (
+ a.source == b.source &&
+ a.global == b.global &&
+ a.multiline == b.multiline &&
+ a.ignoreCase == b.ignoreCase
+ );
+ }
+
+ if (typeof a != 'object' || typeof b != 'object') {
+ return false;
+ }
+
+ const aIsDomNode = DeepTypeUtils.isDomNode(a);
+ const bIsDomNode = DeepTypeUtils.isDomNode(b);
+ if (aIsDomNode && bIsDomNode) {
+ // At first try to use DOM3 method isEqualNode
+ result = a.isEqualNode(b);
+ return result;
+ }
+ if (aIsDomNode || bIsDomNode) {
+ return false;
+ }
+ const aIsPromise = DeepTypeUtils.isPromise(a);
+ const bIsPromise = DeepTypeUtils.isPromise(b);
+ if (aIsPromise && bIsPromise) {
+ return a === b;
+ }
+ let length = aStack.length;
+ while (length--) {
+ if (aStack[length] == a) {
+ return bStack[length] == b;
+ }
+ }
+ aStack.push(a);
+ bStack.push(b);
+ let size = 0;
+
+ // 都是数组
+ if(aClassName == '[object Array]') {
+ const aLength = a.length;
+ const bLength = b.length;
+ if (aLength !== bLength) {
+ // 数组长度不同,不是同一个对象
+ return false;
+ }
+ for (let i = 0; i < aLength || i < bLength; i++) {
+ // 递归每一个元素是否相同
+ result = eq(i < aLength ? a[i] : void 0, i < bLength ? b[i] : void 0, aStack, bStack) && result;
+ }
+ if (!result) {
+ return false;
+ }
+ } else if(DeepTypeUtils.isMap(a) && DeepTypeUtils.isMap(b)) {
+ if (a.size != b.size) {
+ return false;
+ }
+ const keysA = [];
+ const keysB = [];
+ a.forEach(function(valueA, keyA) {
+ keysA.push(keyA);
+ });
+ b.forEach(function(valueB, keyB) {
+ keysB.push(keyB);
+ });
+ const mapKeys = [keysA, keysB];
+ const cmpKeys = [keysB, keysA];
+ for (let i = 0; result && i < mapKeys.length; i++) {
+ const mapIter = mapKeys[i];
+ const cmpIter = cmpKeys[i];
+
+ for (let j = 0; result && j < mapIter.length; j++) {
+ const mapKey = mapIter[j];
+ const cmpKey = cmpIter[j];
+ const mapValueA = a.get(mapKey);
+ let mapValueB;
+ if (
+ DeepTypeUtils.isAsymmetricEqualityTester_(mapKey) ||
+ (DeepTypeUtils.isAsymmetricEqualityTester_(cmpKey) &&
+ eq(mapKey, cmpKey))
+ ) {
+ mapValueB = b.get(cmpKey);
+ } else {
+ mapValueB = b.get(mapKey);
+ }
+ result = eq(mapValueA, mapValueB, aStack, bStack);
+ }
+ }
+ if (!result) {
+ return false;
+ }
+ } else if(DeepTypeUtils.isSet(a) && DeepTypeUtils.isSet(b)) {
+ if (a.size != b.size) {
+ return false;
+ }
+ const valuesA = [];
+ a.forEach(function(valueA) {
+ valuesA.push(valueA);
+ });
+ const valuesB = [];
+ b.forEach(function(valueB) {
+ valuesB.push(valueB);
+ });
+ const setPairs = [[valuesA, valuesB], [valuesB, valuesA]];
+ const stackPairs = [[aStack, bStack], [bStack, aStack]];
+ for (let i = 0; result && i < setPairs.length; i++) {
+ const baseValues = setPairs[i][0];
+ const otherValues = setPairs[i][1];
+ const baseStack = stackPairs[i][0];
+ const otherStack = stackPairs[i][1];
+ for (const baseValue of baseValues) {
+ let found = false;
+ for (let j = 0; !found && j < otherValues.length; j++) {
+ const otherValue = otherValues[j];
+ const prevStackSize = baseStack.length;
+ // 深度比较对象
+ found = eq(baseValue, otherValue, baseStack, otherStack);
+ if (!found && prevStackSize !== baseStack.length) {
+ baseStack.splice(prevStackSize);
+ otherStack.splice(prevStackSize);
+ }
+ }
+ result = result && found;
+ }
+ }
+ if (!result) {
+ return false;
+ }
+ } else {
+ const aCtor = a.constructor,
+ bCtor = b.constructor;
+ if (
+ aCtor !== bCtor &&
+ DeepTypeUtils.isFunction_(aCtor) &&
+ DeepTypeUtils.isFunction_(bCtor) &&
+ a instanceof aCtor &&
+ b instanceof bCtor &&
+ !(aCtor instanceof aCtor && bCtor instanceof bCtor)
+ ) {
+ return false;
+ }
+ }
+
+ // 获取对象所有的属性集合
+ const aKeys = DeepTypeUtils.keys(a, aClassName == '[object Array]');
+ size = aKeys.length;
+
+ // 俩个对象属性长度不一致, 俩对象不相同
+ if (DeepTypeUtils.keys(b, bClassName == '[object Array]').length !== size) {
+ return false;
+ }
+
+ // 俩对象属性数量相同, 递归比较每个属性值得值
+ for (const key of aKeys) {
+ console.log('key is:' + key);
+ // b 没有 key 属性
+ if(!DeepTypeUtils.has(b, key)) {
+ result = false;
+ continue;
+ }
+ if (!eq(a[key], b[key], aStack, bStack)) {
+ result = false;
+ }
+ }
+ if (!result) {
+ return false;
+ }
+ aStack.pop();
+ bStack.pop();
+ return result;
+}
+
+function asymmetricMatch_(a, b) {
+ const asymmetricA = DeepTypeUtils.isAsymmetricEqualityTester_(a);
+ const asymmetricB = DeepTypeUtils.isAsymmetricEqualityTester_(b);
+
+ if (asymmetricA === asymmetricB) {
+ return undefined;
+ }
+
+}
+
+/**
+ * 获取对象的自有属性
+ *
+ * @param obj 对象
+ * @param isArray 是否是一个数组
+ */
+function keys(obj, isArray) {
+ const keys = [];
+
+}
+
+export default assertDeepEquals;
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/isPromiseLike.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/isPromiseLike.js
new file mode 100644
index 0000000000000000000000000000000000000000..015ab19a2a0c4872d7cb490b61f8e1dd6a8ac90b
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/isPromiseLike.js
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+function isPromiseLike(obj) {
+ return !!obj && isFunction_(obj.then);
+}
+
+function isFunction_(value) {
+ return isA_('Function', value);
+}
+
+function isA_(typeName, value) {
+ return getType_(value) === '[object ' + typeName + ']';
+}
+
+function getType_(value) {
+ return Object.prototype.toString.apply(value);
+}
+
+export default isPromiseLike;
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/config/DataDriver.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/config/DataDriver.js
new file mode 100644
index 0000000000000000000000000000000000000000..639dffc9cdb912f1f33a6ccb61868c9ed7c695bf
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/config/DataDriver.js
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+const SUITES_KEY = 'suites';
+const SPECS_KEY = 'items';
+const DESCRIBE_KEY = 'describe';
+const IT_KEY = 'it';
+const PARAMS_KEY = 'params';
+const STRESS_KEY = 'stress';
+
+class ObjectUtils {
+ static get(object, name, defaultValue) {
+ let result = defaultValue;
+ for (const key in object) {
+ if (key === name) {
+ return object[key];
+ }
+ }
+ return result;
+ }
+
+ static has(object, key) {
+ return Object.prototype.hasOwnProperty.call(object, key);
+ }
+}
+
+class DataDriver {
+ constructor(attr) {
+ this.id = 'dataDriver';
+ this.data = attr.data || {};
+ }
+
+ init(coreContext) {
+ this.coreContext = coreContext;
+ this.suiteService = this.coreContext.getDefaultService('suite');
+ this.specService = this.coreContext.getDefaultService('spec');
+ }
+
+ getSpecParams() {
+ let specParams = [];
+ let suiteDesc = this.suiteService.getCurrentRunningSuite().description;
+ let specDesc = this.specService.getCurrentRunningSpec().description;
+ let suites = ObjectUtils.get(this.data, SUITES_KEY, []);
+ for (const suiteItem of suites) {
+ let describeValue = ObjectUtils.get(suiteItem, DESCRIBE_KEY, '');
+ if (ObjectUtils.has(suiteItem, DESCRIBE_KEY) && (typeof describeValue === 'object') && describeValue.constructor === Array && describeValue.includes(suiteDesc)) {
+ let specs = ObjectUtils.get(suiteItem, SPECS_KEY, []);
+ for (const specItem of specs) {
+ if (ObjectUtils.has(specItem, IT_KEY) && ObjectUtils.get(specItem, IT_KEY) === specDesc) {
+ return ObjectUtils.get(specItem, PARAMS_KEY, specParams);
+ }
+ }
+ }
+ }
+ return specParams;
+ }
+
+ getSuiteParams() {
+ let suiteParams = {};
+ let suiteDesc = this.suiteService.getCurrentRunningSuite().description;
+ let suites = ObjectUtils.get(this.data, SUITES_KEY, []);
+ for (const suiteItem of suites) {
+ let describeValue = ObjectUtils.get(suiteItem, DESCRIBE_KEY, []);
+ if (ObjectUtils.has(suiteItem, DESCRIBE_KEY) && (typeof describeValue === 'object') && describeValue.constructor === Array && describeValue.includes(suiteDesc)) {
+ suiteParams = Object.assign({}, suiteParams, ObjectUtils.get(suiteItem, PARAMS_KEY, suiteParams));
+ }
+ }
+ return suiteParams;
+ }
+
+ getSpecStress(specDesc) {
+ let stress = 1;
+ let suiteDesc = this.suiteService.getCurrentRunningSuite().description;
+ let suites = ObjectUtils.get(this.data, SUITES_KEY, []);
+ for (const suiteItem of suites) {
+ let describeValue = ObjectUtils.get(suiteItem, DESCRIBE_KEY, '');
+ if (ObjectUtils.has(suiteItem, DESCRIBE_KEY) && (typeof describeValue === 'object') && describeValue.constructor === Array && describeValue.includes(suiteDesc)) {
+ let specs = ObjectUtils.get(suiteItem, SPECS_KEY, []);
+ for (const specItem of specs) {
+ if (ObjectUtils.has(specItem, IT_KEY) && ObjectUtils.get(specItem, IT_KEY) === specDesc) {
+ let tempStress = ObjectUtils.get(specItem, STRESS_KEY, stress);
+ return (Number.isInteger(tempStress) && tempStress >= 1) ? tempStress : stress;
+ }
+ }
+ }
+ }
+ return stress;
+ }
+
+ getSuiteStress(suiteDesc) {
+ let stress = 1;
+ let suites = ObjectUtils.get(this.data, SUITES_KEY, []);
+ for (const suiteItem of suites) {
+ let describeValue = ObjectUtils.get(suiteItem, DESCRIBE_KEY, []);
+ if (ObjectUtils.has(suiteItem, DESCRIBE_KEY) && (typeof describeValue === 'object') && describeValue.constructor === Array && describeValue.includes(suiteDesc)) {
+ let tempStress = ObjectUtils.get(suiteItem, STRESS_KEY, stress);
+ return (Number.isInteger(tempStress) && tempStress >= 1) ? tempStress : stress;
+ }
+ }
+ return stress;
+ }
+}
+
+export default DataDriver;
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/config/Filter.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/config/Filter.js
new file mode 100644
index 0000000000000000000000000000000000000000..2720b73ea2cebd148ee8d2a337b8fe9529912a0d
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/config/Filter.js
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2021-2024 Huawei Device 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 { LEVEL, SIZE, TESTTYPE } from "../../Constant";
+
+class ClassFilter {
+ constructor(suiteName, itName, params) {
+ this.suiteName = suiteName;
+ this.itName = itName;
+ this.params = params;
+ }
+
+ filterSuite() {
+ return !this.params.split(',').map(item => item.split('#')[0]).map(item => item == this.suiteName).reduce((pre, cur) => pre || cur, false);
+ }
+
+ filterIt() {
+ let classArray = this.params.split(',') || [];
+ let suiteFilterResult = classArray.filter(item => !item.includes('#')).map(item => item == this.suiteName).reduce((pre, cur) => pre || cur, false);
+ let itFilterResult = classArray.filter(item => item.includes('#')).map(item => item == (this.suiteName + '#' + this.itName)).reduce((pre, cur) => pre || cur, false);
+ return !(suiteFilterResult || itFilterResult);
+ }
+}
+
+class NotClassFilter {
+ constructor(suiteName, itName, params) {
+ this.suiteName = suiteName;
+ this.itName = itName;
+ this.params = params;
+ }
+
+ filterSuite() {
+ return this.params.split(',').map(item => item == this.suiteName).reduce((pre, cur) => pre || cur, false);
+ }
+
+ filterIt() {
+ return this.params.split(',').some(item => item == (this.suiteName + '#' + this.itName));
+ }
+}
+
+class SuiteAndItNameFilter {
+ constructor(suiteName, itName, params) {
+ this.suiteName = suiteName;
+ this.itName = itName;
+ this.params = params;
+ }
+
+ filterSuite() {
+ return !this.params.split(',').map(item => item == this.suiteName).reduce((pre, cur) => pre || cur, false);
+ }
+
+ filterIt() {
+ return !this.params.split(',').map(item => item == this.itName).reduce((pre, cur) => pre || cur, false);
+ }
+}
+
+
+class TestTypesFilter {
+ constructor(suiteName, itName, fi, params) {
+ this.suiteName = suiteName;
+ this.itName = itName;
+ this.params = params;
+ this.fi = fi;
+ }
+
+ filterIt() {
+ return !((this.params === (this.fi & this.params)) || this.fi === 0);
+ }
+}
+
+class NestFilter {
+ filterNestName(targetSuiteArray, targetSpecArray, suiteStack, desc) {
+ let targetSuiteName = "";
+ for (let key in suiteStack) {
+ targetSuiteName = targetSuiteName + "." + suiteStack[key].description;
+ }
+ targetSuiteName = targetSuiteName.substring(2);
+ const targetSpecName = targetSuiteName + "#" + desc;
+ let isFilter = true;
+ if (targetSpecArray.includes(targetSpecName)) {
+ return false;
+ }
+ for (let index in targetSuiteArray) {
+ if (targetSuiteName.startsWith(targetSuiteArray[index])) {
+ return false;
+ }
+ }
+ return isFilter;
+ }
+
+ filterNotClass(notClass, suiteStack, desc) {
+ let isFilterNotClass = false;
+ if (notClass != null) {
+ let notClassArray = notClass.split(",");
+ let targetSuiteName = "";
+ for (let key in suiteStack) {
+ targetSuiteName = targetSuiteName + "." + suiteStack[key].description;
+ }
+ targetSuiteName = targetSuiteName.substring(2);
+ const targetSpecName = targetSuiteName + "#" + desc;
+ if (notClassArray.includes(targetSpecName) || notClassArray.some(key => targetSpecName.startsWith(key))) {
+ isFilterNotClass = true;
+ }
+ }
+ return isFilterNotClass;
+ }
+
+ filterLevelOrSizeOrTestType(level, size, testType, filter) {
+ let result = false;
+ if (filter === 0 || filter === '0') {
+ return result;
+ }
+ if (level == null && size == null && testType == null) {
+ return result;
+ }
+ if (level != null) {
+ let levelFilter = LEVEL[`${level}`];
+ result = result || filter === levelFilter;
+ }
+ if (size != null) {
+ let sizeFilter = SIZE[`${size}`];
+ result = result || filter === sizeFilter;
+ }
+ if (testType != null) {
+ let testTypeFilter = TESTTYPE[`${testType}`];
+ result = result || filter === testTypeFilter;
+ }
+ return !result;
+ }
+}
+export { ClassFilter, NotClassFilter, SuiteAndItNameFilter, TestTypesFilter, NestFilter };
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/config/configService.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/config/configService.js
new file mode 100644
index 0000000000000000000000000000000000000000..8639877e3d114d54a1e3430ea41ffaa51cba5a59
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/config/configService.js
@@ -0,0 +1,299 @@
+/*
+ * Copyright (c) 2021-2024 Huawei Device 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 { ClassFilter, NotClassFilter, SuiteAndItNameFilter, TestTypesFilter, NestFilter } from './Filter';
+import { TAG, TESTTYPE, LEVEL, SIZE, KEYSET } from '../../Constant';
+const STRESS_RULE = /^[1-9]\d*$/;
+
+class ConfigService {
+ constructor(attr) {
+ this.id = attr.id;
+ this.supportAsync = true; // 默认异步处理测试用例
+ this.random = false;
+ this.filterValid = [];
+ this.filter = 0;
+ this.flag = false;
+ this.suite = null;
+ this.itName = null;
+ this.testType = null;
+ this.level = null;
+ this.size = null;
+ this.class = null;
+ this.notClass = null;
+ this.timeout = null;
+ // 遇错即停模式配置
+ this.breakOnError = false;
+ // 压力测试配置
+ this.stress = null;
+ this.skipMessage = false;
+ this.runSkipped = '';
+ this.filterXdescribe = [];
+ }
+
+ init(coreContext) {
+ this.coreContext = coreContext;
+ }
+
+ isNormalInteger(str) {
+ const n = Math.floor(Number(str));
+ return n !== Infinity && String(n) === String(str) && n >= 0;
+ }
+
+
+ getStress() {
+ if (this.stress === undefined || this.stress === '' || this.stress === null) {
+ return 1;
+ }
+ return !this.stress.match(STRESS_RULE) ? 1 : Number.parseInt(this.stress);
+ }
+
+ basicParamValidCheck(params) {
+ let size = params.size;
+ if (size !== undefined && size !== '' && size !== null) {
+ let sizeArray = ['small', 'medium', 'large'];
+ if (sizeArray.indexOf(size) === -1) {
+ this.filterValid.push('size:' + size);
+ }
+ }
+ let level = params.level;
+ if (level !== undefined && level !== '' && level !== null) {
+ let levelArray = ['0', '1', '2', '3', '4'];
+ if (levelArray.indexOf(level) === -1) {
+ this.filterValid.push('level:' + level);
+ }
+ }
+ let testType = params.testType;
+ if (testType !== undefined && testType !== '' && testType !== null) {
+ let testTypeArray = ['function', 'performance', 'power', 'reliability', 'security',
+ 'global', 'compatibility', 'user', 'standard', 'safety', 'resilience'];
+ if (testTypeArray.indexOf(testType) === -1) {
+ this.filterValid.push('testType:' + testType);
+ }
+ }
+ }
+
+ filterParamValidCheck(params) {
+ let timeout = params.timeout;
+ if (timeout !== undefined && timeout !== '' && timeout !== null) {
+ if (!this.isNormalInteger(timeout)) {
+ this.filterValid.push('timeout:' + timeout);
+ }
+ }
+
+ let paramKeys = ['dryRun', 'random', 'breakOnError', 'coverage', 'skipMessage'];
+ for (const key of paramKeys) {
+ if (params[key] !== undefined && params[key] !== 'true' && params[key] !== 'false') {
+ this.filterValid.push(`${key}:${params[key]}`);
+ }
+ }
+
+ // 压力测试参数验证,正整数
+ if (params.stress !== undefined && params.stress !== '' && params.stress !== null) {
+ if (!params.stress.match(STRESS_RULE)) {
+ this.filterValid.push('stress:' + params.stress);
+ }
+ }
+
+ let nameRule = /^[A-Za-z]{1}[\w#,.]*$/;
+ let paramClassKeys = ['class', 'notClass'];
+ for (const key of paramClassKeys) {
+ if (params[key] !== undefined && params[key] !== '' && params[key] !== null) {
+ let classArray = params[key].split(',');
+ classArray.forEach(item => !item.match(nameRule) ? this.filterValid.push(`${key}:${params[key]}`) : null);
+ }
+ }
+ }
+
+ setConfig(params) {
+ this.basicParamValidCheck(params);
+ this.filterParamValidCheck(params);
+ try {
+ this.class = params.class;
+ this.notClass = params.notClass;
+ this.flag = params.flag || { flag: false };
+ this.suite = params.suite;
+ this.itName = params.itName;
+ this.filter = params.filter;
+ this.testType = params.testType;
+ this.level = params.level;
+ this.size = params.size;
+ this.timeout = params.timeout;
+ this.dryRun = params.dryRun;
+ this.breakOnError = params.breakOnError;
+ this.random = params.random === 'true' ? true : false;
+ this.stress = params.stress;
+ this.coverage = params.coverage;
+ this.skipMessage = params.skipMessage;
+ this.runSkipped = params.runSkipped;
+ this.filterParam = {
+ testType: TESTTYPE,
+ level: LEVEL,
+ size: SIZE
+ };
+ this.parseParams();
+ } catch (err) {
+ console.info(`${TAG}setConfig error: ${err.message}`);
+ }
+ }
+
+ parseParams() {
+ if (this.filter != null) {
+ return;
+ }
+ let testTypeFilter = 0;
+ let sizeFilter = 0;
+ let levelFilter = 0;
+ if (this.testType != null) {
+ testTypeFilter = this.testType.split(',')
+ .map(item => this.filterParam.testType[item] || 0)
+ .reduce((pre, cur) => pre | cur, 0);
+ }
+ if (this.level != null) {
+ levelFilter = this.level.split(',')
+ .map(item => this.filterParam.level[item] || 0)
+ .reduce((pre, cur) => pre | cur, 0);
+ }
+ if (this.size != null) {
+ sizeFilter = this.size.split(',')
+ .map(item => this.filterParam.size[item] || 0)
+ .reduce((pre, cur) => pre | cur, 0);
+ }
+ this.filter = testTypeFilter | sizeFilter | levelFilter;
+ console.info(`${TAG}filter params:${this.filter}`);
+ }
+
+ isCurrentSuite(description) {
+ if (this.suite !== undefined && this.suite !== '' && this.suite !== null) {
+ let suiteArray = this.suite.split(',');
+ return suiteArray.indexOf(description) !== -1;
+ }
+ return false;
+ }
+
+ filterSuite(currentSuiteName) {
+ let filterArray = [];
+ if (this.suite !== undefined && this.suite !== '' && this.suite !== null) {
+ filterArray.push(new SuiteAndItNameFilter(currentSuiteName, '', this.suite));
+ }
+ if (this.class !== undefined && this.class !== '' && this.class !== null) {
+ filterArray.push(new ClassFilter(currentSuiteName, '', this.class));
+ }
+ if (this.notClass !== undefined && this.notClass !== '' && this.notClass !== null) {
+ filterArray.push(new NotClassFilter(currentSuiteName, '', this.notClass));
+ }
+
+ let result = filterArray.map(item => item.filterSuite()).reduce((pre, cur) => pre || cur, false);
+ return result;
+ }
+
+ filterDesc(currentSuiteName, desc, fi, coreContext) {
+ let filterArray = [];
+ if (this.itName !== undefined && this.itName !== '' && this.itName !== null) {
+ filterArray.push(new SuiteAndItNameFilter(currentSuiteName, desc, this.itName));
+ }
+ if (this.class !== undefined && this.class !== '' && this.class !== null) {
+ filterArray.push(new ClassFilter(currentSuiteName, desc, this.class));
+ }
+ if (this.notClass !== undefined && this.notClass !== '' && this.notClass !== null) {
+ filterArray.push(new NotClassFilter(currentSuiteName, desc, this.notClass));
+ }
+ if (typeof (this.filter) !== 'undefined' && this.filter !== 0 && fi !== 0) {
+ filterArray.push(new TestTypesFilter('', '', fi, this.filter));
+ }
+ let result = filterArray.map(item => item.filterIt()).reduce((pre, cur) => pre || cur, false);
+ return result;
+ }
+
+ filterWithNest(desc, filter) {
+ let filterArray = [];
+ const nestFilter = new NestFilter();
+ const targetSuiteArray = this.coreContext.getDefaultService('suite').targetSuiteArray;
+ const targetSpecArray = this.coreContext.getDefaultService('suite').targetSpecArray;
+ const suiteStack = this.coreContext.getDefaultService('suite').suitesStack;
+ let isFilter = nestFilter.filterNestName(targetSuiteArray, targetSpecArray, suiteStack, desc);
+ const isFullRun = this.coreContext.getDefaultService('suite').fullRun;
+ if (typeof (this.filter) !== 'undefined' && this.filter !== 0 && filter !== 0) {
+ filterArray.push(new TestTypesFilter('', '', filter, this.filter));
+ return filterArray.map(item => item.filterIt()).reduce((pre, cur) => pre || cur, false);
+ }
+ if (isFilter && !isFullRun) {
+ return true;
+ }
+ return nestFilter.filterNotClass(this.notClass, suiteStack, desc);
+
+ }
+
+ isRandom() {
+ return this.random || false;
+ }
+
+ isBreakOnError() {
+ return this.breakOnError !== 'true' ? false : true;
+ }
+
+ setSupportAsync(value) {
+ this.supportAsync = value;
+ }
+
+ isSupportAsync() {
+ return this.supportAsync;
+ }
+
+ translateParams(parameters) {
+ const keySet = new Set(KEYSET);
+ let targetParams = {};
+ for (const key in parameters) {
+ if (keySet.has(key)) {
+ var newKey = key.replace("-s ", "");
+ targetParams[newKey] = parameters[key];
+ }
+ }
+ return targetParams;
+ }
+ translateParamsToString(parameters) {
+ const keySet = new Set(KEYSET);
+ let targetParams = '';
+ for (const key in parameters) {
+ if (keySet.has(key)) {
+ targetParams += ' ' + key + ' ' + parameters[key];
+ }
+ }
+ return targetParams.trim();
+ }
+
+ execute() {
+ }
+
+ checkIfSuiteInSkipRun(desc) {
+ return this.runSkipped.split(",").some(item => {
+ return item === desc || item.startsWith(desc + '.') || item.startsWith(desc + '#') || desc.startsWith(item + '.') || this.runSkipped === 'skipped';
+ });
+ }
+
+ checkIfSpecInSkipRun(desc) {
+ return this.runSkipped.split(",").some(item => {
+ if (item.includes("#")) {
+ return item === desc;
+ } else {
+ return desc.startsWith(item + ".") || desc.startsWith(item + "#") || this.runSkipped === 'skipped';
+ }
+ }
+ );
+ }
+}
+
+export {
+ ConfigService
+};
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/coverage/coverageCollect.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/coverage/coverageCollect.js
new file mode 100644
index 0000000000000000000000000000000000000000..466bbaa11ef258895ebd64929ac5c99f7a471051
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/coverage/coverageCollect.js
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2023 Huawei Device 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 SysTestKit from "../kit/SysTestKit";
+import fs from '@ohos.file.fs';
+import {TAG} from '../../Constant';
+
+const jsCoverageFileName = 'js_coverage.json';
+
+export async function collectCoverageData() {
+ if (globalThis.__coverage__ === undefined) {
+ console.info(`${TAG} globalThis not have coverage`);
+ return;
+ }
+ const strJson = JSON.stringify(globalThis.__coverage__);
+ let testMode = globalThis.__testMode__;
+ console.info(`${TAG} coverage data testMode: ${testMode}`)
+ let savePath = globalThis.__savePath__;
+ console.info(`${TAG} write coverage data to: ${savePath}`);
+ let readPath = globalThis.__readPath__;
+ console.info(`${TAG} read coverage data in: ${readPath}`);
+
+ // run callback mode if local test or (save path and read path ) is not defined
+ if (!testMode || !isCoveragePathValid(savePath)) {
+ console.info(`${TAG} run coverage data in call back mode`)
+ const strLen = strJson.length;
+ const maxLen = 500;
+ const maxCount = Math.floor(strLen / maxLen);
+ const OHOS_REPORT_COVERAGE_DATA = 'OHOS_REPORT_COVERAGE_DATA:';
+ for (let count = 0; count <= maxCount; count++) {
+ console.info(`${OHOS_REPORT_COVERAGE_DATA} ${strJson.substring(count * maxLen, (count + 1) * maxLen)}`);
+ await SysTestKit.print(`${OHOS_REPORT_COVERAGE_DATA} ${strJson.substring(count * maxLen, (count + 1) * maxLen)}`);
+ }
+ return;
+ }
+ console.info(`${TAG} run coverage data in save file mode`);
+ if(fs.accessSync(savePath)) {
+ fs.unlinkSync(savePath)
+ }
+
+ let inputPathDir = savePath.substring(0, savePath.length - jsCoverageFileName.length);
+ if (!fs.accessSync(inputPathDir)) {
+ console.info(`${TAG} coverage data create dir: ${inputPathDir}`);
+ fs.mkdirSync(inputPathDir)
+ }
+
+ let file = fs.openSync(savePath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
+ let writeLen = fs.writeSync(file.fd, strJson, {encoding:"utf-8"});
+ console.info(`${TAG} write coverage data success: ${writeLen}`);
+ fs.closeSync(file);
+ const OHOS_REPORT_COVERAGE_PATH = 'OHOS_REPORT_COVERAGE_PATH:';
+ await SysTestKit.print(`${OHOS_REPORT_COVERAGE_PATH} ${readPath}`);
+ console.info(`${OHOS_REPORT_COVERAGE_PATH} ${readPath}`);
+}
+
+function isCoveragePathValid(inputPath) {
+ if (!inputPath) {
+ return false;
+ }
+ if (inputPath.indexOf(jsCoverageFileName) === -1) {
+ return false;
+ }
+ return true;
+}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/kit/SysTestKit.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/kit/SysTestKit.js
new file mode 100644
index 0000000000000000000000000000000000000000..86173be050350e7284d17842abb0d23d3c1d97bb
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/kit/SysTestKit.js
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2022-2023 Huawei Device 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 {TAG} from '../../Constant';
+import Core from '../../core.js';
+
+export default class SysTestKit {
+
+ static delegator = null;
+ static systemTime = null;
+
+ constructor() {
+ this.id = 'sysTestKit';
+ this.index = 0;
+ }
+
+ static getDescribeName() {
+ return Core.getInstance().getDefaultService('suite').getCurrentRunningSuite().description;
+ }
+
+ static getItName() {
+ return Core.getInstance().getDefaultService('spec').getCurrentRunningSpec().description;
+ }
+
+ static getItAttribute() {
+ return Core.getInstance().getDefaultService('spec').getCurrentRunningSpec().fi;
+ }
+
+ static actionStart(tag) {
+ console.info(`${TAG}${JSON.stringify(tag)}`);
+ var message = '\n' + 'OHOS_REPORT_ACTIONSTART: ' + JSON.stringify(tag) + '\n';
+ SysTestKit.print(message);
+ console.info(`${TAG}${JSON.stringify(tag)} actionStart print success`);
+ }
+
+ static actionEnd(tag) {
+ console.info(`${TAG}${JSON.stringify(tag)}`);
+ var message = '\n' + 'OHOS_REPORT_ACTIONEND: ' + JSON.stringify(tag) + '\n';
+ SysTestKit.print(message);
+ console.info(`${TAG}${JSON.stringify(tag)} actionEnd print success`);
+ }
+
+ static async existKeyword(keyword, timeout) {
+ let reg = new RegExp(/^[a-zA-Z0-9]{1,}$/);
+ if (!reg.test(keyword)) {
+ throw new Error('keyword must contain more than one string, and only letters and numbers are supported.');
+ }
+ timeout = timeout || 4;
+
+ let searchResult = false;
+ let cmd = 'hilog -x | grep -i \'' + keyword + '\' | wc -l';
+ await executePromise(cmd, timeout).then((data) => {
+ searchResult = data;
+ });
+ return searchResult;
+ }
+ static async print(message) {
+ if ('printSync' in SysTestKit.delegator) {
+ console.debug(`${TAG}printSync called ...`);
+ SysTestKit.delegator.printSync(message);
+ } else {
+ await SysTestKit.delegator.print(message);
+ }
+ }
+
+ static async getRealTime() {
+ let currentTime = new Date().getTime();
+ if (SysTestKit.systemTime !== null && SysTestKit.systemTime !== undefined) {
+ await SysTestKit.systemTime.getRealTime().then((time) => {
+ console.info(`${TAG}systemTime.getRealTime success data: ${JSON.stringify(time)}`);
+ currentTime = time;
+ }).catch((error) => {
+ console.error(`${TAG}failed to systemTime.getRealTime because ${JSON.stringify(error)}`);
+ });
+ }
+ return currentTime;
+ }
+}
+
+function executePromise(cmd, timeout) {
+ return new Promise((resolve, reject) => {
+ SysTestKit.delegator.executeShellCommand(cmd, timeout,
+ (error, data) => {
+ console.info(`${TAG}existKeyword CallBack: err : ${JSON.stringify(error)}`);
+ console.info(`${TAG}existKeyword CallBack: data : ${JSON.stringify(data)}`);
+ resolve(parseInt(data.stdResult) > 3 ? true : false);
+ });
+ });
+}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/mock/ArgumentMatchers.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/mock/ArgumentMatchers.js
new file mode 100644
index 0000000000000000000000000000000000000000..6a9d7aac464e95383ea31385284b6603c34e084c
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/mock/ArgumentMatchers.js
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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.
+ */
+
+class ArgumentMatchers {
+ ANY = "";
+ ANY_STRING = "";
+ ANY_BOOLEAN = "";
+ ANY_NUMBER = "";
+ ANY_OBJECT = "";
+ ANY_FUNCTION = "";
+ MATCH_REGEXS = "";
+
+ static any() {
+ }
+
+ static anyString() {
+ }
+
+ static anyBoolean() {
+ }
+
+ static anyNumber() {
+ }
+
+ static anyObj() {
+ }
+
+ static anyFunction() {
+ }
+
+ static matchRegexs() {
+ let regex = arguments[0];
+ if (ArgumentMatchers.isRegExp(regex)) {
+ return regex;
+ }
+ throw Error("not a regex");
+ }
+
+ static isRegExp(value) {
+ return Object.prototype.toString.call(value) === "[object RegExp]";
+ }
+
+ matcheReturnKey() {
+ let arg = arguments[0];
+ let regex = arguments[1];
+ let stubSetKey = arguments[2];
+
+ if (stubSetKey && stubSetKey == this.ANY) {
+ return this.ANY;
+ }
+
+ if (typeof arg === "string" && !regex) {
+ return this.ANY_STRING;
+ }
+
+ if (typeof arg === "boolean" && !regex) {
+ return this.ANY_BOOLEAN;
+ }
+
+ if (typeof arg === "number" && !regex) {
+ return this.ANY_NUMBER;
+ }
+
+ if (typeof arg === "object" && !regex) {
+ return this.ANY_OBJECT;
+ }
+
+ if (typeof arg === "function" && !regex) {
+ return this.ANY_FUNCTION;
+ }
+
+ if (typeof arg === "string" && regex) {
+ return regex.test(arg);
+ }
+
+ return null;
+ }
+
+ matcheStubKey() {
+ let key = arguments[0];
+
+ if (key === ArgumentMatchers.any) {
+ return this.ANY;
+ }
+
+ if (key === ArgumentMatchers.anyString) {
+ return this.ANY_STRING;
+ }
+ if (key === ArgumentMatchers.anyBoolean) {
+ return this.ANY_BOOLEAN;
+ }
+ if (key === ArgumentMatchers.anyNumber) {
+ return this.ANY_NUMBER;
+ }
+ if (key === ArgumentMatchers.anyObj) {
+ return this.ANY_OBJECT;
+ }
+ if (key === ArgumentMatchers.anyFunction) {
+ return this.ANY_FUNCTION;
+ }
+
+ if (ArgumentMatchers.isRegExp(key)) {
+ return key;
+ }
+
+ return null;
+ }
+}
+
+export default ArgumentMatchers;
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/mock/ExtendInterface.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/mock/ExtendInterface.js
new file mode 100644
index 0000000000000000000000000000000000000000..c6a866a6df662ad10a7f6869dcbc2381fa47bcdc
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/mock/ExtendInterface.js
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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.
+ */
+
+class ExtendInterface {
+ constructor(mocker) {
+ this.mocker = mocker;
+ }
+
+ stub() {
+ this.params = arguments;
+ return this;
+ }
+
+ stubMockedCall(returnInfo) {
+ this.mocker.stubApply(this, this.params, returnInfo);
+ }
+
+ afterReturn(value) {
+ this.stubMockedCall(function () {
+ return value;
+ });
+ }
+
+ afterReturnNothing() {
+ this.stubMockedCall(function () {
+ return undefined;
+ });
+ }
+
+ afterAction(action) {
+ this.stubMockedCall(action);
+ }
+
+ afterThrow(msg) {
+ this.stubMockedCall(function () {
+ throw msg;
+ });
+ }
+
+ clear() {
+ this.mocker.clear();
+ }
+}
+
+export default ExtendInterface;
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/mock/MockKit.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/mock/MockKit.js
new file mode 100644
index 0000000000000000000000000000000000000000..6e9e19ab7baa7fe024496e28f4f97abd9a7db9b4
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/mock/MockKit.js
@@ -0,0 +1,256 @@
+/*
+ * Copyright (c) 2022-2023 Huawei Device 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 ExtendInterface from "./ExtendInterface";
+import VerificationMode from "./VerificationMode";
+import ArgumentMatchers from "./ArgumentMatchers";
+
+class MockKit {
+
+ constructor() {
+ this.mFunctions = [];
+ this.stubs = new Map();
+ this.recordCalls = new Map();
+ this.currentSetKey = new Map();
+ this.mockObj = null;
+ this.recordMockedMethod = new Map();
+ }
+
+ init() {
+ this.reset();
+ }
+
+ reset() {
+ this.mFunctions = [];
+ this.stubs = {};
+ this.recordCalls = {};
+ this.currentSetKey = new Map();
+ this.mockObj = null;
+ this.recordMockedMethod = new Map();
+ }
+
+ clearAll() {
+ this.reset();
+ var props = Object.keys(this);
+ for (var i = 0; i < props.length; i++) {
+ delete this[props[i]];
+ }
+
+ var props = Object.getOwnPropertyNames(this);
+ for (var i = 0; i < props.length; i++) {
+ delete this[props[i]];
+ }
+ for (var key in this) {
+ delete this[key];
+ }
+ }
+
+ clear(obj) {
+ if (!obj) throw Error("Please enter an object to be cleaned");
+ if (typeof (obj) !== 'object' && typeof (obj) !== 'function') throw new Error('Not a object or static class');
+ this.recordMockedMethod.forEach(function (value, key, map) {
+ if (key) {
+ obj[key] = value;
+ }
+ });
+ }
+
+ ignoreMock(obj, method) {
+ if (typeof (obj) !== 'object' && typeof (obj) !== 'function') throw new Error('Not a object or static class');
+ if (typeof (method) !== 'function') throw new Error('Not a function');
+ let og = this.recordMockedMethod.get(method.propName);
+ if (og) {
+ obj[method.propName] = og;
+ this.recordMockedMethod.set(method.propName, undefined);
+ }
+ }
+
+ extend(dest, source) {
+ dest["stub"] = source["stub"];
+ dest["afterReturn"] = source["afterReturn"];
+ dest["afterReturnNothing"] = source["afterReturnNothing"];
+ dest["afterAction"] = source["afterAction"];
+ dest["afterThrow"] = source["afterThrow"];
+ dest["stubMockedCall"] = source["stubMockedCall"];
+ dest["clear"] = source["clear"];
+ return dest;
+ }
+
+ stubApply(f, params, returnInfo) {
+ let values = this.stubs.get(f);
+ if (!values) {
+ values = new Map();
+ }
+ let key = params[0];
+ if (typeof key == "undefined") {
+ key = "anonymous-mock-" + f.propName;
+ }
+ let matcher = new ArgumentMatchers();
+ if (matcher.matcheStubKey(key)) {
+ key = matcher.matcheStubKey(key);
+ if (key) {
+ this.currentSetKey.set(f, key);
+ }
+ }
+ values.set(key, returnInfo);
+ this.stubs.set(f, values);
+ }
+
+ getReturnInfo(f, params) {
+ let values = this.stubs.get(f);
+ if (!values) {
+ return undefined;
+ }
+ let retrunKet = params[0];
+ if (typeof retrunKet == "undefined") {
+ retrunKet = "anonymous-mock-" + f.propName;
+ }
+ let stubSetKey = this.currentSetKey.get(f);
+
+ if (stubSetKey && (typeof (retrunKet) !== "undefined")) {
+ retrunKet = stubSetKey;
+ }
+ let matcher = new ArgumentMatchers();
+ if (matcher.matcheReturnKey(params[0], undefined, stubSetKey) && matcher.matcheReturnKey(params[0], undefined, stubSetKey) !== stubSetKey) {
+ retrunKet = params[0];
+ }
+
+ values.forEach(function (value, key, map) {
+ if (ArgumentMatchers.isRegExp(key) && matcher.matcheReturnKey(params[0], key)) {
+ retrunKet = key;
+ }
+ });
+
+ return values.get(retrunKet);
+ }
+
+ findName(obj, value) {
+ let properties = this.findProperties(obj);
+ let name = null;
+ properties.filter(item => (item !== 'caller' && item !== 'arguments')).forEach(
+ function (va1, idx, array) {
+ if (obj[va1] === value) {
+ name = va1;
+ }
+ }
+ );
+ return name;
+ }
+
+ isFunctionFromPrototype(f, container, propName) {
+ if (container.constructor !== Object && container.constructor.prototype !== container) {
+ return container.constructor.prototype[propName] === f;
+ }
+ return false;
+ }
+
+ findProperties(obj, ...arg) {
+ function getProperty(new_obj) {
+ if (new_obj.__proto__ === null) {
+ return [];
+ }
+ let properties = Object.getOwnPropertyNames(new_obj);
+ return [...properties, ...getProperty(new_obj.__proto__)];
+ }
+ return getProperty(obj);
+ }
+
+ recordMethodCall(originalMethod, args) {
+ Function.prototype.getName = function () {
+ return this.name || this.toString().match(/function\s*([^(]*)\(/)[1];
+ };
+ let name = originalMethod.getName();
+ let arglistString = name + '(' + Array.from(args).toString() + ')';
+ let records = this.recordCalls.get(arglistString);
+ if (!records) {
+ records = 0;
+ }
+ records++;
+ this.recordCalls.set(arglistString, records);
+ }
+
+ mockFunc(originalObject, originalMethod) {
+ let tmp = this;
+ this.originalMethod = originalMethod;
+ let f = function () {
+ let args = arguments;
+ let action = tmp.getReturnInfo(f, args);
+ if (originalMethod) {
+ tmp.recordMethodCall(originalMethod, args);
+ }
+ if (action) {
+ return action.apply(this, args);
+ }
+ };
+
+ f.container = null || originalObject;
+ f.original = originalMethod || null;
+
+ if (originalObject && originalMethod) {
+ if (typeof (originalMethod) !== 'function') throw new Error('Not a function');
+ var name = this.findName(originalObject, originalMethod);
+ originalObject[name] = f;
+ this.recordMockedMethod.set(name, originalMethod);
+ f.propName = name;
+ f.originalFromPrototype = this.isFunctionFromPrototype(f.original, originalObject, f.propName);
+ }
+ f.mocker = this;
+ this.mFunctions.push(f);
+ this.extend(f, new ExtendInterface(this));
+ return f;
+ }
+
+ verify(methodName, argsArray) {
+ if (!methodName) {
+ throw Error("not a function name");
+ }
+ let a = this.recordCalls.get(methodName + '(' + argsArray.toString() + ')');
+ return new VerificationMode(a ? a : 0);
+ }
+
+ mockObject(object) {
+ if (!object || typeof object === "string") {
+ throw Error(`this ${object} cannot be mocked`);
+ }
+ const _this = this;
+ let mockedObject = {};
+ let keys = Reflect.ownKeys(object);
+ keys.filter(key => (typeof Reflect.get(object, key)) === 'function')
+ .forEach(key => {
+ mockedObject[key] = object[key];
+ mockedObject[key] = _this.mockFunc(mockedObject, mockedObject[key]);
+ });
+ return mockedObject;
+ }
+}
+
+function ifMockedFunction(f) {
+ if (Object.prototype.toString.call(f) !== "[object Function]" &&
+ Object.prototype.toString.call(f) !== "[object AsyncFunction]") {
+ throw Error("not a function");
+ }
+ if (!f.stub) {
+ throw Error("not a mock function");
+ }
+ return true;
+}
+
+function when(f) {
+ if (ifMockedFunction(f)) {
+ return f.stub.bind(f);
+ }
+}
+
+export {MockKit, when};
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/mock/VerificationMode.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/mock/VerificationMode.js
new file mode 100644
index 0000000000000000000000000000000000000000..28eda2b05fa5ec9f78f9b20d1be1b6c87ffaf33b
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/mock/VerificationMode.js
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2022-2023 Huawei Device 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 {expect} from '../../interface';
+
+class VerificationMode {
+ constructor(times) {
+ this.doTimes = times;
+ }
+
+ times(count) {
+ expect(count).assertEqual(this.doTimes);
+ }
+
+ never() {
+ console.log(this.doTimes);
+ expect(0).assertEqual(this.doTimes);
+ }
+
+ once() {
+ expect(1).assertEqual(this.doTimes);
+ }
+
+ atLeast(count) {
+ if (count > this.doTimes) {
+ throw Error('failed ' + count + ' greater than the actual execution times of method');
+ }
+ }
+
+ atMost(count) {
+ if (count < this.doTimes) {
+ throw Error('failed ' + count + ' less than the actual execution times of method');
+ }
+ }
+}
+
+export default VerificationMode;
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/report/LogExpectError.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/report/LogExpectError.js
new file mode 100644
index 0000000000000000000000000000000000000000..f2aede62f86d762524a59fba0eeacf959f1a846c
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/report/LogExpectError.js
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2024 Huawei Device 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.
+ */
+
+class LogExpectError {
+ static getErrorMsg(matcherName, actualValue, expect, originMsg) {
+ if (matcherName === "assertNull") {
+ return "expect not null, actualValue is " + (actualValue)
+ }
+ if (matcherName === "assertTrue") {
+ return "expect not true, actualValue is " + (actualValue)
+ }
+ if (matcherName === "assertFalse") {
+ return "expect not false, actualValue is " + (actualValue)
+ }
+ if (matcherName === "assertEqual") {
+ return "expect not Equal, actualValue is "
+ + actualValue + ' equals ' + expect;
+ }
+ if (matcherName === "assertContain") {
+ return "expect not have, " + actualValue + " have " + expect;
+ }
+ if (matcherName === "assertInstanceOf") {
+ return "expect not InstanceOf, "
+ + actualValue + ' is '
+ + Object.prototype.toString.call(actualValue) + expect;
+ }
+ if (matcherName === "assertLarger") {
+ return "expect not Larger, "
+ + (actualValue) + ' is larger than ' + expect;
+ }
+ if (matcherName === "assertLargerOrEqual") {
+ return "expect not LargerOrEqual, "
+ + (actualValue) + ' larger than ' + expect;
+ }
+ if (matcherName === "assertLess") {
+ return "expect not Less, "
+ + (actualValue) + ' less than ' + expect;
+ }
+ if (matcherName === "assertLessOrEqual") {
+ return "expect not LessOrEqual, "
+ + (actualValue) + ' is less than ' + expect;
+ }
+ if (matcherName === "assertNaN") {
+ return "expect not NaN, actualValue is " + (actualValue)
+ }
+ if (matcherName === "assertNegUnlimited") {
+ return "expect not NegUnlimited, actualValue is " + (actualValue)
+ }
+ if (matcherName === "assertPosUnlimited") {
+ return "expect not PosUnlimited, actualValue is " + (actualValue)
+ }
+ if (matcherName === "assertUndefined") {
+ return "expect not Undefined, actualValue is " + (actualValue)
+ }
+ return originMsg;
+ }
+}
+export default LogExpectError
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/report/OhReport.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/report/OhReport.js
new file mode 100644
index 0000000000000000000000000000000000000000..529c003cfb8a11f2ddaf24f8884301d4e8e39dd0
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/report/OhReport.js
@@ -0,0 +1,186 @@
+/*
+ * Copyright (c) 2021-2024 Huawei Device 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 SysTestKit from "../kit/SysTestKit";
+import { collectCoverageData } from '../coverage/coverageCollect';
+import { TAG } from '../../Constant';
+
+class OhReport {
+ constructor(attr) {
+ this.delegator = attr.delegator;
+ this.abilityDelegatorArguments = attr.abilityDelegatorArguments;
+ this.id = 'report';
+ this.index = 0;
+ this.duration = 0;
+ }
+
+ init(coreContext) {
+ this.coreContext = coreContext;
+ this.suiteService = this.coreContext.getDefaultService('suite');
+ this.specService = this.coreContext.getDefaultService('spec');
+ }
+
+ taskStart() {
+ }
+
+ async taskDone() {
+ if (this.abilityDelegatorArguments !== null) {
+ this.taskDoneTime = new Date().getTime();
+ let summary = this.suiteService.getSummary();
+ const configService = this.coreContext.getDefaultService('config');
+ const suiteService = this.coreContext.getDefaultService('suite');
+ const specService = this.coreContext.getDefaultService('spec');
+ if (configService['coverage'] === 'true') {
+ await collectCoverageData();
+ }
+ let message = '\n' + 'OHOS_REPORT_RESULT: stream=Tests run: ' + summary.total + ', Failure: ' + summary.failure;
+ message += ', Error: ' + summary.error;
+ message += ', Pass: ' + summary.pass;
+ message += ', Ignore: ' + summary.ignore;
+ if (specService.skipSpecNum > 0) {
+ message += ', SkipSpec: ' + specService.skipSpecNum;
+ }
+ message += '\n' + 'OHOS_REPORT_CODE: ' + (summary.failure > 0 ? -1 : 0) + '\n';
+ let isHasError = summary.failure > 0 || summary.error > 0;
+ let config = this.coreContext.getDefaultService('config');
+ if (config.isBreakOnError() && isHasError) {
+ // 未执行全部说明
+ message += '\n' + 'OHOS_REPORT_RESULT: breakOnError model, Stopping whole test suite if one specific test case failed or error' + '\n';
+ }
+ message += 'OHOS_REPORT_STATUS: taskconsuming=' + summary.duration + '\n';
+ console.info(`${message}`);
+ await SysTestKit.print(message);
+ }
+ console.info(`${TAG}report print success`);
+ this.delegator.finishTest('your test finished!!!', 0, () => { });
+ }
+
+ incorrectFormat() {
+ if (this.coreContext.getDefaultService('config').filterValid.length !== 0) {
+ var value = this.coreContext.getDefaultService('config').filterValid;
+ var message = 'this param ' + value.join(',') + ' is invalid' + '\n';
+ this.delegator.finishTest(message, 0, () => {
+ });
+ }
+ }
+
+ incorrectTestSuiteFormat() {
+ if (this.coreContext.getDefaultService('config').filterXdescribe.length !== 0) {
+ let value = this.coreContext.getDefaultService('config').filterXdescribe;
+ let message = 'xdescribe ' + value.join(',') + ' should not contain it' + '\n';
+ this.delegator.finishTest(message, 0, () => {
+ });
+ }
+ }
+ async suiteStart() {
+ if (this.abilityDelegatorArguments !== null) {
+ let specArr = [];
+ this.suiteService.getAllChildSuiteNum(this.suiteService.getCurrentRunningSuite(), specArr);
+ let message = '\n' + 'OHOS_REPORT_SUM: ' + specArr.length;
+ this.suiteService.setCurrentRunningSuiteDesc(this.suiteService.getRootSuite(), this.suiteService.getCurrentRunningSuite(), '');
+ message += '\n' + 'OHOS_REPORT_STATUS: class=' + this.suiteService.getCurrentRunningSuiteDesc() + '\n';
+ if (this.suiteService.currentRunningSuite.isSkip) {
+ message += 'OHOS_REPORT_STATUS: skipReason=' + this.suiteService.currentRunningSuite.skipReason + '\n';
+ }
+ console.info(`${message}`);
+ await SysTestKit.print(message);
+ console.info(`${TAG}${this.suiteService.getCurrentRunningSuite().description} suiteStart print success`);
+ }
+ }
+
+ async suiteDone() {
+ if (this.abilityDelegatorArguments !== null) {
+ const currentRunningSuite = this.suiteService.getCurrentRunningSuite();
+ this.suiteService.setCurrentRunningSuiteDesc(this.suiteService.getRootSuite(), this.suiteService.getCurrentRunningSuite(), '');
+ let message = '\n' + 'OHOS_REPORT_STATUS: class=' + this.suiteService.getCurrentRunningSuiteDesc();
+ if (this.suiteService.currentRunningSuite.isSkip && this.suiteService.currentRunningSuite.skipReason !== '') {
+ message += '\n' + 'OHOS_REPORT_STATUS: skipReason=' + this.suiteService.currentRunningSuite.skipReason;
+ }
+ message += '\n' + 'OHOS_REPORT_STATUS: suiteconsuming=' + this.suiteService.getCurrentRunningSuite().duration;
+ if (currentRunningSuite.hookError) {
+ message += '\n' + `OHOS_REPORT_STATUS: ${currentRunningSuite.hookError.message}`;
+ }
+ message += '\n';
+ console.info(`${message}`);
+ await SysTestKit.print(message);
+ console.info(`${TAG}${this.suiteService.getCurrentRunningSuite().description} suiteDone print success`);
+ }
+ }
+
+ async specStart() {
+ if (this.abilityDelegatorArguments !== null) {
+ let message = '\n' + 'OHOS_REPORT_STATUS: class=' + this.suiteService.getCurrentRunningSuiteDesc();
+ message += '\n' + 'OHOS_REPORT_STATUS: current=' + (++this.index);
+ message += '\n' + 'OHOS_REPORT_STATUS: id=JS';
+ message += '\n' + 'OHOS_REPORT_STATUS: numtests=' + this.specService.getTestTotal();
+ message += '\n' + 'OHOS_REPORT_STATUS: stream=';
+ message += '\n' + 'OHOS_REPORT_STATUS: test=' + this.specService.currentRunningSpec.description;
+ message += '\n' + 'OHOS_REPORT_STATUS_CODE: 1' + '\n';
+ if (this.specService.currentRunningSpec.isSkip) {
+ message += 'OHOS_REPORT_STATUS: skipReason=' + this.specService.currentRunningSpec.skipReason + '\n';
+ }
+ console.info(`${message}`);
+ await SysTestKit.print(message);
+ console.info(`${TAG}${this.specService.currentRunningSpec.description} specStart start print success`);
+ }
+ }
+
+ async specDone() {
+ if (this.abilityDelegatorArguments !== null) {
+ let message = '\n' + 'OHOS_REPORT_STATUS: class=' + this.suiteService.getCurrentRunningSuiteDesc();
+ message += '\n' + 'OHOS_REPORT_STATUS: current=' + (this.index);
+ message += '\n' + 'OHOS_REPORT_STATUS: id=JS';
+ message += '\n' + 'OHOS_REPORT_STATUS: numtests=' + this.specService.getTestTotal();
+ let messageStack = '';
+ let messageCode = '';
+ if (this.specService.currentRunningSpec.error) {
+ messageStack = 'OHOS_REPORT_STATUS: stack=' + this.specService.currentRunningSpec.error?.stack?.slice(0, -1);
+ messageCode += 'OHOS_REPORT_STATUS: stream=';
+ messageCode += this.specService.currentRunningSpec.expectMsg !== '' ?
+ `message: ${this.specService.currentRunningSpec.expectMsg}, Error in ${this.specService.currentRunningSpec.description}, ${this.specService.currentRunningSpec.error?.message}` :
+ `Error in ${this.specService.currentRunningSpec.description}, ${this.specService.currentRunningSpec.error?.message}`;
+ messageCode += '\n' + 'OHOS_REPORT_STATUS: test=' + this.specService.currentRunningSpec.description;
+ messageCode += '\n' + 'OHOS_REPORT_STATUS_CODE: -1' + '\n';
+ } else if (this.specService.currentRunningSpec) {
+ if (this.specService.currentRunningSpec.fail) {
+ messageStack += 'OHOS_REPORT_STATUS: stack=' + this.specService.currentRunningSpec.fail?.stack?.slice(0, -1);
+ messageCode += 'OHOS_REPORT_STATUS: stream=';
+ messageCode += this.specService.currentRunningSpec.expectMsg !== '' ?
+ `message: ${this.specService.currentRunningSpec.expectMsg}, Error in ${this.specService.currentRunningSpec.description}, ${this.specService.currentRunningSpec.fail?.message}` :
+ `Error in ${this.specService.currentRunningSpec.description}, ${this.specService.currentRunningSpec.fail?.message}`;
+ messageCode += '\n' + 'OHOS_REPORT_STATUS: test=' + this.specService.currentRunningSpec.description;
+ messageCode += '\n' + 'OHOS_REPORT_STATUS_CODE: -2' + '\n';
+ } else {
+ messageStack += 'OHOS_REPORT_STATUS: stream=';
+ messageCode += 'OHOS_REPORT_STATUS: test=' + this.specService.currentRunningSpec.description;
+ messageCode += '\n' + 'OHOS_REPORT_STATUS_CODE: 0' + '\n';
+ messageCode += this.specService.currentRunningSpec.isSkip ? ('OHOS_REPORT_STATUS: skipReason=' + this.specService.currentRunningSpec.skipReason + '\n') : '';
+ }
+ } else {
+ messageCode += '\n';
+ }
+ messageCode += 'OHOS_REPORT_STATUS: consuming=' + this.specService.currentRunningSpec.duration + '\n';
+ console.info(`${message}`);
+ console.info(`\n${messageStack}`);
+ console.info(`\n${messageCode}`);
+ await SysTestKit.print(message);
+ await SysTestKit.print(messageStack);
+ await SysTestKit.print(messageCode);
+ console.info(`${TAG}${this.specService.currentRunningSpec.description} specDone end print success`);
+ }
+ }
+}
+
+export default OhReport;
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/report/ReportExtend.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/report/ReportExtend.js
new file mode 100644
index 0000000000000000000000000000000000000000..852fbcd5cbf97e776ebe5177a029df0f516594a5
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/report/ReportExtend.js
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+class ReportExtend {
+ constructor(fileModule) {
+ this.id = 'extend';
+ this.fileModule = fileModule;
+ }
+
+ init(coreContext) {
+ this.coreContext = coreContext;
+ this.suiteService = this.coreContext.getDefaultService('suite');
+ }
+
+ taskStart() {
+
+ }
+
+ taskDone() {
+ const report = {
+ tag: 'testsuites',
+ name: 'summary_report',
+ timestamp: new Date().toDateString(),
+ time: '1',
+ errors: 0,
+ failures: 0,
+ tests: 0,
+ children: []
+ };
+ const rootSuite = this.suiteService.rootSuite;
+ if (rootSuite && rootSuite.childSuites) {
+ for (let testsuite of rootSuite.childSuites) {
+ let suiteReport = {
+ tag: 'testsuite',
+ name: testsuite['description'],
+ errors: 0,
+ tests: 0,
+ failures: 0,
+ time: '0.1',
+ children: []
+ };
+ let specs = testsuite['specs'];
+ for (let testcase of specs) {
+ report.tests++;
+ suiteReport.tests++;
+ let caseReport = {
+ tag: 'testcase',
+ name: testcase['description'],
+ status: 'run',
+ time: '0.0',
+ classname: testsuite['description']
+ };
+ if (testcase.error) {
+ caseReport['result'] = false;
+ caseReport['children'] = [{
+ tag: 'error',
+ type: '',
+ message: testcase.error.message
+ }];
+ report.errors++;
+ suiteReport.errors++;
+ } else if (testcase.result.failExpects.length > 0) {
+ caseReport['result'] = false;
+ let message = '';
+ testcase.result.failExpects.forEach(failExpect => {
+ message += failExpect.message || ('expect ' + failExpect.actualValue + ' ' + failExpect.checkFunc + ' ' + (failExpect.expectValue || '')) + ';';
+ });
+ caseReport['children'] = [{
+ tag: 'failure',
+ type: '',
+ message: message
+ }];
+ report.failures++;
+ suiteReport.failures++;
+ } else {
+ caseReport['result'] = true;
+ }
+ suiteReport.children.push(caseReport);
+ }
+ report.children.push(suiteReport);
+ }
+ }
+
+ let reportXml = '\n' + json2xml(report);
+ this.fileModule.writeText({
+ uri: 'internal://app/report.xml',
+ text: reportXml,
+ success: function () {
+ console.info('call success callback success');
+ },
+ fail: function (data, code) {
+ console.info('call fail callback success:');
+ },
+ complete: function () {
+ console.info('call complete callback success');
+ }
+ });
+ }
+}
+
+function json2xml(json) {
+ let tagName;
+ let hasChildren = false;
+ let childrenStr = '';
+ let attrStr = '';
+ for (let key in json) {
+ if (key === 'tag') {
+ tagName = json[key];
+ } else if (key === 'children') {
+ if (json[key].length > 0) {
+ hasChildren = true;
+ for (let child of json[key]) {
+ childrenStr += json2xml(child);
+ }
+ }
+ } else {
+ attrStr += ` ${key}="${json[key]}"`;
+ }
+ }
+ let xml = `<${tagName}${attrStr}`;
+ xml += hasChildren ? `>${childrenStr}${tagName}>` : '/>';
+ return xml;
+}
+
+export default ReportExtend;
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/service.js b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/service.js
new file mode 100644
index 0000000000000000000000000000000000000000..c9ea9b3218ee85d859aec61105bd67487d422a9b
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/service.js
@@ -0,0 +1,1217 @@
+/*
+ * Copyright (c) 2021-2024 Huawei Device 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 SysTestKit from "./module/kit/SysTestKit";
+import { TAG } from './Constant';
+import LogExpectError from './module/report/LogExpectError'
+import { NestFilter } from "./module/config/Filter";
+
+class AssertException extends Error {
+ constructor(message) {
+ super();
+ this.name = "AssertException";
+ this.message = message;
+ }
+}
+
+function getFuncWithArgsZero(func, timeout, isStressTest) {
+ return new Promise(async (resolve, reject) => {
+ let timer = null;
+ if (!isStressTest) {
+ timer = setTimeout(() => {
+ reject(new Error('execute timeout ' + timeout + 'ms'));
+ }, timeout);
+ }
+ try {
+ await func();
+ } catch (err) {
+ reject(err);
+ }
+ timer !== null ? clearTimeout(timer) : null;
+ resolve();
+ });
+}
+
+function getFuncWithArgsOne(func, timeout, isStressTest) {
+ return new Promise(async (resolve, reject) => {
+ let timer = null;
+ if (!isStressTest) {
+ timer = setTimeout(() => {
+ reject(new Error('execute timeout ' + timeout + 'ms'));
+ }, timeout);;
+ }
+
+ function done() {
+ timer !== null ? clearTimeout(timer) : null;
+ resolve();
+ }
+
+ try {
+ await func(done);
+ } catch (err) {
+ timer !== null ? clearTimeout(timer) : null;
+ reject(err);
+ }
+ });
+}
+
+function getFuncWithArgsTwo(func, timeout, paramItem, isStressTest) {
+ return new Promise(async (resolve, reject) => {
+ let timer = null;
+ if (!isStressTest) {
+ timer = setTimeout(() => {
+ reject(new Error('execute timeout ' + timeout + 'ms'));
+ }, timeout);
+ }
+
+ function done() {
+ timer !== null ? clearTimeout(timer) : null;
+ resolve();
+ }
+
+ try {
+ await func(done, paramItem);
+ } catch (err) {
+ timer !== null ? clearTimeout(timer) : null;
+ reject(err);
+ }
+ });
+}
+
+function processFunc(coreContext, func) {
+ let argNames = ((func || '').toString()
+ .replace(/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg, '')
+ .match(/^(function)?\s*[^\(]*\(\s*([^\)]*)\)/m) || ['', '', ''])[2]
+ .split(',') // split parameters
+ .map(item => item.replace(/^\s*(_?)(.+?)\1\s*$/, name => name.split('=')[0].trim()))
+ .filter(String);
+ let funcLen = func.length;
+ let processedFunc;
+ const config = coreContext.getDefaultService('config');
+ config.setSupportAsync(true);
+ const timeout = + (config.timeout === undefined ? 5000 : config.timeout);
+ const isStressTest = (coreContext.getServices('dataDriver') !== undefined || config.getStress() > 1);
+ switch (funcLen) {
+ case 0: {
+ processedFunc = function () {
+ return getFuncWithArgsZero(func, timeout, isStressTest);
+ };
+ break;
+ }
+ case 1: {
+ if (argNames[0] === 'data') {
+ processedFunc = function (paramItem) {
+ func(paramItem);
+ };
+ } else {
+ processedFunc = function () {
+ return getFuncWithArgsOne(func, timeout, isStressTest);
+ };
+ }
+ break;
+ }
+ default: {
+ processedFunc = function (paramItem) {
+ return getFuncWithArgsTwo(func, timeout, paramItem, isStressTest);
+ };
+ break;
+ }
+ }
+ return processedFunc;
+}
+
+function secureRandomNumber() {
+ return crypto.randomBytes(8).readUInt32LE() / 0xffffffff;
+}
+
+class SuiteService {
+ constructor(attr) {
+ this.id = attr.id;
+ this.rootSuite = new SuiteService.Suite({});
+ this.currentRunningSuite = this.rootSuite;
+ this.suitesStack = [this.rootSuite];
+ this.targetSuiteArray = [];
+ this.targetSpecArray = [];
+ this.currentRunningSuiteDesc = null;
+ this.fullRun = false;
+ this.isSkipSuite = false;
+ this.suiteSkipReason = null;
+ }
+
+ describe(desc, func) {
+ const configService = this.coreContext.getDefaultService('config');
+ if (this.suitesStack.some(suite => { return suite.description === desc })) {
+ console.error(`${TAG} Loop nesting occurs : ${desc}`);
+ this.suiteSkipReason = '';
+ this.isSkipSuite = false;
+ return;
+ }
+ let isFilter = this.analyzeConfigServiceClass(configService.class, desc);
+ if (configService.filterSuite(desc) && isFilter) {
+ if (this.currentRunningSuite.description === '' || this.currentRunningSuite.description == null) {
+ console.info(`${TAG}filter suite : ${desc}`);
+ this.suiteSkipReason = '';
+ this.isSkipSuite = false;
+ return;
+ }
+ }
+ const suite = new SuiteService.Suite({ description: desc });
+ if (this.isSkipSuite) {
+ suite.isSkip = true;
+ suite.skipReason = this.suiteSkipReason;
+ }
+ this.suiteSkipReason = '';
+ this.isSkipSuite = false;
+ if (typeof this.coreContext.getServices('dataDriver') !== 'undefined' && configService['dryRun'] !== 'true') {
+ let suiteStress = this.coreContext.getServices('dataDriver').dataDriver.getSuiteStress(desc);
+ for (let i = 1; i < suiteStress; i++) {
+ this.currentRunningSuite.childSuites.push(suite);
+ }
+ }
+ this.currentRunningSuite.childSuites.push(suite);
+ this.currentRunningSuite = suite;
+ this.suitesStack.push(suite);
+ func.call();
+ this.suitesStack.pop();
+ this.currentRunningSuite = this.suitesStack.pop();
+ this.suitesStack.push(this.currentRunningSuite);
+ }
+ xdescribe(desc, func, reason) {
+ const configService = this.coreContext.getDefaultService('config');
+ if (!configService.skipMessage && configService.runSkipped !== 'all') {
+ if (configService.runSkipped != null && configService.runSkipped !== '') {
+ let finalDesc = '';
+ this.suitesStack.map(suite => {
+ finalDesc = finalDesc + '.' + suite.description;
+ })
+ finalDesc = (finalDesc + '.' + desc).substring(2);
+ console.info(`${TAG} finalDesc ${finalDesc}`);
+ if (configService.checkIfSuiteInSkipRun(finalDesc)) {
+ console.log(`${TAG} runSkipped suite: ${desc}`);
+ } else {
+ console.log(reason == null ? `${TAG} skip suite: ${desc}` : `${TAG} skip suite: ${desc}, and the reason is ${reason}`);
+ return;
+ }
+ } else {
+ console.log(reason == null ? `${TAG} skip suite: ${desc}` : `${TAG} skip suite: ${desc}, and the reason is ${reason}`);
+ return;
+ }
+ }
+ this.isSkipSuite = true;
+ this.suiteSkipReason = reason;
+ this.describe(desc, func);
+ }
+
+ beforeAll(func) {
+ this.currentRunningSuite.beforeAll.push(processFunc(this.coreContext, func));
+ }
+
+ beforeEach(func) {
+ this.currentRunningSuite.beforeEach.push(processFunc(this.coreContext, func));
+ }
+
+ beforeItSpecified(itDescs, func) {
+ this.currentRunningSuite.beforeItSpecified.set(itDescs, processFunc(this.coreContext, func));
+ }
+
+ afterItSpecified(itDescs, func) {
+ this.currentRunningSuite.afterItSpecified.set(itDescs, processFunc(this.coreContext, func));
+ }
+
+ afterAll(func) {
+ this.currentRunningSuite.afterAll.push(processFunc(this.coreContext, func));
+ }
+
+ afterEach(func) {
+ this.currentRunningSuite.afterEach.push(processFunc(this.coreContext, func));
+ }
+
+ getCurrentRunningSuite() {
+ return this.currentRunningSuite;
+ }
+
+ setCurrentRunningSuite(suite) {
+ this.currentRunningSuite = suite;
+ }
+
+ getRootSuite() {
+ return this.rootSuite;
+ }
+
+ getCurrentRunningSuiteDesc() {
+ return this.currentRunningSuiteDesc;
+ }
+
+
+ setCurrentRunningSuiteDesc(suite, currentSuite, prefix) {
+ if (suite != null && suite === currentSuite) {
+ this.currentRunningSuiteDesc = prefix;
+ } else if (suite != null && suite !== currentSuite) {
+ suite.childSuites.forEach(it => {
+ let temp = prefix;
+ if (it.description != null || it.description !== '') {
+ temp = prefix === '' ? it.description : prefix + "." + it.description;
+ }
+ this.setCurrentRunningSuiteDesc(it, currentSuite, temp);
+ }
+ )
+ }
+ }
+ analyzeConfigServiceClass(configServiceClass, desc) {
+ if (configServiceClass == null || configServiceClass === '') {
+ this.fullRun = true
+ return false;
+ }
+ if (this.targetSuiteArray.length === 0) {
+ const targetArray = configServiceClass.split(",")
+ for (let index in targetArray) {
+ if (targetArray[index].includes("#")) {
+ this.targetSpecArray.push(targetArray[index])
+ } else {
+ this.targetSuiteArray.push(targetArray[index])
+ }
+ }
+
+ }
+ return !configServiceClass.includes(desc);
+
+ }
+ traversalResults(suite, obj, breakOnError) {
+ if (suite.childSuites.length === 0 && suite.specs.length === 0) {
+ return obj;
+ }
+ if (suite.specs.length > 0) {
+ for (const itItem of suite.specs) {
+ obj.total++;
+ if (breakOnError && (obj.error > 0 || obj.failure > 0)) { // breakOnError模式
+ continue;
+ }
+ if (itItem.error) {
+ obj.error++;
+ } else if (itItem.fail) {
+ obj.failure++;
+ } else if (itItem.pass === true) {
+ obj.pass++;
+ }
+ }
+ }
+
+ obj.duration += suite.duration;
+
+ if (suite.childSuites.length > 0) {
+ for (const suiteItem of suite.childSuites) {
+ this.traversalResults(suiteItem, obj, breakOnError);
+ }
+ }
+ }
+
+ async setSuiteResults(suite, error, coreContext) {
+ if (suite.childSuites.length === 0 && suite.specs.length === 0) {
+ return obj;
+ }
+ if (suite.specs.length > 0) {
+ const specService = coreContext.getDefaultService('spec');
+ for (const specItem of suite.specs) {
+ specService.setCurrentRunningSpec(specItem);
+ if (error instanceof AssertException) {
+ specItem.fail = error;
+ } else {
+ specItem.error = error;
+ }
+ await coreContext.fireEvents('spec', 'specStart', specItem);
+ await coreContext.fireEvents('spec', 'specDone', specItem);
+ }
+ }
+ if (suite.childSuites.length > 0) {
+ for (const suiteItem of suite.childSuites) {
+ await this.setSuiteResults(suiteItem, error, coreContext);
+ }
+ }
+ }
+
+ getSummary() {
+ let suiteService = this.coreContext.getDefaultService('suite');
+ let rootSuite = suiteService.rootSuite;
+ const specService = this.coreContext.getDefaultService('spec');
+ const configService = this.coreContext.getDefaultService('config');
+ let breakOnError = configService.isBreakOnError();
+ let isError = specService.getStatus();
+ let isBreaKOnError = breakOnError && isError;
+ let obj = { total: 0, failure: 0, error: 0, pass: 0, ignore: 0, duration: 0 };
+ for (const suiteItem of rootSuite.childSuites) {
+ this.traversalResults(suiteItem, obj, isBreaKOnError);
+ }
+ obj.ignore = obj.total - obj.pass - obj.failure - obj.error;
+ return obj;
+ }
+
+ init(coreContext) {
+ this.coreContext = coreContext;
+ }
+
+ traversalSuites(suite, obj, configService) {
+ if (suite.childSuites.length === 0 && suite.specs.length === 0) {
+ return [];
+ }
+ if (suite.specs.length > 0) {
+ let itArray = [];
+ for (const itItem of suite['specs']) {
+ if (!configService.filterDesc(suite.description, itItem.description, itItem.fi, null)) {
+ itArray.push({ 'itName': itItem.description });
+ }
+ }
+ obj[suite.description] = itArray;
+ }
+ if (suite.childSuites.length > 0) {
+ let suiteArray = [];
+ for (const suiteItem of suite.childSuites) {
+ let suiteObj = {};
+ this.traversalSuites(suiteItem, suiteObj, configService);
+ if (!configService.filterSuite(suiteItem.description)) {
+ suiteArray.push(suiteObj);
+ }
+ }
+ obj.suites = suiteArray;
+ }
+ }
+
+ async dryRun(abilityDelegator) {
+ console.log(`${TAG} rootSuite : ` + JSON.stringify(this.rootSuite));
+ let obj = this.rootSuite;
+ let prefixStack = [];
+ let suiteArray = [];
+ let skipSuiteArray = [];
+ this.analyzeSuitesArray(prefixStack, suiteArray, skipSuiteArray, obj);
+ const configService = this.coreContext.getDefaultService('config');
+ let result;
+ if (configService.skipMessage) {
+ result = { "suites": suiteArray, "skipSuites": skipSuiteArray };
+ } else {
+ result = { "suites": suiteArray };
+ }
+ let strJson = JSON.stringify(result);
+ let strLen = strJson.length;
+ let maxLen = 500;
+ let maxCount = Math.floor(strLen / maxLen);
+ for (let count = 0; count <= maxCount; count++) {
+ await SysTestKit.print(strJson.substring(count * maxLen, (count + 1) * maxLen));
+ }
+ console.info(`${TAG}dryRun print success`);
+ abilityDelegator.finishTest('dry run finished!!!', 0, () => { });
+ }
+
+ //将suitesArray的嵌套结构展开成三层结构
+ analyzeSuitesArray(prefixStack, suiteArray, skipSuiteArray, obj) {
+ obj.childSuites.map(suite => {
+ if (suite.description != null && suite.description !== '') {
+ let prefix = '';
+ if (prefixStack.length > 0) {
+ prefix = prefixStack.join('.') + '.' + suite.description;
+ } else {
+ prefix = suite.description;
+ }
+ prefixStack.push(suite.description);
+ let temp = {};
+ temp[prefix] = [];
+ let skipTemp = {};
+ skipTemp[prefix] = [];
+ suite.specs.map(spec => {
+ let it = { 'itName': spec.description }
+ spec.isSkip ? skipTemp[prefix].push(it) : temp[prefix].push(it);
+ })
+ suiteArray.push(temp);
+ skipSuiteArray.push(skipTemp);
+ }
+ this.analyzeSuitesArray(prefixStack, suiteArray, skipSuiteArray, suite);
+ prefixStack.pop();
+ });
+ }
+ //获取当前测试套下的所有测试用例数量
+ getAllChildSuiteNum(suite, specArray) {
+ if (suite.specs != null) {
+ suite.specs.forEach(spec => specArray.push(spec));
+ }
+ if (suite.childSuites != null) {
+ suite.childSuites.forEach(it => this.getAllChildSuiteNum(it, specArray))
+ }
+ }
+
+ execute() {
+ const configService = this.coreContext.getDefaultService('config');
+ if (configService.filterValid.length !== 0) {
+ this.coreContext.fireEvents('task', 'incorrectFormat');
+ return;
+ }
+ if (configService.filterXdescribe.length !== 0) {
+ this.coreContext.fireEvents('task', 'incorrectTestSuiteFormat');
+ return;
+ }
+ if (configService.isRandom() && this.rootSuite.childSuites.length > 0) {
+ this.rootSuite.childSuites.sort(function () {
+ return Math.random().toFixed(1) > 0.5 ? -1 : 1;
+ });
+ this.currentRunningSuite = this.rootSuite.childSuites[0];
+ }
+ if (configService.isSupportAsync()) {
+ console.info(`${TAG} rootSuite:` + JSON.stringify(this.rootSuite));
+ let asyncExecute = async () => {
+ await this.coreContext.fireEvents('task', 'taskStart');
+ await this.rootSuite.asyncRun(this.coreContext);
+ };
+ asyncExecute().then(async () => {
+ await this.coreContext.fireEvents('task', 'taskDone');
+ });
+ } else {
+ console.info('${TAG} rootSuite:' + JSON.stringify(this.rootSuite));
+ this.coreContext.fireEvents('task', 'taskStart');
+ this.rootSuite.run(this.coreContext);
+ this.coreContext.fireEvents('task', 'taskDone');
+ }
+ }
+
+ apis() {
+ const _this = this;
+ return {
+ describe: function (desc, func) {
+ return _this.describe(desc, func);
+ },
+ xdescribe: function (desc, func, reason) {
+ return _this.xdescribe(desc, func, reason);
+ },
+ beforeItSpecified: function (itDescs, func) {
+ return _this.beforeItSpecified(itDescs, func);
+ },
+ afterItSpecified: function (itDescs, func) {
+ return _this.afterItSpecified(itDescs, func);
+ },
+ beforeAll: function (func) {
+ return _this.beforeAll(func);
+ },
+ beforeEach: function (func) {
+ return _this.beforeEach(func);
+ },
+ afterAll: function (func) {
+ return _this.afterAll(func);
+ },
+ afterEach: function (func) {
+ return _this.afterEach(func);
+ }
+ };
+ }
+}
+
+SuiteService.Suite = class {
+ constructor(attrs) {
+ this.description = attrs.description || '';
+ this.childSuites = [];
+ this.specs = [];
+ this.beforeAll = [];
+ this.afterAll = [];
+ this.beforeItSpecified = new Map();
+ this.afterItSpecified = new Map();
+ this.beforeEach = [];
+ this.afterEach = [];
+ this.duration = 0;
+ this.hookError = null;
+ this.isSkip = false;
+ this.skipReason = '';
+ }
+
+ pushSpec(spec) {
+ this.specs.push(spec);
+ }
+
+ removeSpec(desc) {
+ this.specs = this.specs.filter((item, index) => {
+ return item.description !== desc;
+ });
+ }
+
+ getSpecsNum() {
+ return this.specs.length;
+ }
+
+ isRun(coreContext) {
+ const configService = coreContext.getDefaultService('config');
+ const suiteService = coreContext.getDefaultService('suite');
+ const specService = coreContext.getDefaultService('spec');
+ let breakOnError = configService.isBreakOnError();
+ let isError = specService.getStatus();
+ return breakOnError && isError;
+ }
+
+ run(coreContext) {
+ const suiteService = coreContext.getDefaultService('suite');
+ suiteService.setCurrentRunningSuite(this);
+ if (this.description !== '') {
+ coreContext.fireEvents('suite', 'suiteStart', this);
+ }
+ this.runHookFunc('beforeAll');
+ if (this.specs.length > 0) {
+ const configService = coreContext.getDefaultService('config');
+ if (configService.isRandom()) {
+ this.specs.sort(function () {
+ return Math.random().toFixed(1) > 0.5 ? -1 : 1;
+ });
+ }
+ for (let spec in this.specs) {
+ let isBreakOnError = this.isRun(coreContext);
+ if (isBreakOnError) {
+ break;
+ }
+ this.runHookFunc('beforeEach');
+ spec.run(coreContext);
+ this.runHookFunc('afterEach');
+ }
+ }
+ if (this.childSuites.length > 0) {
+ for (let suite in this.childSuites) {
+ let isBreakOnError = this.isRun(coreContext);
+ if (isBreakOnError) {
+ break;
+ }
+ suite.run(coreContext);
+ suiteService.setCurrentRunningSuite(suite);
+ }
+ }
+ this.runHookFunc('afterAll');
+ if (this.description !== '') {
+ coreContext.fireEvents('suite', 'suiteDone');
+ }
+ }
+
+ async asyncRunSpecs(coreContext) {
+ const configService = coreContext.getDefaultService('config');
+ if (configService.isRandom()) {
+ this.specs.sort(function () {
+ return Math.random().toFixed(1) > 0.5 ? -1 : 1;
+ });
+ }
+ const specService = coreContext.getDefaultService('spec');
+ for (let specItem of this.specs) {
+ specService.setCurrentRunningSpec(specItem);
+ // 遇错即停模式,发现用例有问题,直接返回,不在执行后面的it
+ let isBreakOnError = this.isRun(coreContext);
+ if (isBreakOnError) {
+ console.log("break description :" + this.description);
+ break;
+ }
+ await coreContext.fireEvents('spec', 'specStart', specItem);
+ try {
+ for (const [itNames, hookFunc] of this.beforeItSpecified) {
+ if ((Object.prototype.toString.call(itNames) === '[object Array]' && itNames.includes(specItem.description)) ||
+ (Object.prototype.toString.call(itNames) === '[object String]' && itNames === specItem.description)) {
+ await Reflect.apply(hookFunc, null, []);
+ }
+ break;
+ }
+ await this.runAsyncHookFunc('beforeEach');
+ await specItem.asyncRun(coreContext);
+ for (const [itNames, hookFunc] of this.afterItSpecified) {
+ if ((Object.prototype.toString.call(itNames) === '[object Array]' && itNames.includes(specItem.description)) ||
+ (Object.prototype.toString.call(itNames) === '[object String]' && itNames === specItem.description)) {
+ await Reflect.apply(hookFunc, null, []);
+ }
+ break;
+ }
+ await this.runAsyncHookFunc('afterEach');
+ } catch (e) {
+ console.error(`${TAG}stack:${e?.stack}`);
+ console.error(`${TAG}stack end`);
+ if (e instanceof AssertException) {
+ specItem.fail = e;
+ } else {
+ specItem.error = e;
+ }
+ specService.setStatus(true);
+ }
+ specItem.setResult();
+ await coreContext.fireEvents('spec', 'specDone', specItem);
+ specService.setCurrentRunningSpec(null);
+ }
+ }
+
+ async asyncRunChildSuites(coreContext) {
+ for (let i = 0; i < this.childSuites.length; i++) {
+ // 遇错即停模式, 发现用例有问题,直接返回,不在执行后面的description
+ let isBreakOnError = this.isRun(coreContext);
+ if (isBreakOnError) {
+ console.log(`${TAG}break description : ${this.description}`);
+ break;
+ }
+ await this.childSuites[i].asyncRun(coreContext);
+ }
+ }
+
+ async asyncRun(coreContext) {
+ const suiteService = coreContext.getDefaultService('suite');
+ const specService = coreContext.getDefaultService('spec');
+
+ suiteService.setCurrentRunningSuite(this);
+ suiteService.suitesStack.push(this);
+ if (this.description !== '') {
+ await coreContext.fireEvents('suite', 'suiteStart', this);
+ }
+
+ try {
+ await this.runAsyncHookFunc('beforeAll');
+ } catch (error) {
+ console.error(`${TAG}${error?.stack}`);
+ this.hookError = error;
+ }
+
+ if (this.hookError !== null) {
+ specService.setStatus(true);
+ await suiteService.setSuiteResults(this, this.hookError, coreContext);
+ }
+
+ if (this.specs.length > 0 && this.hookError === null) {
+ await this.asyncRunSpecs(coreContext);
+ }
+
+ if (this.childSuites.length > 0 && this.hookError === null) {
+ await this.asyncRunChildSuites(coreContext);
+ }
+
+ try {
+ await this.runAsyncHookFunc('afterAll');
+ } catch (error) {
+ console.error(`${TAG}${error?.stack}`);
+ this.hookError = error;
+ specService.setStatus(true);
+ }
+
+ if (this.description !== '') {
+ await coreContext.fireEvents('suite', 'suiteDone');
+ let childSuite = suiteService.suitesStack.pop();
+ let currentRunningSuite = suiteService.suitesStack.pop();
+ suiteService.setCurrentRunningSuite(currentRunningSuite);
+ suiteService.suitesStack.push(currentRunningSuite);
+ }
+ }
+
+ runHookFunc(hookName) {
+ if (this[hookName] && this[hookName].length > 0) {
+ this[hookName].forEach(func => {
+ try {
+ func();
+ } catch (e) {
+ console.error(`${TAG}${e.stack}`);
+ }
+ });
+ }
+ }
+
+ async runAsyncHookFunc(hookName) {
+ for (const hookItem of this[hookName]) {
+ try {
+ await hookItem();
+ } catch (error) {
+ error['message'] += `, error in ${hookName} function`;
+ throw error;
+ }
+
+ }
+ }
+};
+
+class SpecService {
+ constructor(attr) {
+ this.id = attr.id;
+ this.totalTest = 0;
+ this.hasError = false;
+ this.skipSpecNum = 0;
+ this.isSkipSpec = false;
+ this.specSkipReason = '';
+ }
+
+ init(coreContext) {
+ this.coreContext = coreContext;
+ }
+
+ setCurrentRunningSpec(spec) {
+ this.currentRunningSpec = spec;
+ }
+
+ setStatus(obj) {
+ this.hasError = obj;
+ }
+
+ getStatus() {
+ return this.hasError;
+ }
+
+ getTestTotal() {
+ return this.totalTest;
+ }
+
+ getCurrentRunningSpec() {
+ return this.currentRunningSpec;
+ }
+
+
+ getSkipSpecNum() {
+ return this.skipSpecNum;
+ }
+
+ initSpecService() {
+ this.isSkipSpec = false;
+ this.specSkipReason = '';
+ }
+
+ it(desc, filter, func) {
+ const suiteService = this.coreContext.getDefaultService('suite');
+ const configService = this.coreContext.getDefaultService('config');
+ let isFilter = new NestFilter().filterNestName(suiteService.targetSuiteArray, suiteService.targetSpecArray, suiteService.suitesStack, desc);
+ if (configService.filterWithNest(desc, filter)) {
+ console.info(`${TAG}filter it :${desc}`);
+ this.initSpecService();
+ return;
+ }
+ if (configService.filterDesc(suiteService.currentRunningSuite.description, desc, filter, this.coreContext) && isFilter && !suiteService.fullRun) {
+ console.info(`${TAG}filter it :${desc}`);
+ this.initSpecService();
+ } else {
+ let processedFunc = processFunc(this.coreContext, func);
+ const spec = new SpecService.Spec({ description: desc, fi: filter, fn: processedFunc });
+ if (this.isSkipSpec) {
+ spec.isSkip = true;
+ spec.skipReason = this.specSkipReason;
+ }
+ this.initSpecService();
+ if (configService.runSkipped === 'skipped' && !spec.isSkip) {
+ console.info(`${TAG} runSkipped is skipped , just run xit, don't run it: ${spec.description}`);
+ return;
+ }
+ if (suiteService.getCurrentRunningSuite().isSkip && !spec.isSkip) {
+ configService.filterXdescribe.push(suiteService.getCurrentRunningSuite().description);
+ }
+ if (typeof this.coreContext.getServices('dataDriver') !== 'undefined' && configService['dryRun'] !== 'true') {
+ let specStress = this.coreContext.getServices('dataDriver').dataDriver.getSpecStress(desc);
+ for (let i = 1; i < specStress; i++) {
+ this.totalTest++;
+ suiteService.getCurrentRunningSuite().pushSpec(spec);
+ }
+ }
+ // dryRun 状态下不统计压力测试重复数据
+ if (configService['dryRun'] !== 'true') {
+ let stress = configService.getStress(); // 命令配置压力测试
+ console.info(`${TAG}stress length : ${stress}`);
+ for (let i = 1; i < stress; i++) {
+ this.totalTest++;
+ suiteService.getCurrentRunningSuite().pushSpec(spec);
+ }
+ }
+ this.totalTest++;
+ suiteService.getCurrentRunningSuite().pushSpec(spec);
+ }
+ }
+
+ xit(desc, filter, func, reason) {
+ const configService = this.coreContext.getDefaultService('config');
+ const suiteService = this.coreContext.getDefaultService('suite');
+ if (!configService.skipMessage && configService.runSkipped !== 'all') {
+ if (configService.runSkipped != null && configService.runSkipped !== '') {
+ let finalDesc = '';
+ suiteService.suitesStack.map(suite => {
+ finalDesc = finalDesc + '.' + suite.description;
+ })
+ finalDesc = (finalDesc + "#" + desc).substring(2);
+ if (configService.checkIfSpecInSkipRun(finalDesc)) {
+ console.log(`${TAG} runSkipped spec: ${desc}`);
+ } else {
+ console.log(reason == null ? `${TAG} skip spec: ${desc}` : `${TAG} skip spec: ${desc}, and the reason is ${reason}`);
+ return;
+ }
+ } else {
+ console.log(reason == null ? `${TAG} skip spec: ${desc}` : `${TAG} skip spec: ${desc}, and the reason is ${reason}`);
+ return;
+ }
+ }
+ this.skipSpecNum++;
+ this.isSkipSpec = true;
+ this.specSkipReason = reason;
+ this.it(desc, filter, func);
+ }
+
+ apis() {
+ const _this = this;
+ return {
+ it: function (desc, filter, func) {
+ return _this.it(desc, filter, func);
+ },
+ xit: function (desc, filter, func, reason) {
+ return _this.xit(desc, filter, func, reason);
+ }
+ };
+ }
+}
+
+SpecService.Spec = class {
+ constructor(attrs) {
+ this.description = attrs.description || '';
+ this.fi = attrs.fi;
+ this.fn = attrs.fn || function () {
+ };
+ this.fail = undefined;
+ this.error = undefined;
+ this.duration = 0;
+ this.startTime = 0;
+ this.isExecuted = false; // 当前用例是否执行
+ this.isSkip = false;
+ this.skipReason = '';
+ this.expectMsg = '';
+ }
+
+ setResult() {
+ if (this.fail) {
+ this.pass = false;
+ } else {
+ this.pass = true;
+ }
+ }
+
+ run(coreContext) {
+ const specService = coreContext.getDefaultService('spec');
+ specService.setCurrentRunningSpec(this);
+ coreContext.fireEvents('spec', 'specStart', this);
+ this.isExecuted = true;
+ try {
+ let dataDriver = coreContext.getServices('dataDriver');
+ if (typeof dataDriver === 'undefined') {
+ this.fn();
+ } else {
+ let suiteParams = dataDriver.dataDriver.getSuiteParams();
+ let specParams = dataDriver.dataDriver.getSpecParams();
+ console.info(`${TAG}[suite params] ${JSON.stringify(suiteParams)}`);
+ console.info(`${TAG}[spec params] ${JSON.stringify(specParams)}`);
+ if (this.fn.length === 0) {
+ this.fn();
+ } else if (specParams.length === 0) {
+ this.fn(suiteParams);
+ } else {
+ specParams.forEach(paramItem => this.fn(Object.assign({}, paramItem, suiteParams)));
+ }
+ }
+ this.setResult();
+ } catch (e) {
+ this.error = e;
+ specService.setStatus(true);
+ }
+ coreContext.fireEvents('spec', 'specDone', this);
+ }
+
+ async asyncRun(coreContext) {
+ const dataDriver = coreContext.getServices('dataDriver');
+ if (typeof dataDriver === 'undefined') {
+ await this.fn();
+ } else {
+ const suiteParams = dataDriver.dataDriver.getSuiteParams();
+ const specParams = dataDriver.dataDriver.getSpecParams();
+ console.info(`[suite params] ${JSON.stringify(suiteParams)}`);
+ console.info(`[spec params] ${JSON.stringify(specParams)}`);
+ if (this.fn.length === 0) {
+ await this.fn();
+ } else if (specParams.length === 0) {
+ await this.fn(suiteParams);
+ } else {
+ for (const paramItem of specParams) {
+ await this.fn(Object.assign({}, paramItem, suiteParams));
+ }
+ }
+ }
+
+ this.isExecuted = true;
+ }
+
+ filterCheck(coreContext) {
+ const specService = coreContext.getDefaultService('spec');
+ specService.setCurrentRunningSpec(this);
+ return true;
+ }
+};
+
+class ExpectService {
+ constructor(attr) {
+ this.id = attr.id;
+ this.matchers = {};
+ this.customMatchers = [];
+ }
+
+ expect(actualValue) {
+ return this.wrapMatchers(actualValue);
+ }
+
+ init(coreContext) {
+ this.coreContext = coreContext;
+ this.addMatchers(this.basicMatchers());
+ }
+
+ addMatchers(matchers) {
+ for (const matcherName in matchers) {
+ if (Object.prototype.hasOwnProperty.call(matchers, matcherName)) {
+ this.matchers[matcherName] = matchers[matcherName];
+ }
+ }
+ }
+
+ removeMatchers(customAssertionName) {
+ if (customAssertionName === 'all') {
+ for (const matcherName in this.matchers) {
+ this.matchers[matcherName] = this.customMatchers.includes(matcherName) ? (() => {throw new Error(`${matcherName} is unregistered`)}) : undefined;
+ }
+ }else {
+ this.matchers[customAssertionName] = () => {
+ throw new Error(`${customAssertionName} is unregistered`)
+ };
+ }
+ }
+
+ basicMatchers() {
+ return {
+ assertTrue: function (actualValue) {
+ return {
+ pass: (actualValue) === true,
+ message: 'expect true, actualValue is ' + actualValue
+ };
+ },
+ assertEqual: function (actualValue, args) {
+ let msg = 'expect ' + actualValue + ' equals ' + args[0];
+ if (actualValue == args[0]) { // 数值相同,提示数据类型
+ const aClassName = Object.prototype.toString.call(actualValue);
+ const bClassName = Object.prototype.toString.call(args[0]);
+ msg = 'expect ' + actualValue + aClassName + ' equals ' + args[0] + bClassName + "strict mode inspect type";
+ }
+ return {
+ pass: (actualValue) === args[0],
+ expectValue: args[0],
+ message: msg
+ };
+ },
+ assertThrow: function (actual, args) {
+ const result = {
+ pass: false
+ };
+ if (typeof actual !== 'function') {
+ result.message = 'toThrow\'s Actual should be a Function';
+ } else {
+ let hasThrow = false;
+ let throwError;
+ try {
+ actual();
+ } catch (e) {
+ hasThrow = true;
+ throwError = e;
+ }
+ if (!hasThrow) {
+ result.message = 'function did not throw an exception';
+ } else if (throwError && throwError.message === args[0]) {
+ result.pass = true;
+ } else {
+ result.message = `expect to throw ${args[0]} , actual throw ${throwError.message}`;
+ }
+ }
+ return result;
+ }
+ };
+ }
+
+ initWrapMatchers(currentRunningSpec) {
+ return {
+ // 翻转标识
+ isNot: false,
+ // 翻转方法
+ not: function () {
+ this.isNot = true;
+ return this;
+ },
+ message: function (msg) {
+ currentRunningSpec.expectMsg = msg;
+ console.info(`${TAG} msg: ${msg}`);
+ return this;
+ }
+ };
+
+ }
+ wrapMatchers(actualValue) {
+ const _this = this;
+ const specService = _this.coreContext.getDefaultService('spec');
+ const currentRunningSpec = specService.getCurrentRunningSpec();
+ const wrappedMatchers = this.initWrapMatchers(currentRunningSpec);
+ const currentRunningSuite = _this.coreContext.getDefaultService('suite').getCurrentRunningSuite();
+ for (const matcherName in this.matchers) {
+ let result = Object.prototype.hasOwnProperty.call(this.matchers, matcherName);
+ if (!result) {
+ continue;
+ }
+ if (matcherName.search('assertPromise') == 0) {
+ wrappedMatchers[matcherName] = async function () {
+ await _this.matchers[matcherName](actualValue, arguments).then(function (result) {
+ if (wrappedMatchers.isNot) {
+ result.pass = !result.pass;
+ }
+ result.actualValue = actualValue;
+ result.checkFunc = matcherName;
+ if (!result.pass) {
+ const assertError = new AssertException(result.message);
+ currentRunningSpec ? currentRunningSpec.fail = assertError : currentRunningSuite.hookError = assertError;
+ throw assertError;
+ }
+ });
+ };
+ } else {
+ wrappedMatchers[matcherName] = function () {
+ const result = _this.customMatchers.includes(matcherName) ? _this.matchers[matcherName](actualValue, arguments[0]) : _this.matchers[matcherName](actualValue, arguments);
+ if (wrappedMatchers.isNot) {
+ result.pass = !result.pass;
+ result.message = LogExpectError.getErrorMsg(matcherName, actualValue, arguments[0], result.message);
+ }
+ result.actualValue = actualValue;
+ result.checkFunc = matcherName;
+ if (!result.pass) {
+ const assertError = new AssertException(result.message);
+ currentRunningSpec ? currentRunningSpec.fail = assertError : currentRunningSuite.hookError = assertError;
+ throw assertError;
+ }
+ };
+ }
+ }
+ return wrappedMatchers;
+ }
+
+ apis() {
+ const _this = this;
+ return {
+ expect: function (actualValue) {
+ return _this.expect(actualValue);
+ }
+ };
+ }
+}
+
+class ReportService {
+ constructor(attr) {
+ this.id = attr.id;
+ }
+
+ init(coreContext) {
+ this.coreContext = coreContext;
+ this.specService = this.coreContext.getDefaultService('spec');
+ this.suiteService = this.coreContext.getDefaultService('suite');
+ this.duration = 0;
+ }
+
+ taskStart() {
+ console.info(`${TAG}[start] start run suites`);
+ }
+
+ async suiteStart() {
+ console.info(`${TAG}[suite start]${this.suiteService.getCurrentRunningSuite().description}`);
+ }
+
+ async specStart() {
+ console.info(`${TAG}start running case '${this.specService.currentRunningSpec.description}'`);
+ this.index = this.index + 1;
+ let spec = this.specService.currentRunningSpec;
+ spec.startTime = await SysTestKit.getRealTime();
+ }
+
+ async specDone() {
+ let msg = '';
+ let spec = this.specService.currentRunningSpec;
+ let suite = this.suiteService.currentRunningSuite;
+ spec.duration = await SysTestKit.getRealTime() - spec.startTime;
+ suite.duration += spec.duration;
+ if (spec.error) {
+ this.formatPrint('error', spec.description + ' ; consuming ' + spec.duration + 'ms');
+ this.formatPrint('errorDetail', spec.error);
+ } else if (spec.fail) {
+ this.formatPrint('fail', spec.description + ' ; consuming ' + spec.duration + 'ms');
+ this.formatPrint('failDetail', spec.fail?.message);
+ } else {
+ this.formatPrint('pass', spec.description + ' ; consuming ' + spec.duration + 'ms');
+ }
+ this.formatPrint(this.specService.currentRunningSpec.error, msg);
+ }
+
+ suiteDone() {
+ let suite = this.suiteService.currentRunningSuite;
+ let message = suite.hookError ? `, ${suite.hookError?.message}` : '';
+ console.info(`[suite end] ${suite.description} consuming ${suite.duration} ms${message}`);
+ }
+
+ taskDone() {
+ let msg = '';
+ let summary = this.suiteService.getSummary();
+ msg = 'total cases:' + summary.total + ';failure ' + summary.failure + ',' + 'error ' + summary.error;
+ msg += ',pass ' + summary.pass + '; consuming ' + summary.duration + 'ms';
+ console.info(`${TAG}${msg}`);
+ console.info(`${TAG}[end] run suites end`);
+ }
+
+ incorrectFormat() {
+ if (this.coreContext.getDefaultService('config').filterValid.length !== 0) {
+ this.coreContext.getDefaultService('config').filterValid.forEach(function (item) {
+ console.info(`${TAG}this param ${item} is invalid`);
+ });
+ }
+ }
+
+ incorrectTestSuiteFormat() {
+ if (this.coreContext.getDefaultService('config').filterXdescribe.length !== 0) {
+ this.coreContext.getDefaultService('config').filterXdescribe.forEach(function (item) {
+ console.info(`${TAG}xdescribe: ${item} should not contain it`);
+ })
+ }
+ }
+
+ formatPrint(type, msg) {
+ switch (type) {
+ case 'pass':
+ console.info(`${TAG}[pass]${msg}`);
+ break;
+ case 'fail':
+ console.info(`${TAG}[fail]${msg}`);
+ break;
+ case 'failDetail':
+ console.info(`${TAG}[failDetail]${msg}`);
+ break;
+ case 'error':
+ console.info(`${TAG}[error]${msg}`);
+ break;
+ case 'errorDetail':
+ console.info(`${TAG}[errorDetail]${msg}`);
+ break;
+ }
+ }
+
+ sleep(numberMillis) {
+ var now = new Date();
+ var exitTime = now.getTime() + numberMillis;
+ while (true) {
+ now = new Date();
+ if (now.getTime() > exitTime) {
+ return;
+ }
+ }
+ }
+}
+
+export {
+ SuiteService,
+ SpecService,
+ ExpectService,
+ ReportService
+};
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/testrunner/OpenHarmonyTestRunner.ts b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/testrunner/OpenHarmonyTestRunner.ts
new file mode 100644
index 0000000000000000000000000000000000000000..e6f4c1b12dd69714ed5a4524671abca1fbcaa58c
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/testrunner/OpenHarmonyTestRunner.ts
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2023-2024 Huawei Device 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 { abilityDelegatorRegistry, TestRunner } from '@kit.TestKit';
+import { BusinessError } from '@kit.BasicServicesKit';
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { resourceManager } from '@kit.LocalizationKit';
+import { util } from '@kit.ArkTS';
+import { Hypium } from '@ohos/hypium';
+import testsuite from '../test/List.test';
+
+let abilityDelegator: abilityDelegatorRegistry.AbilityDelegator;
+let abilityDelegatorArguments: abilityDelegatorRegistry.AbilityDelegatorArgs;
+let jsonPath: string = 'mock/mock-config.json';
+let domain: number = 0x0000; //日志标识,0x0000作为测试框架的业务标识
+let tag: string = 'testTag'; //日志标识字符串,作为tag标识当前runner类下的测试行为
+
+export default class OpenHarmonyTestRunner implements TestRunner {
+ constructor() {
+ }
+
+ onPrepare() {
+ hilog.info(domain, tag, '%{public}s', 'OpenHarmonyTestRunner OnPrepare');
+ }
+
+ async onRun() {
+ hilog.info(domain, tag, '%{public}s', 'OpenHarmonyTestRunner onRun run');
+ abilityDelegatorArguments = abilityDelegatorRegistry.getArguments();
+ abilityDelegator = abilityDelegatorRegistry.getAbilityDelegator();
+ let moduleName = abilityDelegatorArguments.parameters['-m'];
+ let context = abilityDelegator.getAppContext().getApplicationContext().createModuleContext(moduleName);
+ let mResourceManager = context.resourceManager;
+ await checkMock(abilityDelegator, mResourceManager);
+ hilog.info(domain, tag, '%{public}s', 'start run testcase!!!');
+ Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite);
+ hilog.info(domain, tag, '%{public}s', 'OpenHarmonyTestRunner onRun end');
+ }
+}
+
+async function checkMock(abilityDelegator: abilityDelegatorRegistry.AbilityDelegator, resourceManager: resourceManager.ResourceManager) {
+ let rawFile: Uint8Array;
+ try {
+ rawFile = resourceManager.getRawFileContentSync(jsonPath);
+ hilog.info(domain, tag, 'MockList file exists');
+ let mockStr: string = util.TextDecoder.create("utf-8", { ignoreBOM: true }).decodeWithStream(rawFile);
+ let mockMap: Record = getMockList(mockStr);
+ try {
+ abilityDelegator.setMockList(mockMap);
+ } catch (error) {
+ let code = (error as BusinessError).code;
+ let message = (error as BusinessError).message;
+ hilog.error(domain, tag, `abilityDelegator.setMockList failed, error code: ${code}, message: ${message}.`);
+ }
+ } catch (error) {
+ let code = (error as BusinessError).code;
+ let message = (error as BusinessError).message;
+ hilog.error(domain, tag, `ResourceManager:callback getRawFileContent failed, error code: ${code}, message: ${message}.`);
+ }
+}
+
+function getMockList(jsonStr: string) {
+ let jsonObj: Record = JSON.parse(jsonStr);
+ let map: Map = new Map(Object.entries(jsonObj));
+ let mockList: Record = {};
+ map.forEach((value: object, key: string) => {
+ let realValue: string = value['source'].toString();
+ mockList[key] = realValue;
+ });
+ hilog.info(domain, tag, '%{public}s', 'mock-json value:' + JSON.stringify(mockList) ?? '');
+ return mockList;
+}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/lock.json5 b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/lock.json5
new file mode 100644
index 0000000000000000000000000000000000000000..9ce079377ac8069187d7f097f340eca5b0344a4c
--- /dev/null
+++ b/ImageWhiteLumpSolution/PreHttpRequestUseFiles/oh_modules/.ohpm/lock.json5
@@ -0,0 +1,55 @@
+{
+ "lockVersion": "1.0",
+ "settings": {
+ "resolveConflict": true,
+ "resolveConflictStrict": false,
+ "installAll": true
+ },
+ "overrides": {},
+ "overrideDependencyMap": {},
+ "modules": {
+ ".": {
+ "name": "",
+ "dependencies": {},
+ "devDependencies": {
+ "@ohos/hypium": {
+ "specifier": "1.0.18",
+ "version": "1.0.18"
+ },
+ "@ohos/hamock": {
+ "specifier": "1.0.0",
+ "version": "1.0.0"
+ }
+ },
+ "dynamicDependencies": {},
+ "maskedByOverrideDependencyMap": false
+ },
+ "entry": {
+ "name": "entry",
+ "dependencies": {},
+ "devDependencies": {},
+ "dynamicDependencies": {},
+ "maskedByOverrideDependencyMap": false
+ }
+ },
+ "packages": {
+ "@ohos/hypium@1.0.18": {
+ "integrity": "sha512-RGe/iLGdeywdQilMWZsHKUoiE9OJ+9QxQsorF92R2ImLNVHVhbpSePNITGpW7TnvLgOIP/jscOqfIOhk6X7XRQ==",
+ "storePath": "oh_modules/.ohpm/@ohos+hypium@1.0.18",
+ "dependencies": {},
+ "dynamicDependencies": {},
+ "dev": true,
+ "dynamic": false,
+ "maskedByOverrideDependencyMap": false
+ },
+ "@ohos/hamock@1.0.0": {
+ "integrity": "sha512-K6lDPYc6VkKe6ZBNQa9aoG+ZZMiwqfcR/7yAVFSUGIuOAhPvCJAo9+t1fZnpe0dBRBPxj2bxPPbKh69VuyAtDg==",
+ "storePath": "oh_modules/.ohpm/@ohos+hamock@1.0.0",
+ "dependencies": {},
+ "dynamicDependencies": {},
+ "dev": true,
+ "dynamic": false,
+ "maskedByOverrideDependencyMap": false
+ }
+ }
+}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/.clang-format b/ImageWhiteLumpSolution/UseImageHttpRequest/.clang-format
new file mode 100644
index 0000000000000000000000000000000000000000..48439ed68073b99be118d374d1ebd43d04d4c4eb
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/.clang-format
@@ -0,0 +1,64 @@
+Language: Cpp
+# BasedOnStyle: LLVM
+ColumnLimit: 120
+SortIncludes: CaseSensitive
+TabWidth: 4
+IndentWidth: 4
+UseTab: Never
+AccessModifierOffset: -4
+ContinuationIndentWidth: 4
+IndentCaseBlocks: false
+IndentCaseLabels: false
+IndentGotoLabels: true
+IndentWrappedFunctionNames: false
+SortUsingDeclarations: false
+NamespaceIndentation: None
+SpaceAfterCStyleCast: false
+SpaceAfterLogicalNot: false
+SpaceAfterTemplateKeyword: true
+SpaceBeforeAssignmentOperators: true
+SpaceBeforeCaseColon: false
+SpaceBeforeCpp11BracedList: false
+SpaceBeforeCtorInitializerColon: true
+SpaceBeforeInheritanceColon: true
+SpaceBeforeRangeBasedForLoopColon: true
+SpaceBeforeSquareBrackets: false
+SpaceInEmptyBlock: false
+SpaceInEmptyParentheses: false
+SpacesInAngles: false
+SpacesInCStyleCastParentheses: false
+SpacesInConditionalStatement: false
+SpacesInParentheses: false
+SpacesInSquareBrackets: false
+AlignTrailingComments: true
+AlignAfterOpenBracket: true
+AllowShortCaseLabelsOnASingleLine: false
+AllowShortEnumsOnASingleLine: true
+AllowShortFunctionsOnASingleLine: All
+AllowShortIfStatementsOnASingleLine: Never
+AllowShortLambdasOnASingleLine: All
+AllowShortLoopsOnASingleLine: false
+AlwaysBreakTemplateDeclarations: MultiLine
+BinPackArguments: true
+BinPackParameters: true
+BreakBeforeTernaryOperators: true
+BreakConstructorInitializers: BeforeColon
+BreakInheritanceList: BeforeColon
+BreakStringLiterals: true
+InsertBraces: false
+IndentExternBlock: NoIndent
+BreakBeforeBraces: Custom
+BraceWrapping:
+ AfterCaseLabel: false
+ AfterClass: false
+ AfterControlStatement: Never
+ AfterEnum: false
+ AfterFunction: false
+ AfterNamespace: false
+ AfterStruct: false
+ AfterUnion: false
+ AfterExternBlock: false
+ BeforeCatch: false
+ BeforeElse: false
+ReflowComments: true
+MaxEmptyLinesToKeep: 2
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/.hvigor/cache/meta.json b/ImageWhiteLumpSolution/UseImageHttpRequest/.hvigor/cache/meta.json
new file mode 100644
index 0000000000000000000000000000000000000000..18f86af95573be1ca58a8494f7aac0c780d0dfac
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/.hvigor/cache/meta.json
@@ -0,0 +1 @@
+{"compileSdkVersion":"5.0.4(16)","hvigorVersion":"5.16.2","toolChainsVersion":"5.0.4.150"}
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/.hvigor/dependencyMap/dependencyMap.json5 b/ImageWhiteLumpSolution/UseImageHttpRequest/.hvigor/dependencyMap/dependencyMap.json5
new file mode 100644
index 0000000000000000000000000000000000000000..8265b2848a91e12e1d43ce237eb58714d92418aa
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/.hvigor/dependencyMap/dependencyMap.json5
@@ -0,0 +1 @@
+{"basePath":"D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\.hvigor\\dependencyMap\\dependencyMap.json5","rootDependency":"./oh-package.json5","dependencyMap":{"entry":"./entry/oh-package.json5"},"modules":[{"name":"entry","srcPath":"..\\..\\..\\entry"}]}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/.hvigor/dependencyMap/entry/oh-package.json5 b/ImageWhiteLumpSolution/UseImageHttpRequest/.hvigor/dependencyMap/entry/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..50a51753855fc6efdf037d5db6ab2cc001f17bbc
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/.hvigor/dependencyMap/entry/oh-package.json5
@@ -0,0 +1 @@
+{"name":"entry","version":"1.0.0","description":"Please describe the basic information.","main":"","author":"","license":"","dependencies":{}}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/.hvigor/dependencyMap/oh-package.json5 b/ImageWhiteLumpSolution/UseImageHttpRequest/.hvigor/dependencyMap/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..204921fe30efc5e9abf09e97497d0c7735ed5ef4
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/.hvigor/dependencyMap/oh-package.json5
@@ -0,0 +1 @@
+{"modelVersion":"5.0.0","description":"Please describe the basic information.","dependencies":{},"devDependencies":{"@ohos/hypium":"1.0.18","@ohos/hamock":"1.0.0"}}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/.hvigor/outputs/build-logs/build.log b/ImageWhiteLumpSolution/UseImageHttpRequest/.hvigor/outputs/build-logs/build.log
new file mode 100644
index 0000000000000000000000000000000000000000..81fe0019201cad266b6edb24f03929fc4d39fb30
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/.hvigor/outputs/build-logs/build.log
@@ -0,0 +1,361 @@
+[2025-05-12T16:06:47.827] [DEBUG] debug-file - env: nodejsVersion=v18.20.1
+[2025-05-12T16:06:48.294] [DEBUG] debug-file - Hvigor init with startParameters:{
+ hvigorfileTypeCheck: false,
+ parallelExecution: true,
+ incrementalExecution: true,
+ printStackTrace: false,
+ daemon: false,
+ analyze: 0,
+ logLevel: Level { level: 20000, levelStr: 'INFO', colour: 'green' }
+}
+[2025-05-12T16:06:48.313] [DEBUG] debug-file - hvigorfile, resolving D:\git_developmentPractice\DevelopmentPractice\ImageWhiteLumpSolution\UseImageHttpRequest\hvigorfile.ts
+[2025-05-12T16:06:49.764] [DEBUG] debug-file - hvigorfile, require result: { default: { system: [Function: appTasks], plugins: [] } }
+[2025-05-12T16:06:49.974] [DEBUG] debug-file - Start initialize project's product build option map with build mode debug.
+[2025-05-12T16:06:49.980] [DEBUG] debug-file - Product 'default' using build option: {
+ "debuggable": true
+} in this build.
+[2025-05-12T16:06:50.012] [DEBUG] debug-file - Start recording SDK configuration permission data.
+[2025-05-12T16:06:50.052] [DEBUG] debug-file - Sdk init in 61 ms
+[2025-05-12T16:06:50.002] [DEBUG] debug-file - Local scan or download hmscore sdk components toolchains,ets,native
+[2025-05-12T16:06:49.997] [DEBUG] debug-file - Local scan or download HarmonyOS sdk components toolchains,ets,js,native,previewer
+[2025-05-12T16:06:50.091] [DEBUG] debug-file - Project task initialization takes 36 ms
+[2025-05-12T16:06:50.104] [DEBUG] debug-file - hvigorfile, resolving D:\git_developmentPractice\DevelopmentPractice\ImageWhiteLumpSolution\UseImageHttpRequest\entry\hvigorfile.ts
+[2025-05-12T16:06:50.133] [DEBUG] debug-file - Start initialize module-target build option map, moduleName=entry, buildMode=debug
+[2025-05-12T16:06:50.144] [DEBUG] debug-file - Module entry task initialization takes 6 ms
+[2025-05-12T16:06:50.149] [DEBUG] debug-file - project has submodules:entry
+[2025-05-12T16:06:50.200] [DEBUG] debug-file - Configuration task cost before running: 1 s 923 ms
+[2025-05-12T16:06:50.204] [DEBUG] debug-file - Executing task :entry:clean
+[2025-05-12T16:06:50.209] [DEBUG] debug-file - entry : clean cost memory 0.4993743896484375
+[2025-05-12T16:06:50.229] [DEBUG] debug-file - Module 'entry' target 'default' using build option: {
+ "debuggable": true,
+ "copyFrom": "default",
+ "name": "debug"
+} in this build.
+[2025-05-12T16:06:47.829] [DEBUG] debug-file - env: hvigor-config.json5 content = {
+ modelVersion: '5.0.0',
+ dependencies: {},
+ execution: {},
+ logging: {},
+ debugging: {},
+ nodeOptions: {}
+}
+[2025-05-12T16:06:48.295] [DEBUG] debug-file - Since current hvigor version 5.16.2 differs from last hvigor version
+ undefined, delete file-cache.json and task-cache.json.
+[2025-05-12T16:06:49.764] [DEBUG] debug-file - hvigorfile, binding system plugins [Function: appTasks]
+[2025-05-12T16:06:49.974] [DEBUG] debug-file - Picking option from product 'default' with build mode 'debug'.
+[2025-05-12T16:06:49.981] [DEBUG] debug-file - not found resModel json file in : D:\git_developmentPractice\DevelopmentPractice\ImageWhiteLumpSolution\UseImageHttpRequest\entry\src\ohosTest\module.json5
+[2025-05-12T16:06:50.091] [DEBUG] debug-file - hvigorfile, binding custom plugins []
+[2025-05-12T16:06:50.112] [DEBUG] debug-file - hvigorfile, require result: { default: { system: [Function: hapTasks], plugins: [] } }
+[2025-05-12T16:06:50.133] [DEBUG] debug-file - Target 'default' config: {}
+[2025-05-12T16:06:50.144] [DEBUG] debug-file - hvigorfile, binding custom plugins []
+[2025-05-12T16:06:50.151] [DEBUG] debug-file - start to load updatedOhPackageInfo to the disk
+[2025-05-12T16:06:50.204] [DEBUG] debug-file - clean: Worker pool is inactive.
+[2025-05-12T16:06:50.209] [DEBUG] debug-file - runTaskFromQueue task cost before running: 1 s 932 ms
+[2025-05-12T16:06:50.234] [DEBUG] debug-file - Module 'entry' target 'ohosTest' using build option: {
+ "debuggable": true,
+ "name": "default"
+} in this build.
+[2025-05-12T16:06:50.255] [DEBUG] debug-file - Create resident worker with id: 0.
+[2025-05-12T16:06:47.831] [DEBUG] debug-file - env: daemon=false
+[2025-05-12T16:06:48.296] [DEBUG] debug-file - Cache service initialization finished in 2 ms
+[2025-05-12T16:06:49.974] [DEBUG] debug-file - Product 'default' build option: {}
+[2025-05-12T16:06:49.990] [DEBUG] debug-file - No signingConfig found, initRemoteHspCache failed.
+[2025-05-12T16:06:50.091] [DEBUG] debug-file - hvigorfile, no custom plugins were found in D:\git_developmentPractice\DevelopmentPractice\ImageWhiteLumpSolution\UseImageHttpRequest\hvigorfile.ts
+[2025-05-12T16:06:50.112] [DEBUG] debug-file - hvigorfile, binding system plugins [Function: hapTasks]
+[2025-05-12T16:06:50.134] [DEBUG] debug-file - Target 'ohosTest' config: {}
+[2025-05-12T16:06:50.144] [DEBUG] debug-file - hvigorfile, no custom plugins were found in D:\git_developmentPractice\DevelopmentPractice\ImageWhiteLumpSolution\UseImageHttpRequest\entry\hvigorfile.ts
+[2025-05-12T16:06:50.155] [DEBUG] debug-file - load to the disk finished
+[2025-05-12T16:06:50.211] [INFO] debug-file - Finished :entry:clean... after 6 ms
+[2025-05-12T16:06:50.252] [DEBUG] debug-file - Since there is no instance or instance is terminated, create a new worker pool.
+[2025-05-12T16:06:50.257] [DEBUG] debug-file - Create resident worker with id: 1.
+[2025-05-12T16:06:47.831] [DEBUG] debug-file - no-daemon, use the parent process.execArgv --max-old-space-size=8192,--expose-gc
+[2025-05-12T16:06:49.974] [DEBUG] debug-file - End initialize project's product build option map with build mode 'debug'.
+[2025-05-12T16:06:50.091] [DEBUG] debug-file - hvigorfile, resolve finished D:\git_developmentPractice\DevelopmentPractice\ImageWhiteLumpSolution\UseImageHttpRequest\hvigorfile.ts
+[2025-05-12T16:06:50.134] [DEBUG] debug-file - Module 'entry' target 'default' build option: {
+ "debuggable": true,
+ "copyFrom": "default",
+ "name": "debug"
+}
+[2025-05-12T16:06:50.144] [DEBUG] debug-file - hvigorfile, resolve finished D:\git_developmentPractice\DevelopmentPractice\ImageWhiteLumpSolution\UseImageHttpRequest\entry\hvigorfile.ts
+[2025-05-12T16:06:50.156] [DEBUG] debug-file - Start to initialize dependency information.
+[2025-05-12T16:06:50.211] [DEBUG] debug-file - Executing task ::clean
+[2025-05-12T16:06:50.252] [DEBUG] debug-file - Worker pool is initialized with config: {
+ minPoolNum: 2,
+ maxPoolNum: undefined,
+ maxCoreSize: undefined,
+ cacheCapacity: undefined,
+ cacheTtl: undefined
+}
+[2025-05-12T16:06:50.260] [DEBUG] debug-file - Current worker pool is stopped or closed.
+[2025-05-12T16:06:50.134] [DEBUG] debug-file - Module 'entry' target 'ohosTest' build option: {
+ "debuggable": true,
+ "name": "default"
+}
+[2025-05-12T16:06:50.184] [DEBUG] debug-file - Module UseImageHttpRequest Collected Dependency:
+[2025-05-12T16:06:50.211] [DEBUG] debug-file - clean: Worker pool is inactive.
+[2025-05-12T16:06:50.260] [DEBUG] debug-file - Clear worker 0.
+[2025-05-12T16:06:50.134] [DEBUG] debug-file - End initialize module-target build option map, moduleName=entry
+[2025-05-12T16:06:50.184] [DEBUG] debug-file - Module UseImageHttpRequest's total dependency: 0
+[2025-05-12T16:06:50.212] [DEBUG] debug-file - UseImageHttpRequest : clean cost memory 0.03276824951171875
+[2025-05-12T16:06:50.261] [DEBUG] debug-file - Worker 0 has been cleared.
+[2025-05-12T16:06:50.134] [DEBUG] debug-file - Module 'entry' target 'default' using build option: {
+ "debuggable": true,
+ "copyFrom": "default",
+ "name": "debug"
+} in this build.
+[2025-05-12T16:06:50.185] [DEBUG] debug-file - Start to initialize dependency information.
+[2025-05-12T16:06:50.212] [DEBUG] debug-file - runTaskFromQueue task cost before running: 1 s 935 ms
+[2025-05-12T16:06:50.261] [DEBUG] debug-file - Current idle worker size: 1.
+[2025-05-12T16:06:50.189] [DEBUG] debug-file - Module entry Collected Dependency:
+[2025-05-12T16:06:50.212] [INFO] debug-file - Finished ::clean... after 1 ms
+[2025-05-12T16:06:50.261] [DEBUG] debug-file - Current busy worker size: 0.
+[2025-05-12T16:06:50.189] [DEBUG] debug-file - Module entry's total dependency: 0
+[2025-05-12T16:06:50.212] [DEBUG] debug-file - Executing task :entry:init
+[2025-05-12T16:06:50.261] [DEBUG] debug-file - Clear worker 1.
+[2025-05-12T16:06:50.213] [DEBUG] debug-file - entry : init cost memory 0.01019287109375
+[2025-05-12T16:06:50.196] [DEBUG] debug-file - Configuration phase cost:1 s 893 ms
+[2025-05-12T16:06:50.261] [DEBUG] debug-file - Worker 1 has been cleared.
+[2025-05-12T16:06:50.213] [DEBUG] debug-file - runTaskFromQueue task cost before running: 1 s 935 ms
+[2025-05-12T16:06:50.261] [DEBUG] debug-file - Current idle worker size: 0.
+[2025-05-12T16:06:50.213] [INFO] debug-file - Finished :entry:init... after 1 ms
+[2025-05-12T16:06:50.261] [DEBUG] debug-file - Current busy worker size: 0.
+[2025-05-12T16:06:50.213] [DEBUG] debug-file - Executing task ::init
+[2025-05-12T16:06:50.264] [DEBUG] debug-file - hvigor build process will be closed.
+[2025-05-12T16:06:50.213] [DEBUG] debug-file - UseImageHttpRequest : init cost memory 0.00897216796875
+[2025-05-12T16:06:50.271] [DEBUG] debug-file - worker[0] exits with exit code 0.
+[2025-05-12T16:06:50.213] [DEBUG] debug-file - runTaskFromQueue task cost before running: 1 s 936 ms
+[2025-05-12T16:06:50.272] [DEBUG] debug-file - worker[1] exits with exit code 0.
+[2025-05-12T16:06:50.214] [INFO] debug-file - Finished ::init... after 1 ms
+[2025-05-12T16:06:50.273] [DEBUG] debug-file - Current worker pool is terminated.
+[2025-05-16T15:10:54.451] [DEBUG] debug-file - env: nodejsVersion=v18.20.1
+[2025-05-16T15:10:54.903] [DEBUG] debug-file - Hvigor init with startParameters:{
+ hvigorfileTypeCheck: false,
+ parallelExecution: true,
+ incrementalExecution: true,
+ printStackTrace: false,
+ daemon: false,
+ analyze: 0,
+ logLevel: Level { level: 20000, levelStr: 'INFO', colour: 'green' }
+}
+[2025-05-16T15:10:54.920] [DEBUG] debug-file - hvigorfile, resolving D:\git_developmentPractice\BestPracticeSnippets\ImageWhiteLumpSolution\UseImageHttpRequest\hvigorfile.ts
+[2025-05-16T15:10:56.329] [DEBUG] debug-file - hvigorfile, require result: { default: { system: [Function: appTasks], plugins: [] } }
+[2025-05-16T15:10:56.538] [DEBUG] debug-file - Start initialize project's product build option map with build mode debug.
+[2025-05-16T15:10:56.545] [DEBUG] debug-file - Product 'default' using build option: {
+ "debuggable": true
+} in this build.
+[2025-05-16T15:10:56.560] [DEBUG] debug-file - Local scan or download HarmonyOS sdk components toolchains,ets,js,native,previewer
+[2025-05-16T15:10:56.564] [DEBUG] debug-file - Local scan or download hmscore sdk components toolchains,ets,native
+[2025-05-16T15:10:56.572] [DEBUG] debug-file - Start recording SDK configuration permission data.
+[2025-05-16T15:10:56.605] [DEBUG] debug-file - Sdk init in 50 ms
+[2025-05-16T15:10:56.633] [DEBUG] debug-file - Project task initialization takes 26 ms
+[2025-05-16T15:10:56.642] [DEBUG] debug-file - hvigorfile, resolving D:\git_developmentPractice\BestPracticeSnippets\ImageWhiteLumpSolution\UseImageHttpRequest\entry\hvigorfile.ts
+[2025-05-16T15:10:56.666] [DEBUG] debug-file - Start initialize module-target build option map, moduleName=entry, buildMode=debug
+[2025-05-16T15:10:56.675] [DEBUG] debug-file - Module entry task initialization takes 5 ms
+[2025-05-16T15:10:56.678] [DEBUG] debug-file - project has submodules:entry
+[2025-05-16T15:10:56.705] [DEBUG] debug-file - Configuration task cost before running: 1 s 819 ms
+[2025-05-16T15:10:56.720] [DEBUG] debug-file - Module 'entry' target 'default' using build option: {
+ "debuggable": true,
+ "copyFrom": "default",
+ "name": "debug"
+} in this build.
+[2025-05-16T15:10:54.453] [DEBUG] debug-file - env: hvigor-config.json5 content = {
+ modelVersion: '5.0.0',
+ dependencies: {},
+ execution: {},
+ logging: {},
+ debugging: {},
+ nodeOptions: {}
+}
+[2025-05-16T15:10:54.905] [DEBUG] debug-file - Cache service initialization finished in 2 ms
+[2025-05-16T15:10:56.739] [DEBUG] debug-file - Create resident worker with id: 0.
+[2025-05-16T15:10:56.329] [DEBUG] debug-file - hvigorfile, binding system plugins [Function: appTasks]
+[2025-05-16T15:10:56.539] [DEBUG] debug-file - Picking option from product 'default' with build mode 'debug'.
+[2025-05-16T15:10:56.546] [DEBUG] debug-file - not found resModel json file in : D:\git_developmentPractice\BestPracticeSnippets\ImageWhiteLumpSolution\UseImageHttpRequest\entry\src\ohosTest\module.json5
+[2025-05-16T15:10:56.633] [DEBUG] debug-file - hvigorfile, binding custom plugins []
+[2025-05-16T15:10:56.649] [DEBUG] debug-file - hvigorfile, require result: { default: { system: [Function: hapTasks], plugins: [] } }
+[2025-05-16T15:10:56.666] [DEBUG] debug-file - Target 'default' config: {}
+[2025-05-16T15:10:56.675] [DEBUG] debug-file - hvigorfile, binding custom plugins []
+[2025-05-16T15:10:56.680] [DEBUG] debug-file - start to load updatedOhPackageInfo to the disk
+[2025-05-16T15:10:56.705] [DEBUG] debug-file - Executing task :entry:init
+[2025-05-16T15:10:56.724] [DEBUG] debug-file - Module 'entry' target 'ohosTest' using build option: {
+ "debuggable": true,
+ "name": "default"
+} in this build.
+[2025-05-16T15:10:54.455] [DEBUG] debug-file - env: daemon=false
+[2025-05-16T15:10:56.742] [DEBUG] debug-file - Create resident worker with id: 1.
+[2025-05-16T15:10:56.539] [DEBUG] debug-file - Product 'default' build option: {}
+[2025-05-16T15:10:56.554] [DEBUG] debug-file - No signingConfig found, initRemoteHspCache failed.
+[2025-05-16T15:10:56.633] [DEBUG] debug-file - hvigorfile, no custom plugins were found in D:\git_developmentPractice\BestPracticeSnippets\ImageWhiteLumpSolution\UseImageHttpRequest\hvigorfile.ts
+[2025-05-16T15:10:56.649] [DEBUG] debug-file - hvigorfile, binding system plugins [Function: hapTasks]
+[2025-05-16T15:10:56.667] [DEBUG] debug-file - Target 'ohosTest' config: {}
+[2025-05-16T15:10:56.675] [DEBUG] debug-file - hvigorfile, no custom plugins were found in D:\git_developmentPractice\BestPracticeSnippets\ImageWhiteLumpSolution\UseImageHttpRequest\entry\hvigorfile.ts
+[2025-05-16T15:10:56.684] [DEBUG] debug-file - load to the disk finished
+[2025-05-16T15:10:56.705] [DEBUG] debug-file - entry : init cost memory 0.0117645263671875
+[2025-05-16T15:10:56.737] [DEBUG] debug-file - Since there is no instance or instance is terminated, create a new worker pool.
+[2025-05-16T15:10:54.455] [DEBUG] debug-file - no-daemon, use the parent process.execArgv --max-old-space-size=8192,--expose-gc
+[2025-05-16T15:10:56.745] [DEBUG] debug-file - Current worker pool is stopped or closed.
+[2025-05-16T15:10:56.539] [DEBUG] debug-file - End initialize project's product build option map with build mode 'debug'.
+[2025-05-16T15:10:56.633] [DEBUG] debug-file - hvigorfile, resolve finished D:\git_developmentPractice\BestPracticeSnippets\ImageWhiteLumpSolution\UseImageHttpRequest\hvigorfile.ts
+[2025-05-16T15:10:56.667] [DEBUG] debug-file - Module 'entry' target 'default' build option: {
+ "debuggable": true,
+ "copyFrom": "default",
+ "name": "debug"
+}
+[2025-05-16T15:10:56.675] [DEBUG] debug-file - hvigorfile, resolve finished D:\git_developmentPractice\BestPracticeSnippets\ImageWhiteLumpSolution\UseImageHttpRequest\entry\hvigorfile.ts
+[2025-05-16T15:10:56.685] [DEBUG] debug-file - Start to initialize dependency information.
+[2025-05-16T15:10:56.706] [DEBUG] debug-file - runTaskFromQueue task cost before running: 1 s 820 ms
+[2025-05-16T15:10:56.737] [DEBUG] debug-file - Worker pool is initialized with config: {
+ minPoolNum: 2,
+ maxPoolNum: undefined,
+ maxCoreSize: undefined,
+ cacheCapacity: undefined,
+ cacheTtl: undefined
+}
+[2025-05-16T15:10:56.745] [DEBUG] debug-file - Clear worker 0.
+[2025-05-16T15:10:56.667] [DEBUG] debug-file - Module 'entry' target 'ohosTest' build option: {
+ "debuggable": true,
+ "name": "default"
+}
+[2025-05-16T15:10:56.693] [DEBUG] debug-file - Module UseImageHttpRequest Collected Dependency:
+[2025-05-16T15:10:56.707] [INFO] debug-file - Finished :entry:init... after 1 ms
+[2025-05-16T15:10:56.745] [DEBUG] debug-file - Worker 0 has been cleared.
+[2025-05-16T15:10:56.667] [DEBUG] debug-file - End initialize module-target build option map, moduleName=entry
+[2025-05-16T15:10:56.693] [DEBUG] debug-file - Module UseImageHttpRequest's total dependency: 0
+[2025-05-16T15:10:56.707] [DEBUG] debug-file - Executing task ::init
+[2025-05-16T15:10:56.745] [DEBUG] debug-file - Current idle worker size: 1.
+[2025-05-16T15:10:56.667] [DEBUG] debug-file - Module 'entry' target 'default' using build option: {
+ "debuggable": true,
+ "copyFrom": "default",
+ "name": "debug"
+} in this build.
+[2025-05-16T15:10:56.694] [DEBUG] debug-file - Start to initialize dependency information.
+[2025-05-16T15:10:56.707] [DEBUG] debug-file - UseImageHttpRequest : init cost memory 0.00890350341796875
+[2025-05-16T15:10:56.745] [DEBUG] debug-file - Current busy worker size: 0.
+[2025-05-16T15:10:56.696] [DEBUG] debug-file - Module entry Collected Dependency:
+[2025-05-16T15:10:56.707] [DEBUG] debug-file - runTaskFromQueue task cost before running: 1 s 821 ms
+[2025-05-16T15:10:56.745] [DEBUG] debug-file - Clear worker 1.
+[2025-05-16T15:10:56.697] [DEBUG] debug-file - Module entry's total dependency: 0
+[2025-05-16T15:10:56.707] [INFO] debug-file - Finished ::init... after 1 ms
+[2025-05-16T15:10:56.746] [DEBUG] debug-file - Worker 1 has been cleared.
+[2025-05-16T15:10:56.702] [DEBUG] debug-file - Configuration phase cost:1 s 791 ms
+[2025-05-16T15:10:56.746] [DEBUG] debug-file - Current idle worker size: 0.
+[2025-05-16T15:10:56.746] [DEBUG] debug-file - Current busy worker size: 0.
+[2025-05-16T15:10:56.746] [DEBUG] debug-file - hvigor build process will be closed.
+[2025-05-16T15:10:56.752] [DEBUG] debug-file - worker[1] exits with exit code 0.
+[2025-05-16T15:10:56.753] [DEBUG] debug-file - worker[0] exits with exit code 0.
+[2025-05-16T15:10:56.753] [DEBUG] debug-file - Current worker pool is terminated.
+[2025-05-16T15:21:47.721] [DEBUG] debug-file - java daemon tryConnect failed Error: connect ECONNREFUSED 127.0.0.1:45050
+[2025-05-16T15:21:47.726] [DEBUG] debug-file - java daemon started at port 45050 pid 5664
+[2025-05-16T15:21:47.178] [DEBUG] debug-file - env: nodejsVersion=v18.20.1
+[2025-05-16T15:21:47.222] [DEBUG] debug-file - env: daemon=true
+[2025-05-16T15:21:47.180] [DEBUG] debug-file - env: hvigor-config.json5 content = {
+ modelVersion: '5.0.0',
+ dependencies: {},
+ execution: {},
+ logging: {},
+ debugging: {},
+ nodeOptions: {}
+}
+[2025-05-16T15:21:47.812] [DEBUG] debug-file - session manager: set active socket. socketId=Qjgc6PxuvNFBvjARAAAB
+[2025-05-16T15:21:48.441] [DEBUG] debug-file - watch worker: worker id should be larger than 0. Nothing will be sent to any worker thread.
+[2025-05-16T15:21:48.458] [DEBUG] debug-file - Hvigor init with startParameters:{
+ hvigorfileTypeCheck: false,
+ parallelExecution: true,
+ incrementalExecution: true,
+ printStackTrace: false,
+ daemon: true,
+ analyze: 0,
+ logLevel: Level { level: 20000, levelStr: 'INFO', colour: 'green' }
+}
+[2025-05-16T15:21:48.460] [DEBUG] debug-file - Cache service initialization finished in 2 ms
+[2025-05-16T15:21:48.471] [DEBUG] debug-file - hvigorfile, resolving D:\git_developmentPractice\BestPracticeSnippets\ImageWhiteLumpSolution\UseImageHttpRequest\hvigorfile.ts
+[2025-05-16T15:21:49.813] [DEBUG] debug-file - hvigorfile, require result: { default: { plugins: [] } }
+[2025-05-16T15:21:49.813] [DEBUG] debug-file - hvigorfile, binding system plugins null
+[2025-05-16T15:21:50.002] [DEBUG] debug-file - Start initialize project's product build option map with build mode debug.
+[2025-05-16T15:21:50.003] [DEBUG] debug-file - Picking option from product 'default' with build mode 'debug'.
+[2025-05-16T15:21:50.003] [DEBUG] debug-file - Product 'default' build option: {}
+[2025-05-16T15:21:50.003] [DEBUG] debug-file - End initialize project's product build option map with build mode 'debug'.
+[2025-05-16T15:21:50.007] [DEBUG] debug-file - Product 'default' using build option: {
+ "debuggable": true
+} in this build.
+[2025-05-16T15:21:50.008] [DEBUG] debug-file - not found resModel json file in : D:\git_developmentPractice\BestPracticeSnippets\ImageWhiteLumpSolution\UseImageHttpRequest\entry\src\ohosTest\module.json5
+[2025-05-16T15:21:50.015] [DEBUG] debug-file - No signingConfig found, initRemoteHspCache failed.
+[2025-05-16T15:21:50.019] [DEBUG] debug-file - Local scan or download HarmonyOS sdk components toolchains,ets,js,native,previewer
+[2025-05-16T15:21:50.022] [DEBUG] debug-file - Local scan or download hmscore sdk components toolchains,ets,native
+[2025-05-16T15:21:50.028] [DEBUG] debug-file - Start recording SDK configuration permission data.
+[2025-05-16T15:21:50.059] [DEBUG] debug-file - Sdk init in 43 ms
+[2025-05-16T15:21:50.078] [DEBUG] debug-file - Project task initialization takes 18 ms
+[2025-05-16T15:21:50.078] [DEBUG] debug-file - hvigorfile, binding custom plugins []
+[2025-05-16T15:21:50.078] [DEBUG] debug-file - hvigorfile, no custom plugins were found in D:\git_developmentPractice\BestPracticeSnippets\ImageWhiteLumpSolution\UseImageHttpRequest\hvigorfile.ts
+[2025-05-16T15:21:50.078] [DEBUG] debug-file - hvigorfile, resolve finished D:\git_developmentPractice\BestPracticeSnippets\ImageWhiteLumpSolution\UseImageHttpRequest\hvigorfile.ts
+[2025-05-16T15:21:50.084] [DEBUG] debug-file - hvigorfile, resolving D:\git_developmentPractice\BestPracticeSnippets\ImageWhiteLumpSolution\UseImageHttpRequest\entry\hvigorfile.ts
+[2025-05-16T15:21:50.091] [DEBUG] debug-file - hvigorfile, require result: { default: { plugins: [] } }
+[2025-05-16T15:21:50.091] [DEBUG] debug-file - hvigorfile, binding system plugins null
+[2025-05-16T15:21:50.103] [DEBUG] debug-file - Start initialize module-target build option map, moduleName=entry, buildMode=debug
+[2025-05-16T15:21:50.103] [DEBUG] debug-file - Target 'default' config: {}
+[2025-05-16T15:21:50.104] [DEBUG] debug-file - Target 'ohosTest' config: {}
+[2025-05-16T15:21:50.104] [DEBUG] debug-file - Module 'entry' target 'default' build option: {
+ "debuggable": true,
+ "copyFrom": "default",
+ "name": "debug"
+}
+[2025-05-16T15:21:50.104] [DEBUG] debug-file - Module 'entry' target 'ohosTest' build option: {
+ "debuggable": true,
+ "name": "default"
+}
+[2025-05-16T15:21:50.104] [DEBUG] debug-file - End initialize module-target build option map, moduleName=entry
+[2025-05-16T15:21:50.104] [DEBUG] debug-file - Module 'entry' target 'default' using build option: {
+ "debuggable": true,
+ "copyFrom": "default",
+ "name": "debug"
+} in this build.
+[2025-05-16T15:21:50.111] [DEBUG] debug-file - Module entry task initialization takes 5 ms
+[2025-05-16T15:21:50.111] [DEBUG] debug-file - hvigorfile, binding custom plugins []
+[2025-05-16T15:21:50.111] [DEBUG] debug-file - hvigorfile, no custom plugins were found in D:\git_developmentPractice\BestPracticeSnippets\ImageWhiteLumpSolution\UseImageHttpRequest\entry\hvigorfile.ts
+[2025-05-16T15:21:50.111] [DEBUG] debug-file - hvigorfile, resolve finished D:\git_developmentPractice\BestPracticeSnippets\ImageWhiteLumpSolution\UseImageHttpRequest\entry\hvigorfile.ts
+[2025-05-16T15:21:50.133] [DEBUG] debug-file - hvigorfile, resolve hvigorfile dependencies in 21 ms
+[2025-05-16T15:21:50.134] [DEBUG] debug-file - project has submodules:entry
+[2025-05-16T15:21:50.136] [DEBUG] debug-file - Start to initialize dependency information.
+[2025-05-16T15:21:50.142] [DEBUG] debug-file - Module UseImageHttpRequest Collected Dependency:
+[2025-05-16T15:21:50.142] [DEBUG] debug-file - Module UseImageHttpRequest's total dependency: 0
+[2025-05-16T15:21:50.143] [DEBUG] debug-file - Start to initialize dependency information.
+[2025-05-16T15:21:50.145] [DEBUG] debug-file - Module entry Collected Dependency:
+[2025-05-16T15:21:50.145] [DEBUG] debug-file - Module entry's total dependency: 0
+[2025-05-16T15:21:50.150] [DEBUG] debug-file - Configuration phase cost:1 s 686 ms
+[2025-05-16T15:21:50.153] [DEBUG] debug-file - Configuration task cost before running: 1 s 708 ms
+[2025-05-16T15:21:50.155] [DEBUG] debug-file - Executing task :entry:clean
+[2025-05-16T15:21:50.155] [DEBUG] debug-file - clean: Worker pool is inactive.
+[2025-05-16T15:21:50.158] [DEBUG] debug-file - entry : clean cost memory 0.188629150390625
+[2025-05-16T15:21:50.158] [DEBUG] debug-file - runTaskFromQueue task cost before running: 1 s 713 ms
+[2025-05-16T15:21:50.158] [INFO] debug-file - Finished :entry:clean... after 3 ms
+[2025-05-16T15:21:50.159] [DEBUG] debug-file - Executing task ::clean
+[2025-05-16T15:21:50.159] [DEBUG] debug-file - clean: Worker pool is inactive.
+[2025-05-16T15:21:50.159] [DEBUG] debug-file - UseImageHttpRequest : clean cost memory 0.03862762451171875
+[2025-05-16T15:21:50.159] [DEBUG] debug-file - runTaskFromQueue task cost before running: 1 s 714 ms
+[2025-05-16T15:21:50.159] [INFO] debug-file - Finished ::clean... after 1 ms
+[2025-05-16T15:21:50.167] [DEBUG] debug-file - BUILD SUCCESSFUL in 1 s 721 ms
+[2025-05-16T15:21:50.182] [DEBUG] debug-file - Since there is no instance or instance is terminated, create a new worker pool.
+[2025-05-16T15:21:50.182] [DEBUG] debug-file - Worker pool is initialized with config: {
+ minPoolNum: 2,
+ maxPoolNum: undefined,
+ maxCoreSize: undefined,
+ cacheCapacity: undefined,
+ cacheTtl: undefined
+}
+[2025-05-16T15:21:50.183] [DEBUG] debug-file - session manager: send message to worker process.
+[2025-05-16T15:21:50.184] [DEBUG] debug-file - session manager: send message to worker process.
+[2025-05-16T15:21:50.184] [DEBUG] debug-file - Create resident worker with id: 0.
+[2025-05-16T15:21:50.186] [DEBUG] debug-file - Create resident worker with id: 1.
+[2025-05-16T15:21:50.189] [DEBUG] debug-file - Cleanup worker 0.
+[2025-05-16T15:21:50.189] [DEBUG] debug-file - Worker 0 has been cleaned up.
+[2025-05-16T15:21:50.189] [DEBUG] debug-file - Current idle worker size: 1.
+[2025-05-16T15:21:50.189] [DEBUG] debug-file - Current resident worker size: 2.
+[2025-05-16T15:21:50.189] [DEBUG] debug-file - Cleanup worker 1.
+[2025-05-16T15:21:50.189] [DEBUG] debug-file - Worker 1 has been cleaned up.
+[2025-05-16T15:21:50.189] [DEBUG] debug-file - Current idle worker size: 0.
+[2025-05-16T15:21:50.189] [DEBUG] debug-file - Current resident worker size: 2.
+[2025-05-16T15:21:50.190] [DEBUG] debug-file - hvigor build process will be closed.
+[2025-05-16T15:21:50.192] [DEBUG] debug-file - watch worker: worker id should be larger than 0. Nothing will be sent to any worker thread.
+[2025-05-16T15:21:50.192] [DEBUG] debug-file - watch worker: worker id should be larger than 0. Nothing will be sent to any worker thread.
+[2025-05-16T15:21:50.193] [DEBUG] debug-file - worker[0] exits with exit code 0.
+[2025-05-16T15:21:50.194] [DEBUG] debug-file - worker[1] exits with exit code 0.
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/.hvigor/outputs/sync/fileCache.json b/ImageWhiteLumpSolution/UseImageHttpRequest/.hvigor/outputs/sync/fileCache.json
new file mode 100644
index 0000000000000000000000000000000000000000..31cd42eba7c7341d156997ffba0348dce4bdda7d
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/.hvigor/outputs/sync/fileCache.json
@@ -0,0 +1 @@
+{"CACHE_SYNC_FILE_HASH":{"D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\hvigor\\hvigor-config.json5":"e2bc0e1245809161fa74298ed320d3a49c8db39a43bee46f7afee86b1b274282","D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\build-profile.json5":"025775b06f523bc2acde4e19d4ca92535201e9ffea5f016b32aa2bfa02e3c10a","D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\hvigorfile.ts":"3737f6ec69e3b62728cd6ee9a3935d7c6e27192c11bffa709173fcdeaa96da5f","D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\oh-package.json5":"3d19f6019544686cb2e37bf5a1be14cac2e0d4c6882465e1a6caf7dd5a01ab4c","D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\build-profile.json5":"4933e078bc90d224e987213e8dfa2ec754db38dc4cc46f7b8fdafc6e084caa46","D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\hvigorfile.ts":"5af199bd370048048fc20443729b306a403fc328b04ff61b0d2aceca9e55052c","D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\oh-package.json5":"eb8351db9c2efa1befad1118b8583ef877cda1d30c5c0cf09392020fbe7e13fd","D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\.hvigor\\outputs\\sync\\output.json":"5d2484b38ac755ec09f9daf6dee91717b18beeaf855b4f28c7127fc6a79fc399","SDK_LOCATION":"D:/dev-5.0.11/DevEco Studio/sdk"},"OHPM_INSTALL_FILE_HASH":{"D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\oh-package.json5":"3d19f6019544686cb2e37bf5a1be14cac2e0d4c6882465e1a6caf7dd5a01ab4c","D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\oh_modules\\.ohpm\\lock.json5":"dd1242ea1b89dc3ef0afdd7b7cc49ae2ff12fd688914a3ccfe5240cad66082d7","D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\oh-package.json5":"eb8351db9c2efa1befad1118b8583ef877cda1d30c5c0cf09392020fbe7e13fd","D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\oh_modules":true,"D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\oh_modules":false}}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/.hvigor/outputs/sync/output.json b/ImageWhiteLumpSolution/UseImageHttpRequest/.hvigor/outputs/sync/output.json
new file mode 100644
index 0000000000000000000000000000000000000000..08e18a02af8ca3f4cc114ceff3b2bed8b00a3dff
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/.hvigor/outputs/sync/output.json
@@ -0,0 +1,164 @@
+{
+ "ohos-module-entry": {
+ "SELECT_TARGET": "default",
+ "MODULE_BUILD_DIR": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\build",
+ "DEPENDENCY_INFO": {},
+ "TARGETS": {
+ "default": {
+ "SOURCE_ROOT": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\src\\main",
+ "RESOURCES_PATH": [
+ "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\src\\main\\resources"
+ ],
+ "BUILD_PATH": {
+ "OUTPUT_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\build\\default\\outputs\\default",
+ "INTERMEDIA_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\build\\default\\intermediates",
+ "JS_ASSETS_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\build\\default\\intermediates\\loader_out\\default",
+ "JS_LITE_ASSETS_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\build\\default\\intermediates\\loader_out_lite\\default",
+ "RES_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\build\\default\\intermediates\\res\\default",
+ "RES_PROFILE_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\build\\default\\intermediates\\res\\default\\resources\\base\\profile",
+ "ETS_SUPER_VISUAL_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\build\\default\\cache\\default\\default@CompileArkTS\\esmodule",
+ "JS_SUPER_VISUAL_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\build\\default\\cache\\default\\default@CompileJS\\jsbundle",
+ "WORKER_LOADER": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\build\\default\\intermediates\\loader\\default\\loader.json",
+ "MANIFEST_JSON": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\build\\default\\intermediates\\manifest\\default",
+ "OUTPUT_METADATA_JSON": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\build\\default\\intermediates\\hap_metadata\\default\\output_metadata.json",
+ "SOURCE_MAP_DIR": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\build\\default\\intermediates\\source_map\\default"
+ },
+ "BUILD_OPTION": {
+ "debuggable": true
+ }
+ },
+ "ohosTest": {
+ "SOURCE_ROOT": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\src\\ohosTest",
+ "RESOURCES_PATH": [
+ "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\src\\ohosTest\\resources"
+ ],
+ "BUILD_PATH": {
+ "OUTPUT_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\build\\default\\outputs\\ohosTest",
+ "INTERMEDIA_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\build\\default\\intermediates",
+ "JS_ASSETS_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\build\\default\\intermediates\\loader_out\\ohosTest",
+ "JS_LITE_ASSETS_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\build\\default\\intermediates\\loader_out_lite\\ohosTest",
+ "RES_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\build\\default\\intermediates\\res\\ohosTest",
+ "RES_PROFILE_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\build\\default\\intermediates\\res\\ohosTest\\resources\\base\\profile",
+ "ETS_SUPER_VISUAL_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\build\\default\\cache\\ohosTest\\ohosTest@OhosTestCompileArkTS\\esmodule",
+ "JS_SUPER_VISUAL_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\build\\default\\cache\\ohosTest\\ohosTest@OhosTestCompileJS\\jsbundle",
+ "WORKER_LOADER": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\build\\default\\intermediates\\loader\\ohosTest\\loader.json",
+ "MANIFEST_JSON": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\build\\default\\intermediates\\manifest\\ohosTest",
+ "OUTPUT_METADATA_JSON": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\build\\default\\intermediates\\hap_metadata\\ohosTest\\output_metadata.json",
+ "SOURCE_MAP_DIR": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\build\\default\\intermediates\\source_map\\ohosTest"
+ },
+ "BUILD_OPTION": {
+ "debuggable": true
+ }
+ }
+ },
+ "BUILD_OPTION": {
+ "default-default": {
+ "debuggable": true,
+ "copyFrom": "default",
+ "name": "debug"
+ }
+ },
+ "BUILD_PROFILE_OPT": {
+ "apiType": "stageMode",
+ "buildOption": {},
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": true,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ }
+ }
+ }
+ },
+ {
+ "name": "default"
+ },
+ {
+ "name": "debug"
+ }
+ ],
+ "targets": [
+ {
+ "name": "default"
+ },
+ {
+ "name": "ohosTest"
+ }
+ ]
+ },
+ "BUILD_CACHE_DIR": ""
+ },
+ "ohos-project": {
+ "SELECT_PRODUCT_NAME": "default",
+ "MODULE_BUILD_DIR": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\build",
+ "BUNDLE_NAME": "com.example.useimagehttprequest",
+ "BUILD_PATH": {
+ "OUTPUT_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\build\\outputs\\default"
+ },
+ "MODULES": [
+ {
+ "name": "entry",
+ "srcPath": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry",
+ "targets": [
+ {
+ "name": "default",
+ "applyToProducts": [
+ "default"
+ ]
+ }
+ ],
+ "belongProjectPath": "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest"
+ }
+ ],
+ "PROFILE_OPT": {
+ "app": {
+ "signingConfigs": [],
+ "products": [
+ {
+ "name": "default",
+ "signingConfig": "default",
+ "compatibleSdkVersion": "5.0.0(12)",
+ "runtimeOS": "HarmonyOS"
+ }
+ ],
+ "buildModeSet": [
+ {
+ "name": "debug"
+ },
+ {
+ "name": "release"
+ }
+ ]
+ },
+ "modules": [
+ {
+ "name": "entry",
+ "srcPath": "./entry",
+ "targets": [
+ {
+ "name": "default",
+ "applyToProducts": [
+ "default"
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ "CONFIG_PROPERTIES": {
+ "enableSignTask": true,
+ "skipNativeIncremental": false,
+ "hvigor.keepDependency": true
+ },
+ "OVERALL_PROJECT_PATHS": [
+ "D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest"
+ ],
+ "BUILD_CACHE_DIR": ""
+ },
+ "version": 1
+}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/.idea/.deveco/module/entry.cache.json b/ImageWhiteLumpSolution/UseImageHttpRequest/.idea/.deveco/module/entry.cache.json
new file mode 100644
index 0000000000000000000000000000000000000000..321c675f577e9e1fe4b837f4e51537949c1f8e11
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/.idea/.deveco/module/entry.cache.json
@@ -0,0 +1,22 @@
+{
+ "CommonInfo":{
+ "current.select.target":"default"
+ },
+ "BuildOptions":{
+ "SELECT_BUILD_TARGET":"default",
+ "BUILD_PATH":{
+ "OUTPUT_METADATA_JSON":"D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\build\\default\\intermediates\\hap_metadata\\default\\output_metadata.json",
+ "OUTPUT_PATH":"D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\build\\default\\outputs\\default",
+ "RES_PATH":"D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\build\\default\\intermediates\\res\\default",
+ "ETS_SUPER_VISUAL_PATH":"D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\build\\default\\cache\\default\\default@CompileArkTS\\esmodule",
+ "JS_ASSETS_PATH":"D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\build\\default\\intermediates\\loader_out\\default",
+ "SOURCE_MAP_DIR":"D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\build\\default\\intermediates\\source_map\\default",
+ "INTERMEDIA_PATH":"D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\build\\default\\intermediates",
+ "RES_PROFILE_PATH":"D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\build\\default\\intermediates\\res\\default\\resources\\base\\profile",
+ "WORKER_LOADER":"D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\build\\default\\intermediates\\loader\\default\\loader.json",
+ "MANIFEST_JSON":"D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\build\\default\\intermediates\\manifest\\default",
+ "JS_LITE_ASSETS_PATH":"D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\build\\default\\intermediates\\loader_out_lite\\default",
+ "JS_SUPER_VISUAL_PATH":"D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\entry\\build\\default\\cache\\default\\default@CompileJS\\jsbundle"
+ }
+ }
+}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/.idea/.deveco/project.cache.json b/ImageWhiteLumpSolution/UseImageHttpRequest/.idea/.deveco/project.cache.json
new file mode 100644
index 0000000000000000000000000000000000000000..288b17c3ecd683c4ce5992925f147c431182c9c2
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/.idea/.deveco/project.cache.json
@@ -0,0 +1,16 @@
+{
+ "CommonInfo":{
+ "project.ide.version":"5.0.11.100",
+ "current.select.product":"default",
+ "current.select.buildMode":"",
+ "crossplatform.projectType":""
+ },
+ "BuildOptions":{
+ "SELECT_BUILD_PRODUCT":"default",
+ "BUNDLE_NAME":"com.example.useimagehttprequest",
+ "BUILD_PATH":{
+ "OUTPUT_PATH":"D:\\git_developmentPractice\\BestPracticeSnippets\\ImageWhiteLumpSolution\\UseImageHttpRequest\\build\\outputs\\default"
+ },
+ "SELECT_BUILD_MODE":""
+ }
+}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/.idea/git_toolbox_blame.xml b/ImageWhiteLumpSolution/UseImageHttpRequest/.idea/git_toolbox_blame.xml
new file mode 100644
index 0000000000000000000000000000000000000000..7dc124965d28403ec2545a24d7d1cd1fec1f57d8
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/.idea/git_toolbox_blame.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/.idea/modules.xml b/ImageWhiteLumpSolution/UseImageHttpRequest/.idea/modules.xml
new file mode 100644
index 0000000000000000000000000000000000000000..0796299c8de58dcf7c1c7c213541ed0bacf46869
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/.idea/modules.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/.idea/modules/UseImageHttpRequest.iml b/ImageWhiteLumpSolution/UseImageHttpRequest/.idea/modules/UseImageHttpRequest.iml
new file mode 100644
index 0000000000000000000000000000000000000000..c0be1d7c491147540d199ce55f0721012b7ff7b5
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/.idea/modules/UseImageHttpRequest.iml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/.idea/modules/entry/entry.iml b/ImageWhiteLumpSolution/UseImageHttpRequest/.idea/modules/entry/entry.iml
new file mode 100644
index 0000000000000000000000000000000000000000..b630fe7f2a024b997f55fc5a52dea6c90a18c45d
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/.idea/modules/entry/entry.iml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/.idea/workspace.xml b/ImageWhiteLumpSolution/UseImageHttpRequest/.idea/workspace.xml
new file mode 100644
index 0000000000000000000000000000000000000000..0fc6b5c6083d9829160669e10695251b71486197
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/.idea/workspace.xml
@@ -0,0 +1,93 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/AppScope/app.json5 b/ImageWhiteLumpSolution/UseImageHttpRequest/AppScope/app.json5
new file mode 100644
index 0000000000000000000000000000000000000000..076d01dd66673c840554b285a2bf39f08b59a8e0
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/AppScope/app.json5
@@ -0,0 +1,10 @@
+{
+ "app": {
+ "bundleName": "com.example.useimagehttprequest",
+ "vendor": "example",
+ "versionCode": 1000000,
+ "versionName": "1.0.0",
+ "icon": "$media:app_icon",
+ "label": "$string:app_name"
+ }
+}
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/AppScope/resources/base/element/string.json b/ImageWhiteLumpSolution/UseImageHttpRequest/AppScope/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..98a14fff89a8e3b7134c05c5383e4f642b9639eb
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/AppScope/resources/base/element/string.json
@@ -0,0 +1,8 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "UseImageHttpRequest"
+ }
+ ]
+}
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/AppScope/resources/base/media/app_icon.png b/ImageWhiteLumpSolution/UseImageHttpRequest/AppScope/resources/base/media/app_icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..a39445dc87828b76fed6d2ec470dd455c45319e3
Binary files /dev/null and b/ImageWhiteLumpSolution/UseImageHttpRequest/AppScope/resources/base/media/app_icon.png differ
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/README.md b/ImageWhiteLumpSolution/UseImageHttpRequest/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..35857a0abb6769408338dd33676c5c657d554680
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/README.md
@@ -0,0 +1,2 @@
+最佳实践"Image白块解决指导"目录
+ImageWhiteLumpSolution-UseImageHttpRequest 直接使用Image原生组件加载网络图片白块时长较长 反例
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/build-profile.json5 b/ImageWhiteLumpSolution/UseImageHttpRequest/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..c033ce4278fb0641d84107c3c134047ac487368e
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/build-profile.json5
@@ -0,0 +1,35 @@
+{
+ "app": {
+ "signingConfigs": [],
+ "products": [
+ {
+ "name": "default",
+ "signingConfig": "default",
+ "compatibleSdkVersion": "5.0.0(12)",
+ "runtimeOS": "HarmonyOS",
+ }
+ ],
+ "buildModeSet": [
+ {
+ "name": "debug",
+ },
+ {
+ "name": "release"
+ }
+ ]
+ },
+ "modules": [
+ {
+ "name": "entry",
+ "srcPath": "./entry",
+ "targets": [
+ {
+ "name": "default",
+ "applyToProducts": [
+ "default"
+ ]
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/entry/build-profile.json5 b/ImageWhiteLumpSolution/UseImageHttpRequest/entry/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..b695582d3680556f4cce2ec518f65720a9413ca3
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/entry/build-profile.json5
@@ -0,0 +1,28 @@
+{
+ "apiType": "stageMode",
+ "buildOption": {
+ },
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": true,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ }
+ }
+ }
+ },
+ ],
+ "targets": [
+ {
+ "name": "default"
+ },
+ {
+ "name": "ohosTest",
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/entry/hvigorfile.ts b/ImageWhiteLumpSolution/UseImageHttpRequest/entry/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..c6edcd90486dd5a853cf7d34c8647f08414ca7a3
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/entry/hvigorfile.ts
@@ -0,0 +1,6 @@
+import { hapTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/entry/obfuscation-rules.txt b/ImageWhiteLumpSolution/UseImageHttpRequest/entry/obfuscation-rules.txt
new file mode 100644
index 0000000000000000000000000000000000000000..69c4d6a8a5531548e4886fa766090c5c157a87d9
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/entry/obfuscation-rules.txt
@@ -0,0 +1,18 @@
+# Define project specific obfuscation rules here.
+# You can include the obfuscation configuration files in the current module's build-profile.json5.
+#
+# For more details, see
+# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
+
+# Obfuscation options:
+# -disable-obfuscation: disable all obfuscations
+# -enable-property-obfuscation: obfuscate the property names
+# -enable-toplevel-obfuscation: obfuscate the names in the global scope
+# -compact: remove unnecessary blank spaces and all line feeds
+# -remove-log: remove all console.* statements
+# -print-namecache: print the name cache that contains the mapping from the old names to new names
+# -apply-namecache: reuse the given cache file
+
+# Keep options:
+# -keep-property-name: specifies property names that you want to keep
+# -keep-global-name: specifies names that you want to keep in the global scope
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/entry/oh-package.json5 b/ImageWhiteLumpSolution/UseImageHttpRequest/entry/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..248c3b7541a589682a250f86a6d3ecf7414d2d6a
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/entry/oh-package.json5
@@ -0,0 +1,10 @@
+{
+ "name": "entry",
+ "version": "1.0.0",
+ "description": "Please describe the basic information.",
+ "main": "",
+ "author": "",
+ "license": "",
+ "dependencies": {}
+}
+
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/entry/src/main/ets/entryability/EntryAbility.ets b/ImageWhiteLumpSolution/UseImageHttpRequest/entry/src/main/ets/entryability/EntryAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..e356e08fc0c5fee587699b54820a71b232bd4d55
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/entry/src/main/ets/entryability/EntryAbility.ets
@@ -0,0 +1,56 @@
+/*
+* Copyright (C) 2024 Huawei Device 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 { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { window } from '@kit.ArkUI';
+
+export default class EntryAbility extends UIAbility {
+ onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
+ }
+
+ onDestroy(): void {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
+ }
+
+ onWindowStageCreate(windowStage: window.WindowStage): void {
+ // Main window is created, set main page for this ability
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
+
+ windowStage.loadContent('pages/MainPage', (err) => {
+ 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.');
+ });
+ }
+
+ onWindowStageDestroy(): void {
+ // Main window is destroyed, release UI related resources
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
+ }
+
+ onForeground(): void {
+ // Ability has brought to foreground
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
+ }
+
+ onBackground(): void {
+ // Ability has back to background
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
+ }
+}
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/entry/src/main/ets/pages/MainPage.ets b/ImageWhiteLumpSolution/UseImageHttpRequest/entry/src/main/ets/pages/MainPage.ets
new file mode 100644
index 0000000000000000000000000000000000000000..674832b0de439f1575575cd7bc7daff9d168588d
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/entry/src/main/ets/pages/MainPage.ets
@@ -0,0 +1,47 @@
+/*
+* Copyright (C) 2024 Huawei Device 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.
+*/
+
+/*
+ * 最佳实践:Image白块解决问题指导
+ *
+ * 直接使用Image原生组件加载网络图片白块时长较长 反例
+ */
+
+// DocsCode 1
+@Entry
+@Component
+struct MainPage {
+ @State childNavStack: NavPathStack = new NavPathStack();
+
+ build() {
+ Navigation(this.childNavStack) {
+ Column() {
+ Button('push Path to pageOne', { stateEffect: true, type: ButtonType.Capsule })
+ .width('80%')
+ .height(40)
+ .margin({ bottom: '36vp' })
+ .onClick(() => {
+ this.childNavStack.pushPath({ name: 'pageOne' });
+ })
+ }
+ .width('100%')
+ .height('100%')
+ .justifyContent(FlexAlign.End)
+ }
+ .backgroundColor(Color.Transparent)
+ .title('ParentNavigation')
+ }
+}
+// DocsCode 1
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/entry/src/main/ets/pages/PageOne.ets b/ImageWhiteLumpSolution/UseImageHttpRequest/entry/src/main/ets/pages/PageOne.ets
new file mode 100644
index 0000000000000000000000000000000000000000..6dff2e7de6fda8b3f02c062f1639fd84c9561558
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/entry/src/main/ets/pages/PageOne.ets
@@ -0,0 +1,51 @@
+/*
+* Copyright (C) 2024 Huawei Device 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.
+*/
+
+/*
+ * 最佳实践:Image白块解决问题指导
+ *
+ * 直接使用Image原生组件加载网络图片白块时长较长 反例
+ */
+
+// DocsCode 1
+// [Start PageOne_builder_other]
+@Builder
+export function PageOneBuilder(name: string) {
+ PageOne()
+}
+
+@Component
+export struct PageOne {
+ pageInfo: NavPathStack = new NavPathStack();
+ @State name: string = 'pageOne';
+
+ build() {
+ NavDestination() {
+ Row() {
+ // Not recommended usage: Using Image to directly load images from the internet is subject to delays caused by image downloading and parsing, which can easily result in white blocks.
+ Image("https://www.example.com/xxx.png") // Please fill in a specific URL of the online image here.
+ .objectFit(ImageFit.Auto)
+ .width('100%')
+ .height('100%')
+ }
+ .width('100%')
+ .height('100%')
+ .justifyContent(FlexAlign.Center)
+ }
+ .title(this.name)
+ }
+}
+// [End PageOne_builder_other]
+// DocsCode 1
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/entry/src/main/module.json5 b/ImageWhiteLumpSolution/UseImageHttpRequest/entry/src/main/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..3b1635a6803cee1cb44c80ae97e9014e14f57163
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/entry/src/main/module.json5
@@ -0,0 +1,58 @@
+{
+ "module": {
+ "name": "entry",
+ "type": "entry",
+ "description": "$string:module_desc",
+ "mainElement": "EntryAbility",
+ "routerMap": "$profile:router_map",
+ "deviceTypes": [
+ "phone",
+ "tablet",
+ "2in1"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false,
+ "pages": "$profile:main_pages",
+ "abilities": [
+ {
+ "name": "EntryAbility",
+ "srcEntry": "./ets/entryability/EntryAbility.ets",
+ "description": "$string:EntryAbility_desc",
+ "icon": "$media:layered_image",
+ "label": "$string:EntryAbility_label",
+ "startWindowIcon": "$media:startIcon",
+ "startWindowBackground": "$color:start_window_background",
+ "exported": true,
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ]
+ }
+ ],
+ "extensionAbilities": [
+ {
+ "name": "EntryBackupAbility",
+ "srcEntry": "./ets/entrybackupability/EntryBackupAbility.ets",
+ "type": "backup",
+ "exported": false,
+ "metadata": [
+ {
+ "name": "ohos.extension.backup",
+ "resource": "$profile:backup_config"
+ }
+ ],
+ }
+ ],
+ "requestPermissions": [
+ {
+ "name": "ohos.permission.INTERNET"
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/entry/src/main/resources/base/element/color.json b/ImageWhiteLumpSolution/UseImageHttpRequest/entry/src/main/resources/base/element/color.json
new file mode 100644
index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/entry/src/main/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/ImageWhiteLumpSolution/UseImageHttpRequest/entry/src/main/resources/base/element/string.json b/ImageWhiteLumpSolution/UseImageHttpRequest/entry/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..f94595515a99e0c828807e243494f57f09251930
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,16 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "label"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/entry/src/main/resources/base/media/background.png b/ImageWhiteLumpSolution/UseImageHttpRequest/entry/src/main/resources/base/media/background.png
new file mode 100644
index 0000000000000000000000000000000000000000..f939c9fa8cc8914832e602198745f592a0dfa34d
Binary files /dev/null and b/ImageWhiteLumpSolution/UseImageHttpRequest/entry/src/main/resources/base/media/background.png differ
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/entry/src/main/resources/base/media/foreground.png b/ImageWhiteLumpSolution/UseImageHttpRequest/entry/src/main/resources/base/media/foreground.png
new file mode 100644
index 0000000000000000000000000000000000000000..4483ddad1f079e1089d685bd204ee1cfe1d01902
Binary files /dev/null and b/ImageWhiteLumpSolution/UseImageHttpRequest/entry/src/main/resources/base/media/foreground.png differ
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/entry/src/main/resources/base/media/layered_image.json b/ImageWhiteLumpSolution/UseImageHttpRequest/entry/src/main/resources/base/media/layered_image.json
new file mode 100644
index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/entry/src/main/resources/base/media/layered_image.json
@@ -0,0 +1,7 @@
+{
+ "layered-image":
+ {
+ "background" : "$media:background",
+ "foreground" : "$media:foreground"
+ }
+}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/entry/src/main/resources/base/media/startIcon.png b/ImageWhiteLumpSolution/UseImageHttpRequest/entry/src/main/resources/base/media/startIcon.png
new file mode 100644
index 0000000000000000000000000000000000000000..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b
Binary files /dev/null and b/ImageWhiteLumpSolution/UseImageHttpRequest/entry/src/main/resources/base/media/startIcon.png differ
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/entry/src/main/resources/base/profile/backup_config.json b/ImageWhiteLumpSolution/UseImageHttpRequest/entry/src/main/resources/base/profile/backup_config.json
new file mode 100644
index 0000000000000000000000000000000000000000..78f40ae7c494d71e2482278f359ec790ca73471a
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/entry/src/main/resources/base/profile/backup_config.json
@@ -0,0 +1,3 @@
+{
+ "allowToBackupRestore": true
+}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/entry/src/main/resources/base/profile/main_pages.json b/ImageWhiteLumpSolution/UseImageHttpRequest/entry/src/main/resources/base/profile/main_pages.json
new file mode 100644
index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/entry/src/main/resources/base/profile/main_pages.json
@@ -0,0 +1,5 @@
+{
+ "src": [
+ "pages/Index"
+ ]
+}
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/entry/src/main/resources/base/profile/router_map.json b/ImageWhiteLumpSolution/UseImageHttpRequest/entry/src/main/resources/base/profile/router_map.json
new file mode 100644
index 0000000000000000000000000000000000000000..d54fa89e19edf4e9bba311784818c084ed961105
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/entry/src/main/resources/base/profile/router_map.json
@@ -0,0 +1,12 @@
+{
+ "routerMap": [
+ {
+ "name": "pageOne",
+ "pageSourceFile": "src/main/ets/pages/PageOne.ets",
+ "buildFunction": "PageOneBuilder",
+ "data": {
+ "description": "this is pageOne"
+ }
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/hvigor/hvigor-config.json5 b/ImageWhiteLumpSolution/UseImageHttpRequest/hvigor/hvigor-config.json5
new file mode 100644
index 0000000000000000000000000000000000000000..06b2783670a348f95533b352c1ceda909a842bbc
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/hvigor/hvigor-config.json5
@@ -0,0 +1,22 @@
+{
+ "modelVersion": "5.0.0",
+ "dependencies": {
+ },
+ "execution": {
+ // "analyze": "normal", /* Define the build analyze mode. Value: [ "normal" | "advanced" | false ]. Default: "normal" */
+ // "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */
+ // "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */
+ // "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */
+ // "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */
+ },
+ "logging": {
+ // "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */
+ },
+ "debugging": {
+ // "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */
+ },
+ "nodeOptions": {
+ // "maxOldSpaceSize": 8192 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process. Default: 8192*/
+ // "exposeGC": true /* Enable to trigger garbage collection explicitly. Default: true*/
+ }
+}
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/hvigorfile.ts b/ImageWhiteLumpSolution/UseImageHttpRequest/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..f3cb9f1a87a81687554a76283af8df27d8bda775
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/hvigorfile.ts
@@ -0,0 +1,6 @@
+import { appTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh-package-lock.json5 b/ImageWhiteLumpSolution/UseImageHttpRequest/oh-package-lock.json5
new file mode 100644
index 0000000000000000000000000000000000000000..d3e54c94dcaeaa389813c16ca70e69f962cdefd8
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh-package-lock.json5
@@ -0,0 +1,27 @@
+{
+ "meta": {
+ "stableOrder": true
+ },
+ "lockfileVersion": 3,
+ "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
+ "specifiers": {
+ "@ohos/hamock@1.0.0": "@ohos/hamock@1.0.0",
+ "@ohos/hypium@1.0.18": "@ohos/hypium@1.0.18"
+ },
+ "packages": {
+ "@ohos/hamock@1.0.0": {
+ "name": "@ohos/hamock",
+ "version": "1.0.0",
+ "integrity": "sha512-K6lDPYc6VkKe6ZBNQa9aoG+ZZMiwqfcR/7yAVFSUGIuOAhPvCJAo9+t1fZnpe0dBRBPxj2bxPPbKh69VuyAtDg==",
+ "resolved": "https://repo.harmonyos.com/ohpm/@ohos/hamock/-/hamock-1.0.0.har",
+ "registryType": "ohpm"
+ },
+ "@ohos/hypium@1.0.18": {
+ "name": "@ohos/hypium",
+ "version": "1.0.18",
+ "integrity": "sha512-RGe/iLGdeywdQilMWZsHKUoiE9OJ+9QxQsorF92R2ImLNVHVhbpSePNITGpW7TnvLgOIP/jscOqfIOhk6X7XRQ==",
+ "resolved": "https://repo.harmonyos.com/ohpm/@ohos/hypium/-/hypium-1.0.18.har",
+ "registryType": "ohpm"
+ }
+ }
+}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh-package.json5 b/ImageWhiteLumpSolution/UseImageHttpRequest/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..ebdda7e54d1c41e952f1c7f6993c6d15ea3d146d
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh-package.json5
@@ -0,0 +1,10 @@
+{
+ "modelVersion": "5.0.0",
+ "description": "Please describe the basic information.",
+ "dependencies": {
+ },
+ "devDependencies": {
+ "@ohos/hypium": "1.0.18",
+ "@ohos/hamock": "1.0.0"
+ }
+}
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/CHANGELOG.md b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/CHANGELOG.md
new file mode 100644
index 0000000000000000000000000000000000000000..22a35bda8a1fab36dd81c1c7ae86addcc1f111cc
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/CHANGELOG.md
@@ -0,0 +1,4 @@
+## 1.0.0
+- 修复once断言问题
+## 1.0.0-rc
+- 提供DevEco Studio预览器场景使能的MockSetup装饰器
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/LICENSE b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..4947287f7b5ccb5d1e8b7b2d3aa5d89f322c160d
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/README.md b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..c46981eb6b9163cb82723dd4c410b69b5e6a66cd
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/README.md
@@ -0,0 +1,82 @@
+# Hamock
+
+## 简介
+
+Hamock 是 OpenHarmony 上的模拟框架,提供预览场景的模拟功能。
+
+## 下载安装
+
+```bash
+ohpm install @ohos/hamock
+```
+
+OpenHarmony ohpm 环境配置等更多内容,请参考[如何安装 OpenHarmony ohpm 包](https://gitee.com/openharmony-tpc/docs/blob/master/OpenHarmony_har_usage.md)
+
+## 使用示例
+
+Hamock 提供了 @MockSetup 用于修饰 Mock 方法,仅支持声明式范式的组件。当开发者预览该组件时,预览运行时将在组件初始化时执行被 @MockSetup 修饰的方法。因此,开发者可以在这个被修饰的方法内重定义组件的方法或重赋值组件的属性,其将在预览时生效。
+
+> 说明:
+> @MockSetup 修饰的方法仅在预览场景会自动触发,并先于组件的 aboutToAppear 执行。
+
+### UI组件的方法
+
+在 ArkTS 页面代码中引入 Hamock。在目标组件中定义一个方法,并用 @MockSetup 修饰该方法。在这个方法中,使用 MockKit 模拟目标方法。
+
+```typescript
+import { MockKit, when, MockSetup } from '@ohos/hamock';
+
+@Entry
+@Component
+struct Index {
+ ...
+ @MockSetup
+ randomName() {
+ let mocker: MockKit = new MockKit();
+ let mockfunc: Object = mocker.mockFunc(this, this.method1);
+ // mock 指定的方法在指定入参的返回值
+ when(mockfunc)('test').afterReturn(1);
+ }
+ ...
+ // 业务场景调用方法
+ const result: number = this.method1('test'); // in previewer, result = 1
+}
+```
+
+### UI组件的属性
+
+在 ArkTS 页面代码中引入 Hamock。在目标组件中定义一个方法,并用 @MockSetup 修饰该方法。在这个方法中,对于需要 Mock 的属性,可以重新赋值。
+
+```typescript
+import { MockSetup } from '@ohos/hamock';
+
+@Component
+struct Person {
+ @Prop species: string;
+ ...
+ // 在 @MockSetup 片段中,定义对象属性
+ @MockSetup
+ randomName() {
+ this.species = 'primates';
+ }
+ ...
+ // 业务场景调用属性(如果从初始化到调用期间,该属性无变化)
+ const result: string = this.species; // in previewer, result = primates
+}
+```
+
+## 约束与限制
+
+在下述版本验证通过:
+
+DevEco Studio: 4.1 (4.1.3.400), SDK: API11 (4.1.0.36)
+
+MockSetup 仅在 API11 支持。
+
+## 贡献代码
+
+使用过程中发现任何问题都可以提[Issue](https://gitee.com/openharmony/testfwk_arkxtest/issues) 给我们,当然,我们也非常欢迎你给我们提[PR](https://gitee.com/openharmony/testfwk_arkxtest/pulls) 。
+
+## 开源协议
+
+本项目基于 [Apache License 2.0](https://gitee.com/openharmony/testfwk_arkxtest/blob/master/hamock/LICENSE) ,请自由地享受和参与开源。
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/build-profile.json5 b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..12fe2d844bdb69584fd05ebaa3e1cb197a25c3f1
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/build-profile.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2023 Huawei Device 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.
+ */
+
+{
+ "apiType": "stageMode",
+ "buildOption": {
+ },
+ "targets": [
+ {
+ "name": "default"
+ }
+ ]
+}
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/hvigorfile.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/hvigorfile.js
new file mode 100644
index 0000000000000000000000000000000000000000..d7bda561c9bf09b92a7fac485141cc8648907388
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/hvigorfile.js
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2023 Huawei Device 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.
+ */
+
+// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
+export { harTasks } from '@ohos/hvigor-ohos-plugin';
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/hvigorfile.ts b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..960be7d7df0790853d6bdab1f52a3ec8c8e4a1ca
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/hvigorfile.ts
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2023 Huawei Device 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.
+ */
+
+// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
+export { harTasks } from '@ohos/hvigor-ohos-plugin';
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/index.d.ts b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/index.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..6bc7929ba5718da0e459721be04e903ec59289c0
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/index.d.ts
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2023 Huawei Device 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.
+ */
+
+export class ArgumentMatchers {
+ static any;
+ static anyString;
+ static anyBoolean;
+ static anyNumber;
+ static anyObj;
+ static anyFunction;
+ static matchRegexs(Regex: RegExp): void
+}
+
+declare interface when {
+ afterReturn(value: any): any
+ afterReturnNothing(): undefined
+ afterAction(action: any): any
+ afterThrow(e_msg: string): string
+ (argMatchers?: any): when;
+}
+
+export const when: when;
+
+export interface VerificationMode {
+ times(count: Number): void
+ never(): void
+ once(): void
+ atLeast(count: Number): void
+ atMost(count: Number): void
+}
+
+export class MockKit {
+ constructor()
+ mockFunc(obj: Object, func: Function): Function
+ mockObject(obj: Object): Object
+ verify(methodName: String, argsArray: Array): VerificationMode
+ ignoreMock(obj: Object, func: Function): void
+ clear(obj: Object): void
+ clearAll(): void
+}
+
+export declare function MockSetup(
+ target: Object,
+ propertyName: string | Symbol,
+ descriptor: TypedPropertyDescriptor<() => void>
+): void;
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/index.ets b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..c3a47320c2b674216cccde0fe217dbb8423625cc
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/index.ets
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2023 Huawei Device 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.
+ */
+
+export { MockSetup, MockKit, when } from './src/main/mock/MockKit';
+export { ArgumentMatchers } from './src/main/mock/ArgumentMatchers';
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/index.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..1cb2b5e0256e00aa9276867f0753a89a7ac5e16f
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/index.js
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2021-2023 Huawei Device 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.
+ */
+export { MockSetup, MockKit, when } from './src/main/mock/MockKit.js';
+export { ArgumentMatchers } from './src/main/mock/ArgumentMatchers.js';
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/index.ts b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/index.ts
new file mode 100644
index 0000000000000000000000000000000000000000..608eb4fe72aaf0f6cca0ccb3baad94e9b6101de0
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/index.ts
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2021-2023 Huawei Device 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.
+ */
+
+export { MockSetup, MockKit, when } from './src/main/mock/MockKit.js';
+export { ArgumentMatchers } from './src/main/mock/ArgumentMatchers.js';
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/oh-package.json5 b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..0ef4eeed251a93463c2abf85b262c3e1fb6733bc
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/oh-package.json5
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2023 Huawei Device 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.
+ */
+
+{
+ name: '@ohos/hamock',
+ version: '1.0.0',
+ description: 'A mock framework for OpenHarmony application.',
+ main: 'index.ets',
+ author: 'huawei',
+ license: 'Apache-2.0',
+ dependencies: {},
+ ohos: {
+ org: 'ohos',
+ },
+ types: 'index.d.ts'
+}
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/ArgumentMatchers.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/ArgumentMatchers.js
new file mode 100644
index 0000000000000000000000000000000000000000..f06bbca0b287aac612f42f9263c064c0157ae03a
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/ArgumentMatchers.js
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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.
+ */
+export class ArgumentMatchers {
+ constructor() {
+ this.ANY = "";
+ this.ANY_STRING = "";
+ this.ANY_BOOLEAN = "";
+ this.ANY_NUMBER = "";
+ this.ANY_OBJECT = "";
+ this.ANY_FUNCTION = "";
+ this.MATCH_REGEXS = "";
+ }
+ static any() {
+ }
+ static anyString() {
+ }
+ static anyBoolean() {
+ }
+ static anyNumber() {
+ }
+ static anyObj() {
+ }
+ static anyFunction() {
+ }
+ static matchRegexs(regex) {
+ if (ArgumentMatchers.isRegExp(regex)) {
+ return regex;
+ }
+ throw Error("not a regex");
+ }
+ static isRegExp(value) {
+ return Object.prototype.toString.call(value) === "[object RegExp]";
+ }
+ matcheReturnKey(...args) {
+ let arg = args[0];
+ let regex = args[1];
+ let stubSetKey = args[2];
+ if (stubSetKey && stubSetKey == this.ANY) {
+ return this.ANY;
+ }
+ if (typeof arg === "string" && !regex) {
+ return this.ANY_STRING;
+ }
+ if (typeof arg === "boolean" && !regex) {
+ return this.ANY_BOOLEAN;
+ }
+ if (typeof arg === "number" && !regex) {
+ return this.ANY_NUMBER;
+ }
+ if (typeof arg === "object" && !regex) {
+ return this.ANY_OBJECT;
+ }
+ if (typeof arg === "function" && !regex) {
+ return this.ANY_FUNCTION;
+ }
+ if (typeof arg === "string" && regex) {
+ return regex.test(arg);
+ }
+ return null;
+ }
+ matcheStubKey(key) {
+ if (key === ArgumentMatchers.any) {
+ return this.ANY;
+ }
+ if (key === ArgumentMatchers.anyString) {
+ return this.ANY_STRING;
+ }
+ if (key === ArgumentMatchers.anyBoolean) {
+ return this.ANY_BOOLEAN;
+ }
+ if (key === ArgumentMatchers.anyNumber) {
+ return this.ANY_NUMBER;
+ }
+ if (key === ArgumentMatchers.anyObj) {
+ return this.ANY_OBJECT;
+ }
+ if (key === ArgumentMatchers.anyFunction) {
+ return this.ANY_FUNCTION;
+ }
+ if (ArgumentMatchers.isRegExp(key)) {
+ return key;
+ }
+ return null;
+ }
+}
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/ArgumentMatchers.ts b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/ArgumentMatchers.ts
new file mode 100644
index 0000000000000000000000000000000000000000..262bea1afbeb611029db0cfaeb65767b92f97b91
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/ArgumentMatchers.ts
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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.
+ */
+
+export class ArgumentMatchers {
+ ANY = "";
+ ANY_STRING = "";
+ ANY_BOOLEAN = "";
+ ANY_NUMBER = "";
+ ANY_OBJECT = "";
+ ANY_FUNCTION = "";
+ MATCH_REGEXS = "";
+
+ static any() {
+ }
+
+ static anyString() {
+ }
+
+ static anyBoolean() {
+ }
+
+ static anyNumber() {
+ }
+
+ static anyObj() {
+ }
+
+ static anyFunction() {
+ }
+
+ static matchRegexs(regex: any) {
+ if (ArgumentMatchers.isRegExp(regex)) {
+ return regex;
+ }
+ throw Error("not a regex");
+ }
+
+ static isRegExp(value: string) {
+ return Object.prototype.toString.call(value) === "[object RegExp]";
+ }
+
+ matcheReturnKey(...args: Array) {
+ let arg = args[0];
+ let regex = args[1];
+ let stubSetKey = args[2];
+
+ if (stubSetKey && stubSetKey == this.ANY) {
+ return this.ANY;
+ }
+
+ if (typeof arg === "string" && !regex) {
+ return this.ANY_STRING;
+ }
+
+ if (typeof arg === "boolean" && !regex) {
+ return this.ANY_BOOLEAN;
+ }
+
+ if (typeof arg === "number" && !regex) {
+ return this.ANY_NUMBER;
+ }
+
+ if (typeof arg === "object" && !regex) {
+ return this.ANY_OBJECT;
+ }
+
+ if (typeof arg === "function" && !regex) {
+ return this.ANY_FUNCTION;
+ }
+
+ if (typeof arg === "string" && regex) {
+ return regex.test(arg);
+ }
+
+ return null;
+ }
+
+ matcheStubKey(key: any) {
+
+ if (key === ArgumentMatchers.any) {
+ return this.ANY;
+ }
+
+ if (key === ArgumentMatchers.anyString) {
+ return this.ANY_STRING;
+ }
+ if (key === ArgumentMatchers.anyBoolean) {
+ return this.ANY_BOOLEAN;
+ }
+ if (key === ArgumentMatchers.anyNumber) {
+ return this.ANY_NUMBER;
+ }
+ if (key === ArgumentMatchers.anyObj) {
+ return this.ANY_OBJECT;
+ }
+ if (key === ArgumentMatchers.anyFunction) {
+ return this.ANY_FUNCTION;
+ }
+
+ if (ArgumentMatchers.isRegExp(key)) {
+ return key;
+ }
+
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/ExtendInterface.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/ExtendInterface.js
new file mode 100644
index 0000000000000000000000000000000000000000..52f9dff07f7b719900ca47d56c3020586db31d5b
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/ExtendInterface.js
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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.
+ */
+class ExtendInterface {
+ constructor(mocker) {
+ this.mocker = mocker;
+ }
+ stub() {
+ this.params = arguments;
+ return this;
+ }
+ stubMockedCall(returnInfo) {
+ this.mocker.stubApply(this, this.params, returnInfo);
+ }
+ afterReturn(value) {
+ this.stubMockedCall(function () {
+ return value;
+ });
+ }
+ afterReturnNothing() {
+ this.stubMockedCall(function () {
+ return undefined;
+ });
+ }
+ afterAction(action) {
+ this.stubMockedCall(action);
+ }
+ afterThrow(msg) {
+ this.stubMockedCall(function () {
+ throw msg;
+ });
+ }
+ clear(obj) {
+ this.mocker.clear(obj);
+ }
+}
+export default ExtendInterface;
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/ExtendInterface.ts b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/ExtendInterface.ts
new file mode 100644
index 0000000000000000000000000000000000000000..55f7a0b36bc2895e17a2e6b32a6c1980853cbce9
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/ExtendInterface.ts
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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 { MockKit } from "./MockKit.js";
+
+class ExtendInterface {
+
+ private mocker: MockKit
+ private params: any
+
+ constructor(mocker: MockKit) {
+ this.mocker = mocker;
+ }
+
+ stub() {
+ this.params = arguments;
+ return this;
+ }
+
+ stubMockedCall(returnInfo: any) {
+ this.mocker.stubApply(this, this.params, returnInfo);
+ }
+
+ afterReturn(value: any) {
+ this.stubMockedCall(function () {
+ return value;
+ });
+ }
+
+ afterReturnNothing() {
+ this.stubMockedCall(function () {
+ return undefined;
+ });
+ }
+
+ afterAction(action: Function) {
+ this.stubMockedCall(action);
+ }
+
+ afterThrow(msg: string) {
+ this.stubMockedCall(function () {
+ throw msg;
+ });
+ }
+
+ clear(obj?: any) {
+ this.mocker.clear(obj);
+ }
+}
+
+export default ExtendInterface;
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/MockKit.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/MockKit.js
new file mode 100644
index 0000000000000000000000000000000000000000..c1ca51614abe9f9c149094f5186eeb750b00a074
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/MockKit.js
@@ -0,0 +1,253 @@
+/*
+ * Copyright (c) 2022-2023 Huawei Device 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 ExtendInterface from "./ExtendInterface.js";
+import VerificationMode from "./VerificationMode.js";
+import { ArgumentMatchers } from "./ArgumentMatchers.js";
+class MockKit {
+ constructor() {
+ this.mFunctions = [];
+ this.stubs = new Map();
+ this.recordCalls = new Map();
+ this.currentSetKey = new Map();
+ this.mockObj = null;
+ this.recordMockedMethod = new Map();
+ this.mFunctions = [];
+ this.stubs = new Map();
+ this.recordCalls = new Map();
+ this.currentSetKey = new Map();
+ this.mockObj = null;
+ this.recordMockedMethod = new Map();
+ }
+ init() {
+ this.reset();
+ }
+ reset() {
+ this.mFunctions = [];
+ this.stubs = new Map();
+ this.recordCalls = new Map();
+ this.currentSetKey = new Map();
+ this.mockObj = null;
+ this.recordMockedMethod = new Map();
+ }
+ clearAll() {
+ this.reset();
+ }
+ clear(obj) {
+ if (!obj) throw Error("Please enter an object to be cleaned");
+ if (typeof (obj) !== 'object' && typeof (obj) !== 'function') throw new Error('Not a object or static class');
+ this.recordMockedMethod.forEach(function (value, key, map) {
+ if (key) {
+ obj[key] = value;
+ }
+ });
+ }
+ ignoreMock(obj, method) {
+ if (typeof (obj) !== 'object' && typeof (obj) !== 'function') throw new Error('Not a object or static class');
+ if (typeof (method) !== 'function') throw new Error('Not a function');
+ let og = this.recordMockedMethod.get(method.propName);
+ if (og) {
+ obj[method.propName] = og;
+ this.recordMockedMethod.set(method.propName, undefined);
+ }
+ }
+ extend(dest, source) {
+ dest["stub"] = source["stub"];
+ dest["afterReturn"] = source["afterReturn"];
+ dest["afterReturnNothing"] = source["afterReturnNothing"];
+ dest["afterAction"] = source["afterAction"];
+ dest["afterThrow"] = source["afterThrow"];
+ dest["stubMockedCall"] = source["stubMockedCall"];
+ dest["clear"] = source["clear"];
+ return dest;
+ }
+ stubApply(f, params, returnInfo) {
+ let values = this.stubs.get(f);
+ if (!values) {
+ values = new Map();
+ }
+ let key = params[0];
+ if (typeof key === "undefined") {
+ key = "anonymous-mock-" + f.propName;
+ }
+ let matcher = new ArgumentMatchers();
+ if (matcher.matcheStubKey(key)) {
+ key = matcher.matcheStubKey(key);
+ if (key) {
+ this.currentSetKey.set(f, key);
+ }
+ }
+ values.set(key, returnInfo);
+ this.stubs.set(f, values);
+ }
+ getReturnInfo(f, params) {
+ let values = this.stubs.get(f);
+ if (!values) {
+ return undefined;
+ }
+ let retrunKet = params[0];
+ if (typeof retrunKet === "undefined") {
+ retrunKet = "anonymous-mock-" + f.propName;
+ }
+ let stubSetKey = this.currentSetKey.get(f);
+
+ if (stubSetKey && (typeof (retrunKet) !== "undefined")) {
+ retrunKet = stubSetKey;
+ }
+ let matcher = new ArgumentMatchers();
+ if (matcher.matcheReturnKey(params[0], undefined, stubSetKey) && matcher.matcheReturnKey(params[0], undefined, stubSetKey) !== stubSetKey) {
+ retrunKet = params[0];
+ }
+ values.forEach(function (value, key, map) {
+ if (ArgumentMatchers.isRegExp(key) && matcher.matcheReturnKey(params[0], key)) {
+ retrunKet = key;
+ }
+ });
+ return values.get(retrunKet);
+ }
+ findName(obj, value) {
+ let properties = this.findProperties(obj);
+ let name = '';
+ properties.filter((item) => (item !== 'caller' && item !== 'arguments')).forEach(function (va1, idx, array) {
+ if (obj[va1] === value) {
+ name = va1;
+ }
+ });
+ return name;
+ }
+ isFunctionFromPrototype(f, container, propName) {
+ if (container.constructor !== Object && container.constructor.prototype !== container) {
+ return container.constructor.prototype[propName] === f;
+ }
+ return false;
+ }
+ findProperties(obj, ...arg) {
+ function getProperty(new_obj) {
+ if (new_obj.__proto__ === null) {
+ return [];
+ }
+ let properties = Object.getOwnPropertyNames(new_obj);
+ return [...properties, ...getProperty(new_obj.__proto__)];
+ }
+ return getProperty(obj);
+ }
+ recordMethodCall(originalMethod, args) {
+ originalMethod['getName'] = function () {
+ return this.name || this.toString().match(/function\s*([^(]*)\(/)[1];
+ };
+ let name = originalMethod.getName();
+ let arglistString = name + '(' + Array.from(args).toString() + ')';
+ let records = this.recordCalls.get(arglistString);
+ if (!records) {
+ records = 0;
+ }
+ records++;
+ this.recordCalls.set(arglistString, records);
+ }
+ mockFunc(originalObject, originalMethod) {
+ let tmp = this;
+ this.originalMethod = originalMethod;
+ const _this = this;
+ let f = function () {
+ let args = arguments;
+ let action = tmp.getReturnInfo(f, args);
+ if (originalMethod) {
+ tmp.recordMethodCall(originalMethod, args);
+ }
+ if (action) {
+ return action.apply(_this, args);
+ }
+ };
+ f.container = null || originalObject;
+ f.original = originalMethod || null;
+ if (originalObject && originalMethod) {
+ if (typeof (originalMethod) != 'function')
+ throw new Error('Not a function');
+ var name = this.findName(originalObject, originalMethod);
+ originalObject[name] = f;
+ this.recordMockedMethod.set(name, originalMethod);
+ f.propName = name;
+ f.originalFromPrototype = this.isFunctionFromPrototype(f.original, originalObject, f.propName);
+ }
+ f.mocker = this;
+ this.mFunctions.push(f);
+ this.extend(f, new ExtendInterface(this));
+ return f;
+ }
+ verify(methodName, argsArray) {
+ if (!methodName) {
+ throw Error("not a function name");
+ }
+ let a = this.recordCalls.get(methodName + '(' + argsArray.toString() + ')');
+ return new VerificationMode(a ? a : 0);
+ }
+ mockObject(object) {
+ if (!object || typeof object === "string") {
+ throw Error(`this ${object} cannot be mocked`);
+ }
+ const _this = this;
+ let mockedObject = {};
+ let keys = Reflect.ownKeys(object);
+ keys.filter(key => (typeof Reflect.get(object, key)) === 'function')
+ .forEach((key) => {
+ mockedObject[key] = object[key];
+ mockedObject[key] = _this.mockFunc(mockedObject, mockedObject[key]);
+ });
+ return mockedObject;
+ }
+}
+function ifMockedFunction(f) {
+ if (Object.prototype.toString.call(f) != "[object Function]" &&
+ Object.prototype.toString.call(f) != "[object AsyncFunction]") {
+ throw Error("not a function");
+ }
+ if (!f.stub) {
+ throw Error("not a mock function");
+ }
+ return true;
+}
+function when(f) {
+ if (ifMockedFunction(f)) {
+ return f.stub.bind(f);
+ }
+}
+function MockSetup(target, propertyName, descriptor) {
+ const aboutToAppearOrigin = target.aboutToAppear;
+ const setup = descriptor.value;
+ target.aboutToAppear = function (...args) {
+ if (target.__Param) { // copy attributes and params of the original context
+ try {
+ const map = target.__Param;
+ for (const [key, val] of map) {
+ this[key] = val; // 'this' refers to context of current function
+ }
+ }
+ catch (e) {
+ throw new Error(`Mock setup param error: ${e}`);
+ }
+ }
+ if (setup) { // apply the mock content
+ try {
+ setup.apply(this);
+ }
+ catch (e) {
+ throw new Error(`Mock setup apply error: ${e}`);
+ }
+ }
+ if (aboutToAppearOrigin) { // append to aboutToAppear function of the original context
+ aboutToAppearOrigin.apply(this, args);
+ }
+ };
+}
+export { MockSetup, MockKit, when };
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/MockKit.ts b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/MockKit.ts
new file mode 100644
index 0000000000000000000000000000000000000000..2807643e29d6da16ee7061ce5674b696a4fc3ca6
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/MockKit.ts
@@ -0,0 +1,294 @@
+/*
+ * Copyright (c) 2023 Huawei Device 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 ExtendInterface from "./ExtendInterface.js";
+import VerificationMode from "./VerificationMode.js";
+import { ArgumentMatchers } from "./ArgumentMatchers.js";
+
+interface IFunction extends Function {
+ container: any;
+ original: any;
+ propName: string;
+ originalFromPrototype: boolean
+ mocker: MockKit
+}
+
+class MockKit {
+
+ private mFunctions:Array = [];
+ private stubs = new Map();
+ private recordCalls = new Map();
+ private currentSetKey = new Map();
+ private mockObj = null;
+ private recordMockedMethod = new Map();
+ private originalMethod: any;
+
+ constructor() {
+ this.mFunctions = [];
+ this.stubs = new Map();
+ this.recordCalls = new Map();
+ this.currentSetKey = new Map();
+ this.mockObj = null;
+ this.recordMockedMethod = new Map();
+ }
+
+ init() {
+ this.reset();
+ }
+
+ reset() {
+ this.mFunctions = [];
+ this.stubs = new Map()
+ this.recordCalls = new Map();
+ this.currentSetKey = new Map();
+ this.mockObj = null;
+ this.recordMockedMethod = new Map();
+ }
+
+ clearAll() {
+ this.reset();
+ }
+
+ clear(obj: any) {
+ if (!obj) throw Error("Please enter an object to be cleaned");
+ if (typeof (obj) != 'object') throw new Error('Not a object');
+ this.recordMockedMethod.forEach(function (value, key, map) {
+ if (key) {
+ obj[key] = value;
+ }
+ });
+ }
+
+ ignoreMock(obj:any, method: any) {
+ if (typeof (obj) != 'object') throw new Error('Not a object');
+ if (typeof (method) != 'function') throw new Error('Not a function');
+ let og = this.recordMockedMethod.get(method.propName);
+ if (og) {
+ obj[method.propName] = og;
+ this.recordMockedMethod.set(method.propName, undefined);
+ }
+ }
+
+ extend(dest: any, source:any) {
+ dest["stub"] = source["stub"];
+ dest["afterReturn"] = source["afterReturn"];
+ dest["afterReturnNothing"] = source["afterReturnNothing"];
+ dest["afterAction"] = source["afterAction"];
+ dest["afterThrow"] = source["afterThrow"];
+ dest["stubMockedCall"] = source["stubMockedCall"];
+ dest["clear"] = source["clear"];
+ return dest;
+ }
+
+ stubApply(f: any, params:any, returnInfo:any) {
+ let values = this.stubs.get(f);
+ if (!values) {
+ values = new Map();
+ }
+ let key = params[0];
+ if (typeof key == "undefined") {
+ key = "anonymous-mock-" + f.propName;
+ }
+ let matcher = new ArgumentMatchers();
+ if (matcher.matcheStubKey(key)) {
+ key = matcher.matcheStubKey(key);
+ if (key) {
+ this.currentSetKey.set(f, key);
+ }
+ }
+ values.set(key, returnInfo);
+ this.stubs.set(f, values);
+ }
+
+ getReturnInfo(f: any, params:any) {
+ let values = this.stubs.get(f);
+ if (!values) {
+ return undefined;
+ }
+ let retrunKet = params[0];
+ if (typeof retrunKet == "undefined") {
+ retrunKet = "anonymous-mock-" + f.propName;
+ }
+ let stubSetKey = this.currentSetKey.get(f);
+
+ if (stubSetKey && (typeof (retrunKet) != "undefined")) {
+ retrunKet = stubSetKey;
+ }
+ let matcher = new ArgumentMatchers();
+ if (matcher.matcheReturnKey(params[0], undefined, stubSetKey) && matcher.matcheReturnKey(params[0], undefined, stubSetKey) != stubSetKey) {
+ retrunKet = params[0];
+ }
+
+ values.forEach(function (value: any, key: any, map: any) {
+ if (ArgumentMatchers.isRegExp(key) && matcher.matcheReturnKey(params[0], key)) {
+ retrunKet = key;
+ }
+ });
+
+ return values.get(retrunKet);
+ }
+
+ findName(obj: any, value: any) {
+ let properties = this.findProperties(obj);
+ let name = '';
+ properties.filter((item:any) => (item !== 'caller' && item !== 'arguments')).forEach(
+ function (va1:any, idx:any, array:any) {
+ if (obj[va1] === value) {
+ name = va1;
+ }
+ }
+ );
+ return name;
+ }
+
+ isFunctionFromPrototype(f: Function, container:Function, propName: string) {
+ if (container.constructor != Object && container.constructor.prototype !== container) {
+ return container.constructor.prototype[propName] === f;
+ }
+ return false;
+ }
+
+ findProperties(obj: any, ...arg: Array) {
+ function getProperty(new_obj:any): Array {
+ if (new_obj.__proto__ === null) {
+ return [];
+ }
+ let properties = Object.getOwnPropertyNames(new_obj);
+ return [...properties, ...getProperty(new_obj.__proto__)];
+ }
+ return getProperty(obj);
+ }
+
+ recordMethodCall(originalMethod: any, args: any) {
+ originalMethod['getName'] = function () {
+ return this.name || this.toString().match(/function\s*([^(]*)\(/)[1];
+ }
+ let name = originalMethod.getName();
+ let arglistString = name + '(' + Array.from(args).toString() + ')';
+ let records = this.recordCalls.get(arglistString);
+ if (!records) {
+ records = 0;
+ }
+ records++;
+ this.recordCalls.set(arglistString, records);
+ }
+
+ mockFunc(originalObject:any, originalMethod:any) {
+ let tmp = this;
+ this.originalMethod = originalMethod;
+ const _this = this;
+ let f:any = function () {
+ let args = arguments;
+ let action = tmp.getReturnInfo(f, args);
+ if (originalMethod) {
+ tmp.recordMethodCall(originalMethod, args);
+ }
+ if (action) {
+ return action.apply(_this, args);
+ }
+ };
+
+ f.container = null || originalObject;
+ f.original = originalMethod || null;
+
+ if (originalObject && originalMethod) {
+ if (typeof (originalMethod) != 'function') throw new Error('Not a function');
+ var name = this.findName(originalObject, originalMethod);
+ originalObject[name] = f;
+ this.recordMockedMethod.set(name, originalMethod);
+ f.propName = name;
+ f.originalFromPrototype = this.isFunctionFromPrototype(f.original, originalObject, f.propName);
+ }
+ f.mocker = this;
+ this.mFunctions.push(f);
+ this.extend(f, new ExtendInterface(this));
+ return f;
+ }
+
+ verify(methodName:any, argsArray:any) {
+ if (!methodName) {
+ throw Error("not a function name");
+ }
+ let a = this.recordCalls.get(methodName + '(' + argsArray.toString() + ')');
+ return new VerificationMode(a ? a : 0);
+ }
+
+ mockObject(object: any) {
+ if (!object || typeof object === "string") {
+ throw Error(`this ${object} cannot be mocked`);
+ }
+ const _this = this;
+ let mockedObject:any = {};
+ let keys = Reflect.ownKeys(object);
+ keys.filter(key => (typeof Reflect.get(object, key)) === 'function')
+ .forEach((key:any) => {
+ mockedObject[key] = object[key];
+ mockedObject[key] = _this.mockFunc(mockedObject, mockedObject[key]);
+ });
+ return mockedObject;
+ }
+}
+
+function ifMockedFunction(f: any) {
+ if (Object.prototype.toString.call(f) != "[object Function]" &&
+ Object.prototype.toString.call(f) != "[object AsyncFunction]") {
+ throw Error("not a function");
+ }
+ if (!f.stub) {
+ throw Error("not a mock function");
+ }
+ return true;
+}
+
+function when(f: any) {
+ if (ifMockedFunction(f)) {
+ return f.stub.bind(f);
+ }
+}
+
+function MockSetup(target: Object, propertyName: string | Symbol, descriptor: TypedPropertyDescriptor<() => void>): void {
+ const aboutToAppearOrigin = target.aboutToAppear;
+ const setup = descriptor.value;
+ target.aboutToAppear = function (...args: any[]) {
+ if (target.__Param) { // copy attributes and params of the original context
+ try {
+ const map = target.__Param as Map;
+ for (const [key, val] of map) {
+ this[key] = val; // 'this' refers to context of current function
+ }
+ } catch (e) {
+ throw new Error(`Mock setup param error: ${e}`);
+ }
+ }
+
+ if (setup) { // apply the mock content
+ try {
+ setup.apply(this);
+ } catch (e) {
+ throw new Error(`Mock setup apply error: ${e}`);
+ }
+ }
+
+ if (aboutToAppearOrigin) { // append to aboutToAppear function of the original context
+ aboutToAppearOrigin.apply(this, args);
+ }
+ }
+}
+
+export {
+ MockSetup,
+ MockKit,
+ when
+};
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/VerificationMode.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/VerificationMode.js
new file mode 100644
index 0000000000000000000000000000000000000000..21e10fb8037f59475510b2821fcf7432c9459a4a
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/VerificationMode.js
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2022-2023 Huawei Device 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.
+ */
+class VerificationMode {
+ constructor(times) {
+ this.doTimes = times;
+ }
+ times(count) {
+ if (count !== this.doTimes) {
+ throw Error(`expect ${count} actual ${this.doTimes}`);
+ }
+ }
+ never() {
+ if (this.doTimes !== 0) {
+ throw Error(`expect 0 actual ${this.doTimes}`);
+ }
+ }
+ once() {
+ if (this.doTimes !== 1) {
+ throw Error(`expect 1 actual ${this.doTimes}`);
+ }
+ }
+ atLeast(count) {
+ if (count > this.doTimes) {
+ throw Error('failed ' + count + ' greater than the actual execution times of method');
+ }
+ }
+ atMost(count) {
+ if (count < this.doTimes) {
+ throw Error('failed ' + count + ' less than the actual execution times of method');
+ }
+ }
+}
+export default VerificationMode;
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/VerificationMode.ts b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/VerificationMode.ts
new file mode 100644
index 0000000000000000000000000000000000000000..93d976ce73b2fbde199d31b3efd30eb3544179d8
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/VerificationMode.ts
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2022-2023 Huawei Device 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.
+ */
+
+
+class VerificationMode {
+
+ private doTimes: number
+
+ constructor(times: number) {
+ this.doTimes = times;
+ }
+
+ times(count: number) {
+ if(count !== this.doTimes) {
+ throw Error(`expect ${count} actual ${this.doTimes}`);
+ }
+ }
+
+ never() {
+ if (this.doTimes !== 0) {
+ throw Error(`expect 0 actual ${this.doTimes}`);
+ }
+ }
+
+ once() {
+ if (this.doTimes !== 1) {
+ throw Error(`expect 1 actual ${this.doTimes}`);
+ }
+ }
+
+ atLeast(count: number) {
+ if (count > this.doTimes) {
+ throw Error('failed ' + count + ' greater than the actual execution times of method');
+ }
+ }
+
+ atMost(count: number) {
+ if (count < this.doTimes) {
+ throw Error('failed ' + count + ' less than the actual execution times of method');
+ }
+ }
+}
+
+export default VerificationMode;
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/module.json b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/module.json
new file mode 100644
index 0000000000000000000000000000000000000000..384ae72f9bd2353fea8a5c9c5d6696ab5e67cb21
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/module.json
@@ -0,0 +1,22 @@
+{
+ "app": {
+ "bundleName": "com.example.hamock",
+ "debug": true,
+ "versionCode": 1000000,
+ "versionName": "1.0.0",
+ "minAPIVersion": 9,
+ "targetAPIVersion": 9,
+ "apiReleaseType": "Release"
+ },
+ "module": {
+ "name": "hamock",
+ "type": "har",
+ "deviceTypes": [
+ "default",
+ "tablet",
+ "tv",
+ "wearable",
+ "car"
+ ]
+ }
+}
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/res/schemas/mock-config-json5-schema.json b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/res/schemas/mock-config-json5-schema.json
new file mode 100644
index 0000000000000000000000000000000000000000..96036325a316d827cb9fcb6908b3de23c53b4b79
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/res/schemas/mock-config-json5-schema.json
@@ -0,0 +1,25 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "title": "JSON schema for mock-config.json5 file",
+ "definitions": {
+ "sourceRedirection": {
+ "description": "A source redirection for mocked module.",
+ "type": "object",
+ "required": [
+ "source"
+ ],
+ "properties": {
+ "source": {
+ "type": "string",
+ "maxLength": 128,
+ "minLength": 1
+ }
+ }
+ }
+ },
+ "patternProperties": {
+ ".+": {
+ "$ref": "#/definitions/sourceRedirection"
+ }
+ }
+}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/BuildProfile.ets b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/BuildProfile.ets
new file mode 100644
index 0000000000000000000000000000000000000000..e84ee338f70bbfe5512c648fc7cc88b019557243
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/BuildProfile.ets
@@ -0,0 +1,5 @@
+export default class BuildProfile {
+ static readonly HAR_VERSION = '1.0.18';
+ static readonly BUILD_MODE_NAME = 'debug';
+ static readonly DEBUG = true;
+}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/CHANGELOG.md b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/CHANGELOG.md
new file mode 100644
index 0000000000000000000000000000000000000000..b7e0113af1ceafe3ba8abc35ecf69aa9746088be
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/CHANGELOG.md
@@ -0,0 +1,18 @@
+## 1.0.14
+- 堆栈信息打印到cmd
+## 1.0.15
+- 支持获取测试代码的失败堆栈信息
+- mock代码迁移至harmock包
+- 适配arkts语法
+- 修复覆盖率数据容易截断的bug
+## 1.0.16
+- 修改覆盖率文件生成功能
+- 修改静态方法无法ignoreMock函数
+- ## 1.0.17
+- 修改not断言失败提示日志
+- 自定义错误message信息
+- 添加xdescribe, xit API功能
+- ## 1.0.18
+- 添加全局变量存储API get set
+- 自定义断言功能
+
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/LICENSE b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..4947287f7b5ccb5d1e8b7b2d3aa5d89f322c160d
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/README.md b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..50cdf9dc5e11bba059f2147354273225bd3781b0
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/README.md
@@ -0,0 +1,220 @@
+
Hypium
+
A unit test framework for OpenHarmonyOS application
+
+## Hypium是什么?
+***
+- Hypium是OpenHarmony上的测试框架,提供测试用例编写、执行、结果显示能力,用于OpenHarmony系统应用接口以及应用界面测试。
+- Hypium结构化模型:hypium工程主要由List.test.js与TestCase.test.js组成。
+```
+rootProject // Hypium工程根目录
+├── moduleA
+│ ├── src
+│ ├── main // 被测试应用目录
+│ ├── ohosTest // 测试用例目录
+│ ├── js/ets
+│ └── test
+│ └── List.test.js // 测试用例加载脚本,ets目录下为.ets后缀
+│ └── TestCase.test.js // 测试用例脚本,ets目录下为.ets后缀
+└── moduleB
+ ...
+│ └── List.test.js // 测试用例加载脚本,ets目录下为.ets后缀
+│ └── TestCase.test.js // 测试用例脚本,ets目录下为.ets后缀
+```
+
+## 安装使用
+***
+- 在DevEco Studio内使用Hypium
+- 工程级package.json内配置:
+```json
+"dependencies": {
+ "@ohos/hypium": "1.0.18"
+}
+```
+注:
+hypium服务于OpenHarmonyOS应用对外接口测试、系统对外接口测试(SDK中接口),完成HAP自动化测试。详细指导:
+[Deveco Studio](https://developer.harmonyos.com/cn/develop/deveco-studio)
+
+#### 通用语法
+
+- 测试用例采用业内通用语法,describe代表一个测试套, it代表一条用例。
+
+| No. | API | 功能说明 |
+|-----| ---------- | ---------------------------------------------------------------------------------------------------------------------- |
+| 1 | describe | 定义一个测试套,支持两个参数:测试套名称和测试套函数 |
+| 2 | beforeAll | 在测试套内定义一个预置条件,在所有测试用例开始前执行且仅执行一次,支持一个参数:预置动作函数 |
+| 3 | beforeEach | 在测试套内定义一个单元预置条件,在每条测试用例开始前执行,执行次数与it定义的测试用例数一致,支持一个参数:预置动作函数 |
+| 4 | afterEach | 在测试套内定义一个单元清理条件,在每条测试用例结束后执行,执行次数与it定义的测试用例数一致,支持一个参数:清理动作函数 |
+| 5 | afterAll | 在测试套内定义一个清理条件,在所有测试用例结束后执行且仅执行一次,支持一个参数:清理动作函数 |
+| 6 | it | 定义一条测试用例,支持三个参数:用例名称,过滤参数和用例函数 |
+| 7 | expect | 支持bool类型判断等多种断言方法 |
+| 8 | xdescribe | @since1.0.17定义一个跳过的测试套,支持两个参数:测试套名称和测试套函数。 |
+| 9 | xit | @since1.0.17定义一条跳过的测试用例,支持三个参数:用例名称,过滤参数和用例函数。 |
+#### 断言库
+
+- 示例代码:
+
+```javascript
+ expect(${actualvalue}).assertX(${expectvalue})
+```
+
+- 断言功能列表:
+
+| No. | API | 功能说明 |
+| :--- | :------------------------------- | ---------------------------------------------------------------------------------------------- |
+| 1 | assertClose | 检验actualvalue和expectvalue(0)的接近程度是否是expectValue(1) |
+| 2 | assertContain | 检验actualvalue中是否包含expectvalue |
+| 3 | assertDeepEquals | @since1.0.4 检验actualvalue和expectvalue(0)是否是同一个对象 |
+| 4 | assertEqual | 检验actualvalue是否等于expectvalue[0] |
+| 5 | assertFail | 抛出一个错误 |
+| 6 | assertFalse | 检验actualvalue是否是false |
+| 7 | assertTrue | 检验actualvalue是否是true |
+| 8 | assertInstanceOf | 检验actualvalue是否是expectvalue类型 |
+| 9 | assertLarger | 检验actualvalue是否大于expectvalue |
+| 10 | assertLess | 检验actualvalue是否小于expectvalue |
+| 11 | assertNaN | @since1.0.4 检验actualvalue是否是NaN |
+| 12 | assertNegUnlimited | @since1.0.4 检验actualvalue是否等于Number.NEGATIVE_INFINITY |
+| 13 | assertNull | 检验actualvalue是否是null |
+| 14 | assertPosUnlimited | @since1.0.4 检验actualvalue是否等于Number.POSITIVE_INFINITY |
+| 15 | assertPromiseIsPending | @since1.0.4 检验actualvalue是否处于Pending状态【actualvalue为promse对象】 |
+| 16 | assertPromiseIsRejected | @since1.0.4 检验actualvalue是否处于Rejected状态【同15】 |
+| 17 | assertPromiseIsRejectedWith | @since1.0.4 检验actualvalue是否处于Rejected状态,并且比较执行的结果值【同15】 |
+| 18 | assertPromiseIsRejectedWithError | @since1.0.4 检验actualvalue是否处于Rejected状态并有异常,同时比较异常的类型和message值【同15】 |
+| 19 | assertPromiseIsResolved | @since1.0.4 检验actualvalue是否处于Resolved状态【同15】 |
+| 20 | assertPromiseIsResolvedWith | @since1.0.4 检验actualvalue是否处于Resolved状态,并且比较执行的结果值【同15】 |
+| 21 | assertThrowError | 检验actualvalue抛出Error内容是否是expectValue |
+| 22 | assertUndefined | 检验actualvalue是否是undefined |
+| 23 | not | @since1.0.4 断言结果取反 |
+| 24 | message | @since1.0.17自定义断言异常信息 |
+
+示例代码:
+
+```javascript
+ import { describe, it, expect } from '@ohos/hypium';
+
+ export default async function assertCloseTest() {
+ describe('assertClose', function () {
+ it('assertClose_success', 0, function () {
+ let a = 100;
+ let b = 0.1;
+ expect(a).assertClose(99, b);
+ })
+ })
+ }
+```
+
+#### 公共系统能力
+
+| No. | API | 功能描述 |
+| ---- | ------------------------------------------------------- | ------------------------------------------------------------ |
+| 1 | existKeyword(keyword: string, timeout: number): boolean | @since1.0.3 hilog日志中查找指定字段是否存在,keyword是待查找关键字,timeout为设置的查找时间 |
+| 2 | actionStart(tag: string): void | @since1.0.3 cmd窗口输出开始tag |
+| 3 | actionEnd(tag: string): void | @since1.0.3 cmd窗口输出结束tag |
+
+示例代码:
+
+```javascript
+import { describe, it, expect, SysTestKit} from '@ohos/hypium';
+
+export default function existKeywordTest() {
+ describe('existKeywordTest', function () {
+ it('existKeyword',DEFAULT, async function () {
+ console.info("HelloTest");
+ let isExist = await SysTestKit.existKeyword('HelloTest');
+ console.info('isExist ------>' + isExist);
+ })
+ })
+}
+```
+```javascript
+import { describe, it, expect, SysTestKit} from '@ohos/hypium';
+
+export default function actionTest() {
+ describe('actionTest', function () {
+ it('existKeyword',DEFAULT, async function () {
+ let tag = '[MyTest]';
+ SysTestKit.actionStart(tag);
+ //do something
+ SysTestKit.actionEnd(tag);
+ })
+ })
+}
+```
+
+#### 专项能力
+
+- 测试用例属性筛选能力:hypium支持根据用例属性筛选执行指定测试用例,使用方式是先在测试用例上标记用例属性后,再在测试应用的启动shell命令后新增" -s ${Key} ${Value}"。
+
+| Key | 含义说明 | Value取值范围 |
+| -------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
+| level | 用例级别 | "0","1","2","3","4", 例如:-s level 1 |
+| size | 用例粒度 | "small","medium","large", 例如:-s size small |
+| testType | 用例测试类型 | "function","performance","power","reliability","security","global","compatibility","user","standard","safety","resilience", 例如:-s testType function |
+
+示例代码
+
+```javascript
+import { describe, it, expect, TestType, Size, Level } from '@ohos/hypium';
+
+export default function attributeTest() {
+ describe('attributeTest', function () {
+ it("testAttributeIt", TestType.FUNCTION | Size.SMALLTEST | Level.LEVEL0, function () {
+ console.info('Hello Test');
+ })
+ })
+}
+```
+
+示例命令
+```shell
+XX -s level 1 -s size small -s testType function
+```
+该命令的作用是:筛选测试应用中同时满足a)用例级别是1 b)用例粒度是small c)用例测试类型是function 三个条件的用例执行。
+
+- 测试套/测试用例名称筛选能力(测试套与用例名称用“#”号连接,多个用“,”英文逗号分隔)
+
+| Key | 含义说明 | Value取值范围 |
+| -------- | ----------------------- | -------------------------------------------------------------------------------------------- |
+| class | 指定要执行的测试套&用例 | ${describeName}#${itName},${describeName} , 例如:-s class attributeTest#testAttributeIt |
+| notClass | 指定不执行的测试套&用例 | ${describeName}#${itName},${describeName} , 例如:-s notClass attributeTest#testAttributeIt |
+
+示例命令
+```shell
+XX -s class attributeTest#testAttributeIt,abilityTest#testAbilityIt
+```
+该命令的作用是:筛选测试应用中attributeTest测试套下的testAttributeIt测试用例,abilityTest测试套下的testAbilityIt测试用例,只执行这两条用例。
+
+- 其他能力
+
+| 能力项 | Key | 含义说明 | Value取值范围 |
+| ------------ | ------- | ---------------------------- | ---------------------------------------------- |
+| 随机执行能力 | random | 测试套&测试用例随机执行 | true, 不传参默认为false, 例如:-s random true |
+| 空跑能力 | dryRun | 显示要执行的测试用例信息全集 | true , 不传参默认为false,例如:-s dryRun true |
+| 异步超时能力 | timeout | 异步用例执行的超时时间 | 正整数 , 单位ms,例如:-s timeout 5000 |
+
+##### 约束限制
+随机执行能力和空跑能力从npm包1.0.3版本开始支持
+
+#### Mock能力
+
+##### 约束限制
+
+单元测试框架Mock能力从npm包[1.0.1版本](https://repo.harmonyos.com/#/cn/application/atomService/@ohos%2Fhypium/v/1.0.1)开始支持
+
+## 约束
+
+***
+ 本模块首批接口从OpenHarmony SDK API version 8开始支持。
+
+## Hypium开放能力隐私声明
+
+- 我们如何收集和使用您的个人信息
+ 您在使用集成了Hypium开放能力的测试应用时,Hypium不会处理您的个人信息。
+- SDK处理的个人信息
+ 不涉及。
+- SDK集成第三方服务声明
+ 不涉及。
+- SDK数据安全保护
+ 不涉及。
+- SDK版本更新声明
+ 为了向您提供最新的服务,我们会不时更新Hypium版本。我们强烈建议开发者集成使用最新版本的Hypium。
+
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/build-profile.json5 b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..312d38eb08629793b3484c7373213f22840c8d82
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/build-profile.json5
@@ -0,0 +1,28 @@
+{
+ "apiType": "stageMode",
+ "buildOption": {
+ },
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": true,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ },
+ "consumerFiles": [
+ "./consumer-rules.txt"
+ ]
+ }
+ },
+ },
+ ],
+ "targets": [
+ {
+ "name": "default"
+ }
+ ]
+}
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/hvigorfile.ts b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..42187071482d292588ad40babeda74f7b8d97a23
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/hvigorfile.ts
@@ -0,0 +1,6 @@
+import { harTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/index.d.ts b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/index.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..54fc0420f7b872b8ffd6f9e6c3623e32be6ff606
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/index.d.ts
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2021-2024 Huawei Device 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.
+ */
+
+export const DEFAULT = 0B0000
+
+export const when: when;
+
+export enum TestType {
+ FUNCTION = 0B1,
+ PERFORMANCE = 0B1 << 1,
+ POWER = 0B1 << 2,
+ RELIABILITY = 0B1 << 3,
+ SECURITY = 0B1 << 4,
+ GLOBAL = 0B1 << 5,
+ COMPATIBILITY = 0B1 << 6,
+ USER = 0B1 << 7,
+ STANDARD = 0B1 << 8,
+ SAFETY = 0B1 << 9,
+ RESILIENCE = 0B1 << 10
+}
+
+export enum Size {
+ SMALLTEST = 0B1 << 16,
+ MEDIUMTEST = 0B1 << 17,
+ LARGETEST = 0B1 << 18
+}
+
+export enum Level {
+ LEVEL0 = 0B1 << 24,
+ LEVEL1 = 0B1 << 25,
+ LEVEL2 = 0B1 << 26,
+ LEVEL3 = 0B1 << 27,
+ LEVEL4 = 0B1 << 28
+}
+export { xdescribe, xit, describe, it } from './index';
+
+
+
+export function beforeItSpecified(testCaseNames: Array | string, callback: Function): void
+
+export function afterItSpecified(testCaseNames: Array | string, callback: Function): void
+
+export function beforeEach(callback: Function): void
+
+export function afterEach(callback: Function): void
+
+export function beforeAll(callback: Function): void
+
+export function afterAll(callback: Function): void
+
+
+export interface Assert {
+ assertClose(expectValue: number, precision: number): void
+ assertContain(expectValue: any): void
+ assertEqual(expectValue: any): void
+ assertFail(): void
+ assertFalse(): void
+ assertTrue(): void
+ assertInstanceOf(expectValue: string): void
+ assertLarger(expectValue: number): void
+ assertLess(expectValue: number): void
+ assertNull(): void
+ assertThrowError(expectValue: string): void
+ assertUndefined(): void
+ assertLargerOrEqual(expectValue: number): void
+ assertLessOrEqual(expectValue: number): void
+ assertNaN(): void
+ assertNegUnlimited(): void
+ assertPosUnlimited(): void
+ not(): Assert;
+ assertDeepEquals(expectValue: any): void
+ assertPromiseIsPending(): void
+ assertPromiseIsRejected(): void
+ assertPromiseIsRejectedWith(expectValue?: any): void
+ assertPromiseIsRejectedWithError(...expectValue): void
+ assertPromiseIsResolved(): void
+ assertPromiseIsResolvedWith(expectValue?: any): void
+ message(msg: string): Assert
+}
+
+export function expect(actualValue?: any): Assert
+
+export class ArgumentMatchers {
+ static any;
+ static anyString;
+ static anyBoolean;
+ static anyNumber;
+ static anyObj;
+ static anyFunction;
+ static matchRegexs(Regex: RegExp): void
+}
+
+declare interface when {
+ afterReturn(value: any): any
+ afterReturnNothing(): undefined
+ afterAction(action: any): any
+ afterThrow(e_msg: string): string
+ (argMatchers?: any): when;
+}
+
+export interface VerificationMode {
+ times(count: Number): void
+ never(): void
+ once(): void
+ atLeast(count: Number): void
+ atMost(count: Number): void
+}
+
+export class MockKit {
+ constructor()
+ mockFunc(obj: Object, func: Function): Function
+ mockObject(obj: Object): Object
+ verify(methodName: String, argsArray: Array): VerificationMode
+ ignoreMock(obj: Object, func: Function): void
+ clear(obj: Object): void
+ clearAll(): void
+}
+
+export class SysTestKit {
+ static getDescribeName(): string;
+ static getItName(): string;
+ static getItAttribute(): TestType | Size | Level
+ static actionStart(tag: string): void
+ static actionEnd(tag: string): void
+ static existKeyword(keyword: string, timeout?: number): boolean
+}
+
+export class Hypium {
+ static setData(data: { [key: string]: any }): void
+ static setTimeConfig(systemTime: any)
+ static hypiumTest(abilityDelegator: any, abilityDelegatorArguments: any, testsuite: Function): void
+ static set(key: string, value: any): void
+ static get(key: string): any
+ static registerAssert(customAssertion: Function): void
+ static unregisterAssert(customAssertion: string | Function): void
+}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/index.ets b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..1a9b707e35e58e5819594321bac6e36997a90713
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/index.ets
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2021-2024 Huawei Device 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 Core from './src/main/core';
+import {TestType, Size, Level, DEFAULT} from './src/main/Constant';
+import DataDriver from './src/main/module/config/DataDriver';
+import ExpectExtend from './src/main/module/assert/ExpectExtend';
+import OhReport from './src/main/module/report/OhReport';
+export { xdescribe, xit, describe, it } from './index.ts';
+
+export declare class Hypium {
+ static setData(data: Object): void
+ static setTimeConfig(systemTime: Object): void
+ static hypiumTest(abilityDelegator: Object, abilityDelegatorArguments: Object, testsuite: Function): void
+ static set(key: string, value: Object): void
+ static get(key: string): Object
+ static registerAssert(customAssertion: Function): void
+ static unregisterAssert(customAssertion: string | Function): void
+}
+
+export {
+ Core,
+ DataDriver,
+ ExpectExtend,
+ OhReport,
+ TestType,
+ Size,
+ Level,
+ DEFAULT
+};
+
+type allExpectType = Object | undefined | null
+
+export declare function beforeItSpecified(testCaseNames: Array | string, callback: Function): void
+
+export declare function afterItSpecified(testCaseNames: Array | string, callback: Function): void
+
+export declare function beforeEach(callback: Function): void
+
+export declare function afterEach(callback: Function): void
+
+export declare function beforeAll(callback: Function): void
+
+export declare function afterAll(callback: Function): void
+
+export declare interface Assert {
+ assertClose(expectValue: number, precision: number): void
+ assertContain(expectValue: allExpectType): void
+ assertEqual(expectValue: allExpectType): void
+ assertFail(): void
+ assertFalse(): void
+ assertTrue(): void
+ assertInstanceOf(expectValue: string): void
+ assertLarger(expectValue: number): void
+ assertLess(expectValue: number): void
+ assertNull(): void
+ assertThrowError(expectValue: string): void
+ assertUndefined(): void
+ assertLargerOrEqual(expectValue: number):void
+ assertLessOrEqual(expectValue: number):void
+ assertNaN():void
+ assertNegUnlimited(): void
+ assertPosUnlimited(): void
+ not(): Assert;
+ assertDeepEquals(expectValue: allExpectType):void
+ assertPromiseIsPending(): void
+ assertPromiseIsRejected(): void
+ assertPromiseIsRejectedWith(expectValue?: allExpectType): void
+ assertPromiseIsRejectedWithError(...expectValue: allExpectType[]): void
+ assertPromiseIsResolved(): void
+ assertPromiseIsResolvedWith(expectValue?: allExpectType): void
+ message(msg: string): Assert
+}
+
+export declare function expect(actualValue?: allExpectType): Assert
+
+export declare class ArgumentMatchers {
+ static any: allExpectType;
+ static anyString: string;
+ static anyBoolean: Boolean;
+ static anyNumber: Number;
+ static anyObj: Object;
+ static anyFunction: Function;
+ static matchRegexs(Regex: RegExp): void
+}
+
+declare interface whenResult {
+ afterReturn: (value: allExpectType) => allExpectType
+ afterReturnNothing: () => undefined
+ afterAction: (action: allExpectType) => allExpectType
+ afterThrow: (e_msg: string) => string
+}
+
+export declare function when(f:Function): (f?: allExpectType | void) => whenResult
+
+export declare interface VerificationMode {
+ times(count: Number): void
+ never(): void
+ once(): void
+ atLeast(count: Number): void
+ atMost(count: Number): void
+}
+
+export declare class MockKit {
+ constructor()
+ mockFunc(obj: Object, func: Function): Function
+ mockObject(obj: Object): Object
+ verify(methodName: String, argsArray: Array): VerificationMode
+ ignoreMock(obj: Object, func: Function): void
+ clear(obj: Object): void
+ clearAll(): void
+}
+
+export declare class SysTestKit {
+ static actionStart(tag: string): void
+ static actionEnd(tag: string): void
+ static existKeyword(keyword: string, timeout?: number): boolean
+}
+
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/index.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..320cff5bd99bfe6c13665e558f0845b98b2c8619
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/index.js
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2021-2024 Huawei Device 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 Core from './src/main/core';
+import { DEFAULT, TestType, Size, Level, TAG } from './src/main/Constant';
+import DataDriver from './src/main/module/config/DataDriver';
+import ExpectExtend from './src/main/module/assert/ExpectExtend';
+import OhReport from './src/main/module/report/OhReport';
+import SysTestKit from './src/main/module/kit/SysTestKit';
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, beforeItSpecified, afterItSpecified, xdescribe, xit } from './src/main/interface';
+import { MockKit, when } from './src/main/module/mock/MockKit';
+import ArgumentMatchers from './src/main/module/mock/ArgumentMatchers';
+
+class Hypium {
+ static context = new Map();
+ static setData(data) {
+ const core = Core.getInstance();
+ const dataDriver = new DataDriver({ data });
+ core.addService('dataDriver', dataDriver);
+ }
+
+ static setTimeConfig(systemTime) {
+ SysTestKit.systemTime = systemTime;
+ }
+
+ static set(key, value) {
+ Hypium.context.set(key, value);
+ }
+
+ static get(key) {
+ return Hypium.context.get(key);
+ }
+
+ static hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) {
+ const core = Core.getInstance();
+ const expectExtend = new ExpectExtend({
+ 'id': 'extend'
+ });
+ core.addService('expect', expectExtend);
+ const ohReport = new OhReport({
+ 'delegator': abilityDelegator,
+ 'abilityDelegatorArguments': abilityDelegatorArguments
+ });
+ SysTestKit.delegator = abilityDelegator;
+ core.addService('report', ohReport);
+ core.init();
+ core.subscribeEvent('spec', ohReport);
+ core.subscribeEvent('suite', ohReport);
+ core.subscribeEvent('task', ohReport);
+ const configService = core.getDefaultService('config');
+ if (abilityDelegatorArguments !== null) {
+ let testParameters = configService.translateParams(abilityDelegatorArguments.parameters);
+ console.info(`${TAG}parameters:${JSON.stringify(testParameters)}`);
+ configService.setConfig(testParameters);
+ }
+ testsuite();
+ core.execute(abilityDelegator);
+ }
+
+ static registerAssert(customAssertion) {
+ const core = Core.getInstance();
+ const expectService = core.getDefaultService('expect');
+ let matchers = {};
+ matchers[customAssertion.name] = customAssertion;
+ expectService.addMatchers(matchers);
+ expectService.customMatchers.push(customAssertion.name);
+ console.log(`${TAG}success to register the ${customAssertion.name}`);
+ }
+
+ static unregisterAssert(customAssertion) {
+ const core = Core.getInstance();
+ const expectService = core.getDefaultService('expect');
+ let customAssertionName = typeof customAssertion === 'function' ? customAssertion.name : customAssertion;
+ expectService.removeMatchers(customAssertionName);
+ console.log(`${TAG}success to unregister the ${customAssertionName}`);
+ }
+
+}
+
+export {
+ Hypium,
+ Core,
+ DEFAULT,
+ TestType,
+ Size,
+ Level,
+ DataDriver,
+ ExpectExtend,
+ OhReport,
+ SysTestKit,
+ describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, beforeItSpecified, afterItSpecified, xdescribe, xit,
+ MockKit, when,
+ ArgumentMatchers
+};
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/index.ts b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/index.ts
new file mode 100644
index 0000000000000000000000000000000000000000..b7082ebc98214b58d41e8681791809f1aee48f12
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/index.ts
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2024 Huawei Device 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 { TestType, Size, Level } from "./src/main/Constant";
+
+export declare function xdescribe(testSuiteName: string, func: Function): void;
+
+export declare namespace xdescribe {
+ function reason(reason: string): any;
+};
+
+export declare function describe(testSuiteName: string, func: Function): void;
+
+export declare function xit(testCaseName: string, attribute: TestType | Size | Level, func: Function): void;
+
+export declare namespace xit {
+ function reason(reason: string): any;
+};
+
+export declare function it(testCaseName: string, attribute: TestType | Size | Level, func: Function): void;
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/oh-package.json5 b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..9cd9da2c41f9f31a6c14b8fe792c87bcf4183554
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/oh-package.json5
@@ -0,0 +1 @@
+{"name":"@ohos/hypium","version":"1.0.18","description":"A unit test framework for OpenHarmony application","main":"index.js","keywords":["测试框架","except","mock"],"author":"huawei","license":"Apache-2.0","repository":"https://gitee.com/openharmony/testfwk_arkxtest","homepage":"https://gitee.com/openharmony/testfwk_arkxtest","dependencies":{}}
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/Constant.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/Constant.js
new file mode 100644
index 0000000000000000000000000000000000000000..7a24b2130e3c6e3f2f7bc75d425247e9b355c6b6
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/Constant.js
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2021-2024 Huawei Device 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.
+ */
+
+/**
+ * define the testcase type : TestType, Size , Level
+ */
+export const TAG = '[Hypium]';
+
+export const DEFAULT = 0B0000;
+
+export class TestType {
+ static FUNCTION = 0B1;
+ static PERFORMANCE = 0B1 << 1;
+ static POWER = 0B1 << 2;
+ static RELIABILITY = 0B1 << 3;
+ static SECURITY = 0B1 << 4;
+ static GLOBAL = 0B1 << 5;
+ static COMPATIBILITY = 0B1 << 6;
+ static USER = 0B1 << 7;
+ static STANDARD = 0B1 << 8;
+ static SAFETY = 0B1 << 9;
+ static RESILIENCE = 0B1 << 10;
+}
+
+export class Size {
+ static SMALLTEST = 0B1 << 16;
+ static MEDIUMTEST = 0B1 << 17;
+ static LARGETEST = 0B1 << 18;
+}
+
+export class Level {
+ static LEVEL0 = 0B1 << 24;
+ static LEVEL1 = 0B1 << 25;
+ static LEVEL2 = 0B1 << 26;
+ static LEVEL3 = 0B1 << 27;
+ static LEVEL4 = 0B1 << 28;
+}
+
+export const TESTTYPE = {
+ 'function': 1,
+ 'performance': 1 << 1,
+ 'power': 1 << 2,
+ 'reliability': 1 << 3,
+ 'security': 1 << 4,
+ 'global': 1 << 5,
+ 'compatibility': 1 << 6,
+ 'user': 1 << 7,
+ 'standard': 1 << 8,
+ 'safety': 1 << 9,
+ 'resilience': 1 << 10,
+}
+
+export const LEVEL = {
+ '0': 1 << 24,
+ '1': 1 << 25,
+ '2': 1 << 26,
+ '3': 1 << 27,
+ '4': 1 << 28,
+}
+
+export const SIZE = {
+ 'small': 1 << 16,
+ 'medium': 1 << 17,
+ 'large': 1 << 18,
+}
+
+export const KEYSET = [
+ '-s class', '-s notClass', '-s suite', '-s itName',
+ '-s level', '-s testType', '-s size', '-s timeout',
+ '-s dryRun', '-s random', '-s breakOnError', '-s stress',
+ '-s coverage', '-s skipMessage', '-s runSkipped',
+ 'class', 'notClass', 'suite', 'itName',
+ 'level', 'testType', 'size', 'timeout', 'dryRun', 'random',
+ 'breakOnError', 'stress', 'coverage', 'skipMessage', 'runSkipped'
+]
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/core.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/core.js
new file mode 100644
index 0000000000000000000000000000000000000000..cfcb5f17287208f5e6869b4248faf6c9093002d9
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/core.js
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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 {SuiteService, SpecService, ExpectService, ReportService} from './service';
+import {ConfigService} from './module/config/configService';
+import {SpecEvent, TaskEvent, SuiteEvent} from './event';
+
+/**
+ * core service for execute testcase.
+ */
+class Core {
+ static getInstance() {
+ if (!this.instance) {
+ this.instance = new Core();
+ }
+ return this.instance;
+ }
+
+ constructor() {
+ this.instance = null;
+ this.services = {
+ suite: {},
+ spec: {},
+ config: {},
+ expect: {},
+ log: {},
+ report: {}
+
+ };
+ this.events = {
+ suite: {},
+ spec: {},
+ task: {}
+ };
+ }
+
+ addService(name, service) {
+ let serviceObj = {};
+ if (!this.services[name]) {
+ this.services[name] = serviceObj;
+ } else {
+ serviceObj = this.services[name];
+ }
+ serviceObj[service.id] = service;
+ }
+
+ getDefaultService(name) {
+ return this.services[name].default;
+ }
+
+ getServices(name) {
+ return this.services[name];
+ }
+
+ registerEvent(serviceName, event) {
+ let eventObj = {};
+ if (!this.events[serviceName]) {
+ this.events[serviceName] = eventObj;
+ } else {
+ eventObj = this.events[serviceName];
+ }
+ eventObj[event.id] = event;
+ }
+
+ unRegisterEvent(serviceName, eventID) {
+ const eventObj = this.events[serviceName];
+ if (eventObj) {
+ delete eventObj[eventID];
+ }
+ }
+
+ subscribeEvent(serviceName, serviceObj) {
+ const eventObj = this.events[serviceName];
+ if (eventObj) {
+ for (const attr in eventObj) {
+ eventObj[attr]['subscribeEvent'](serviceObj);
+ }
+ }
+ }
+
+ async fireEvents(serviceName, eventName) {
+ const eventObj = this.events[serviceName];
+ if (!eventObj) {
+ return;
+ }
+ for (const attr in eventObj) {
+ await eventObj[attr][eventName]();
+ }
+ }
+
+ addToGlobal(apis) {
+ if (typeof globalThis !== 'undefined') {
+ for (let api in apis) {
+ globalThis[api] = apis[api];
+ }
+ }
+ for (const api in apis) {
+ this[api] = apis[api];
+ }
+ }
+
+ init() {
+ this.addService('suite', new SuiteService({id: 'default'}));
+ this.addService('spec', new SpecService({id: 'default'}));
+ this.addService('expect', new ExpectService({id: 'default'}));
+ this.addService('report', new ReportService({id: 'default'}));
+ this.addService('config', new ConfigService({id: 'default'}));
+ this.registerEvent('task', new TaskEvent({id: 'default', coreContext: this}));
+ this.registerEvent('suite', new SuiteEvent({id: 'default', coreContext: this}));
+ this.registerEvent('spec', new SpecEvent({id: 'default', coreContext: this}));
+ this.subscribeEvent('spec', this.getDefaultService('report'));
+ this.subscribeEvent('suite', this.getDefaultService('report'));
+ this.subscribeEvent('task', this.getDefaultService('report'));
+ const context = this;
+ for (const key in this.services) {
+ const serviceObj = this.services[key];
+ for (const serviceID in serviceObj) {
+ const service = serviceObj[serviceID];
+ service.init(context);
+
+ if (typeof service.apis !== 'function') {
+ continue;
+ }
+ const apis = service.apis();
+ if (apis) {
+ this.addToGlobal(apis);
+ }
+ }
+ }
+ }
+
+ execute(abilityDelegator) {
+ const suiteService = this.getDefaultService('suite');
+ const configService = this.getDefaultService('config');
+ if (configService['dryRun'] === 'true') {
+ (async function () {
+ await suiteService.dryRun(abilityDelegator);
+ })();
+ return;
+ }
+ setTimeout(() => {
+ suiteService.execute();
+ }, 10);
+ }
+}
+
+export default Core;
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/event.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/event.js
new file mode 100644
index 0000000000000000000000000000000000000000..3be0211f01646c9c269c2425cbee82c87ac6d9ea
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/event.js
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2021-2024 Huawei Device 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.
+ */
+
+class SpecEvent {
+ constructor(attr) {
+ this.id = attr.id;
+ this.coreContext = attr.context;
+ this.eventMonitors = [];
+ }
+
+ subscribeEvent(service) {
+ this.eventMonitors.push(service);
+ }
+
+ async specStart() {
+ for (const monitor of this.eventMonitors) {
+ await monitor['specStart']();
+ }
+ }
+
+ async specDone() {
+ for (const monitor of this.eventMonitors) {
+ await monitor['specDone']();
+ }
+ }
+}
+
+class SuiteEvent {
+ constructor(attr) {
+ this.id = attr.id;
+ this.suiteContext = attr.coreContext;
+ this.eventMonitors = [];
+ }
+
+ subscribeEvent(service) {
+ this.eventMonitors.push(service);
+ }
+
+ async suiteStart() {
+ for (const monitor of this.eventMonitors) {
+ await monitor['suiteStart']();
+ }
+ }
+
+ async suiteDone() {
+ for (const monitor of this.eventMonitors) {
+ await monitor['suiteDone']();
+ }
+ }
+}
+
+class TaskEvent {
+ constructor(attr) {
+ this.id = attr.id;
+ this.coreContext = attr.coreContext;
+ this.eventMonitors = [];
+ }
+
+ subscribeEvent(service) {
+ this.eventMonitors.push(service);
+ }
+
+ async taskStart() {
+ for (const monitor of this.eventMonitors) {
+ await monitor['taskStart']();
+ }
+ }
+
+ async taskDone() {
+ for (const monitor of this.eventMonitors) {
+ await monitor['taskDone']();
+ }
+ }
+
+ incorrectFormat() {
+ for (const monitor of this.eventMonitors) {
+ monitor['incorrectFormat']();
+ }
+ }
+
+ incorrectTestSuiteFormat() {
+ for (const monitor of this.eventMonitors) {
+ monitor.incorrectTestSuiteFormat();
+ }
+ }
+}
+
+export { SpecEvent, TaskEvent, SuiteEvent };
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/interface.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/interface.js
new file mode 100644
index 0000000000000000000000000000000000000000..44c345543313b6bad3108a8fa8824dfd92c39c79
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/interface.js
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2021-2024 Huawei Device 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 Core from './core';
+
+const core = Core.getInstance();
+
+const describe = function (desc, func) {
+ return Reflect.has(core, 'describe') ? core.describe(desc, func) : (desc, func) => { };
+};
+const it = function (desc, filter, func) {
+ return Reflect.has(core, 'it') ? core.it(desc, filter, func) : (desc, filter, func) => { };
+};
+const beforeItSpecified = function (itDescs, func) {
+ return Reflect.has(core, 'beforeItSpecified') ? core.beforeItSpecified(itDescs, func) : (itDescs, func) => { };
+};
+
+const afterItSpecified = function (itDescs, func) {
+ return Reflect.has(core, 'afterItSpecified') ? core.afterItSpecified(itDescs, func) : (itDescs, func) => { };
+};
+const beforeEach = function (func) {
+ return Reflect.has(core, 'beforeEach') ? core.beforeEach(func) : (func) => { };
+};
+const afterEach = function (func) {
+ return Reflect.has(core, 'afterEach') ? core.afterEach(func) : (func) => { };
+};
+const beforeAll = function (func) {
+ return Reflect.has(core, 'beforeAll') ? core.beforeAll(func) : (func) => { };
+};
+const afterAll = function (func) {
+ return Reflect.has(core, 'afterAll') ? core.afterAll(func) : (func) => { };
+};
+const expect = function (actualValue) {
+ return Reflect.has(core, 'expect') ? core.expect(actualValue) : (actualValue) => { };
+};
+
+const xdescribe = function (desc, func) {
+ return Reflect.has(core, 'xdescribe') ? core.xdescribe(desc, func, null) : (desc, func, reason) => { };
+};
+xdescribe.reason = (reason) => {
+ return (desc, func) => {
+ return Reflect.has(core, 'xdescribe') ? core.xdescribe(desc, func, reason) : (desc, func, reason) => { };
+ }
+}
+const xit = function (desc, filter, func) {
+ return Reflect.has(core, 'xit') ? core.xit(desc, filter, func, null) : (desc, filter, func, reason) => { };
+};
+xit.reason = (reason) => {
+ return (desc, filter, func) => {
+ return Reflect.has(core, 'xit') ? core.xit(desc, filter, func, reason) : (desc, filter, func, reason) => { };
+ }
+}
+
+export {
+ describe, it, beforeAll, beforeEach, afterEach, afterAll, expect, beforeItSpecified, afterItSpecified, xdescribe, xit
+};
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module.json b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module.json
new file mode 100644
index 0000000000000000000000000000000000000000..1fd46ff69422297a5b9139cf75e4a5ab55e38c19
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module.json
@@ -0,0 +1,26 @@
+{
+ "app": {
+ "bundleName": "com.ohos.hypium",
+ "debug": true,
+ "versionCode": 1000000,
+ "versionName": "1.0.0",
+ "minAPIVersion": 40100011,
+ "targetAPIVersion": 40100011,
+ "apiReleaseType": "Beta1",
+ "compileSdkVersion": "4.1.0.55",
+ "compileSdkType": "HarmonyOS",
+ "bundleType": "app"
+ },
+ "module": {
+ "name": "hypium",
+ "type": "har",
+ "deviceTypes": [
+ "default",
+ "tablet",
+ "tv",
+ "wearable",
+ "car"
+ ],
+ "installationFree": false
+ }
+}
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/ExpectExtend.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/ExpectExtend.js
new file mode 100644
index 0000000000000000000000000000000000000000..d10d15e6f9955c6d04610101f8766c951ee1a35d
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/ExpectExtend.js
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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 assertNull from './assertNull';
+import assertClose from './assertClose';
+import assertContain from './assertContain';
+import assertLess from './assertLess';
+import assertLarger from './assertLarger';
+import assertFail from './assertFail';
+import assertUndefined from './assertUndefined';
+import assertFalse from './assertFalse';
+import assertInstanceOf from './assertInstanceOf';
+import assertThrowError from './assertThrowError';
+import assertLargerOrEqual from './assertLargerOrEqual'
+import assertLessOrEqual from './assertLessOrEqual'
+import assertNaN from './assertNaN'
+import assertNegUnlimited from './assertNegUnlimited'
+import assertPosUnlimited from './assertPosUnlimited'
+import assertDeepEquals from './deepEquals/assertDeepEquals'
+import assertPromiseIsPending from './assertPromiseIsPending';
+import assertPromiseIsRejected from './assertPromiseIsRejected';
+import assertPromiseIsRejectedWith from './assertPromiseIsRejectedWith';
+import assertPromiseIsRejectedWithError from './assertPromiseIsRejectedWithError';
+import assertPromiseIsResolved from './assertPromiseIsResolved';
+import assertPromiseIsResolvedWith from './assertPromiseIsResolvedWith';
+class ExpectExtend {
+ constructor(attr) {
+ this.id = attr.id;
+ this.matchers = {};
+ }
+
+ extendsMatchers() {
+ this.matchers.assertNull = assertNull;
+ this.matchers.assertClose = assertClose;
+ this.matchers.assertContain = assertContain;
+ this.matchers.assertLess = assertLess;
+ this.matchers.assertLarger = assertLarger;
+ this.matchers.assertFail = assertFail;
+ this.matchers.assertUndefined = assertUndefined;
+ this.matchers.assertFalse = assertFalse;
+ this.matchers.assertInstanceOf = assertInstanceOf;
+ this.matchers.assertThrowError = assertThrowError;
+ this.matchers.assertLargerOrEqual = assertLargerOrEqual;
+ this.matchers.assertLessOrEqual = assertLessOrEqual;
+ this.matchers.assertNaN = assertNaN;
+ this.matchers.assertNegUnlimited = assertNegUnlimited;
+ this.matchers.assertPosUnlimited = assertPosUnlimited;
+ this.matchers.assertDeepEquals = assertDeepEquals;
+ this.matchers.assertPromiseIsPending = assertPromiseIsPending;
+ this.matchers.assertPromiseIsRejected = assertPromiseIsRejected;
+ this.matchers.assertPromiseIsRejectedWith = assertPromiseIsRejectedWith;
+ this.matchers.assertPromiseIsRejectedWithError = assertPromiseIsRejectedWithError;
+ this.matchers.assertPromiseIsResolved = assertPromiseIsResolved;
+ this.matchers.assertPromiseIsResolvedWith = assertPromiseIsResolvedWith;
+ }
+
+ init(coreContext) {
+ this.coreContext = coreContext;
+ this.extendsMatchers();
+ const expectService = this.coreContext.getDefaultService('expect');
+ expectService.addMatchers(this.matchers);
+ }
+
+ apis() {
+ return {
+ 'expect': function (actualValue) {
+ return this.coreContext.getDefaultService('expect').expect(actualValue);
+ }
+ };
+ }
+}
+
+export default ExpectExtend;
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertClose.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertClose.js
new file mode 100644
index 0000000000000000000000000000000000000000..63635bea5bf1298776de565260e0e0babae56857
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertClose.js
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+function assertClose(actualValue, expected) {
+ console.log('expected:' + expected[0] + ',precision:' + expected[1]);
+ if (actualValue === null && expected[0] === null) {
+ throw new Error('actualValue and expected can not be both null!!!');
+ }
+ let result;
+ let diff = Math.abs(expected[0] - actualValue);
+ let actualAbs = Math.abs(actualValue);
+ if ((actualAbs - 0) === 0) {
+ if ((diff - 0) === 0) {
+ result = true;
+ } else {
+ result = false;
+ }
+ } else if (diff / actualAbs < expected[1]) {
+ result = true;
+ } else {
+ result = false;
+ }
+ return {
+ pass: result,
+ message: '|' + actualValue + ' - ' + expected[0] + '|/' + actualValue + ' is not less than ' + expected[1]
+ };
+}
+
+export default assertClose;
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertContain.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertContain.js
new file mode 100644
index 0000000000000000000000000000000000000000..7fba0d9755503e5e926f6c1a4e425e0d1cf47570
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertContain.js
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+function assertContain(actualValue, expect) {
+ let result = false;
+ if (Object.prototype.toString.call(actualValue).indexOf('Array')) {
+ for (let i in actualValue) {
+ if (actualValue[i] == expect[0]) {
+ result = true;
+ }
+ }
+ }
+ let type = Object.prototype.toString.call(actualValue);
+ if (type === '[object String]') {
+ result = actualValue.indexOf(expect[0]) >= 0;
+ }
+ return {
+ pass: result,
+ message: 'expect false, ' + actualValue + ' do not have ' + expect[0]
+ };
+}
+
+export default assertContain;
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertFail.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertFail.js
new file mode 100644
index 0000000000000000000000000000000000000000..8ab4ac5caef712c75c4eac49dfbbb91d33669d9a
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertFail.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+function assertFail() {
+ return {
+ pass: false,
+ message: 'fail '
+ };
+}
+
+export default assertFail;
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertFalse.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertFalse.js
new file mode 100644
index 0000000000000000000000000000000000000000..c5008e94f4b2ce13ed35b604811793c76b542347
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertFalse.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+function assertFalse(actualValue) {
+ return {
+ pass: (actualValue) === false,
+ message: 'expect false, actualValue is ' + actualValue
+ };
+}
+
+export default assertFalse;
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertInstanceOf.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertInstanceOf.js
new file mode 100644
index 0000000000000000000000000000000000000000..1e11b93f7251c67f5455c5007cd7be268aa53b32
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertInstanceOf.js
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+function assertInstanceOf(actualValue, expected) {
+ if (Object.prototype.toString.call(actualValue) == '[object ' + expected[0] + ']') {
+ return {
+ pass: true
+ };
+ } else {
+ return {
+ pass: false,
+ message: actualValue + ' is ' + Object.prototype.toString.call(actualValue) + 'not ' + expected[0]
+ };
+ }
+}
+
+export default assertInstanceOf;
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertLarger.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertLarger.js
new file mode 100644
index 0000000000000000000000000000000000000000..a74f4a8cedaf3add9c2dc2d3799081a83198732f
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertLarger.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+function assertLarger(actualValue, expected) {
+ return {
+ pass: (actualValue) > expected[0],
+ message: (actualValue) + ' is not larger than ' + expected[0]
+ };
+}
+
+export default assertLarger;
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertLargerOrEqual.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertLargerOrEqual.js
new file mode 100644
index 0000000000000000000000000000000000000000..e847e6c217364b7f69c173c66fb98d10efc45ef1
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertLargerOrEqual.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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.
+ */
+
+function assertLargerOrEqual(actualValue, expected) {
+ return {
+ pass: (actualValue) >= expected[0],
+ message: (actualValue) + ' is not larger than ' + expected[0]
+ };
+}
+
+export default assertLargerOrEqual;
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertLess.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertLess.js
new file mode 100644
index 0000000000000000000000000000000000000000..17e84b0abaeb20804048a5a15c19e0603634846d
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertLess.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+function assertLess(actualValue, expected) {
+ return {
+ pass: (actualValue) < expected[0],
+ message: (actualValue) + ' is not less than ' + expected[0]
+ };
+}
+
+export default assertLess;
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertLessOrEqual.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertLessOrEqual.js
new file mode 100644
index 0000000000000000000000000000000000000000..f754f97ffa9d24e7852efe2423a1dd35d448af82
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertLessOrEqual.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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.
+ */
+
+function assertLessOrEqual(actualValue, expected) {
+ return {
+ pass: (actualValue) <= expected[0],
+ message: (actualValue) + ' is not less than ' + expected[0]
+ };
+}
+
+export default assertLessOrEqual;
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertNaN.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertNaN.js
new file mode 100644
index 0000000000000000000000000000000000000000..8d45d6a93b86c5ed325a68b32ff014835993a58e
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertNaN.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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.
+ */
+
+function assertNaN(actualValue) {
+ return {
+ pass: actualValue !== actualValue,
+ message: 'expect NaN, actualValue is ' + actualValue
+ };
+}
+
+export default assertNaN;
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertNegUnlimited.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertNegUnlimited.js
new file mode 100644
index 0000000000000000000000000000000000000000..ceac555afc826e057970e6cfe9c73b322c672aa2
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertNegUnlimited.js
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2022 Huawei Device 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.
+*/
+
+function assertNegUnlimited(actualValue) {
+ return {
+ pass: actualValue === Number.NEGATIVE_INFINITY,
+ message: 'Expected actualValue not to be -Infinity. actualValue is,' + actualValue
+ };
+}
+
+export default assertNegUnlimited;
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertNull.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertNull.js
new file mode 100644
index 0000000000000000000000000000000000000000..53a7bad827323a98d3302a4e7eea679551b459c5
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertNull.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+function assertNull(actualValue) {
+ return {
+ pass: (actualValue) === null,
+ message: 'expect null, actualValue is ' + (actualValue)
+ };
+}
+
+export default assertNull;
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPosUnlimited.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPosUnlimited.js
new file mode 100644
index 0000000000000000000000000000000000000000..6e68c0e2b6c499f4dc3dd56c13e9ea1073a3c54c
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPosUnlimited.js
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2022 Huawei Device 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.
+*/
+
+function assertPosUnlimited(actualValue) {
+ return {
+ pass: actualValue === Number.POSITIVE_INFINITY,
+ message: 'Expected actualValue is POSITIVE_INFINITY. actualValue is,' + actualValue
+ };
+}
+
+export default assertPosUnlimited;
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsPending.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsPending.js
new file mode 100644
index 0000000000000000000000000000000000000000..7e2ca2ce14d50c39554fc1157d6d4eb9329d5c39
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsPending.js
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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 isPromiseLike from './isPromiseLike';
+
+function assertPromiseIsPending(actualPromise) {
+ if (!isPromiseLike(actualPromise)) {
+ return Promise.reject().then(function () {
+ }, function () {
+ return {pass: false, message: 'Expected not be called on a promise.'};
+ });
+ }
+ const helper = {};
+ return Promise.race([actualPromise, Promise.resolve(helper)]).then(
+ function (got) {
+ return helper === got ? {pass: true, message: 'actualValue is isPending'}
+ : {
+ pass: false,
+ message: 'expect isPending, actualValue is resolve'
+ };
+ },
+ function () {
+ return {
+ pass: false
+ , message: 'expect isPending, actualValue is reject'
+ };
+ });
+}
+
+export default assertPromiseIsPending;
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsRejected.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsRejected.js
new file mode 100644
index 0000000000000000000000000000000000000000..eb8e65c7d70d5750a9ccebb55c2cf5049cf144fc
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsRejected.js
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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 isPromiseLike from './isPromiseLike';
+
+function assertPromiseIsRejected(actualPromise) {
+ if (!isPromiseLike(actualPromise)) {
+ return Promise.reject().then(function () {
+ }, function () {
+ return {pass: false, message: 'Expected not be called on a promise.'};
+ });
+ }
+ const helper = {};
+ return Promise.race([actualPromise, Promise.resolve(helper)]).then(
+ function (got) {
+ return {
+ pass: false,
+ message: 'expect isRejected, but actualValue is '
+ + (helper === got ? 'isPending' : 'resolve')
+ };
+ },
+ function () {
+ return {pass: true, message: 'actualValue is isRejected'};
+ }
+ );
+}
+
+export default assertPromiseIsRejected;
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsRejectedWith.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsRejectedWith.js
new file mode 100644
index 0000000000000000000000000000000000000000..48eaf7859279a70ea2ad85509296b5da1c7b69f9
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsRejectedWith.js
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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 isPromiseLike from './isPromiseLike';
+
+function assertPromiseIsRejectedWith(actualPromise, expectedValue) {
+
+ if (!isPromiseLike(actualPromise)) {
+ return Promise.reject().then(function () {
+ }, function () {
+ return {pass: false, message: 'Expected not be called on a promise.'};
+ });
+ }
+
+ function tips(passed) {
+ return ('Expected a promise ' + (passed ? 'not ' : '') +
+ 'to be rejected with ' + JSON.stringify(expectedValue[0]));
+ }
+
+ const helper = {};
+ return Promise.race([actualPromise, Promise.resolve(helper)]).then(
+ function (got) {
+ return {
+ pass: false,
+ message: tips(false) + ' but actualValue is '
+ + (helper === got ? 'isPending' : 'resolve')
+ };
+ },
+ function (actualValue) {
+ if (JSON.stringify(actualValue) == JSON.stringify(expectedValue[0])) {
+ return {
+ pass: true,
+ message: 'actualValue was rejected with ' + JSON.stringify(actualValue) + '.'
+ };
+ } else {
+ return {
+ pass: false,
+ message: tips(false) + ' but it was rejected with ' + JSON.stringify(actualValue) + '.'
+ };
+ }
+ }
+ );
+}
+
+export default assertPromiseIsRejectedWith;
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsRejectedWithError.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsRejectedWithError.js
new file mode 100644
index 0000000000000000000000000000000000000000..20f236fc11dd66f270322efa12a1b3f6b543407c
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsRejectedWithError.js
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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 isPromiseLike from './isPromiseLike';
+
+function assertPromiseIsRejectedWithError(actualPromise, expectedValue) {
+ if (!isPromiseLike(actualPromise)) {
+ return Promise.reject().then(function () {
+ }, function () {
+ return {pass: false, message: 'Expected not be called on a promise.'};
+ });
+ }
+ const helper = {};
+ return Promise.race([actualPromise, Promise.resolve(helper)]).then(
+ function (got) {
+ return {
+ pass: false,
+ message: 'Expected a promise to be rejected but actualValue is '
+ + (helper === got ? 'isPending' : 'resolve')
+ };
+ },
+ function (actualValue) {
+ return matchError(actualValue, expectedValue);
+ }
+ );
+
+}
+
+function matchError(actualValue, expectedValue) {
+ if (expectedValue.length == 1 && typeof expectedValue[0] === 'function') {
+ if (expectedValue[0].name === actualValue.__proto__.name) {
+ return {pass: true, message: 'actual error type is ' + actualValue.name + '.'};
+ }
+ return {pass: false, message: `except error type is ${expectedValue[0].name},but actual is ${actualValue.name}.`};
+ }
+
+ if (expectedValue.length == 1 && typeof expectedValue[0] === 'string') {
+ if (expectedValue[0] === actualValue.message) {
+ return {pass: true, message: `actual error message is ${actualValue.message}.`};
+ }
+ return {pass: false, message: `except error message ${expectedValue[0]},but actual is ${actualValue.message}.`};
+ }
+
+ if (expectedValue.length == 1) {
+ return {pass: false, message: 'When only one parameter, it should be error type or error message.'};
+ }
+
+ if (expectedValue.length == 2 && typeof expectedValue[0] === 'function' && expectedValue[0].name === actualValue.name) {
+ if (typeof expectedValue[1] === 'string' && actualValue.message === expectedValue[1]) {
+ return {pass: true, message: 'actual error message is ' + actualValue.message + '.'};
+ }
+ return {pass: false, message: `except error message is ${expectedValue[1]},but actual is ${actualValue.message}.`};
+ }
+
+ if (expectedValue.length == 2 && typeof expectedValue[0] === 'function' && expectedValue[0].name !== actualValue.name) {
+ if (typeof expectedValue[1] === 'string' && actualValue.message === expectedValue[1]) {
+ return {pass: false, message: `except error type is ${expectedValue[0].name},but actual is ${actualValue.name}.`};
+ }
+ return {pass: false, message: 'except error type and message are incorrect.'};
+ }
+ if (expectedValue.length > 2) {
+ return {pass: false, message: 'Up to two parameters are supported.'};
+ }
+}
+
+export default assertPromiseIsRejectedWithError;
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsResolved.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsResolved.js
new file mode 100644
index 0000000000000000000000000000000000000000..855426ca79e5002428e53d4fcb5f843cdf7119f7
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsResolved.js
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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 isPromiseLike from './isPromiseLike';
+
+function assertPromiseIsResolved(actualPromise) {
+ if (!isPromiseLike(actualPromise)) {
+ return Promise.reject().then(function () {
+ }, function () {
+ return {pass: false, message: 'Expected not be called on a promise.'};
+ });
+ }
+
+ const helper = {};
+ return Promise.race([actualPromise, Promise.resolve(helper)]).then(
+ function (got) {
+ return helper === got ? {
+ pass: false,
+ message: 'expect resolve, actualValue is isPending'
+ }
+ : {pass: true, message: 'actualValue is isResolved'};
+ },
+ function (rej) {
+ return {
+ pass: false,
+ message: 'Expected a promise to be resolved but it was ' +
+ 'rejected with ' + JSON.stringify(rej) + '.'
+ };
+ }
+ );
+}
+
+export default assertPromiseIsResolved;
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsResolvedWith.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsResolvedWith.js
new file mode 100644
index 0000000000000000000000000000000000000000..d5eb01e32491b281a1e1d650a307723253a61e39
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsResolvedWith.js
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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 isPromiseLike from './isPromiseLike';
+
+function assertPromiseIsResolvedWith(actualPromise, expectedValue) {
+ if (!isPromiseLike(actualPromise)) {
+ return Promise.reject().then(function () {
+ }, function () {
+ return {pass: false, message: 'Expected not be called on a promise.'};
+ });
+ }
+
+ function tips(passed) {
+ return (
+ 'Expected a promise ' + (passed ? 'not ' : '') +
+ 'to be resolved with ' + JSON.stringify(expectedValue[0]));
+ }
+
+ const helper = {};
+ return Promise.race([actualPromise, Promise.resolve(helper)]).then(
+ function (got) {
+ if (helper === got) {
+ return {pass: false, message: 'expect resolve, actualValue is isPending'};
+ }
+ if (JSON.stringify(got) == JSON.stringify(expectedValue[0])) {
+ return {
+ pass: true,
+ message: 'actualValue was resolved with ' + JSON.stringify(got) + '.'
+ };
+ }
+ return {
+ pass: false,
+ message: tips(false) + ' but it was resolved with ' +
+ JSON.stringify(got) + '.'
+ };
+ },
+ function (rej) {
+ return {
+ pass: false,
+ message: tips(false) + ' but it was rejected with ' + JSON.stringify(rej) + '.'
+ };
+ }
+ );
+}
+
+export default assertPromiseIsResolvedWith;
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertThrowError.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertThrowError.js
new file mode 100644
index 0000000000000000000000000000000000000000..749cab0daee3f156909f60c9375146c23d7aa322
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertThrowError.js
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+function assertThrowError(actualValue, expected) {
+ let result = false;
+ let err;
+ if (typeof actualValue !== 'function') {
+ throw new Error('actualValue is not a function');
+ }
+ try {
+ actualValue();
+ return {
+ pass: result,
+ message: ' An error is not thrown while it is expected!'
+ };
+ } catch (e) {
+ err = e;
+ }
+
+ if (err instanceof Error) {
+ console.log(err.message);
+ if (err.message == expected[0]) {
+ result = true;
+ }
+ }
+ return {
+ pass: result,
+ message: 'expected throw failed , ' + err.message + ' is not ' + expected[0]
+ };
+}
+
+export default assertThrowError;
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertUndefined.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertUndefined.js
new file mode 100644
index 0000000000000000000000000000000000000000..61f092d715dd1630297518b59ff13ef0940991e1
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertUndefined.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+function assertUndefined(actualValue) {
+ return {
+ pass: undefined === (actualValue),
+ message: 'expect Undefined, actualValue is ' + (actualValue)
+ };
+}
+
+export default assertUndefined;
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/deepEquals/DeepTypeUtils.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/deepEquals/DeepTypeUtils.js
new file mode 100644
index 0000000000000000000000000000000000000000..627fb3b3ae7e315808b5ee2927d4bfbf17cc64b2
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/deepEquals/DeepTypeUtils.js
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2022-2023 Huawei Device 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.
+ */
+
+class DeepTypeUtils {
+ static getType_(value) {
+ return Object.prototype.toString.apply(value);
+ }
+ static isA_(typeName, value) {
+ return this.getType_(value) === '[object ' + typeName + ']';
+ }
+ static isAsymmetricEqualityTester_(obj) {
+ return obj ? this.isA_('Function', obj.asymmetricMatch) : false;
+ }
+
+ /**
+ * 是否是function
+ * @param value
+ */
+ static isFunction_(value) {
+ return this.isA_('Function', value);
+ }
+
+ /**
+ * 是否是undefined
+ * @param obj
+ */
+ static isUndefined(obj) {
+ return obj === void 0;
+ }
+
+ /**
+ * 是否是Node
+ * @param obj
+ */
+ static isDomNode(obj) {
+ return obj !== null &&
+ typeof obj === 'object' &&
+ typeof obj.nodeType === 'number' &&
+ typeof obj.nodeName === 'string';
+ }
+
+ /**
+ * 是否是promise对象
+ * @param obj
+ */
+ static isPromise (obj) {
+ return !!obj && obj.constructor === Promise;
+ };
+ /**
+ * 是否是map对象
+ * @param obj
+ */
+ static isMap(obj) {
+ return (
+ obj !== null &&
+ typeof obj !== 'undefined' &&
+ obj.constructor === Map
+ );
+ }
+
+ /**
+ * 是否是set对象
+ * @param obj 对象
+ */
+ static isSet(obj) {
+ return (
+ obj !== null &&
+ typeof obj !== 'undefined' &&
+ obj.constructor === Set
+ );
+ }
+
+ /**
+ * 对象是否有key属性
+ * @param obj 对象
+ * @param key 对象属性名称
+ */
+ static has(obj, key) {
+ return Object.prototype.hasOwnProperty.call(obj, key);
+ }
+
+ /**
+ * 获取对象的自有属性
+ * @param obj 对象
+ * @param isArray 是否是数组,[object Array]
+ */
+ static keys(obj, isArray) {
+ const extraKeys = [];
+ // 获取对象所有属性
+ const allKeys = this.getAllKeys(obj);
+ if (!isArray) {
+ return allKeys;
+ }
+ if (allKeys.length === 0) {
+ return allKeys;
+ }
+ for (const k of allKeys) {
+ if (typeof k === 'symbol' || !/^[0-9]+$/.test(k)) {
+ extraKeys.push(k);
+ }
+ }
+ return extraKeys;
+ }
+
+ /**
+ * 获取obj对象的所有属性
+ * @param obj obj对象
+ */
+ static getAllKeys(obj) {
+ const keys = [];
+ for (let key in obj) {
+ if(this.has(obj, key)) {
+ keys.push(key);
+ }
+ }
+ const symbols = Object.getOwnPropertySymbols(obj);
+ for (const sym of symbols) {
+ if (obj.propertyIsEnumerable(sym)) {
+ keys.push(sym);
+ }
+ }
+ return keys;
+ }
+
+}
+export default DeepTypeUtils;
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/deepEquals/assertDeepEquals.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/deepEquals/assertDeepEquals.js
new file mode 100644
index 0000000000000000000000000000000000000000..482e28e6af45482f8c2d9d0f61130730b07eba70
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/deepEquals/assertDeepEquals.js
@@ -0,0 +1,315 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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 DeepTypeUtils from './DeepTypeUtils'
+function assertDeepEquals(actualValue, expected) {
+ console.log('actualValue:' + actualValue + ',expected:' + expected[0]);
+ let result = eq(actualValue, expected[0],[], [])
+ let msg = logMsg(actualValue, expected[0]);
+ return {
+ pass: result,
+ message: msg
+ };
+}
+
+/**
+ * 获取失败显示日志
+ * @param actualValue 实际对象
+ * @param expected 期待比较对象
+ */
+function logMsg(actualValue, expected) {
+ // 获取a的对象名称
+ const aClassName = Object.prototype.toString.call(actualValue);
+ const bClassName = Object.prototype.toString.call(expected);
+ let actualMsg;
+ let expectMsg;
+ if(aClassName == "[object Function]") {
+ actualMsg = "actualValue Function"
+ }else if(aClassName == "[object Promise]") {
+ actualMsg = "actualValue Promise"
+ }else if(aClassName == "[object Set]" || aClassName == "[object Map]") {
+ actualMsg = JSON.stringify(Array.from(actualValue));;
+ }else if(aClassName == "[object RegExp]") {
+ actualMsg = JSON.stringify(actualValue.source.replace("\\",""));;
+ }else if(aClassName == "[object BigInt]") {
+ actualMsg = actualValue;
+ }
+ else{
+ actualMsg = JSON.stringify(actualValue);
+ }
+ if(bClassName == "[object Function]") {
+ expectMsg = "expected Function"
+ }else if(bClassName == "[object Promise]") {
+ expectMsg = "expected Promise"
+ }else if(bClassName == "[object Set]" || bClassName == "[object Map]") {
+ expectMsg = JSON.stringify(Array.from(expected));
+ }else if(bClassName == "[object RegExp]") {
+ expectMsg = JSON.stringify(expected.source.replace("\\",""));;
+ }else if(bClassName == "[object BigInt]") {
+ expectMsg = expected;
+ }
+ else{
+ expectMsg = JSON.stringify(expected);
+ }
+ return actualMsg + " is not deep equal " + expectMsg;
+}
+
+function eq(a, b, aStack, bStack) {
+ let result = true;
+ console.log('a is:' + a + ',b is:' + b);
+ const asymmetricResult = asymmetricMatch_(a,b);
+ if (!DeepTypeUtils.isUndefined(asymmetricResult)) {
+ return asymmetricResult;
+ }
+
+ if (a instanceof Error && b instanceof Error) {
+ result = a.message == b.message;
+ return result;
+ }
+
+ if (a === b) {
+ result = a !== 0 || 1 / a == 1 / b;
+ return result;
+ }
+
+ if (a === null || b === null) {
+ result = a === b;
+ return result;
+ }
+ // 获取a的对象名称
+ const aClassName = Object.prototype.toString.call(a);
+ const bClassName = Object.prototype.toString.call(b);
+ console.log('aClassName is:' + aClassName);
+ console.log('bClassName is:' + bClassName);
+ // 不同类型不同对象
+ if (aClassName != bClassName) {
+ return false;
+ }
+ // 俩个string对象
+ if(aClassName === '[object String]') {
+ result = a == String(b);
+ return result;
+ }
+ // 俩个Number对象
+ if(aClassName === '[object Number]') {
+ result = a != +a ? b != +b : a === 0 && b === 0 ? 1 / a == 1 / b : a == +b;
+ return result;
+ }
+
+ if(aClassName === '[object Date]' || aClassName === '[object Boolean]') {
+ result = +a == +b;
+ return result;
+ }
+
+ // 数组
+ if(aClassName === '[object ArrayBuffer]') {
+ return eq(new Uint8Array(a), new Uint8Array(b), aStack, bStack);
+ }
+
+ // 正则表达式
+ if(aClassName === '[object RegExp]') {
+ return (
+ a.source == b.source &&
+ a.global == b.global &&
+ a.multiline == b.multiline &&
+ a.ignoreCase == b.ignoreCase
+ );
+ }
+
+ if (typeof a != 'object' || typeof b != 'object') {
+ return false;
+ }
+
+ const aIsDomNode = DeepTypeUtils.isDomNode(a);
+ const bIsDomNode = DeepTypeUtils.isDomNode(b);
+ if (aIsDomNode && bIsDomNode) {
+ // At first try to use DOM3 method isEqualNode
+ result = a.isEqualNode(b);
+ return result;
+ }
+ if (aIsDomNode || bIsDomNode) {
+ return false;
+ }
+ const aIsPromise = DeepTypeUtils.isPromise(a);
+ const bIsPromise = DeepTypeUtils.isPromise(b);
+ if (aIsPromise && bIsPromise) {
+ return a === b;
+ }
+ let length = aStack.length;
+ while (length--) {
+ if (aStack[length] == a) {
+ return bStack[length] == b;
+ }
+ }
+ aStack.push(a);
+ bStack.push(b);
+ let size = 0;
+
+ // 都是数组
+ if(aClassName == '[object Array]') {
+ const aLength = a.length;
+ const bLength = b.length;
+ if (aLength !== bLength) {
+ // 数组长度不同,不是同一个对象
+ return false;
+ }
+ for (let i = 0; i < aLength || i < bLength; i++) {
+ // 递归每一个元素是否相同
+ result = eq(i < aLength ? a[i] : void 0, i < bLength ? b[i] : void 0, aStack, bStack) && result;
+ }
+ if (!result) {
+ return false;
+ }
+ } else if(DeepTypeUtils.isMap(a) && DeepTypeUtils.isMap(b)) {
+ if (a.size != b.size) {
+ return false;
+ }
+ const keysA = [];
+ const keysB = [];
+ a.forEach(function(valueA, keyA) {
+ keysA.push(keyA);
+ });
+ b.forEach(function(valueB, keyB) {
+ keysB.push(keyB);
+ });
+ const mapKeys = [keysA, keysB];
+ const cmpKeys = [keysB, keysA];
+ for (let i = 0; result && i < mapKeys.length; i++) {
+ const mapIter = mapKeys[i];
+ const cmpIter = cmpKeys[i];
+
+ for (let j = 0; result && j < mapIter.length; j++) {
+ const mapKey = mapIter[j];
+ const cmpKey = cmpIter[j];
+ const mapValueA = a.get(mapKey);
+ let mapValueB;
+ if (
+ DeepTypeUtils.isAsymmetricEqualityTester_(mapKey) ||
+ (DeepTypeUtils.isAsymmetricEqualityTester_(cmpKey) &&
+ eq(mapKey, cmpKey))
+ ) {
+ mapValueB = b.get(cmpKey);
+ } else {
+ mapValueB = b.get(mapKey);
+ }
+ result = eq(mapValueA, mapValueB, aStack, bStack);
+ }
+ }
+ if (!result) {
+ return false;
+ }
+ } else if(DeepTypeUtils.isSet(a) && DeepTypeUtils.isSet(b)) {
+ if (a.size != b.size) {
+ return false;
+ }
+ const valuesA = [];
+ a.forEach(function(valueA) {
+ valuesA.push(valueA);
+ });
+ const valuesB = [];
+ b.forEach(function(valueB) {
+ valuesB.push(valueB);
+ });
+ const setPairs = [[valuesA, valuesB], [valuesB, valuesA]];
+ const stackPairs = [[aStack, bStack], [bStack, aStack]];
+ for (let i = 0; result && i < setPairs.length; i++) {
+ const baseValues = setPairs[i][0];
+ const otherValues = setPairs[i][1];
+ const baseStack = stackPairs[i][0];
+ const otherStack = stackPairs[i][1];
+ for (const baseValue of baseValues) {
+ let found = false;
+ for (let j = 0; !found && j < otherValues.length; j++) {
+ const otherValue = otherValues[j];
+ const prevStackSize = baseStack.length;
+ // 深度比较对象
+ found = eq(baseValue, otherValue, baseStack, otherStack);
+ if (!found && prevStackSize !== baseStack.length) {
+ baseStack.splice(prevStackSize);
+ otherStack.splice(prevStackSize);
+ }
+ }
+ result = result && found;
+ }
+ }
+ if (!result) {
+ return false;
+ }
+ } else {
+ const aCtor = a.constructor,
+ bCtor = b.constructor;
+ if (
+ aCtor !== bCtor &&
+ DeepTypeUtils.isFunction_(aCtor) &&
+ DeepTypeUtils.isFunction_(bCtor) &&
+ a instanceof aCtor &&
+ b instanceof bCtor &&
+ !(aCtor instanceof aCtor && bCtor instanceof bCtor)
+ ) {
+ return false;
+ }
+ }
+
+ // 获取对象所有的属性集合
+ const aKeys = DeepTypeUtils.keys(a, aClassName == '[object Array]');
+ size = aKeys.length;
+
+ // 俩个对象属性长度不一致, 俩对象不相同
+ if (DeepTypeUtils.keys(b, bClassName == '[object Array]').length !== size) {
+ return false;
+ }
+
+ // 俩对象属性数量相同, 递归比较每个属性值得值
+ for (const key of aKeys) {
+ console.log('key is:' + key);
+ // b 没有 key 属性
+ if(!DeepTypeUtils.has(b, key)) {
+ result = false;
+ continue;
+ }
+ if (!eq(a[key], b[key], aStack, bStack)) {
+ result = false;
+ }
+ }
+ if (!result) {
+ return false;
+ }
+ aStack.pop();
+ bStack.pop();
+ return result;
+}
+
+function asymmetricMatch_(a, b) {
+ const asymmetricA = DeepTypeUtils.isAsymmetricEqualityTester_(a);
+ const asymmetricB = DeepTypeUtils.isAsymmetricEqualityTester_(b);
+
+ if (asymmetricA === asymmetricB) {
+ return undefined;
+ }
+
+}
+
+/**
+ * 获取对象的自有属性
+ *
+ * @param obj 对象
+ * @param isArray 是否是一个数组
+ */
+function keys(obj, isArray) {
+ const keys = [];
+
+}
+
+export default assertDeepEquals;
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/isPromiseLike.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/isPromiseLike.js
new file mode 100644
index 0000000000000000000000000000000000000000..015ab19a2a0c4872d7cb490b61f8e1dd6a8ac90b
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/isPromiseLike.js
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+function isPromiseLike(obj) {
+ return !!obj && isFunction_(obj.then);
+}
+
+function isFunction_(value) {
+ return isA_('Function', value);
+}
+
+function isA_(typeName, value) {
+ return getType_(value) === '[object ' + typeName + ']';
+}
+
+function getType_(value) {
+ return Object.prototype.toString.apply(value);
+}
+
+export default isPromiseLike;
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/config/DataDriver.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/config/DataDriver.js
new file mode 100644
index 0000000000000000000000000000000000000000..639dffc9cdb912f1f33a6ccb61868c9ed7c695bf
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/config/DataDriver.js
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+const SUITES_KEY = 'suites';
+const SPECS_KEY = 'items';
+const DESCRIBE_KEY = 'describe';
+const IT_KEY = 'it';
+const PARAMS_KEY = 'params';
+const STRESS_KEY = 'stress';
+
+class ObjectUtils {
+ static get(object, name, defaultValue) {
+ let result = defaultValue;
+ for (const key in object) {
+ if (key === name) {
+ return object[key];
+ }
+ }
+ return result;
+ }
+
+ static has(object, key) {
+ return Object.prototype.hasOwnProperty.call(object, key);
+ }
+}
+
+class DataDriver {
+ constructor(attr) {
+ this.id = 'dataDriver';
+ this.data = attr.data || {};
+ }
+
+ init(coreContext) {
+ this.coreContext = coreContext;
+ this.suiteService = this.coreContext.getDefaultService('suite');
+ this.specService = this.coreContext.getDefaultService('spec');
+ }
+
+ getSpecParams() {
+ let specParams = [];
+ let suiteDesc = this.suiteService.getCurrentRunningSuite().description;
+ let specDesc = this.specService.getCurrentRunningSpec().description;
+ let suites = ObjectUtils.get(this.data, SUITES_KEY, []);
+ for (const suiteItem of suites) {
+ let describeValue = ObjectUtils.get(suiteItem, DESCRIBE_KEY, '');
+ if (ObjectUtils.has(suiteItem, DESCRIBE_KEY) && (typeof describeValue === 'object') && describeValue.constructor === Array && describeValue.includes(suiteDesc)) {
+ let specs = ObjectUtils.get(suiteItem, SPECS_KEY, []);
+ for (const specItem of specs) {
+ if (ObjectUtils.has(specItem, IT_KEY) && ObjectUtils.get(specItem, IT_KEY) === specDesc) {
+ return ObjectUtils.get(specItem, PARAMS_KEY, specParams);
+ }
+ }
+ }
+ }
+ return specParams;
+ }
+
+ getSuiteParams() {
+ let suiteParams = {};
+ let suiteDesc = this.suiteService.getCurrentRunningSuite().description;
+ let suites = ObjectUtils.get(this.data, SUITES_KEY, []);
+ for (const suiteItem of suites) {
+ let describeValue = ObjectUtils.get(suiteItem, DESCRIBE_KEY, []);
+ if (ObjectUtils.has(suiteItem, DESCRIBE_KEY) && (typeof describeValue === 'object') && describeValue.constructor === Array && describeValue.includes(suiteDesc)) {
+ suiteParams = Object.assign({}, suiteParams, ObjectUtils.get(suiteItem, PARAMS_KEY, suiteParams));
+ }
+ }
+ return suiteParams;
+ }
+
+ getSpecStress(specDesc) {
+ let stress = 1;
+ let suiteDesc = this.suiteService.getCurrentRunningSuite().description;
+ let suites = ObjectUtils.get(this.data, SUITES_KEY, []);
+ for (const suiteItem of suites) {
+ let describeValue = ObjectUtils.get(suiteItem, DESCRIBE_KEY, '');
+ if (ObjectUtils.has(suiteItem, DESCRIBE_KEY) && (typeof describeValue === 'object') && describeValue.constructor === Array && describeValue.includes(suiteDesc)) {
+ let specs = ObjectUtils.get(suiteItem, SPECS_KEY, []);
+ for (const specItem of specs) {
+ if (ObjectUtils.has(specItem, IT_KEY) && ObjectUtils.get(specItem, IT_KEY) === specDesc) {
+ let tempStress = ObjectUtils.get(specItem, STRESS_KEY, stress);
+ return (Number.isInteger(tempStress) && tempStress >= 1) ? tempStress : stress;
+ }
+ }
+ }
+ }
+ return stress;
+ }
+
+ getSuiteStress(suiteDesc) {
+ let stress = 1;
+ let suites = ObjectUtils.get(this.data, SUITES_KEY, []);
+ for (const suiteItem of suites) {
+ let describeValue = ObjectUtils.get(suiteItem, DESCRIBE_KEY, []);
+ if (ObjectUtils.has(suiteItem, DESCRIBE_KEY) && (typeof describeValue === 'object') && describeValue.constructor === Array && describeValue.includes(suiteDesc)) {
+ let tempStress = ObjectUtils.get(suiteItem, STRESS_KEY, stress);
+ return (Number.isInteger(tempStress) && tempStress >= 1) ? tempStress : stress;
+ }
+ }
+ return stress;
+ }
+}
+
+export default DataDriver;
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/config/Filter.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/config/Filter.js
new file mode 100644
index 0000000000000000000000000000000000000000..2720b73ea2cebd148ee8d2a337b8fe9529912a0d
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/config/Filter.js
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2021-2024 Huawei Device 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 { LEVEL, SIZE, TESTTYPE } from "../../Constant";
+
+class ClassFilter {
+ constructor(suiteName, itName, params) {
+ this.suiteName = suiteName;
+ this.itName = itName;
+ this.params = params;
+ }
+
+ filterSuite() {
+ return !this.params.split(',').map(item => item.split('#')[0]).map(item => item == this.suiteName).reduce((pre, cur) => pre || cur, false);
+ }
+
+ filterIt() {
+ let classArray = this.params.split(',') || [];
+ let suiteFilterResult = classArray.filter(item => !item.includes('#')).map(item => item == this.suiteName).reduce((pre, cur) => pre || cur, false);
+ let itFilterResult = classArray.filter(item => item.includes('#')).map(item => item == (this.suiteName + '#' + this.itName)).reduce((pre, cur) => pre || cur, false);
+ return !(suiteFilterResult || itFilterResult);
+ }
+}
+
+class NotClassFilter {
+ constructor(suiteName, itName, params) {
+ this.suiteName = suiteName;
+ this.itName = itName;
+ this.params = params;
+ }
+
+ filterSuite() {
+ return this.params.split(',').map(item => item == this.suiteName).reduce((pre, cur) => pre || cur, false);
+ }
+
+ filterIt() {
+ return this.params.split(',').some(item => item == (this.suiteName + '#' + this.itName));
+ }
+}
+
+class SuiteAndItNameFilter {
+ constructor(suiteName, itName, params) {
+ this.suiteName = suiteName;
+ this.itName = itName;
+ this.params = params;
+ }
+
+ filterSuite() {
+ return !this.params.split(',').map(item => item == this.suiteName).reduce((pre, cur) => pre || cur, false);
+ }
+
+ filterIt() {
+ return !this.params.split(',').map(item => item == this.itName).reduce((pre, cur) => pre || cur, false);
+ }
+}
+
+
+class TestTypesFilter {
+ constructor(suiteName, itName, fi, params) {
+ this.suiteName = suiteName;
+ this.itName = itName;
+ this.params = params;
+ this.fi = fi;
+ }
+
+ filterIt() {
+ return !((this.params === (this.fi & this.params)) || this.fi === 0);
+ }
+}
+
+class NestFilter {
+ filterNestName(targetSuiteArray, targetSpecArray, suiteStack, desc) {
+ let targetSuiteName = "";
+ for (let key in suiteStack) {
+ targetSuiteName = targetSuiteName + "." + suiteStack[key].description;
+ }
+ targetSuiteName = targetSuiteName.substring(2);
+ const targetSpecName = targetSuiteName + "#" + desc;
+ let isFilter = true;
+ if (targetSpecArray.includes(targetSpecName)) {
+ return false;
+ }
+ for (let index in targetSuiteArray) {
+ if (targetSuiteName.startsWith(targetSuiteArray[index])) {
+ return false;
+ }
+ }
+ return isFilter;
+ }
+
+ filterNotClass(notClass, suiteStack, desc) {
+ let isFilterNotClass = false;
+ if (notClass != null) {
+ let notClassArray = notClass.split(",");
+ let targetSuiteName = "";
+ for (let key in suiteStack) {
+ targetSuiteName = targetSuiteName + "." + suiteStack[key].description;
+ }
+ targetSuiteName = targetSuiteName.substring(2);
+ const targetSpecName = targetSuiteName + "#" + desc;
+ if (notClassArray.includes(targetSpecName) || notClassArray.some(key => targetSpecName.startsWith(key))) {
+ isFilterNotClass = true;
+ }
+ }
+ return isFilterNotClass;
+ }
+
+ filterLevelOrSizeOrTestType(level, size, testType, filter) {
+ let result = false;
+ if (filter === 0 || filter === '0') {
+ return result;
+ }
+ if (level == null && size == null && testType == null) {
+ return result;
+ }
+ if (level != null) {
+ let levelFilter = LEVEL[`${level}`];
+ result = result || filter === levelFilter;
+ }
+ if (size != null) {
+ let sizeFilter = SIZE[`${size}`];
+ result = result || filter === sizeFilter;
+ }
+ if (testType != null) {
+ let testTypeFilter = TESTTYPE[`${testType}`];
+ result = result || filter === testTypeFilter;
+ }
+ return !result;
+ }
+}
+export { ClassFilter, NotClassFilter, SuiteAndItNameFilter, TestTypesFilter, NestFilter };
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/config/configService.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/config/configService.js
new file mode 100644
index 0000000000000000000000000000000000000000..8639877e3d114d54a1e3430ea41ffaa51cba5a59
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/config/configService.js
@@ -0,0 +1,299 @@
+/*
+ * Copyright (c) 2021-2024 Huawei Device 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 { ClassFilter, NotClassFilter, SuiteAndItNameFilter, TestTypesFilter, NestFilter } from './Filter';
+import { TAG, TESTTYPE, LEVEL, SIZE, KEYSET } from '../../Constant';
+const STRESS_RULE = /^[1-9]\d*$/;
+
+class ConfigService {
+ constructor(attr) {
+ this.id = attr.id;
+ this.supportAsync = true; // 默认异步处理测试用例
+ this.random = false;
+ this.filterValid = [];
+ this.filter = 0;
+ this.flag = false;
+ this.suite = null;
+ this.itName = null;
+ this.testType = null;
+ this.level = null;
+ this.size = null;
+ this.class = null;
+ this.notClass = null;
+ this.timeout = null;
+ // 遇错即停模式配置
+ this.breakOnError = false;
+ // 压力测试配置
+ this.stress = null;
+ this.skipMessage = false;
+ this.runSkipped = '';
+ this.filterXdescribe = [];
+ }
+
+ init(coreContext) {
+ this.coreContext = coreContext;
+ }
+
+ isNormalInteger(str) {
+ const n = Math.floor(Number(str));
+ return n !== Infinity && String(n) === String(str) && n >= 0;
+ }
+
+
+ getStress() {
+ if (this.stress === undefined || this.stress === '' || this.stress === null) {
+ return 1;
+ }
+ return !this.stress.match(STRESS_RULE) ? 1 : Number.parseInt(this.stress);
+ }
+
+ basicParamValidCheck(params) {
+ let size = params.size;
+ if (size !== undefined && size !== '' && size !== null) {
+ let sizeArray = ['small', 'medium', 'large'];
+ if (sizeArray.indexOf(size) === -1) {
+ this.filterValid.push('size:' + size);
+ }
+ }
+ let level = params.level;
+ if (level !== undefined && level !== '' && level !== null) {
+ let levelArray = ['0', '1', '2', '3', '4'];
+ if (levelArray.indexOf(level) === -1) {
+ this.filterValid.push('level:' + level);
+ }
+ }
+ let testType = params.testType;
+ if (testType !== undefined && testType !== '' && testType !== null) {
+ let testTypeArray = ['function', 'performance', 'power', 'reliability', 'security',
+ 'global', 'compatibility', 'user', 'standard', 'safety', 'resilience'];
+ if (testTypeArray.indexOf(testType) === -1) {
+ this.filterValid.push('testType:' + testType);
+ }
+ }
+ }
+
+ filterParamValidCheck(params) {
+ let timeout = params.timeout;
+ if (timeout !== undefined && timeout !== '' && timeout !== null) {
+ if (!this.isNormalInteger(timeout)) {
+ this.filterValid.push('timeout:' + timeout);
+ }
+ }
+
+ let paramKeys = ['dryRun', 'random', 'breakOnError', 'coverage', 'skipMessage'];
+ for (const key of paramKeys) {
+ if (params[key] !== undefined && params[key] !== 'true' && params[key] !== 'false') {
+ this.filterValid.push(`${key}:${params[key]}`);
+ }
+ }
+
+ // 压力测试参数验证,正整数
+ if (params.stress !== undefined && params.stress !== '' && params.stress !== null) {
+ if (!params.stress.match(STRESS_RULE)) {
+ this.filterValid.push('stress:' + params.stress);
+ }
+ }
+
+ let nameRule = /^[A-Za-z]{1}[\w#,.]*$/;
+ let paramClassKeys = ['class', 'notClass'];
+ for (const key of paramClassKeys) {
+ if (params[key] !== undefined && params[key] !== '' && params[key] !== null) {
+ let classArray = params[key].split(',');
+ classArray.forEach(item => !item.match(nameRule) ? this.filterValid.push(`${key}:${params[key]}`) : null);
+ }
+ }
+ }
+
+ setConfig(params) {
+ this.basicParamValidCheck(params);
+ this.filterParamValidCheck(params);
+ try {
+ this.class = params.class;
+ this.notClass = params.notClass;
+ this.flag = params.flag || { flag: false };
+ this.suite = params.suite;
+ this.itName = params.itName;
+ this.filter = params.filter;
+ this.testType = params.testType;
+ this.level = params.level;
+ this.size = params.size;
+ this.timeout = params.timeout;
+ this.dryRun = params.dryRun;
+ this.breakOnError = params.breakOnError;
+ this.random = params.random === 'true' ? true : false;
+ this.stress = params.stress;
+ this.coverage = params.coverage;
+ this.skipMessage = params.skipMessage;
+ this.runSkipped = params.runSkipped;
+ this.filterParam = {
+ testType: TESTTYPE,
+ level: LEVEL,
+ size: SIZE
+ };
+ this.parseParams();
+ } catch (err) {
+ console.info(`${TAG}setConfig error: ${err.message}`);
+ }
+ }
+
+ parseParams() {
+ if (this.filter != null) {
+ return;
+ }
+ let testTypeFilter = 0;
+ let sizeFilter = 0;
+ let levelFilter = 0;
+ if (this.testType != null) {
+ testTypeFilter = this.testType.split(',')
+ .map(item => this.filterParam.testType[item] || 0)
+ .reduce((pre, cur) => pre | cur, 0);
+ }
+ if (this.level != null) {
+ levelFilter = this.level.split(',')
+ .map(item => this.filterParam.level[item] || 0)
+ .reduce((pre, cur) => pre | cur, 0);
+ }
+ if (this.size != null) {
+ sizeFilter = this.size.split(',')
+ .map(item => this.filterParam.size[item] || 0)
+ .reduce((pre, cur) => pre | cur, 0);
+ }
+ this.filter = testTypeFilter | sizeFilter | levelFilter;
+ console.info(`${TAG}filter params:${this.filter}`);
+ }
+
+ isCurrentSuite(description) {
+ if (this.suite !== undefined && this.suite !== '' && this.suite !== null) {
+ let suiteArray = this.suite.split(',');
+ return suiteArray.indexOf(description) !== -1;
+ }
+ return false;
+ }
+
+ filterSuite(currentSuiteName) {
+ let filterArray = [];
+ if (this.suite !== undefined && this.suite !== '' && this.suite !== null) {
+ filterArray.push(new SuiteAndItNameFilter(currentSuiteName, '', this.suite));
+ }
+ if (this.class !== undefined && this.class !== '' && this.class !== null) {
+ filterArray.push(new ClassFilter(currentSuiteName, '', this.class));
+ }
+ if (this.notClass !== undefined && this.notClass !== '' && this.notClass !== null) {
+ filterArray.push(new NotClassFilter(currentSuiteName, '', this.notClass));
+ }
+
+ let result = filterArray.map(item => item.filterSuite()).reduce((pre, cur) => pre || cur, false);
+ return result;
+ }
+
+ filterDesc(currentSuiteName, desc, fi, coreContext) {
+ let filterArray = [];
+ if (this.itName !== undefined && this.itName !== '' && this.itName !== null) {
+ filterArray.push(new SuiteAndItNameFilter(currentSuiteName, desc, this.itName));
+ }
+ if (this.class !== undefined && this.class !== '' && this.class !== null) {
+ filterArray.push(new ClassFilter(currentSuiteName, desc, this.class));
+ }
+ if (this.notClass !== undefined && this.notClass !== '' && this.notClass !== null) {
+ filterArray.push(new NotClassFilter(currentSuiteName, desc, this.notClass));
+ }
+ if (typeof (this.filter) !== 'undefined' && this.filter !== 0 && fi !== 0) {
+ filterArray.push(new TestTypesFilter('', '', fi, this.filter));
+ }
+ let result = filterArray.map(item => item.filterIt()).reduce((pre, cur) => pre || cur, false);
+ return result;
+ }
+
+ filterWithNest(desc, filter) {
+ let filterArray = [];
+ const nestFilter = new NestFilter();
+ const targetSuiteArray = this.coreContext.getDefaultService('suite').targetSuiteArray;
+ const targetSpecArray = this.coreContext.getDefaultService('suite').targetSpecArray;
+ const suiteStack = this.coreContext.getDefaultService('suite').suitesStack;
+ let isFilter = nestFilter.filterNestName(targetSuiteArray, targetSpecArray, suiteStack, desc);
+ const isFullRun = this.coreContext.getDefaultService('suite').fullRun;
+ if (typeof (this.filter) !== 'undefined' && this.filter !== 0 && filter !== 0) {
+ filterArray.push(new TestTypesFilter('', '', filter, this.filter));
+ return filterArray.map(item => item.filterIt()).reduce((pre, cur) => pre || cur, false);
+ }
+ if (isFilter && !isFullRun) {
+ return true;
+ }
+ return nestFilter.filterNotClass(this.notClass, suiteStack, desc);
+
+ }
+
+ isRandom() {
+ return this.random || false;
+ }
+
+ isBreakOnError() {
+ return this.breakOnError !== 'true' ? false : true;
+ }
+
+ setSupportAsync(value) {
+ this.supportAsync = value;
+ }
+
+ isSupportAsync() {
+ return this.supportAsync;
+ }
+
+ translateParams(parameters) {
+ const keySet = new Set(KEYSET);
+ let targetParams = {};
+ for (const key in parameters) {
+ if (keySet.has(key)) {
+ var newKey = key.replace("-s ", "");
+ targetParams[newKey] = parameters[key];
+ }
+ }
+ return targetParams;
+ }
+ translateParamsToString(parameters) {
+ const keySet = new Set(KEYSET);
+ let targetParams = '';
+ for (const key in parameters) {
+ if (keySet.has(key)) {
+ targetParams += ' ' + key + ' ' + parameters[key];
+ }
+ }
+ return targetParams.trim();
+ }
+
+ execute() {
+ }
+
+ checkIfSuiteInSkipRun(desc) {
+ return this.runSkipped.split(",").some(item => {
+ return item === desc || item.startsWith(desc + '.') || item.startsWith(desc + '#') || desc.startsWith(item + '.') || this.runSkipped === 'skipped';
+ });
+ }
+
+ checkIfSpecInSkipRun(desc) {
+ return this.runSkipped.split(",").some(item => {
+ if (item.includes("#")) {
+ return item === desc;
+ } else {
+ return desc.startsWith(item + ".") || desc.startsWith(item + "#") || this.runSkipped === 'skipped';
+ }
+ }
+ );
+ }
+}
+
+export {
+ ConfigService
+};
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/coverage/coverageCollect.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/coverage/coverageCollect.js
new file mode 100644
index 0000000000000000000000000000000000000000..466bbaa11ef258895ebd64929ac5c99f7a471051
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/coverage/coverageCollect.js
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2023 Huawei Device 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 SysTestKit from "../kit/SysTestKit";
+import fs from '@ohos.file.fs';
+import {TAG} from '../../Constant';
+
+const jsCoverageFileName = 'js_coverage.json';
+
+export async function collectCoverageData() {
+ if (globalThis.__coverage__ === undefined) {
+ console.info(`${TAG} globalThis not have coverage`);
+ return;
+ }
+ const strJson = JSON.stringify(globalThis.__coverage__);
+ let testMode = globalThis.__testMode__;
+ console.info(`${TAG} coverage data testMode: ${testMode}`)
+ let savePath = globalThis.__savePath__;
+ console.info(`${TAG} write coverage data to: ${savePath}`);
+ let readPath = globalThis.__readPath__;
+ console.info(`${TAG} read coverage data in: ${readPath}`);
+
+ // run callback mode if local test or (save path and read path ) is not defined
+ if (!testMode || !isCoveragePathValid(savePath)) {
+ console.info(`${TAG} run coverage data in call back mode`)
+ const strLen = strJson.length;
+ const maxLen = 500;
+ const maxCount = Math.floor(strLen / maxLen);
+ const OHOS_REPORT_COVERAGE_DATA = 'OHOS_REPORT_COVERAGE_DATA:';
+ for (let count = 0; count <= maxCount; count++) {
+ console.info(`${OHOS_REPORT_COVERAGE_DATA} ${strJson.substring(count * maxLen, (count + 1) * maxLen)}`);
+ await SysTestKit.print(`${OHOS_REPORT_COVERAGE_DATA} ${strJson.substring(count * maxLen, (count + 1) * maxLen)}`);
+ }
+ return;
+ }
+ console.info(`${TAG} run coverage data in save file mode`);
+ if(fs.accessSync(savePath)) {
+ fs.unlinkSync(savePath)
+ }
+
+ let inputPathDir = savePath.substring(0, savePath.length - jsCoverageFileName.length);
+ if (!fs.accessSync(inputPathDir)) {
+ console.info(`${TAG} coverage data create dir: ${inputPathDir}`);
+ fs.mkdirSync(inputPathDir)
+ }
+
+ let file = fs.openSync(savePath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
+ let writeLen = fs.writeSync(file.fd, strJson, {encoding:"utf-8"});
+ console.info(`${TAG} write coverage data success: ${writeLen}`);
+ fs.closeSync(file);
+ const OHOS_REPORT_COVERAGE_PATH = 'OHOS_REPORT_COVERAGE_PATH:';
+ await SysTestKit.print(`${OHOS_REPORT_COVERAGE_PATH} ${readPath}`);
+ console.info(`${OHOS_REPORT_COVERAGE_PATH} ${readPath}`);
+}
+
+function isCoveragePathValid(inputPath) {
+ if (!inputPath) {
+ return false;
+ }
+ if (inputPath.indexOf(jsCoverageFileName) === -1) {
+ return false;
+ }
+ return true;
+}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/kit/SysTestKit.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/kit/SysTestKit.js
new file mode 100644
index 0000000000000000000000000000000000000000..86173be050350e7284d17842abb0d23d3c1d97bb
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/kit/SysTestKit.js
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2022-2023 Huawei Device 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 {TAG} from '../../Constant';
+import Core from '../../core.js';
+
+export default class SysTestKit {
+
+ static delegator = null;
+ static systemTime = null;
+
+ constructor() {
+ this.id = 'sysTestKit';
+ this.index = 0;
+ }
+
+ static getDescribeName() {
+ return Core.getInstance().getDefaultService('suite').getCurrentRunningSuite().description;
+ }
+
+ static getItName() {
+ return Core.getInstance().getDefaultService('spec').getCurrentRunningSpec().description;
+ }
+
+ static getItAttribute() {
+ return Core.getInstance().getDefaultService('spec').getCurrentRunningSpec().fi;
+ }
+
+ static actionStart(tag) {
+ console.info(`${TAG}${JSON.stringify(tag)}`);
+ var message = '\n' + 'OHOS_REPORT_ACTIONSTART: ' + JSON.stringify(tag) + '\n';
+ SysTestKit.print(message);
+ console.info(`${TAG}${JSON.stringify(tag)} actionStart print success`);
+ }
+
+ static actionEnd(tag) {
+ console.info(`${TAG}${JSON.stringify(tag)}`);
+ var message = '\n' + 'OHOS_REPORT_ACTIONEND: ' + JSON.stringify(tag) + '\n';
+ SysTestKit.print(message);
+ console.info(`${TAG}${JSON.stringify(tag)} actionEnd print success`);
+ }
+
+ static async existKeyword(keyword, timeout) {
+ let reg = new RegExp(/^[a-zA-Z0-9]{1,}$/);
+ if (!reg.test(keyword)) {
+ throw new Error('keyword must contain more than one string, and only letters and numbers are supported.');
+ }
+ timeout = timeout || 4;
+
+ let searchResult = false;
+ let cmd = 'hilog -x | grep -i \'' + keyword + '\' | wc -l';
+ await executePromise(cmd, timeout).then((data) => {
+ searchResult = data;
+ });
+ return searchResult;
+ }
+ static async print(message) {
+ if ('printSync' in SysTestKit.delegator) {
+ console.debug(`${TAG}printSync called ...`);
+ SysTestKit.delegator.printSync(message);
+ } else {
+ await SysTestKit.delegator.print(message);
+ }
+ }
+
+ static async getRealTime() {
+ let currentTime = new Date().getTime();
+ if (SysTestKit.systemTime !== null && SysTestKit.systemTime !== undefined) {
+ await SysTestKit.systemTime.getRealTime().then((time) => {
+ console.info(`${TAG}systemTime.getRealTime success data: ${JSON.stringify(time)}`);
+ currentTime = time;
+ }).catch((error) => {
+ console.error(`${TAG}failed to systemTime.getRealTime because ${JSON.stringify(error)}`);
+ });
+ }
+ return currentTime;
+ }
+}
+
+function executePromise(cmd, timeout) {
+ return new Promise((resolve, reject) => {
+ SysTestKit.delegator.executeShellCommand(cmd, timeout,
+ (error, data) => {
+ console.info(`${TAG}existKeyword CallBack: err : ${JSON.stringify(error)}`);
+ console.info(`${TAG}existKeyword CallBack: data : ${JSON.stringify(data)}`);
+ resolve(parseInt(data.stdResult) > 3 ? true : false);
+ });
+ });
+}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/mock/ArgumentMatchers.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/mock/ArgumentMatchers.js
new file mode 100644
index 0000000000000000000000000000000000000000..6a9d7aac464e95383ea31385284b6603c34e084c
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/mock/ArgumentMatchers.js
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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.
+ */
+
+class ArgumentMatchers {
+ ANY = "";
+ ANY_STRING = "";
+ ANY_BOOLEAN = "";
+ ANY_NUMBER = "";
+ ANY_OBJECT = "";
+ ANY_FUNCTION = "";
+ MATCH_REGEXS = "";
+
+ static any() {
+ }
+
+ static anyString() {
+ }
+
+ static anyBoolean() {
+ }
+
+ static anyNumber() {
+ }
+
+ static anyObj() {
+ }
+
+ static anyFunction() {
+ }
+
+ static matchRegexs() {
+ let regex = arguments[0];
+ if (ArgumentMatchers.isRegExp(regex)) {
+ return regex;
+ }
+ throw Error("not a regex");
+ }
+
+ static isRegExp(value) {
+ return Object.prototype.toString.call(value) === "[object RegExp]";
+ }
+
+ matcheReturnKey() {
+ let arg = arguments[0];
+ let regex = arguments[1];
+ let stubSetKey = arguments[2];
+
+ if (stubSetKey && stubSetKey == this.ANY) {
+ return this.ANY;
+ }
+
+ if (typeof arg === "string" && !regex) {
+ return this.ANY_STRING;
+ }
+
+ if (typeof arg === "boolean" && !regex) {
+ return this.ANY_BOOLEAN;
+ }
+
+ if (typeof arg === "number" && !regex) {
+ return this.ANY_NUMBER;
+ }
+
+ if (typeof arg === "object" && !regex) {
+ return this.ANY_OBJECT;
+ }
+
+ if (typeof arg === "function" && !regex) {
+ return this.ANY_FUNCTION;
+ }
+
+ if (typeof arg === "string" && regex) {
+ return regex.test(arg);
+ }
+
+ return null;
+ }
+
+ matcheStubKey() {
+ let key = arguments[0];
+
+ if (key === ArgumentMatchers.any) {
+ return this.ANY;
+ }
+
+ if (key === ArgumentMatchers.anyString) {
+ return this.ANY_STRING;
+ }
+ if (key === ArgumentMatchers.anyBoolean) {
+ return this.ANY_BOOLEAN;
+ }
+ if (key === ArgumentMatchers.anyNumber) {
+ return this.ANY_NUMBER;
+ }
+ if (key === ArgumentMatchers.anyObj) {
+ return this.ANY_OBJECT;
+ }
+ if (key === ArgumentMatchers.anyFunction) {
+ return this.ANY_FUNCTION;
+ }
+
+ if (ArgumentMatchers.isRegExp(key)) {
+ return key;
+ }
+
+ return null;
+ }
+}
+
+export default ArgumentMatchers;
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/mock/ExtendInterface.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/mock/ExtendInterface.js
new file mode 100644
index 0000000000000000000000000000000000000000..c6a866a6df662ad10a7f6869dcbc2381fa47bcdc
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/mock/ExtendInterface.js
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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.
+ */
+
+class ExtendInterface {
+ constructor(mocker) {
+ this.mocker = mocker;
+ }
+
+ stub() {
+ this.params = arguments;
+ return this;
+ }
+
+ stubMockedCall(returnInfo) {
+ this.mocker.stubApply(this, this.params, returnInfo);
+ }
+
+ afterReturn(value) {
+ this.stubMockedCall(function () {
+ return value;
+ });
+ }
+
+ afterReturnNothing() {
+ this.stubMockedCall(function () {
+ return undefined;
+ });
+ }
+
+ afterAction(action) {
+ this.stubMockedCall(action);
+ }
+
+ afterThrow(msg) {
+ this.stubMockedCall(function () {
+ throw msg;
+ });
+ }
+
+ clear() {
+ this.mocker.clear();
+ }
+}
+
+export default ExtendInterface;
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/mock/MockKit.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/mock/MockKit.js
new file mode 100644
index 0000000000000000000000000000000000000000..6e9e19ab7baa7fe024496e28f4f97abd9a7db9b4
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/mock/MockKit.js
@@ -0,0 +1,256 @@
+/*
+ * Copyright (c) 2022-2023 Huawei Device 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 ExtendInterface from "./ExtendInterface";
+import VerificationMode from "./VerificationMode";
+import ArgumentMatchers from "./ArgumentMatchers";
+
+class MockKit {
+
+ constructor() {
+ this.mFunctions = [];
+ this.stubs = new Map();
+ this.recordCalls = new Map();
+ this.currentSetKey = new Map();
+ this.mockObj = null;
+ this.recordMockedMethod = new Map();
+ }
+
+ init() {
+ this.reset();
+ }
+
+ reset() {
+ this.mFunctions = [];
+ this.stubs = {};
+ this.recordCalls = {};
+ this.currentSetKey = new Map();
+ this.mockObj = null;
+ this.recordMockedMethod = new Map();
+ }
+
+ clearAll() {
+ this.reset();
+ var props = Object.keys(this);
+ for (var i = 0; i < props.length; i++) {
+ delete this[props[i]];
+ }
+
+ var props = Object.getOwnPropertyNames(this);
+ for (var i = 0; i < props.length; i++) {
+ delete this[props[i]];
+ }
+ for (var key in this) {
+ delete this[key];
+ }
+ }
+
+ clear(obj) {
+ if (!obj) throw Error("Please enter an object to be cleaned");
+ if (typeof (obj) !== 'object' && typeof (obj) !== 'function') throw new Error('Not a object or static class');
+ this.recordMockedMethod.forEach(function (value, key, map) {
+ if (key) {
+ obj[key] = value;
+ }
+ });
+ }
+
+ ignoreMock(obj, method) {
+ if (typeof (obj) !== 'object' && typeof (obj) !== 'function') throw new Error('Not a object or static class');
+ if (typeof (method) !== 'function') throw new Error('Not a function');
+ let og = this.recordMockedMethod.get(method.propName);
+ if (og) {
+ obj[method.propName] = og;
+ this.recordMockedMethod.set(method.propName, undefined);
+ }
+ }
+
+ extend(dest, source) {
+ dest["stub"] = source["stub"];
+ dest["afterReturn"] = source["afterReturn"];
+ dest["afterReturnNothing"] = source["afterReturnNothing"];
+ dest["afterAction"] = source["afterAction"];
+ dest["afterThrow"] = source["afterThrow"];
+ dest["stubMockedCall"] = source["stubMockedCall"];
+ dest["clear"] = source["clear"];
+ return dest;
+ }
+
+ stubApply(f, params, returnInfo) {
+ let values = this.stubs.get(f);
+ if (!values) {
+ values = new Map();
+ }
+ let key = params[0];
+ if (typeof key == "undefined") {
+ key = "anonymous-mock-" + f.propName;
+ }
+ let matcher = new ArgumentMatchers();
+ if (matcher.matcheStubKey(key)) {
+ key = matcher.matcheStubKey(key);
+ if (key) {
+ this.currentSetKey.set(f, key);
+ }
+ }
+ values.set(key, returnInfo);
+ this.stubs.set(f, values);
+ }
+
+ getReturnInfo(f, params) {
+ let values = this.stubs.get(f);
+ if (!values) {
+ return undefined;
+ }
+ let retrunKet = params[0];
+ if (typeof retrunKet == "undefined") {
+ retrunKet = "anonymous-mock-" + f.propName;
+ }
+ let stubSetKey = this.currentSetKey.get(f);
+
+ if (stubSetKey && (typeof (retrunKet) !== "undefined")) {
+ retrunKet = stubSetKey;
+ }
+ let matcher = new ArgumentMatchers();
+ if (matcher.matcheReturnKey(params[0], undefined, stubSetKey) && matcher.matcheReturnKey(params[0], undefined, stubSetKey) !== stubSetKey) {
+ retrunKet = params[0];
+ }
+
+ values.forEach(function (value, key, map) {
+ if (ArgumentMatchers.isRegExp(key) && matcher.matcheReturnKey(params[0], key)) {
+ retrunKet = key;
+ }
+ });
+
+ return values.get(retrunKet);
+ }
+
+ findName(obj, value) {
+ let properties = this.findProperties(obj);
+ let name = null;
+ properties.filter(item => (item !== 'caller' && item !== 'arguments')).forEach(
+ function (va1, idx, array) {
+ if (obj[va1] === value) {
+ name = va1;
+ }
+ }
+ );
+ return name;
+ }
+
+ isFunctionFromPrototype(f, container, propName) {
+ if (container.constructor !== Object && container.constructor.prototype !== container) {
+ return container.constructor.prototype[propName] === f;
+ }
+ return false;
+ }
+
+ findProperties(obj, ...arg) {
+ function getProperty(new_obj) {
+ if (new_obj.__proto__ === null) {
+ return [];
+ }
+ let properties = Object.getOwnPropertyNames(new_obj);
+ return [...properties, ...getProperty(new_obj.__proto__)];
+ }
+ return getProperty(obj);
+ }
+
+ recordMethodCall(originalMethod, args) {
+ Function.prototype.getName = function () {
+ return this.name || this.toString().match(/function\s*([^(]*)\(/)[1];
+ };
+ let name = originalMethod.getName();
+ let arglistString = name + '(' + Array.from(args).toString() + ')';
+ let records = this.recordCalls.get(arglistString);
+ if (!records) {
+ records = 0;
+ }
+ records++;
+ this.recordCalls.set(arglistString, records);
+ }
+
+ mockFunc(originalObject, originalMethod) {
+ let tmp = this;
+ this.originalMethod = originalMethod;
+ let f = function () {
+ let args = arguments;
+ let action = tmp.getReturnInfo(f, args);
+ if (originalMethod) {
+ tmp.recordMethodCall(originalMethod, args);
+ }
+ if (action) {
+ return action.apply(this, args);
+ }
+ };
+
+ f.container = null || originalObject;
+ f.original = originalMethod || null;
+
+ if (originalObject && originalMethod) {
+ if (typeof (originalMethod) !== 'function') throw new Error('Not a function');
+ var name = this.findName(originalObject, originalMethod);
+ originalObject[name] = f;
+ this.recordMockedMethod.set(name, originalMethod);
+ f.propName = name;
+ f.originalFromPrototype = this.isFunctionFromPrototype(f.original, originalObject, f.propName);
+ }
+ f.mocker = this;
+ this.mFunctions.push(f);
+ this.extend(f, new ExtendInterface(this));
+ return f;
+ }
+
+ verify(methodName, argsArray) {
+ if (!methodName) {
+ throw Error("not a function name");
+ }
+ let a = this.recordCalls.get(methodName + '(' + argsArray.toString() + ')');
+ return new VerificationMode(a ? a : 0);
+ }
+
+ mockObject(object) {
+ if (!object || typeof object === "string") {
+ throw Error(`this ${object} cannot be mocked`);
+ }
+ const _this = this;
+ let mockedObject = {};
+ let keys = Reflect.ownKeys(object);
+ keys.filter(key => (typeof Reflect.get(object, key)) === 'function')
+ .forEach(key => {
+ mockedObject[key] = object[key];
+ mockedObject[key] = _this.mockFunc(mockedObject, mockedObject[key]);
+ });
+ return mockedObject;
+ }
+}
+
+function ifMockedFunction(f) {
+ if (Object.prototype.toString.call(f) !== "[object Function]" &&
+ Object.prototype.toString.call(f) !== "[object AsyncFunction]") {
+ throw Error("not a function");
+ }
+ if (!f.stub) {
+ throw Error("not a mock function");
+ }
+ return true;
+}
+
+function when(f) {
+ if (ifMockedFunction(f)) {
+ return f.stub.bind(f);
+ }
+}
+
+export {MockKit, when};
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/mock/VerificationMode.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/mock/VerificationMode.js
new file mode 100644
index 0000000000000000000000000000000000000000..28eda2b05fa5ec9f78f9b20d1be1b6c87ffaf33b
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/mock/VerificationMode.js
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2022-2023 Huawei Device 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 {expect} from '../../interface';
+
+class VerificationMode {
+ constructor(times) {
+ this.doTimes = times;
+ }
+
+ times(count) {
+ expect(count).assertEqual(this.doTimes);
+ }
+
+ never() {
+ console.log(this.doTimes);
+ expect(0).assertEqual(this.doTimes);
+ }
+
+ once() {
+ expect(1).assertEqual(this.doTimes);
+ }
+
+ atLeast(count) {
+ if (count > this.doTimes) {
+ throw Error('failed ' + count + ' greater than the actual execution times of method');
+ }
+ }
+
+ atMost(count) {
+ if (count < this.doTimes) {
+ throw Error('failed ' + count + ' less than the actual execution times of method');
+ }
+ }
+}
+
+export default VerificationMode;
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/report/LogExpectError.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/report/LogExpectError.js
new file mode 100644
index 0000000000000000000000000000000000000000..f2aede62f86d762524a59fba0eeacf959f1a846c
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/report/LogExpectError.js
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2024 Huawei Device 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.
+ */
+
+class LogExpectError {
+ static getErrorMsg(matcherName, actualValue, expect, originMsg) {
+ if (matcherName === "assertNull") {
+ return "expect not null, actualValue is " + (actualValue)
+ }
+ if (matcherName === "assertTrue") {
+ return "expect not true, actualValue is " + (actualValue)
+ }
+ if (matcherName === "assertFalse") {
+ return "expect not false, actualValue is " + (actualValue)
+ }
+ if (matcherName === "assertEqual") {
+ return "expect not Equal, actualValue is "
+ + actualValue + ' equals ' + expect;
+ }
+ if (matcherName === "assertContain") {
+ return "expect not have, " + actualValue + " have " + expect;
+ }
+ if (matcherName === "assertInstanceOf") {
+ return "expect not InstanceOf, "
+ + actualValue + ' is '
+ + Object.prototype.toString.call(actualValue) + expect;
+ }
+ if (matcherName === "assertLarger") {
+ return "expect not Larger, "
+ + (actualValue) + ' is larger than ' + expect;
+ }
+ if (matcherName === "assertLargerOrEqual") {
+ return "expect not LargerOrEqual, "
+ + (actualValue) + ' larger than ' + expect;
+ }
+ if (matcherName === "assertLess") {
+ return "expect not Less, "
+ + (actualValue) + ' less than ' + expect;
+ }
+ if (matcherName === "assertLessOrEqual") {
+ return "expect not LessOrEqual, "
+ + (actualValue) + ' is less than ' + expect;
+ }
+ if (matcherName === "assertNaN") {
+ return "expect not NaN, actualValue is " + (actualValue)
+ }
+ if (matcherName === "assertNegUnlimited") {
+ return "expect not NegUnlimited, actualValue is " + (actualValue)
+ }
+ if (matcherName === "assertPosUnlimited") {
+ return "expect not PosUnlimited, actualValue is " + (actualValue)
+ }
+ if (matcherName === "assertUndefined") {
+ return "expect not Undefined, actualValue is " + (actualValue)
+ }
+ return originMsg;
+ }
+}
+export default LogExpectError
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/report/OhReport.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/report/OhReport.js
new file mode 100644
index 0000000000000000000000000000000000000000..529c003cfb8a11f2ddaf24f8884301d4e8e39dd0
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/report/OhReport.js
@@ -0,0 +1,186 @@
+/*
+ * Copyright (c) 2021-2024 Huawei Device 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 SysTestKit from "../kit/SysTestKit";
+import { collectCoverageData } from '../coverage/coverageCollect';
+import { TAG } from '../../Constant';
+
+class OhReport {
+ constructor(attr) {
+ this.delegator = attr.delegator;
+ this.abilityDelegatorArguments = attr.abilityDelegatorArguments;
+ this.id = 'report';
+ this.index = 0;
+ this.duration = 0;
+ }
+
+ init(coreContext) {
+ this.coreContext = coreContext;
+ this.suiteService = this.coreContext.getDefaultService('suite');
+ this.specService = this.coreContext.getDefaultService('spec');
+ }
+
+ taskStart() {
+ }
+
+ async taskDone() {
+ if (this.abilityDelegatorArguments !== null) {
+ this.taskDoneTime = new Date().getTime();
+ let summary = this.suiteService.getSummary();
+ const configService = this.coreContext.getDefaultService('config');
+ const suiteService = this.coreContext.getDefaultService('suite');
+ const specService = this.coreContext.getDefaultService('spec');
+ if (configService['coverage'] === 'true') {
+ await collectCoverageData();
+ }
+ let message = '\n' + 'OHOS_REPORT_RESULT: stream=Tests run: ' + summary.total + ', Failure: ' + summary.failure;
+ message += ', Error: ' + summary.error;
+ message += ', Pass: ' + summary.pass;
+ message += ', Ignore: ' + summary.ignore;
+ if (specService.skipSpecNum > 0) {
+ message += ', SkipSpec: ' + specService.skipSpecNum;
+ }
+ message += '\n' + 'OHOS_REPORT_CODE: ' + (summary.failure > 0 ? -1 : 0) + '\n';
+ let isHasError = summary.failure > 0 || summary.error > 0;
+ let config = this.coreContext.getDefaultService('config');
+ if (config.isBreakOnError() && isHasError) {
+ // 未执行全部说明
+ message += '\n' + 'OHOS_REPORT_RESULT: breakOnError model, Stopping whole test suite if one specific test case failed or error' + '\n';
+ }
+ message += 'OHOS_REPORT_STATUS: taskconsuming=' + summary.duration + '\n';
+ console.info(`${message}`);
+ await SysTestKit.print(message);
+ }
+ console.info(`${TAG}report print success`);
+ this.delegator.finishTest('your test finished!!!', 0, () => { });
+ }
+
+ incorrectFormat() {
+ if (this.coreContext.getDefaultService('config').filterValid.length !== 0) {
+ var value = this.coreContext.getDefaultService('config').filterValid;
+ var message = 'this param ' + value.join(',') + ' is invalid' + '\n';
+ this.delegator.finishTest(message, 0, () => {
+ });
+ }
+ }
+
+ incorrectTestSuiteFormat() {
+ if (this.coreContext.getDefaultService('config').filterXdescribe.length !== 0) {
+ let value = this.coreContext.getDefaultService('config').filterXdescribe;
+ let message = 'xdescribe ' + value.join(',') + ' should not contain it' + '\n';
+ this.delegator.finishTest(message, 0, () => {
+ });
+ }
+ }
+ async suiteStart() {
+ if (this.abilityDelegatorArguments !== null) {
+ let specArr = [];
+ this.suiteService.getAllChildSuiteNum(this.suiteService.getCurrentRunningSuite(), specArr);
+ let message = '\n' + 'OHOS_REPORT_SUM: ' + specArr.length;
+ this.suiteService.setCurrentRunningSuiteDesc(this.suiteService.getRootSuite(), this.suiteService.getCurrentRunningSuite(), '');
+ message += '\n' + 'OHOS_REPORT_STATUS: class=' + this.suiteService.getCurrentRunningSuiteDesc() + '\n';
+ if (this.suiteService.currentRunningSuite.isSkip) {
+ message += 'OHOS_REPORT_STATUS: skipReason=' + this.suiteService.currentRunningSuite.skipReason + '\n';
+ }
+ console.info(`${message}`);
+ await SysTestKit.print(message);
+ console.info(`${TAG}${this.suiteService.getCurrentRunningSuite().description} suiteStart print success`);
+ }
+ }
+
+ async suiteDone() {
+ if (this.abilityDelegatorArguments !== null) {
+ const currentRunningSuite = this.suiteService.getCurrentRunningSuite();
+ this.suiteService.setCurrentRunningSuiteDesc(this.suiteService.getRootSuite(), this.suiteService.getCurrentRunningSuite(), '');
+ let message = '\n' + 'OHOS_REPORT_STATUS: class=' + this.suiteService.getCurrentRunningSuiteDesc();
+ if (this.suiteService.currentRunningSuite.isSkip && this.suiteService.currentRunningSuite.skipReason !== '') {
+ message += '\n' + 'OHOS_REPORT_STATUS: skipReason=' + this.suiteService.currentRunningSuite.skipReason;
+ }
+ message += '\n' + 'OHOS_REPORT_STATUS: suiteconsuming=' + this.suiteService.getCurrentRunningSuite().duration;
+ if (currentRunningSuite.hookError) {
+ message += '\n' + `OHOS_REPORT_STATUS: ${currentRunningSuite.hookError.message}`;
+ }
+ message += '\n';
+ console.info(`${message}`);
+ await SysTestKit.print(message);
+ console.info(`${TAG}${this.suiteService.getCurrentRunningSuite().description} suiteDone print success`);
+ }
+ }
+
+ async specStart() {
+ if (this.abilityDelegatorArguments !== null) {
+ let message = '\n' + 'OHOS_REPORT_STATUS: class=' + this.suiteService.getCurrentRunningSuiteDesc();
+ message += '\n' + 'OHOS_REPORT_STATUS: current=' + (++this.index);
+ message += '\n' + 'OHOS_REPORT_STATUS: id=JS';
+ message += '\n' + 'OHOS_REPORT_STATUS: numtests=' + this.specService.getTestTotal();
+ message += '\n' + 'OHOS_REPORT_STATUS: stream=';
+ message += '\n' + 'OHOS_REPORT_STATUS: test=' + this.specService.currentRunningSpec.description;
+ message += '\n' + 'OHOS_REPORT_STATUS_CODE: 1' + '\n';
+ if (this.specService.currentRunningSpec.isSkip) {
+ message += 'OHOS_REPORT_STATUS: skipReason=' + this.specService.currentRunningSpec.skipReason + '\n';
+ }
+ console.info(`${message}`);
+ await SysTestKit.print(message);
+ console.info(`${TAG}${this.specService.currentRunningSpec.description} specStart start print success`);
+ }
+ }
+
+ async specDone() {
+ if (this.abilityDelegatorArguments !== null) {
+ let message = '\n' + 'OHOS_REPORT_STATUS: class=' + this.suiteService.getCurrentRunningSuiteDesc();
+ message += '\n' + 'OHOS_REPORT_STATUS: current=' + (this.index);
+ message += '\n' + 'OHOS_REPORT_STATUS: id=JS';
+ message += '\n' + 'OHOS_REPORT_STATUS: numtests=' + this.specService.getTestTotal();
+ let messageStack = '';
+ let messageCode = '';
+ if (this.specService.currentRunningSpec.error) {
+ messageStack = 'OHOS_REPORT_STATUS: stack=' + this.specService.currentRunningSpec.error?.stack?.slice(0, -1);
+ messageCode += 'OHOS_REPORT_STATUS: stream=';
+ messageCode += this.specService.currentRunningSpec.expectMsg !== '' ?
+ `message: ${this.specService.currentRunningSpec.expectMsg}, Error in ${this.specService.currentRunningSpec.description}, ${this.specService.currentRunningSpec.error?.message}` :
+ `Error in ${this.specService.currentRunningSpec.description}, ${this.specService.currentRunningSpec.error?.message}`;
+ messageCode += '\n' + 'OHOS_REPORT_STATUS: test=' + this.specService.currentRunningSpec.description;
+ messageCode += '\n' + 'OHOS_REPORT_STATUS_CODE: -1' + '\n';
+ } else if (this.specService.currentRunningSpec) {
+ if (this.specService.currentRunningSpec.fail) {
+ messageStack += 'OHOS_REPORT_STATUS: stack=' + this.specService.currentRunningSpec.fail?.stack?.slice(0, -1);
+ messageCode += 'OHOS_REPORT_STATUS: stream=';
+ messageCode += this.specService.currentRunningSpec.expectMsg !== '' ?
+ `message: ${this.specService.currentRunningSpec.expectMsg}, Error in ${this.specService.currentRunningSpec.description}, ${this.specService.currentRunningSpec.fail?.message}` :
+ `Error in ${this.specService.currentRunningSpec.description}, ${this.specService.currentRunningSpec.fail?.message}`;
+ messageCode += '\n' + 'OHOS_REPORT_STATUS: test=' + this.specService.currentRunningSpec.description;
+ messageCode += '\n' + 'OHOS_REPORT_STATUS_CODE: -2' + '\n';
+ } else {
+ messageStack += 'OHOS_REPORT_STATUS: stream=';
+ messageCode += 'OHOS_REPORT_STATUS: test=' + this.specService.currentRunningSpec.description;
+ messageCode += '\n' + 'OHOS_REPORT_STATUS_CODE: 0' + '\n';
+ messageCode += this.specService.currentRunningSpec.isSkip ? ('OHOS_REPORT_STATUS: skipReason=' + this.specService.currentRunningSpec.skipReason + '\n') : '';
+ }
+ } else {
+ messageCode += '\n';
+ }
+ messageCode += 'OHOS_REPORT_STATUS: consuming=' + this.specService.currentRunningSpec.duration + '\n';
+ console.info(`${message}`);
+ console.info(`\n${messageStack}`);
+ console.info(`\n${messageCode}`);
+ await SysTestKit.print(message);
+ await SysTestKit.print(messageStack);
+ await SysTestKit.print(messageCode);
+ console.info(`${TAG}${this.specService.currentRunningSpec.description} specDone end print success`);
+ }
+ }
+}
+
+export default OhReport;
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/report/ReportExtend.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/report/ReportExtend.js
new file mode 100644
index 0000000000000000000000000000000000000000..852fbcd5cbf97e776ebe5177a029df0f516594a5
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/report/ReportExtend.js
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+class ReportExtend {
+ constructor(fileModule) {
+ this.id = 'extend';
+ this.fileModule = fileModule;
+ }
+
+ init(coreContext) {
+ this.coreContext = coreContext;
+ this.suiteService = this.coreContext.getDefaultService('suite');
+ }
+
+ taskStart() {
+
+ }
+
+ taskDone() {
+ const report = {
+ tag: 'testsuites',
+ name: 'summary_report',
+ timestamp: new Date().toDateString(),
+ time: '1',
+ errors: 0,
+ failures: 0,
+ tests: 0,
+ children: []
+ };
+ const rootSuite = this.suiteService.rootSuite;
+ if (rootSuite && rootSuite.childSuites) {
+ for (let testsuite of rootSuite.childSuites) {
+ let suiteReport = {
+ tag: 'testsuite',
+ name: testsuite['description'],
+ errors: 0,
+ tests: 0,
+ failures: 0,
+ time: '0.1',
+ children: []
+ };
+ let specs = testsuite['specs'];
+ for (let testcase of specs) {
+ report.tests++;
+ suiteReport.tests++;
+ let caseReport = {
+ tag: 'testcase',
+ name: testcase['description'],
+ status: 'run',
+ time: '0.0',
+ classname: testsuite['description']
+ };
+ if (testcase.error) {
+ caseReport['result'] = false;
+ caseReport['children'] = [{
+ tag: 'error',
+ type: '',
+ message: testcase.error.message
+ }];
+ report.errors++;
+ suiteReport.errors++;
+ } else if (testcase.result.failExpects.length > 0) {
+ caseReport['result'] = false;
+ let message = '';
+ testcase.result.failExpects.forEach(failExpect => {
+ message += failExpect.message || ('expect ' + failExpect.actualValue + ' ' + failExpect.checkFunc + ' ' + (failExpect.expectValue || '')) + ';';
+ });
+ caseReport['children'] = [{
+ tag: 'failure',
+ type: '',
+ message: message
+ }];
+ report.failures++;
+ suiteReport.failures++;
+ } else {
+ caseReport['result'] = true;
+ }
+ suiteReport.children.push(caseReport);
+ }
+ report.children.push(suiteReport);
+ }
+ }
+
+ let reportXml = '\n' + json2xml(report);
+ this.fileModule.writeText({
+ uri: 'internal://app/report.xml',
+ text: reportXml,
+ success: function () {
+ console.info('call success callback success');
+ },
+ fail: function (data, code) {
+ console.info('call fail callback success:');
+ },
+ complete: function () {
+ console.info('call complete callback success');
+ }
+ });
+ }
+}
+
+function json2xml(json) {
+ let tagName;
+ let hasChildren = false;
+ let childrenStr = '';
+ let attrStr = '';
+ for (let key in json) {
+ if (key === 'tag') {
+ tagName = json[key];
+ } else if (key === 'children') {
+ if (json[key].length > 0) {
+ hasChildren = true;
+ for (let child of json[key]) {
+ childrenStr += json2xml(child);
+ }
+ }
+ } else {
+ attrStr += ` ${key}="${json[key]}"`;
+ }
+ }
+ let xml = `<${tagName}${attrStr}`;
+ xml += hasChildren ? `>${childrenStr}${tagName}>` : '/>';
+ return xml;
+}
+
+export default ReportExtend;
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/service.js b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/service.js
new file mode 100644
index 0000000000000000000000000000000000000000..c9ea9b3218ee85d859aec61105bd67487d422a9b
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/service.js
@@ -0,0 +1,1217 @@
+/*
+ * Copyright (c) 2021-2024 Huawei Device 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 SysTestKit from "./module/kit/SysTestKit";
+import { TAG } from './Constant';
+import LogExpectError from './module/report/LogExpectError'
+import { NestFilter } from "./module/config/Filter";
+
+class AssertException extends Error {
+ constructor(message) {
+ super();
+ this.name = "AssertException";
+ this.message = message;
+ }
+}
+
+function getFuncWithArgsZero(func, timeout, isStressTest) {
+ return new Promise(async (resolve, reject) => {
+ let timer = null;
+ if (!isStressTest) {
+ timer = setTimeout(() => {
+ reject(new Error('execute timeout ' + timeout + 'ms'));
+ }, timeout);
+ }
+ try {
+ await func();
+ } catch (err) {
+ reject(err);
+ }
+ timer !== null ? clearTimeout(timer) : null;
+ resolve();
+ });
+}
+
+function getFuncWithArgsOne(func, timeout, isStressTest) {
+ return new Promise(async (resolve, reject) => {
+ let timer = null;
+ if (!isStressTest) {
+ timer = setTimeout(() => {
+ reject(new Error('execute timeout ' + timeout + 'ms'));
+ }, timeout);;
+ }
+
+ function done() {
+ timer !== null ? clearTimeout(timer) : null;
+ resolve();
+ }
+
+ try {
+ await func(done);
+ } catch (err) {
+ timer !== null ? clearTimeout(timer) : null;
+ reject(err);
+ }
+ });
+}
+
+function getFuncWithArgsTwo(func, timeout, paramItem, isStressTest) {
+ return new Promise(async (resolve, reject) => {
+ let timer = null;
+ if (!isStressTest) {
+ timer = setTimeout(() => {
+ reject(new Error('execute timeout ' + timeout + 'ms'));
+ }, timeout);
+ }
+
+ function done() {
+ timer !== null ? clearTimeout(timer) : null;
+ resolve();
+ }
+
+ try {
+ await func(done, paramItem);
+ } catch (err) {
+ timer !== null ? clearTimeout(timer) : null;
+ reject(err);
+ }
+ });
+}
+
+function processFunc(coreContext, func) {
+ let argNames = ((func || '').toString()
+ .replace(/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg, '')
+ .match(/^(function)?\s*[^\(]*\(\s*([^\)]*)\)/m) || ['', '', ''])[2]
+ .split(',') // split parameters
+ .map(item => item.replace(/^\s*(_?)(.+?)\1\s*$/, name => name.split('=')[0].trim()))
+ .filter(String);
+ let funcLen = func.length;
+ let processedFunc;
+ const config = coreContext.getDefaultService('config');
+ config.setSupportAsync(true);
+ const timeout = + (config.timeout === undefined ? 5000 : config.timeout);
+ const isStressTest = (coreContext.getServices('dataDriver') !== undefined || config.getStress() > 1);
+ switch (funcLen) {
+ case 0: {
+ processedFunc = function () {
+ return getFuncWithArgsZero(func, timeout, isStressTest);
+ };
+ break;
+ }
+ case 1: {
+ if (argNames[0] === 'data') {
+ processedFunc = function (paramItem) {
+ func(paramItem);
+ };
+ } else {
+ processedFunc = function () {
+ return getFuncWithArgsOne(func, timeout, isStressTest);
+ };
+ }
+ break;
+ }
+ default: {
+ processedFunc = function (paramItem) {
+ return getFuncWithArgsTwo(func, timeout, paramItem, isStressTest);
+ };
+ break;
+ }
+ }
+ return processedFunc;
+}
+
+function secureRandomNumber() {
+ return crypto.randomBytes(8).readUInt32LE() / 0xffffffff;
+}
+
+class SuiteService {
+ constructor(attr) {
+ this.id = attr.id;
+ this.rootSuite = new SuiteService.Suite({});
+ this.currentRunningSuite = this.rootSuite;
+ this.suitesStack = [this.rootSuite];
+ this.targetSuiteArray = [];
+ this.targetSpecArray = [];
+ this.currentRunningSuiteDesc = null;
+ this.fullRun = false;
+ this.isSkipSuite = false;
+ this.suiteSkipReason = null;
+ }
+
+ describe(desc, func) {
+ const configService = this.coreContext.getDefaultService('config');
+ if (this.suitesStack.some(suite => { return suite.description === desc })) {
+ console.error(`${TAG} Loop nesting occurs : ${desc}`);
+ this.suiteSkipReason = '';
+ this.isSkipSuite = false;
+ return;
+ }
+ let isFilter = this.analyzeConfigServiceClass(configService.class, desc);
+ if (configService.filterSuite(desc) && isFilter) {
+ if (this.currentRunningSuite.description === '' || this.currentRunningSuite.description == null) {
+ console.info(`${TAG}filter suite : ${desc}`);
+ this.suiteSkipReason = '';
+ this.isSkipSuite = false;
+ return;
+ }
+ }
+ const suite = new SuiteService.Suite({ description: desc });
+ if (this.isSkipSuite) {
+ suite.isSkip = true;
+ suite.skipReason = this.suiteSkipReason;
+ }
+ this.suiteSkipReason = '';
+ this.isSkipSuite = false;
+ if (typeof this.coreContext.getServices('dataDriver') !== 'undefined' && configService['dryRun'] !== 'true') {
+ let suiteStress = this.coreContext.getServices('dataDriver').dataDriver.getSuiteStress(desc);
+ for (let i = 1; i < suiteStress; i++) {
+ this.currentRunningSuite.childSuites.push(suite);
+ }
+ }
+ this.currentRunningSuite.childSuites.push(suite);
+ this.currentRunningSuite = suite;
+ this.suitesStack.push(suite);
+ func.call();
+ this.suitesStack.pop();
+ this.currentRunningSuite = this.suitesStack.pop();
+ this.suitesStack.push(this.currentRunningSuite);
+ }
+ xdescribe(desc, func, reason) {
+ const configService = this.coreContext.getDefaultService('config');
+ if (!configService.skipMessage && configService.runSkipped !== 'all') {
+ if (configService.runSkipped != null && configService.runSkipped !== '') {
+ let finalDesc = '';
+ this.suitesStack.map(suite => {
+ finalDesc = finalDesc + '.' + suite.description;
+ })
+ finalDesc = (finalDesc + '.' + desc).substring(2);
+ console.info(`${TAG} finalDesc ${finalDesc}`);
+ if (configService.checkIfSuiteInSkipRun(finalDesc)) {
+ console.log(`${TAG} runSkipped suite: ${desc}`);
+ } else {
+ console.log(reason == null ? `${TAG} skip suite: ${desc}` : `${TAG} skip suite: ${desc}, and the reason is ${reason}`);
+ return;
+ }
+ } else {
+ console.log(reason == null ? `${TAG} skip suite: ${desc}` : `${TAG} skip suite: ${desc}, and the reason is ${reason}`);
+ return;
+ }
+ }
+ this.isSkipSuite = true;
+ this.suiteSkipReason = reason;
+ this.describe(desc, func);
+ }
+
+ beforeAll(func) {
+ this.currentRunningSuite.beforeAll.push(processFunc(this.coreContext, func));
+ }
+
+ beforeEach(func) {
+ this.currentRunningSuite.beforeEach.push(processFunc(this.coreContext, func));
+ }
+
+ beforeItSpecified(itDescs, func) {
+ this.currentRunningSuite.beforeItSpecified.set(itDescs, processFunc(this.coreContext, func));
+ }
+
+ afterItSpecified(itDescs, func) {
+ this.currentRunningSuite.afterItSpecified.set(itDescs, processFunc(this.coreContext, func));
+ }
+
+ afterAll(func) {
+ this.currentRunningSuite.afterAll.push(processFunc(this.coreContext, func));
+ }
+
+ afterEach(func) {
+ this.currentRunningSuite.afterEach.push(processFunc(this.coreContext, func));
+ }
+
+ getCurrentRunningSuite() {
+ return this.currentRunningSuite;
+ }
+
+ setCurrentRunningSuite(suite) {
+ this.currentRunningSuite = suite;
+ }
+
+ getRootSuite() {
+ return this.rootSuite;
+ }
+
+ getCurrentRunningSuiteDesc() {
+ return this.currentRunningSuiteDesc;
+ }
+
+
+ setCurrentRunningSuiteDesc(suite, currentSuite, prefix) {
+ if (suite != null && suite === currentSuite) {
+ this.currentRunningSuiteDesc = prefix;
+ } else if (suite != null && suite !== currentSuite) {
+ suite.childSuites.forEach(it => {
+ let temp = prefix;
+ if (it.description != null || it.description !== '') {
+ temp = prefix === '' ? it.description : prefix + "." + it.description;
+ }
+ this.setCurrentRunningSuiteDesc(it, currentSuite, temp);
+ }
+ )
+ }
+ }
+ analyzeConfigServiceClass(configServiceClass, desc) {
+ if (configServiceClass == null || configServiceClass === '') {
+ this.fullRun = true
+ return false;
+ }
+ if (this.targetSuiteArray.length === 0) {
+ const targetArray = configServiceClass.split(",")
+ for (let index in targetArray) {
+ if (targetArray[index].includes("#")) {
+ this.targetSpecArray.push(targetArray[index])
+ } else {
+ this.targetSuiteArray.push(targetArray[index])
+ }
+ }
+
+ }
+ return !configServiceClass.includes(desc);
+
+ }
+ traversalResults(suite, obj, breakOnError) {
+ if (suite.childSuites.length === 0 && suite.specs.length === 0) {
+ return obj;
+ }
+ if (suite.specs.length > 0) {
+ for (const itItem of suite.specs) {
+ obj.total++;
+ if (breakOnError && (obj.error > 0 || obj.failure > 0)) { // breakOnError模式
+ continue;
+ }
+ if (itItem.error) {
+ obj.error++;
+ } else if (itItem.fail) {
+ obj.failure++;
+ } else if (itItem.pass === true) {
+ obj.pass++;
+ }
+ }
+ }
+
+ obj.duration += suite.duration;
+
+ if (suite.childSuites.length > 0) {
+ for (const suiteItem of suite.childSuites) {
+ this.traversalResults(suiteItem, obj, breakOnError);
+ }
+ }
+ }
+
+ async setSuiteResults(suite, error, coreContext) {
+ if (suite.childSuites.length === 0 && suite.specs.length === 0) {
+ return obj;
+ }
+ if (suite.specs.length > 0) {
+ const specService = coreContext.getDefaultService('spec');
+ for (const specItem of suite.specs) {
+ specService.setCurrentRunningSpec(specItem);
+ if (error instanceof AssertException) {
+ specItem.fail = error;
+ } else {
+ specItem.error = error;
+ }
+ await coreContext.fireEvents('spec', 'specStart', specItem);
+ await coreContext.fireEvents('spec', 'specDone', specItem);
+ }
+ }
+ if (suite.childSuites.length > 0) {
+ for (const suiteItem of suite.childSuites) {
+ await this.setSuiteResults(suiteItem, error, coreContext);
+ }
+ }
+ }
+
+ getSummary() {
+ let suiteService = this.coreContext.getDefaultService('suite');
+ let rootSuite = suiteService.rootSuite;
+ const specService = this.coreContext.getDefaultService('spec');
+ const configService = this.coreContext.getDefaultService('config');
+ let breakOnError = configService.isBreakOnError();
+ let isError = specService.getStatus();
+ let isBreaKOnError = breakOnError && isError;
+ let obj = { total: 0, failure: 0, error: 0, pass: 0, ignore: 0, duration: 0 };
+ for (const suiteItem of rootSuite.childSuites) {
+ this.traversalResults(suiteItem, obj, isBreaKOnError);
+ }
+ obj.ignore = obj.total - obj.pass - obj.failure - obj.error;
+ return obj;
+ }
+
+ init(coreContext) {
+ this.coreContext = coreContext;
+ }
+
+ traversalSuites(suite, obj, configService) {
+ if (suite.childSuites.length === 0 && suite.specs.length === 0) {
+ return [];
+ }
+ if (suite.specs.length > 0) {
+ let itArray = [];
+ for (const itItem of suite['specs']) {
+ if (!configService.filterDesc(suite.description, itItem.description, itItem.fi, null)) {
+ itArray.push({ 'itName': itItem.description });
+ }
+ }
+ obj[suite.description] = itArray;
+ }
+ if (suite.childSuites.length > 0) {
+ let suiteArray = [];
+ for (const suiteItem of suite.childSuites) {
+ let suiteObj = {};
+ this.traversalSuites(suiteItem, suiteObj, configService);
+ if (!configService.filterSuite(suiteItem.description)) {
+ suiteArray.push(suiteObj);
+ }
+ }
+ obj.suites = suiteArray;
+ }
+ }
+
+ async dryRun(abilityDelegator) {
+ console.log(`${TAG} rootSuite : ` + JSON.stringify(this.rootSuite));
+ let obj = this.rootSuite;
+ let prefixStack = [];
+ let suiteArray = [];
+ let skipSuiteArray = [];
+ this.analyzeSuitesArray(prefixStack, suiteArray, skipSuiteArray, obj);
+ const configService = this.coreContext.getDefaultService('config');
+ let result;
+ if (configService.skipMessage) {
+ result = { "suites": suiteArray, "skipSuites": skipSuiteArray };
+ } else {
+ result = { "suites": suiteArray };
+ }
+ let strJson = JSON.stringify(result);
+ let strLen = strJson.length;
+ let maxLen = 500;
+ let maxCount = Math.floor(strLen / maxLen);
+ for (let count = 0; count <= maxCount; count++) {
+ await SysTestKit.print(strJson.substring(count * maxLen, (count + 1) * maxLen));
+ }
+ console.info(`${TAG}dryRun print success`);
+ abilityDelegator.finishTest('dry run finished!!!', 0, () => { });
+ }
+
+ //将suitesArray的嵌套结构展开成三层结构
+ analyzeSuitesArray(prefixStack, suiteArray, skipSuiteArray, obj) {
+ obj.childSuites.map(suite => {
+ if (suite.description != null && suite.description !== '') {
+ let prefix = '';
+ if (prefixStack.length > 0) {
+ prefix = prefixStack.join('.') + '.' + suite.description;
+ } else {
+ prefix = suite.description;
+ }
+ prefixStack.push(suite.description);
+ let temp = {};
+ temp[prefix] = [];
+ let skipTemp = {};
+ skipTemp[prefix] = [];
+ suite.specs.map(spec => {
+ let it = { 'itName': spec.description }
+ spec.isSkip ? skipTemp[prefix].push(it) : temp[prefix].push(it);
+ })
+ suiteArray.push(temp);
+ skipSuiteArray.push(skipTemp);
+ }
+ this.analyzeSuitesArray(prefixStack, suiteArray, skipSuiteArray, suite);
+ prefixStack.pop();
+ });
+ }
+ //获取当前测试套下的所有测试用例数量
+ getAllChildSuiteNum(suite, specArray) {
+ if (suite.specs != null) {
+ suite.specs.forEach(spec => specArray.push(spec));
+ }
+ if (suite.childSuites != null) {
+ suite.childSuites.forEach(it => this.getAllChildSuiteNum(it, specArray))
+ }
+ }
+
+ execute() {
+ const configService = this.coreContext.getDefaultService('config');
+ if (configService.filterValid.length !== 0) {
+ this.coreContext.fireEvents('task', 'incorrectFormat');
+ return;
+ }
+ if (configService.filterXdescribe.length !== 0) {
+ this.coreContext.fireEvents('task', 'incorrectTestSuiteFormat');
+ return;
+ }
+ if (configService.isRandom() && this.rootSuite.childSuites.length > 0) {
+ this.rootSuite.childSuites.sort(function () {
+ return Math.random().toFixed(1) > 0.5 ? -1 : 1;
+ });
+ this.currentRunningSuite = this.rootSuite.childSuites[0];
+ }
+ if (configService.isSupportAsync()) {
+ console.info(`${TAG} rootSuite:` + JSON.stringify(this.rootSuite));
+ let asyncExecute = async () => {
+ await this.coreContext.fireEvents('task', 'taskStart');
+ await this.rootSuite.asyncRun(this.coreContext);
+ };
+ asyncExecute().then(async () => {
+ await this.coreContext.fireEvents('task', 'taskDone');
+ });
+ } else {
+ console.info('${TAG} rootSuite:' + JSON.stringify(this.rootSuite));
+ this.coreContext.fireEvents('task', 'taskStart');
+ this.rootSuite.run(this.coreContext);
+ this.coreContext.fireEvents('task', 'taskDone');
+ }
+ }
+
+ apis() {
+ const _this = this;
+ return {
+ describe: function (desc, func) {
+ return _this.describe(desc, func);
+ },
+ xdescribe: function (desc, func, reason) {
+ return _this.xdescribe(desc, func, reason);
+ },
+ beforeItSpecified: function (itDescs, func) {
+ return _this.beforeItSpecified(itDescs, func);
+ },
+ afterItSpecified: function (itDescs, func) {
+ return _this.afterItSpecified(itDescs, func);
+ },
+ beforeAll: function (func) {
+ return _this.beforeAll(func);
+ },
+ beforeEach: function (func) {
+ return _this.beforeEach(func);
+ },
+ afterAll: function (func) {
+ return _this.afterAll(func);
+ },
+ afterEach: function (func) {
+ return _this.afterEach(func);
+ }
+ };
+ }
+}
+
+SuiteService.Suite = class {
+ constructor(attrs) {
+ this.description = attrs.description || '';
+ this.childSuites = [];
+ this.specs = [];
+ this.beforeAll = [];
+ this.afterAll = [];
+ this.beforeItSpecified = new Map();
+ this.afterItSpecified = new Map();
+ this.beforeEach = [];
+ this.afterEach = [];
+ this.duration = 0;
+ this.hookError = null;
+ this.isSkip = false;
+ this.skipReason = '';
+ }
+
+ pushSpec(spec) {
+ this.specs.push(spec);
+ }
+
+ removeSpec(desc) {
+ this.specs = this.specs.filter((item, index) => {
+ return item.description !== desc;
+ });
+ }
+
+ getSpecsNum() {
+ return this.specs.length;
+ }
+
+ isRun(coreContext) {
+ const configService = coreContext.getDefaultService('config');
+ const suiteService = coreContext.getDefaultService('suite');
+ const specService = coreContext.getDefaultService('spec');
+ let breakOnError = configService.isBreakOnError();
+ let isError = specService.getStatus();
+ return breakOnError && isError;
+ }
+
+ run(coreContext) {
+ const suiteService = coreContext.getDefaultService('suite');
+ suiteService.setCurrentRunningSuite(this);
+ if (this.description !== '') {
+ coreContext.fireEvents('suite', 'suiteStart', this);
+ }
+ this.runHookFunc('beforeAll');
+ if (this.specs.length > 0) {
+ const configService = coreContext.getDefaultService('config');
+ if (configService.isRandom()) {
+ this.specs.sort(function () {
+ return Math.random().toFixed(1) > 0.5 ? -1 : 1;
+ });
+ }
+ for (let spec in this.specs) {
+ let isBreakOnError = this.isRun(coreContext);
+ if (isBreakOnError) {
+ break;
+ }
+ this.runHookFunc('beforeEach');
+ spec.run(coreContext);
+ this.runHookFunc('afterEach');
+ }
+ }
+ if (this.childSuites.length > 0) {
+ for (let suite in this.childSuites) {
+ let isBreakOnError = this.isRun(coreContext);
+ if (isBreakOnError) {
+ break;
+ }
+ suite.run(coreContext);
+ suiteService.setCurrentRunningSuite(suite);
+ }
+ }
+ this.runHookFunc('afterAll');
+ if (this.description !== '') {
+ coreContext.fireEvents('suite', 'suiteDone');
+ }
+ }
+
+ async asyncRunSpecs(coreContext) {
+ const configService = coreContext.getDefaultService('config');
+ if (configService.isRandom()) {
+ this.specs.sort(function () {
+ return Math.random().toFixed(1) > 0.5 ? -1 : 1;
+ });
+ }
+ const specService = coreContext.getDefaultService('spec');
+ for (let specItem of this.specs) {
+ specService.setCurrentRunningSpec(specItem);
+ // 遇错即停模式,发现用例有问题,直接返回,不在执行后面的it
+ let isBreakOnError = this.isRun(coreContext);
+ if (isBreakOnError) {
+ console.log("break description :" + this.description);
+ break;
+ }
+ await coreContext.fireEvents('spec', 'specStart', specItem);
+ try {
+ for (const [itNames, hookFunc] of this.beforeItSpecified) {
+ if ((Object.prototype.toString.call(itNames) === '[object Array]' && itNames.includes(specItem.description)) ||
+ (Object.prototype.toString.call(itNames) === '[object String]' && itNames === specItem.description)) {
+ await Reflect.apply(hookFunc, null, []);
+ }
+ break;
+ }
+ await this.runAsyncHookFunc('beforeEach');
+ await specItem.asyncRun(coreContext);
+ for (const [itNames, hookFunc] of this.afterItSpecified) {
+ if ((Object.prototype.toString.call(itNames) === '[object Array]' && itNames.includes(specItem.description)) ||
+ (Object.prototype.toString.call(itNames) === '[object String]' && itNames === specItem.description)) {
+ await Reflect.apply(hookFunc, null, []);
+ }
+ break;
+ }
+ await this.runAsyncHookFunc('afterEach');
+ } catch (e) {
+ console.error(`${TAG}stack:${e?.stack}`);
+ console.error(`${TAG}stack end`);
+ if (e instanceof AssertException) {
+ specItem.fail = e;
+ } else {
+ specItem.error = e;
+ }
+ specService.setStatus(true);
+ }
+ specItem.setResult();
+ await coreContext.fireEvents('spec', 'specDone', specItem);
+ specService.setCurrentRunningSpec(null);
+ }
+ }
+
+ async asyncRunChildSuites(coreContext) {
+ for (let i = 0; i < this.childSuites.length; i++) {
+ // 遇错即停模式, 发现用例有问题,直接返回,不在执行后面的description
+ let isBreakOnError = this.isRun(coreContext);
+ if (isBreakOnError) {
+ console.log(`${TAG}break description : ${this.description}`);
+ break;
+ }
+ await this.childSuites[i].asyncRun(coreContext);
+ }
+ }
+
+ async asyncRun(coreContext) {
+ const suiteService = coreContext.getDefaultService('suite');
+ const specService = coreContext.getDefaultService('spec');
+
+ suiteService.setCurrentRunningSuite(this);
+ suiteService.suitesStack.push(this);
+ if (this.description !== '') {
+ await coreContext.fireEvents('suite', 'suiteStart', this);
+ }
+
+ try {
+ await this.runAsyncHookFunc('beforeAll');
+ } catch (error) {
+ console.error(`${TAG}${error?.stack}`);
+ this.hookError = error;
+ }
+
+ if (this.hookError !== null) {
+ specService.setStatus(true);
+ await suiteService.setSuiteResults(this, this.hookError, coreContext);
+ }
+
+ if (this.specs.length > 0 && this.hookError === null) {
+ await this.asyncRunSpecs(coreContext);
+ }
+
+ if (this.childSuites.length > 0 && this.hookError === null) {
+ await this.asyncRunChildSuites(coreContext);
+ }
+
+ try {
+ await this.runAsyncHookFunc('afterAll');
+ } catch (error) {
+ console.error(`${TAG}${error?.stack}`);
+ this.hookError = error;
+ specService.setStatus(true);
+ }
+
+ if (this.description !== '') {
+ await coreContext.fireEvents('suite', 'suiteDone');
+ let childSuite = suiteService.suitesStack.pop();
+ let currentRunningSuite = suiteService.suitesStack.pop();
+ suiteService.setCurrentRunningSuite(currentRunningSuite);
+ suiteService.suitesStack.push(currentRunningSuite);
+ }
+ }
+
+ runHookFunc(hookName) {
+ if (this[hookName] && this[hookName].length > 0) {
+ this[hookName].forEach(func => {
+ try {
+ func();
+ } catch (e) {
+ console.error(`${TAG}${e.stack}`);
+ }
+ });
+ }
+ }
+
+ async runAsyncHookFunc(hookName) {
+ for (const hookItem of this[hookName]) {
+ try {
+ await hookItem();
+ } catch (error) {
+ error['message'] += `, error in ${hookName} function`;
+ throw error;
+ }
+
+ }
+ }
+};
+
+class SpecService {
+ constructor(attr) {
+ this.id = attr.id;
+ this.totalTest = 0;
+ this.hasError = false;
+ this.skipSpecNum = 0;
+ this.isSkipSpec = false;
+ this.specSkipReason = '';
+ }
+
+ init(coreContext) {
+ this.coreContext = coreContext;
+ }
+
+ setCurrentRunningSpec(spec) {
+ this.currentRunningSpec = spec;
+ }
+
+ setStatus(obj) {
+ this.hasError = obj;
+ }
+
+ getStatus() {
+ return this.hasError;
+ }
+
+ getTestTotal() {
+ return this.totalTest;
+ }
+
+ getCurrentRunningSpec() {
+ return this.currentRunningSpec;
+ }
+
+
+ getSkipSpecNum() {
+ return this.skipSpecNum;
+ }
+
+ initSpecService() {
+ this.isSkipSpec = false;
+ this.specSkipReason = '';
+ }
+
+ it(desc, filter, func) {
+ const suiteService = this.coreContext.getDefaultService('suite');
+ const configService = this.coreContext.getDefaultService('config');
+ let isFilter = new NestFilter().filterNestName(suiteService.targetSuiteArray, suiteService.targetSpecArray, suiteService.suitesStack, desc);
+ if (configService.filterWithNest(desc, filter)) {
+ console.info(`${TAG}filter it :${desc}`);
+ this.initSpecService();
+ return;
+ }
+ if (configService.filterDesc(suiteService.currentRunningSuite.description, desc, filter, this.coreContext) && isFilter && !suiteService.fullRun) {
+ console.info(`${TAG}filter it :${desc}`);
+ this.initSpecService();
+ } else {
+ let processedFunc = processFunc(this.coreContext, func);
+ const spec = new SpecService.Spec({ description: desc, fi: filter, fn: processedFunc });
+ if (this.isSkipSpec) {
+ spec.isSkip = true;
+ spec.skipReason = this.specSkipReason;
+ }
+ this.initSpecService();
+ if (configService.runSkipped === 'skipped' && !spec.isSkip) {
+ console.info(`${TAG} runSkipped is skipped , just run xit, don't run it: ${spec.description}`);
+ return;
+ }
+ if (suiteService.getCurrentRunningSuite().isSkip && !spec.isSkip) {
+ configService.filterXdescribe.push(suiteService.getCurrentRunningSuite().description);
+ }
+ if (typeof this.coreContext.getServices('dataDriver') !== 'undefined' && configService['dryRun'] !== 'true') {
+ let specStress = this.coreContext.getServices('dataDriver').dataDriver.getSpecStress(desc);
+ for (let i = 1; i < specStress; i++) {
+ this.totalTest++;
+ suiteService.getCurrentRunningSuite().pushSpec(spec);
+ }
+ }
+ // dryRun 状态下不统计压力测试重复数据
+ if (configService['dryRun'] !== 'true') {
+ let stress = configService.getStress(); // 命令配置压力测试
+ console.info(`${TAG}stress length : ${stress}`);
+ for (let i = 1; i < stress; i++) {
+ this.totalTest++;
+ suiteService.getCurrentRunningSuite().pushSpec(spec);
+ }
+ }
+ this.totalTest++;
+ suiteService.getCurrentRunningSuite().pushSpec(spec);
+ }
+ }
+
+ xit(desc, filter, func, reason) {
+ const configService = this.coreContext.getDefaultService('config');
+ const suiteService = this.coreContext.getDefaultService('suite');
+ if (!configService.skipMessage && configService.runSkipped !== 'all') {
+ if (configService.runSkipped != null && configService.runSkipped !== '') {
+ let finalDesc = '';
+ suiteService.suitesStack.map(suite => {
+ finalDesc = finalDesc + '.' + suite.description;
+ })
+ finalDesc = (finalDesc + "#" + desc).substring(2);
+ if (configService.checkIfSpecInSkipRun(finalDesc)) {
+ console.log(`${TAG} runSkipped spec: ${desc}`);
+ } else {
+ console.log(reason == null ? `${TAG} skip spec: ${desc}` : `${TAG} skip spec: ${desc}, and the reason is ${reason}`);
+ return;
+ }
+ } else {
+ console.log(reason == null ? `${TAG} skip spec: ${desc}` : `${TAG} skip spec: ${desc}, and the reason is ${reason}`);
+ return;
+ }
+ }
+ this.skipSpecNum++;
+ this.isSkipSpec = true;
+ this.specSkipReason = reason;
+ this.it(desc, filter, func);
+ }
+
+ apis() {
+ const _this = this;
+ return {
+ it: function (desc, filter, func) {
+ return _this.it(desc, filter, func);
+ },
+ xit: function (desc, filter, func, reason) {
+ return _this.xit(desc, filter, func, reason);
+ }
+ };
+ }
+}
+
+SpecService.Spec = class {
+ constructor(attrs) {
+ this.description = attrs.description || '';
+ this.fi = attrs.fi;
+ this.fn = attrs.fn || function () {
+ };
+ this.fail = undefined;
+ this.error = undefined;
+ this.duration = 0;
+ this.startTime = 0;
+ this.isExecuted = false; // 当前用例是否执行
+ this.isSkip = false;
+ this.skipReason = '';
+ this.expectMsg = '';
+ }
+
+ setResult() {
+ if (this.fail) {
+ this.pass = false;
+ } else {
+ this.pass = true;
+ }
+ }
+
+ run(coreContext) {
+ const specService = coreContext.getDefaultService('spec');
+ specService.setCurrentRunningSpec(this);
+ coreContext.fireEvents('spec', 'specStart', this);
+ this.isExecuted = true;
+ try {
+ let dataDriver = coreContext.getServices('dataDriver');
+ if (typeof dataDriver === 'undefined') {
+ this.fn();
+ } else {
+ let suiteParams = dataDriver.dataDriver.getSuiteParams();
+ let specParams = dataDriver.dataDriver.getSpecParams();
+ console.info(`${TAG}[suite params] ${JSON.stringify(suiteParams)}`);
+ console.info(`${TAG}[spec params] ${JSON.stringify(specParams)}`);
+ if (this.fn.length === 0) {
+ this.fn();
+ } else if (specParams.length === 0) {
+ this.fn(suiteParams);
+ } else {
+ specParams.forEach(paramItem => this.fn(Object.assign({}, paramItem, suiteParams)));
+ }
+ }
+ this.setResult();
+ } catch (e) {
+ this.error = e;
+ specService.setStatus(true);
+ }
+ coreContext.fireEvents('spec', 'specDone', this);
+ }
+
+ async asyncRun(coreContext) {
+ const dataDriver = coreContext.getServices('dataDriver');
+ if (typeof dataDriver === 'undefined') {
+ await this.fn();
+ } else {
+ const suiteParams = dataDriver.dataDriver.getSuiteParams();
+ const specParams = dataDriver.dataDriver.getSpecParams();
+ console.info(`[suite params] ${JSON.stringify(suiteParams)}`);
+ console.info(`[spec params] ${JSON.stringify(specParams)}`);
+ if (this.fn.length === 0) {
+ await this.fn();
+ } else if (specParams.length === 0) {
+ await this.fn(suiteParams);
+ } else {
+ for (const paramItem of specParams) {
+ await this.fn(Object.assign({}, paramItem, suiteParams));
+ }
+ }
+ }
+
+ this.isExecuted = true;
+ }
+
+ filterCheck(coreContext) {
+ const specService = coreContext.getDefaultService('spec');
+ specService.setCurrentRunningSpec(this);
+ return true;
+ }
+};
+
+class ExpectService {
+ constructor(attr) {
+ this.id = attr.id;
+ this.matchers = {};
+ this.customMatchers = [];
+ }
+
+ expect(actualValue) {
+ return this.wrapMatchers(actualValue);
+ }
+
+ init(coreContext) {
+ this.coreContext = coreContext;
+ this.addMatchers(this.basicMatchers());
+ }
+
+ addMatchers(matchers) {
+ for (const matcherName in matchers) {
+ if (Object.prototype.hasOwnProperty.call(matchers, matcherName)) {
+ this.matchers[matcherName] = matchers[matcherName];
+ }
+ }
+ }
+
+ removeMatchers(customAssertionName) {
+ if (customAssertionName === 'all') {
+ for (const matcherName in this.matchers) {
+ this.matchers[matcherName] = this.customMatchers.includes(matcherName) ? (() => {throw new Error(`${matcherName} is unregistered`)}) : undefined;
+ }
+ }else {
+ this.matchers[customAssertionName] = () => {
+ throw new Error(`${customAssertionName} is unregistered`)
+ };
+ }
+ }
+
+ basicMatchers() {
+ return {
+ assertTrue: function (actualValue) {
+ return {
+ pass: (actualValue) === true,
+ message: 'expect true, actualValue is ' + actualValue
+ };
+ },
+ assertEqual: function (actualValue, args) {
+ let msg = 'expect ' + actualValue + ' equals ' + args[0];
+ if (actualValue == args[0]) { // 数值相同,提示数据类型
+ const aClassName = Object.prototype.toString.call(actualValue);
+ const bClassName = Object.prototype.toString.call(args[0]);
+ msg = 'expect ' + actualValue + aClassName + ' equals ' + args[0] + bClassName + "strict mode inspect type";
+ }
+ return {
+ pass: (actualValue) === args[0],
+ expectValue: args[0],
+ message: msg
+ };
+ },
+ assertThrow: function (actual, args) {
+ const result = {
+ pass: false
+ };
+ if (typeof actual !== 'function') {
+ result.message = 'toThrow\'s Actual should be a Function';
+ } else {
+ let hasThrow = false;
+ let throwError;
+ try {
+ actual();
+ } catch (e) {
+ hasThrow = true;
+ throwError = e;
+ }
+ if (!hasThrow) {
+ result.message = 'function did not throw an exception';
+ } else if (throwError && throwError.message === args[0]) {
+ result.pass = true;
+ } else {
+ result.message = `expect to throw ${args[0]} , actual throw ${throwError.message}`;
+ }
+ }
+ return result;
+ }
+ };
+ }
+
+ initWrapMatchers(currentRunningSpec) {
+ return {
+ // 翻转标识
+ isNot: false,
+ // 翻转方法
+ not: function () {
+ this.isNot = true;
+ return this;
+ },
+ message: function (msg) {
+ currentRunningSpec.expectMsg = msg;
+ console.info(`${TAG} msg: ${msg}`);
+ return this;
+ }
+ };
+
+ }
+ wrapMatchers(actualValue) {
+ const _this = this;
+ const specService = _this.coreContext.getDefaultService('spec');
+ const currentRunningSpec = specService.getCurrentRunningSpec();
+ const wrappedMatchers = this.initWrapMatchers(currentRunningSpec);
+ const currentRunningSuite = _this.coreContext.getDefaultService('suite').getCurrentRunningSuite();
+ for (const matcherName in this.matchers) {
+ let result = Object.prototype.hasOwnProperty.call(this.matchers, matcherName);
+ if (!result) {
+ continue;
+ }
+ if (matcherName.search('assertPromise') == 0) {
+ wrappedMatchers[matcherName] = async function () {
+ await _this.matchers[matcherName](actualValue, arguments).then(function (result) {
+ if (wrappedMatchers.isNot) {
+ result.pass = !result.pass;
+ }
+ result.actualValue = actualValue;
+ result.checkFunc = matcherName;
+ if (!result.pass) {
+ const assertError = new AssertException(result.message);
+ currentRunningSpec ? currentRunningSpec.fail = assertError : currentRunningSuite.hookError = assertError;
+ throw assertError;
+ }
+ });
+ };
+ } else {
+ wrappedMatchers[matcherName] = function () {
+ const result = _this.customMatchers.includes(matcherName) ? _this.matchers[matcherName](actualValue, arguments[0]) : _this.matchers[matcherName](actualValue, arguments);
+ if (wrappedMatchers.isNot) {
+ result.pass = !result.pass;
+ result.message = LogExpectError.getErrorMsg(matcherName, actualValue, arguments[0], result.message);
+ }
+ result.actualValue = actualValue;
+ result.checkFunc = matcherName;
+ if (!result.pass) {
+ const assertError = new AssertException(result.message);
+ currentRunningSpec ? currentRunningSpec.fail = assertError : currentRunningSuite.hookError = assertError;
+ throw assertError;
+ }
+ };
+ }
+ }
+ return wrappedMatchers;
+ }
+
+ apis() {
+ const _this = this;
+ return {
+ expect: function (actualValue) {
+ return _this.expect(actualValue);
+ }
+ };
+ }
+}
+
+class ReportService {
+ constructor(attr) {
+ this.id = attr.id;
+ }
+
+ init(coreContext) {
+ this.coreContext = coreContext;
+ this.specService = this.coreContext.getDefaultService('spec');
+ this.suiteService = this.coreContext.getDefaultService('suite');
+ this.duration = 0;
+ }
+
+ taskStart() {
+ console.info(`${TAG}[start] start run suites`);
+ }
+
+ async suiteStart() {
+ console.info(`${TAG}[suite start]${this.suiteService.getCurrentRunningSuite().description}`);
+ }
+
+ async specStart() {
+ console.info(`${TAG}start running case '${this.specService.currentRunningSpec.description}'`);
+ this.index = this.index + 1;
+ let spec = this.specService.currentRunningSpec;
+ spec.startTime = await SysTestKit.getRealTime();
+ }
+
+ async specDone() {
+ let msg = '';
+ let spec = this.specService.currentRunningSpec;
+ let suite = this.suiteService.currentRunningSuite;
+ spec.duration = await SysTestKit.getRealTime() - spec.startTime;
+ suite.duration += spec.duration;
+ if (spec.error) {
+ this.formatPrint('error', spec.description + ' ; consuming ' + spec.duration + 'ms');
+ this.formatPrint('errorDetail', spec.error);
+ } else if (spec.fail) {
+ this.formatPrint('fail', spec.description + ' ; consuming ' + spec.duration + 'ms');
+ this.formatPrint('failDetail', spec.fail?.message);
+ } else {
+ this.formatPrint('pass', spec.description + ' ; consuming ' + spec.duration + 'ms');
+ }
+ this.formatPrint(this.specService.currentRunningSpec.error, msg);
+ }
+
+ suiteDone() {
+ let suite = this.suiteService.currentRunningSuite;
+ let message = suite.hookError ? `, ${suite.hookError?.message}` : '';
+ console.info(`[suite end] ${suite.description} consuming ${suite.duration} ms${message}`);
+ }
+
+ taskDone() {
+ let msg = '';
+ let summary = this.suiteService.getSummary();
+ msg = 'total cases:' + summary.total + ';failure ' + summary.failure + ',' + 'error ' + summary.error;
+ msg += ',pass ' + summary.pass + '; consuming ' + summary.duration + 'ms';
+ console.info(`${TAG}${msg}`);
+ console.info(`${TAG}[end] run suites end`);
+ }
+
+ incorrectFormat() {
+ if (this.coreContext.getDefaultService('config').filterValid.length !== 0) {
+ this.coreContext.getDefaultService('config').filterValid.forEach(function (item) {
+ console.info(`${TAG}this param ${item} is invalid`);
+ });
+ }
+ }
+
+ incorrectTestSuiteFormat() {
+ if (this.coreContext.getDefaultService('config').filterXdescribe.length !== 0) {
+ this.coreContext.getDefaultService('config').filterXdescribe.forEach(function (item) {
+ console.info(`${TAG}xdescribe: ${item} should not contain it`);
+ })
+ }
+ }
+
+ formatPrint(type, msg) {
+ switch (type) {
+ case 'pass':
+ console.info(`${TAG}[pass]${msg}`);
+ break;
+ case 'fail':
+ console.info(`${TAG}[fail]${msg}`);
+ break;
+ case 'failDetail':
+ console.info(`${TAG}[failDetail]${msg}`);
+ break;
+ case 'error':
+ console.info(`${TAG}[error]${msg}`);
+ break;
+ case 'errorDetail':
+ console.info(`${TAG}[errorDetail]${msg}`);
+ break;
+ }
+ }
+
+ sleep(numberMillis) {
+ var now = new Date();
+ var exitTime = now.getTime() + numberMillis;
+ while (true) {
+ now = new Date();
+ if (now.getTime() > exitTime) {
+ return;
+ }
+ }
+ }
+}
+
+export {
+ SuiteService,
+ SpecService,
+ ExpectService,
+ ReportService
+};
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/testrunner/OpenHarmonyTestRunner.ts b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/testrunner/OpenHarmonyTestRunner.ts
new file mode 100644
index 0000000000000000000000000000000000000000..e6f4c1b12dd69714ed5a4524671abca1fbcaa58c
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/testrunner/OpenHarmonyTestRunner.ts
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2023-2024 Huawei Device 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 { abilityDelegatorRegistry, TestRunner } from '@kit.TestKit';
+import { BusinessError } from '@kit.BasicServicesKit';
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { resourceManager } from '@kit.LocalizationKit';
+import { util } from '@kit.ArkTS';
+import { Hypium } from '@ohos/hypium';
+import testsuite from '../test/List.test';
+
+let abilityDelegator: abilityDelegatorRegistry.AbilityDelegator;
+let abilityDelegatorArguments: abilityDelegatorRegistry.AbilityDelegatorArgs;
+let jsonPath: string = 'mock/mock-config.json';
+let domain: number = 0x0000; //日志标识,0x0000作为测试框架的业务标识
+let tag: string = 'testTag'; //日志标识字符串,作为tag标识当前runner类下的测试行为
+
+export default class OpenHarmonyTestRunner implements TestRunner {
+ constructor() {
+ }
+
+ onPrepare() {
+ hilog.info(domain, tag, '%{public}s', 'OpenHarmonyTestRunner OnPrepare');
+ }
+
+ async onRun() {
+ hilog.info(domain, tag, '%{public}s', 'OpenHarmonyTestRunner onRun run');
+ abilityDelegatorArguments = abilityDelegatorRegistry.getArguments();
+ abilityDelegator = abilityDelegatorRegistry.getAbilityDelegator();
+ let moduleName = abilityDelegatorArguments.parameters['-m'];
+ let context = abilityDelegator.getAppContext().getApplicationContext().createModuleContext(moduleName);
+ let mResourceManager = context.resourceManager;
+ await checkMock(abilityDelegator, mResourceManager);
+ hilog.info(domain, tag, '%{public}s', 'start run testcase!!!');
+ Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite);
+ hilog.info(domain, tag, '%{public}s', 'OpenHarmonyTestRunner onRun end');
+ }
+}
+
+async function checkMock(abilityDelegator: abilityDelegatorRegistry.AbilityDelegator, resourceManager: resourceManager.ResourceManager) {
+ let rawFile: Uint8Array;
+ try {
+ rawFile = resourceManager.getRawFileContentSync(jsonPath);
+ hilog.info(domain, tag, 'MockList file exists');
+ let mockStr: string = util.TextDecoder.create("utf-8", { ignoreBOM: true }).decodeWithStream(rawFile);
+ let mockMap: Record = getMockList(mockStr);
+ try {
+ abilityDelegator.setMockList(mockMap);
+ } catch (error) {
+ let code = (error as BusinessError).code;
+ let message = (error as BusinessError).message;
+ hilog.error(domain, tag, `abilityDelegator.setMockList failed, error code: ${code}, message: ${message}.`);
+ }
+ } catch (error) {
+ let code = (error as BusinessError).code;
+ let message = (error as BusinessError).message;
+ hilog.error(domain, tag, `ResourceManager:callback getRawFileContent failed, error code: ${code}, message: ${message}.`);
+ }
+}
+
+function getMockList(jsonStr: string) {
+ let jsonObj: Record = JSON.parse(jsonStr);
+ let map: Map = new Map(Object.entries(jsonObj));
+ let mockList: Record = {};
+ map.forEach((value: object, key: string) => {
+ let realValue: string = value['source'].toString();
+ mockList[key] = realValue;
+ });
+ hilog.info(domain, tag, '%{public}s', 'mock-json value:' + JSON.stringify(mockList) ?? '');
+ return mockList;
+}
\ No newline at end of file
diff --git a/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/lock.json5 b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/lock.json5
new file mode 100644
index 0000000000000000000000000000000000000000..9ce079377ac8069187d7f097f340eca5b0344a4c
--- /dev/null
+++ b/ImageWhiteLumpSolution/UseImageHttpRequest/oh_modules/.ohpm/lock.json5
@@ -0,0 +1,55 @@
+{
+ "lockVersion": "1.0",
+ "settings": {
+ "resolveConflict": true,
+ "resolveConflictStrict": false,
+ "installAll": true
+ },
+ "overrides": {},
+ "overrideDependencyMap": {},
+ "modules": {
+ ".": {
+ "name": "",
+ "dependencies": {},
+ "devDependencies": {
+ "@ohos/hypium": {
+ "specifier": "1.0.18",
+ "version": "1.0.18"
+ },
+ "@ohos/hamock": {
+ "specifier": "1.0.0",
+ "version": "1.0.0"
+ }
+ },
+ "dynamicDependencies": {},
+ "maskedByOverrideDependencyMap": false
+ },
+ "entry": {
+ "name": "entry",
+ "dependencies": {},
+ "devDependencies": {},
+ "dynamicDependencies": {},
+ "maskedByOverrideDependencyMap": false
+ }
+ },
+ "packages": {
+ "@ohos/hypium@1.0.18": {
+ "integrity": "sha512-RGe/iLGdeywdQilMWZsHKUoiE9OJ+9QxQsorF92R2ImLNVHVhbpSePNITGpW7TnvLgOIP/jscOqfIOhk6X7XRQ==",
+ "storePath": "oh_modules/.ohpm/@ohos+hypium@1.0.18",
+ "dependencies": {},
+ "dynamicDependencies": {},
+ "dev": true,
+ "dynamic": false,
+ "maskedByOverrideDependencyMap": false
+ },
+ "@ohos/hamock@1.0.0": {
+ "integrity": "sha512-K6lDPYc6VkKe6ZBNQa9aoG+ZZMiwqfcR/7yAVFSUGIuOAhPvCJAo9+t1fZnpe0dBRBPxj2bxPPbKh69VuyAtDg==",
+ "storePath": "oh_modules/.ohpm/@ohos+hamock@1.0.0",
+ "dependencies": {},
+ "dynamicDependencies": {},
+ "dev": true,
+ "dynamic": false,
+ "maskedByOverrideDependencyMap": false
+ }
+ }
+}
\ No newline at end of file
diff --git a/MultipleImage/.clang-format b/MultipleImage/.clang-format
new file mode 100644
index 0000000000000000000000000000000000000000..48439ed68073b99be118d374d1ebd43d04d4c4eb
--- /dev/null
+++ b/MultipleImage/.clang-format
@@ -0,0 +1,64 @@
+Language: Cpp
+# BasedOnStyle: LLVM
+ColumnLimit: 120
+SortIncludes: CaseSensitive
+TabWidth: 4
+IndentWidth: 4
+UseTab: Never
+AccessModifierOffset: -4
+ContinuationIndentWidth: 4
+IndentCaseBlocks: false
+IndentCaseLabels: false
+IndentGotoLabels: true
+IndentWrappedFunctionNames: false
+SortUsingDeclarations: false
+NamespaceIndentation: None
+SpaceAfterCStyleCast: false
+SpaceAfterLogicalNot: false
+SpaceAfterTemplateKeyword: true
+SpaceBeforeAssignmentOperators: true
+SpaceBeforeCaseColon: false
+SpaceBeforeCpp11BracedList: false
+SpaceBeforeCtorInitializerColon: true
+SpaceBeforeInheritanceColon: true
+SpaceBeforeRangeBasedForLoopColon: true
+SpaceBeforeSquareBrackets: false
+SpaceInEmptyBlock: false
+SpaceInEmptyParentheses: false
+SpacesInAngles: false
+SpacesInCStyleCastParentheses: false
+SpacesInConditionalStatement: false
+SpacesInParentheses: false
+SpacesInSquareBrackets: false
+AlignTrailingComments: true
+AlignAfterOpenBracket: true
+AllowShortCaseLabelsOnASingleLine: false
+AllowShortEnumsOnASingleLine: true
+AllowShortFunctionsOnASingleLine: All
+AllowShortIfStatementsOnASingleLine: Never
+AllowShortLambdasOnASingleLine: All
+AllowShortLoopsOnASingleLine: false
+AlwaysBreakTemplateDeclarations: MultiLine
+BinPackArguments: true
+BinPackParameters: true
+BreakBeforeTernaryOperators: true
+BreakConstructorInitializers: BeforeColon
+BreakInheritanceList: BeforeColon
+BreakStringLiterals: true
+InsertBraces: false
+IndentExternBlock: NoIndent
+BreakBeforeBraces: Custom
+BraceWrapping:
+ AfterCaseLabel: false
+ AfterClass: false
+ AfterControlStatement: Never
+ AfterEnum: false
+ AfterFunction: false
+ AfterNamespace: false
+ AfterStruct: false
+ AfterUnion: false
+ AfterExternBlock: false
+ BeforeCatch: false
+ BeforeElse: false
+ReflowComments: true
+MaxEmptyLinesToKeep: 2
\ No newline at end of file
diff --git a/MultipleImage/.hvigor/cache/meta.json b/MultipleImage/.hvigor/cache/meta.json
new file mode 100644
index 0000000000000000000000000000000000000000..18f86af95573be1ca58a8494f7aac0c780d0dfac
--- /dev/null
+++ b/MultipleImage/.hvigor/cache/meta.json
@@ -0,0 +1 @@
+{"compileSdkVersion":"5.0.4(16)","hvigorVersion":"5.16.2","toolChainsVersion":"5.0.4.150"}
diff --git a/MultipleImage/.hvigor/dependencyMap/dependencyMap.json5 b/MultipleImage/.hvigor/dependencyMap/dependencyMap.json5
new file mode 100644
index 0000000000000000000000000000000000000000..4dd4f70e0cb8b82de49d2abe8317ff3449dec534
--- /dev/null
+++ b/MultipleImage/.hvigor/dependencyMap/dependencyMap.json5
@@ -0,0 +1 @@
+{"basePath":"D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\.hvigor\\dependencyMap\\dependencyMap.json5","rootDependency":"./oh-package.json5","dependencyMap":{"entry":"./entry/oh-package.json5"},"modules":[{"name":"entry","srcPath":"..\\..\\..\\entry"}]}
\ No newline at end of file
diff --git a/MultipleImage/.hvigor/dependencyMap/entry/oh-package.json5 b/MultipleImage/.hvigor/dependencyMap/entry/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..50a51753855fc6efdf037d5db6ab2cc001f17bbc
--- /dev/null
+++ b/MultipleImage/.hvigor/dependencyMap/entry/oh-package.json5
@@ -0,0 +1 @@
+{"name":"entry","version":"1.0.0","description":"Please describe the basic information.","main":"","author":"","license":"","dependencies":{}}
\ No newline at end of file
diff --git a/MultipleImage/.hvigor/dependencyMap/oh-package.json5 b/MultipleImage/.hvigor/dependencyMap/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..204921fe30efc5e9abf09e97497d0c7735ed5ef4
--- /dev/null
+++ b/MultipleImage/.hvigor/dependencyMap/oh-package.json5
@@ -0,0 +1 @@
+{"modelVersion":"5.0.0","description":"Please describe the basic information.","dependencies":{},"devDependencies":{"@ohos/hypium":"1.0.18","@ohos/hamock":"1.0.0"}}
\ No newline at end of file
diff --git a/MultipleImage/.hvigor/outputs/build-logs/build.log b/MultipleImage/.hvigor/outputs/build-logs/build.log
new file mode 100644
index 0000000000000000000000000000000000000000..e807d59d9273f54eba50c5735bc92220b9808128
--- /dev/null
+++ b/MultipleImage/.hvigor/outputs/build-logs/build.log
@@ -0,0 +1,246 @@
+[2025-05-12T14:05:40.978] [DEBUG] debug-file - env: nodejsVersion=v18.20.1
+[2025-05-12T14:05:41.442] [DEBUG] debug-file - Hvigor init with startParameters:{
+ hvigorfileTypeCheck: false,
+ parallelExecution: true,
+ incrementalExecution: true,
+ printStackTrace: false,
+ daemon: false,
+ analyze: 0,
+ logLevel: Level { level: 20000, levelStr: 'INFO', colour: 'green' }
+}
+[2025-05-12T14:05:41.460] [DEBUG] debug-file - hvigorfile, resolving D:\git_developmentPractice\DevelopmentPractice\MultipleImage\hvigorfile.ts
+[2025-05-12T14:05:42.941] [DEBUG] debug-file - hvigorfile, require result: { default: { system: [Function: appTasks], plugins: [] } }
+[2025-05-12T14:05:43.148] [DEBUG] debug-file - Start initialize project's product build option map with build mode debug.
+[2025-05-12T14:05:43.153] [DEBUG] debug-file - Product 'default' using build option: {
+ "debuggable": true
+} in this build.
+[2025-05-12T14:05:43.168] [DEBUG] debug-file - Local scan or download HarmonyOS sdk components toolchains,ets,js,native,previewer
+[2025-05-12T14:05:43.172] [DEBUG] debug-file - Local scan or download hmscore sdk components toolchains,ets,native
+[2025-05-12T14:05:43.180] [DEBUG] debug-file - Start recording SDK configuration permission data.
+[2025-05-12T14:05:43.214] [DEBUG] debug-file - Sdk init in 51 ms
+[2025-05-12T14:05:43.240] [DEBUG] debug-file - Project task initialization takes 25 ms
+[2025-05-12T14:05:43.250] [DEBUG] debug-file - hvigorfile, resolving D:\git_developmentPractice\DevelopmentPractice\MultipleImage\entry\hvigorfile.ts
+[2025-05-12T14:05:43.273] [DEBUG] debug-file - Start initialize module-target build option map, moduleName=entry, buildMode=debug
+[2025-05-12T14:05:43.283] [DEBUG] debug-file - Module entry task initialization takes 6 ms
+[2025-05-12T14:05:43.340] [DEBUG] debug-file - Configuration task cost before running: 1 s 915 ms
+[2025-05-12T14:05:43.286] [DEBUG] debug-file - project has submodules:entry
+[2025-05-12T14:05:43.343] [DEBUG] debug-file - Executing task :entry:clean
+[2025-05-12T14:05:43.346] [DEBUG] debug-file - entry : clean cost memory 0.24472808837890625
+[2025-05-12T14:05:43.362] [DEBUG] debug-file - Module 'entry' target 'default' using build option: {
+ "debuggable": true,
+ "copyFrom": "default",
+ "name": "debug"
+} in this build.
+[2025-05-12T14:05:40.980] [DEBUG] debug-file - env: hvigor-config.json5 content = {
+ modelVersion: '5.0.0',
+ dependencies: {},
+ execution: {},
+ logging: {},
+ debugging: {},
+ nodeOptions: {}
+}
+[2025-05-12T14:05:41.444] [DEBUG] debug-file - Since current hvigor version 5.16.2 differs from last hvigor version
+ undefined, delete file-cache.json and task-cache.json.
+[2025-05-12T14:05:43.381] [DEBUG] debug-file - Create resident worker with id: 0.
+[2025-05-12T14:05:42.942] [DEBUG] debug-file - hvigorfile, binding system plugins [Function: appTasks]
+[2025-05-12T14:05:43.148] [DEBUG] debug-file - Picking option from product 'default' with build mode 'debug'.
+[2025-05-12T14:05:43.154] [DEBUG] debug-file - not found resModel json file in : D:\git_developmentPractice\DevelopmentPractice\MultipleImage\entry\src\ohosTest\module.json5
+[2025-05-12T14:05:43.241] [DEBUG] debug-file - hvigorfile, binding custom plugins []
+[2025-05-12T14:05:43.257] [DEBUG] debug-file - hvigorfile, require result: { default: { system: [Function: hapTasks], plugins: [] } }
+[2025-05-12T14:05:43.274] [DEBUG] debug-file - Target 'default' config: {}
+[2025-05-12T14:05:43.283] [DEBUG] debug-file - hvigorfile, binding custom plugins []
+[2025-05-12T14:05:43.287] [DEBUG] debug-file - start to load updatedOhPackageInfo to the disk
+[2025-05-12T14:05:43.343] [DEBUG] debug-file - clean: Worker pool is inactive.
+[2025-05-12T14:05:43.346] [DEBUG] debug-file - runTaskFromQueue task cost before running: 1 s 921 ms
+[2025-05-12T14:05:43.366] [DEBUG] debug-file - Module 'entry' target 'ohosTest' using build option: {
+ "debuggable": true,
+ "name": "default"
+} in this build.
+[2025-05-12T14:05:40.983] [DEBUG] debug-file - env: daemon=false
+[2025-05-12T14:05:41.444] [DEBUG] debug-file - Cache service initialization finished in 2 ms
+[2025-05-12T14:05:43.383] [DEBUG] debug-file - Create resident worker with id: 1.
+[2025-05-12T14:05:43.149] [DEBUG] debug-file - Product 'default' build option: {}
+[2025-05-12T14:05:43.162] [DEBUG] debug-file - No signingConfig found, initRemoteHspCache failed.
+[2025-05-12T14:05:43.241] [DEBUG] debug-file - hvigorfile, no custom plugins were found in D:\git_developmentPractice\DevelopmentPractice\MultipleImage\hvigorfile.ts
+[2025-05-12T14:05:43.257] [DEBUG] debug-file - hvigorfile, binding system plugins [Function: hapTasks]
+[2025-05-12T14:05:43.274] [DEBUG] debug-file - Target 'ohosTest' config: {}
+[2025-05-12T14:05:43.283] [DEBUG] debug-file - hvigorfile, no custom plugins were found in D:\git_developmentPractice\DevelopmentPractice\MultipleImage\entry\hvigorfile.ts
+[2025-05-12T14:05:43.293] [DEBUG] debug-file - load to the disk finished
+[2025-05-12T14:05:43.348] [INFO] debug-file - Finished :entry:clean... after 4 ms
+[2025-05-12T14:05:43.379] [DEBUG] debug-file - Since there is no instance or instance is terminated, create a new worker pool.
+[2025-05-12T14:05:40.983] [DEBUG] debug-file - no-daemon, use the parent process.execArgv --max-old-space-size=8192,--expose-gc
+[2025-05-12T14:05:43.386] [DEBUG] debug-file - Current worker pool is stopped or closed.
+[2025-05-12T14:05:43.149] [DEBUG] debug-file - End initialize project's product build option map with build mode 'debug'.
+[2025-05-12T14:05:43.241] [DEBUG] debug-file - hvigorfile, resolve finished D:\git_developmentPractice\DevelopmentPractice\MultipleImage\hvigorfile.ts
+[2025-05-12T14:05:43.274] [DEBUG] debug-file - Module 'entry' target 'default' build option: {
+ "debuggable": true,
+ "copyFrom": "default",
+ "name": "debug"
+}
+[2025-05-12T14:05:43.283] [DEBUG] debug-file - hvigorfile, resolve finished D:\git_developmentPractice\DevelopmentPractice\MultipleImage\entry\hvigorfile.ts
+[2025-05-12T14:05:43.295] [DEBUG] debug-file - Start to initialize dependency information.
+[2025-05-12T14:05:43.348] [DEBUG] debug-file - Executing task ::clean
+[2025-05-12T14:05:43.379] [DEBUG] debug-file - Worker pool is initialized with config: {
+ minPoolNum: 2,
+ maxPoolNum: undefined,
+ maxCoreSize: undefined,
+ cacheCapacity: undefined,
+ cacheTtl: undefined
+}
+[2025-05-12T14:05:43.386] [DEBUG] debug-file - Clear worker 0.
+[2025-05-12T14:05:43.274] [DEBUG] debug-file - Module 'entry' target 'ohosTest' build option: {
+ "debuggable": true,
+ "name": "default"
+}
+[2025-05-12T14:05:43.328] [DEBUG] debug-file - Module MultipleImage Collected Dependency:
+[2025-05-12T14:05:43.348] [DEBUG] debug-file - clean: Worker pool is inactive.
+[2025-05-12T14:05:43.386] [DEBUG] debug-file - Worker 0 has been cleared.
+[2025-05-12T14:05:43.274] [DEBUG] debug-file - End initialize module-target build option map, moduleName=entry
+[2025-05-12T14:05:43.328] [DEBUG] debug-file - Module MultipleImage's total dependency: 0
+[2025-05-12T14:05:43.349] [DEBUG] debug-file - MultipleImage : clean cost memory 0.0313873291015625
+[2025-05-12T14:05:43.386] [DEBUG] debug-file - Current idle worker size: 1.
+[2025-05-12T14:05:43.274] [DEBUG] debug-file - Module 'entry' target 'default' using build option: {
+ "debuggable": true,
+ "copyFrom": "default",
+ "name": "debug"
+} in this build.
+[2025-05-12T14:05:43.349] [DEBUG] debug-file - runTaskFromQueue task cost before running: 1 s 924 ms
+[2025-05-12T14:05:43.329] [DEBUG] debug-file - Start to initialize dependency information.
+[2025-05-12T14:05:43.386] [DEBUG] debug-file - Current busy worker size: 0.
+[2025-05-12T14:05:43.349] [INFO] debug-file - Finished ::clean... after 1 ms
+[2025-05-12T14:05:43.331] [DEBUG] debug-file - Module entry Collected Dependency:
+[2025-05-12T14:05:43.386] [DEBUG] debug-file - Clear worker 1.
+[2025-05-12T14:05:43.349] [DEBUG] debug-file - Executing task :entry:init
+[2025-05-12T14:05:43.331] [DEBUG] debug-file - Module entry's total dependency: 0
+[2025-05-12T14:05:43.386] [DEBUG] debug-file - Worker 1 has been cleared.
+[2025-05-12T14:05:43.349] [DEBUG] debug-file - entry : init cost memory 0.01019287109375
+[2025-05-12T14:05:43.337] [DEBUG] debug-file - Configuration phase cost:1 s 886 ms
+[2025-05-12T14:05:43.386] [DEBUG] debug-file - Current idle worker size: 0.
+[2025-05-12T14:05:43.349] [DEBUG] debug-file - runTaskFromQueue task cost before running: 1 s 924 ms
+[2025-05-12T14:05:43.386] [DEBUG] debug-file - Current busy worker size: 0.
+[2025-05-12T14:05:43.350] [INFO] debug-file - Finished :entry:init... after 1 ms
+[2025-05-12T14:05:43.387] [DEBUG] debug-file - hvigor build process will be closed.
+[2025-05-12T14:05:43.350] [DEBUG] debug-file - Executing task ::init
+[2025-05-12T14:05:43.393] [DEBUG] debug-file - worker[0] exits with exit code 0.
+[2025-05-12T14:05:43.350] [DEBUG] debug-file - MultipleImage : init cost memory 0.00897216796875
+[2025-05-12T14:05:43.394] [DEBUG] debug-file - worker[1] exits with exit code 0.
+[2025-05-12T14:05:43.350] [DEBUG] debug-file - runTaskFromQueue task cost before running: 1 s 925 ms
+[2025-05-12T14:05:43.394] [DEBUG] debug-file - Current worker pool is terminated.
+[2025-05-12T14:05:43.350] [INFO] debug-file - Finished ::init... after 1 ms
+[2025-05-17T15:59:08.928] [DEBUG] debug-file - env: nodejsVersion=v18.20.1
+[2025-05-17T15:59:09.375] [DEBUG] debug-file - Hvigor init with startParameters:{
+ hvigorfileTypeCheck: false,
+ parallelExecution: true,
+ incrementalExecution: true,
+ printStackTrace: false,
+ daemon: false,
+ analyze: 0,
+ logLevel: Level { level: 20000, levelStr: 'INFO', colour: 'green' }
+}
+[2025-05-17T15:59:09.396] [DEBUG] debug-file - hvigorfile, resolving D:\git_developmentPractice\BestPracticeSnippets\MultipleImage\hvigorfile.ts
+[2025-05-17T15:59:10.839] [DEBUG] debug-file - hvigorfile, require result: { default: { system: [Function: appTasks], plugins: [] } }
+[2025-05-17T15:59:11.038] [DEBUG] debug-file - Start initialize project's product build option map with build mode debug.
+[2025-05-17T15:59:11.043] [DEBUG] debug-file - Product 'default' using build option: {
+ "debuggable": true
+} in this build.
+[2025-05-17T15:59:11.056] [DEBUG] debug-file - Local scan or download HarmonyOS sdk components toolchains,ets,js,native,previewer
+[2025-05-17T15:59:11.059] [DEBUG] debug-file - Local scan or download hmscore sdk components toolchains,ets,native
+[2025-05-17T15:59:11.067] [DEBUG] debug-file - Start recording SDK configuration permission data.
+[2025-05-17T15:59:11.100] [DEBUG] debug-file - Sdk init in 49 ms
+[2025-05-17T15:59:11.126] [DEBUG] debug-file - Project task initialization takes 24 ms
+[2025-05-17T15:59:11.134] [DEBUG] debug-file - hvigorfile, resolving D:\git_developmentPractice\BestPracticeSnippets\MultipleImage\entry\hvigorfile.ts
+[2025-05-17T15:59:11.156] [DEBUG] debug-file - Start initialize module-target build option map, moduleName=entry, buildMode=debug
+[2025-05-17T15:59:11.165] [DEBUG] debug-file - Module entry task initialization takes 5 ms
+[2025-05-17T15:59:11.195] [DEBUG] debug-file - Configuration task cost before running: 1 s 838 ms
+[2025-05-17T15:59:11.168] [DEBUG] debug-file - project has submodules:entry
+[2025-05-17T15:59:11.210] [DEBUG] debug-file - Module 'entry' target 'default' using build option: {
+ "debuggable": true,
+ "copyFrom": "default",
+ "name": "debug"
+} in this build.
+[2025-05-17T15:59:08.930] [DEBUG] debug-file - env: hvigor-config.json5 content = {
+ modelVersion: '5.0.0',
+ dependencies: {},
+ execution: {},
+ logging: {},
+ debugging: {},
+ nodeOptions: {}
+}
+[2025-05-17T15:59:09.378] [DEBUG] debug-file - Cache service initialization finished in 3 ms
+[2025-05-17T15:59:11.228] [DEBUG] debug-file - Create resident worker with id: 0.
+[2025-05-17T15:59:10.839] [DEBUG] debug-file - hvigorfile, binding system plugins [Function: appTasks]
+[2025-05-17T15:59:11.038] [DEBUG] debug-file - Picking option from product 'default' with build mode 'debug'.
+[2025-05-17T15:59:11.044] [DEBUG] debug-file - not found resModel json file in : D:\git_developmentPractice\BestPracticeSnippets\MultipleImage\entry\src\ohosTest\module.json5
+[2025-05-17T15:59:11.126] [DEBUG] debug-file - hvigorfile, binding custom plugins []
+[2025-05-17T15:59:11.141] [DEBUG] debug-file - hvigorfile, require result: { default: { system: [Function: hapTasks], plugins: [] } }
+[2025-05-17T15:59:11.157] [DEBUG] debug-file - Target 'default' config: {}
+[2025-05-17T15:59:11.166] [DEBUG] debug-file - hvigorfile, binding custom plugins []
+[2025-05-17T15:59:11.196] [DEBUG] debug-file - Executing task :entry:init
+[2025-05-17T15:59:11.170] [DEBUG] debug-file - start to load updatedOhPackageInfo to the disk
+[2025-05-17T15:59:11.214] [DEBUG] debug-file - Module 'entry' target 'ohosTest' using build option: {
+ "debuggable": true,
+ "name": "default"
+} in this build.
+[2025-05-17T15:59:08.932] [DEBUG] debug-file - env: daemon=false
+[2025-05-17T15:59:11.230] [DEBUG] debug-file - Create resident worker with id: 1.
+[2025-05-17T15:59:11.039] [DEBUG] debug-file - Product 'default' build option: {}
+[2025-05-17T15:59:11.051] [DEBUG] debug-file - No signingConfig found, initRemoteHspCache failed.
+[2025-05-17T15:59:11.126] [DEBUG] debug-file - hvigorfile, no custom plugins were found in D:\git_developmentPractice\BestPracticeSnippets\MultipleImage\hvigorfile.ts
+[2025-05-17T15:59:11.141] [DEBUG] debug-file - hvigorfile, binding system plugins [Function: hapTasks]
+[2025-05-17T15:59:11.157] [DEBUG] debug-file - Target 'ohosTest' config: {}
+[2025-05-17T15:59:11.166] [DEBUG] debug-file - hvigorfile, no custom plugins were found in D:\git_developmentPractice\BestPracticeSnippets\MultipleImage\entry\hvigorfile.ts
+[2025-05-17T15:59:11.196] [DEBUG] debug-file - entry : init cost memory 0.11040496826171875
+[2025-05-17T15:59:11.175] [DEBUG] debug-file - load to the disk finished
+[2025-05-17T15:59:11.226] [DEBUG] debug-file - Since there is no instance or instance is terminated, create a new worker pool.
+[2025-05-17T15:59:08.932] [DEBUG] debug-file - no-daemon, use the parent process.execArgv --max-old-space-size=8192,--expose-gc
+[2025-05-17T15:59:11.232] [DEBUG] debug-file - Current worker pool is stopped or closed.
+[2025-05-17T15:59:11.039] [DEBUG] debug-file - End initialize project's product build option map with build mode 'debug'.
+[2025-05-17T15:59:11.126] [DEBUG] debug-file - hvigorfile, resolve finished D:\git_developmentPractice\BestPracticeSnippets\MultipleImage\hvigorfile.ts
+[2025-05-17T15:59:11.157] [DEBUG] debug-file - Module 'entry' target 'default' build option: {
+ "debuggable": true,
+ "copyFrom": "default",
+ "name": "debug"
+}
+[2025-05-17T15:59:11.166] [DEBUG] debug-file - hvigorfile, resolve finished D:\git_developmentPractice\BestPracticeSnippets\MultipleImage\entry\hvigorfile.ts
+[2025-05-17T15:59:11.196] [DEBUG] debug-file - runTaskFromQueue task cost before running: 1 s 839 ms
+[2025-05-17T15:59:11.176] [DEBUG] debug-file - Start to initialize dependency information.
+[2025-05-17T15:59:11.226] [DEBUG] debug-file - Worker pool is initialized with config: {
+ minPoolNum: 2,
+ maxPoolNum: undefined,
+ maxCoreSize: undefined,
+ cacheCapacity: undefined,
+ cacheTtl: undefined
+}
+[2025-05-17T15:59:11.233] [DEBUG] debug-file - Clear worker 0.
+[2025-05-17T15:59:11.157] [DEBUG] debug-file - Module 'entry' target 'ohosTest' build option: {
+ "debuggable": true,
+ "name": "default"
+}
+[2025-05-17T15:59:11.197] [INFO] debug-file - Finished :entry:init... after 1 ms
+[2025-05-17T15:59:11.183] [DEBUG] debug-file - Module MultipleImage Collected Dependency:
+[2025-05-17T15:59:11.233] [DEBUG] debug-file - Worker 0 has been cleared.
+[2025-05-17T15:59:11.157] [DEBUG] debug-file - End initialize module-target build option map, moduleName=entry
+[2025-05-17T15:59:11.197] [DEBUG] debug-file - Executing task ::init
+[2025-05-17T15:59:11.183] [DEBUG] debug-file - Module MultipleImage's total dependency: 0
+[2025-05-17T15:59:11.233] [DEBUG] debug-file - Current idle worker size: 1.
+[2025-05-17T15:59:11.158] [DEBUG] debug-file - Module 'entry' target 'default' using build option: {
+ "debuggable": true,
+ "copyFrom": "default",
+ "name": "debug"
+} in this build.
+[2025-05-17T15:59:11.198] [DEBUG] debug-file - MultipleImage : init cost memory 0.00890350341796875
+[2025-05-17T15:59:11.184] [DEBUG] debug-file - Start to initialize dependency information.
+[2025-05-17T15:59:11.233] [DEBUG] debug-file - Current busy worker size: 0.
+[2025-05-17T15:59:11.198] [DEBUG] debug-file - runTaskFromQueue task cost before running: 1 s 841 ms
+[2025-05-17T15:59:11.186] [DEBUG] debug-file - Module entry Collected Dependency:
+[2025-05-17T15:59:11.233] [DEBUG] debug-file - Clear worker 1.
+[2025-05-17T15:59:11.198] [INFO] debug-file - Finished ::init... after 1 ms
+[2025-05-17T15:59:11.187] [DEBUG] debug-file - Module entry's total dependency: 0
+[2025-05-17T15:59:11.233] [DEBUG] debug-file - Worker 1 has been cleared.
+[2025-05-17T15:59:11.192] [DEBUG] debug-file - Configuration phase cost:1 s 806 ms
+[2025-05-17T15:59:11.233] [DEBUG] debug-file - Current idle worker size: 0.
+[2025-05-17T15:59:11.233] [DEBUG] debug-file - Current busy worker size: 0.
+[2025-05-17T15:59:11.234] [DEBUG] debug-file - hvigor build process will be closed.
+[2025-05-17T15:59:11.240] [DEBUG] debug-file - worker[0] exits with exit code 0.
+[2025-05-17T15:59:11.240] [DEBUG] debug-file - worker[1] exits with exit code 0.
+[2025-05-17T15:59:11.241] [DEBUG] debug-file - Current worker pool is terminated.
diff --git a/MultipleImage/.hvigor/outputs/sync/fileCache.json b/MultipleImage/.hvigor/outputs/sync/fileCache.json
new file mode 100644
index 0000000000000000000000000000000000000000..2fd4216544b0e5594ebb7d93eacec459c1686b5a
--- /dev/null
+++ b/MultipleImage/.hvigor/outputs/sync/fileCache.json
@@ -0,0 +1 @@
+{"CACHE_SYNC_FILE_HASH":{"D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\hvigor\\hvigor-config.json5":"89e85abc1f2d7ddf27f61011a767335991f49bb6d06655086594c13b6f69a8a5","D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\build-profile.json5":"0dc9a7c02c0e863ec9e5f29f82c3f9822426bdc2d029fc792df0abfd95e066da","D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\hvigorfile.ts":"7cd055832b5508e9d32ab453bbf275d3a9b6341475a4d307beaa805ec612cd62","D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\oh-package.json5":"56bbb67a1a2d3b88c44acca819722d7bf041117213ba953dfd5ba040f42b9a78","D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\build-profile.json5":"0c5e943228e253cba1fdbe3d18336c14d566eb58086de0e7f931f639c236355d","D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\hvigorfile.ts":"2ea01b65e44e9199537159143e979c1d3fcfd9d857b5f3f0f3b47ca11d0ba0e8","D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\oh-package.json5":"9096ebd6da0217f06d01b48e188f50043ae8112de723f0ba1338be8301b6d2cf","D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\.hvigor\\outputs\\sync\\output.json":"a596da51dc2e9cbdb874049c2d5a85abf86491031e0e745c2defdc3d2832b0eb","SDK_LOCATION":"D:/dev-5.0.11/DevEco Studio/sdk"},"OHPM_INSTALL_FILE_HASH":{"D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\oh-package.json5":"56bbb67a1a2d3b88c44acca819722d7bf041117213ba953dfd5ba040f42b9a78","D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\oh_modules\\.ohpm\\lock.json5":"ccb9670ae5342a494c9c696ae9b9414e20dc3f94467c21629865e227fbdf34f8","D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\oh-package.json5":"9096ebd6da0217f06d01b48e188f50043ae8112de723f0ba1338be8301b6d2cf","D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\oh_modules":true,"D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\oh_modules":false}}
\ No newline at end of file
diff --git a/MultipleImage/.hvigor/outputs/sync/output.json b/MultipleImage/.hvigor/outputs/sync/output.json
new file mode 100644
index 0000000000000000000000000000000000000000..661d664e60f124f682bb30eac37548f892f7617e
--- /dev/null
+++ b/MultipleImage/.hvigor/outputs/sync/output.json
@@ -0,0 +1,164 @@
+{
+ "ohos-module-entry": {
+ "SELECT_TARGET": "default",
+ "MODULE_BUILD_DIR": "D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\build",
+ "DEPENDENCY_INFO": {},
+ "TARGETS": {
+ "default": {
+ "SOURCE_ROOT": "D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\src\\main",
+ "RESOURCES_PATH": [
+ "D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\src\\main\\resources"
+ ],
+ "BUILD_PATH": {
+ "OUTPUT_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\build\\default\\outputs\\default",
+ "INTERMEDIA_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\build\\default\\intermediates",
+ "JS_ASSETS_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\build\\default\\intermediates\\loader_out\\default",
+ "JS_LITE_ASSETS_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\build\\default\\intermediates\\loader_out_lite\\default",
+ "RES_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\build\\default\\intermediates\\res\\default",
+ "RES_PROFILE_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\build\\default\\intermediates\\res\\default\\resources\\base\\profile",
+ "ETS_SUPER_VISUAL_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\build\\default\\cache\\default\\default@CompileArkTS\\esmodule",
+ "JS_SUPER_VISUAL_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\build\\default\\cache\\default\\default@CompileJS\\jsbundle",
+ "WORKER_LOADER": "D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\build\\default\\intermediates\\loader\\default\\loader.json",
+ "MANIFEST_JSON": "D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\build\\default\\intermediates\\manifest\\default",
+ "OUTPUT_METADATA_JSON": "D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\build\\default\\intermediates\\hap_metadata\\default\\output_metadata.json",
+ "SOURCE_MAP_DIR": "D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\build\\default\\intermediates\\source_map\\default"
+ },
+ "BUILD_OPTION": {
+ "debuggable": true
+ }
+ },
+ "ohosTest": {
+ "SOURCE_ROOT": "D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\src\\ohosTest",
+ "RESOURCES_PATH": [
+ "D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\src\\ohosTest\\resources"
+ ],
+ "BUILD_PATH": {
+ "OUTPUT_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\build\\default\\outputs\\ohosTest",
+ "INTERMEDIA_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\build\\default\\intermediates",
+ "JS_ASSETS_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\build\\default\\intermediates\\loader_out\\ohosTest",
+ "JS_LITE_ASSETS_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\build\\default\\intermediates\\loader_out_lite\\ohosTest",
+ "RES_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\build\\default\\intermediates\\res\\ohosTest",
+ "RES_PROFILE_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\build\\default\\intermediates\\res\\ohosTest\\resources\\base\\profile",
+ "ETS_SUPER_VISUAL_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\build\\default\\cache\\ohosTest\\ohosTest@OhosTestCompileArkTS\\esmodule",
+ "JS_SUPER_VISUAL_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\build\\default\\cache\\ohosTest\\ohosTest@OhosTestCompileJS\\jsbundle",
+ "WORKER_LOADER": "D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\build\\default\\intermediates\\loader\\ohosTest\\loader.json",
+ "MANIFEST_JSON": "D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\build\\default\\intermediates\\manifest\\ohosTest",
+ "OUTPUT_METADATA_JSON": "D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\build\\default\\intermediates\\hap_metadata\\ohosTest\\output_metadata.json",
+ "SOURCE_MAP_DIR": "D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\build\\default\\intermediates\\source_map\\ohosTest"
+ },
+ "BUILD_OPTION": {
+ "debuggable": true
+ }
+ }
+ },
+ "BUILD_OPTION": {
+ "default-default": {
+ "debuggable": true,
+ "copyFrom": "default",
+ "name": "debug"
+ }
+ },
+ "BUILD_PROFILE_OPT": {
+ "apiType": "stageMode",
+ "buildOption": {},
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": true,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ }
+ }
+ }
+ },
+ {
+ "name": "default"
+ },
+ {
+ "name": "debug"
+ }
+ ],
+ "targets": [
+ {
+ "name": "default"
+ },
+ {
+ "name": "ohosTest"
+ }
+ ]
+ },
+ "BUILD_CACHE_DIR": ""
+ },
+ "ohos-project": {
+ "SELECT_PRODUCT_NAME": "default",
+ "MODULE_BUILD_DIR": "D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\build",
+ "BUNDLE_NAME": "com.example.multipleimages",
+ "BUILD_PATH": {
+ "OUTPUT_PATH": "D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\build\\outputs\\default"
+ },
+ "MODULES": [
+ {
+ "name": "entry",
+ "srcPath": "D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry",
+ "targets": [
+ {
+ "name": "default",
+ "applyToProducts": [
+ "default"
+ ]
+ }
+ ],
+ "belongProjectPath": "D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage"
+ }
+ ],
+ "PROFILE_OPT": {
+ "app": {
+ "signingConfigs": [],
+ "products": [
+ {
+ "name": "default",
+ "signingConfig": "default",
+ "compatibleSdkVersion": "5.0.0(12)",
+ "runtimeOS": "HarmonyOS"
+ }
+ ],
+ "buildModeSet": [
+ {
+ "name": "debug"
+ },
+ {
+ "name": "release"
+ }
+ ]
+ },
+ "modules": [
+ {
+ "name": "entry",
+ "srcPath": "./entry",
+ "targets": [
+ {
+ "name": "default",
+ "applyToProducts": [
+ "default"
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ "CONFIG_PROPERTIES": {
+ "enableSignTask": true,
+ "skipNativeIncremental": false,
+ "hvigor.keepDependency": true
+ },
+ "OVERALL_PROJECT_PATHS": [
+ "D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage"
+ ],
+ "BUILD_CACHE_DIR": ""
+ },
+ "version": 1
+}
\ No newline at end of file
diff --git a/MultipleImage/.idea/.deveco/module/entry.cache.json b/MultipleImage/.idea/.deveco/module/entry.cache.json
new file mode 100644
index 0000000000000000000000000000000000000000..919364cc0fd7678fa9a10fbc45bebe36bfeb58b0
--- /dev/null
+++ b/MultipleImage/.idea/.deveco/module/entry.cache.json
@@ -0,0 +1,22 @@
+{
+ "CommonInfo":{
+ "current.select.target":"default"
+ },
+ "BuildOptions":{
+ "SELECT_BUILD_TARGET":"default",
+ "BUILD_PATH":{
+ "OUTPUT_METADATA_JSON":"D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\build\\default\\intermediates\\hap_metadata\\default\\output_metadata.json",
+ "OUTPUT_PATH":"D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\build\\default\\outputs\\default",
+ "RES_PATH":"D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\build\\default\\intermediates\\res\\default",
+ "ETS_SUPER_VISUAL_PATH":"D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\build\\default\\cache\\default\\default@CompileArkTS\\esmodule",
+ "JS_ASSETS_PATH":"D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\build\\default\\intermediates\\loader_out\\default",
+ "SOURCE_MAP_DIR":"D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\build\\default\\intermediates\\source_map\\default",
+ "INTERMEDIA_PATH":"D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\build\\default\\intermediates",
+ "RES_PROFILE_PATH":"D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\build\\default\\intermediates\\res\\default\\resources\\base\\profile",
+ "WORKER_LOADER":"D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\build\\default\\intermediates\\loader\\default\\loader.json",
+ "MANIFEST_JSON":"D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\build\\default\\intermediates\\manifest\\default",
+ "JS_LITE_ASSETS_PATH":"D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\build\\default\\intermediates\\loader_out_lite\\default",
+ "JS_SUPER_VISUAL_PATH":"D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\entry\\build\\default\\cache\\default\\default@CompileJS\\jsbundle"
+ }
+ }
+}
\ No newline at end of file
diff --git a/MultipleImage/.idea/.deveco/project.cache.json b/MultipleImage/.idea/.deveco/project.cache.json
new file mode 100644
index 0000000000000000000000000000000000000000..b51c980b39beada5f46e5bb62edd658a5b089194
--- /dev/null
+++ b/MultipleImage/.idea/.deveco/project.cache.json
@@ -0,0 +1,16 @@
+{
+ "CommonInfo":{
+ "project.ide.version":"5.0.11.100",
+ "current.select.product":"default",
+ "current.select.buildMode":"",
+ "crossplatform.projectType":""
+ },
+ "BuildOptions":{
+ "SELECT_BUILD_PRODUCT":"default",
+ "BUNDLE_NAME":"com.example.multipleimages",
+ "BUILD_PATH":{
+ "OUTPUT_PATH":"D:\\git_developmentPractice\\BestPracticeSnippets\\MultipleImage\\build\\outputs\\default"
+ },
+ "SELECT_BUILD_MODE":""
+ }
+}
\ No newline at end of file
diff --git a/MultipleImage/.idea/.gitignore b/MultipleImage/.idea/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..359bb5307e8535ab7d59faf27a7377033291821e
--- /dev/null
+++ b/MultipleImage/.idea/.gitignore
@@ -0,0 +1,3 @@
+# 默认忽略的文件
+/shelf/
+/workspace.xml
diff --git a/MultipleImage/.idea/git_toolbox_blame.xml b/MultipleImage/.idea/git_toolbox_blame.xml
new file mode 100644
index 0000000000000000000000000000000000000000..7dc124965d28403ec2545a24d7d1cd1fec1f57d8
--- /dev/null
+++ b/MultipleImage/.idea/git_toolbox_blame.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MultipleImage/.idea/modules.xml b/MultipleImage/.idea/modules.xml
new file mode 100644
index 0000000000000000000000000000000000000000..07243728a337fc19757af9ede801878fbee8aabe
--- /dev/null
+++ b/MultipleImage/.idea/modules.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MultipleImage/.idea/modules/MultipleImage.iml b/MultipleImage/.idea/modules/MultipleImage.iml
new file mode 100644
index 0000000000000000000000000000000000000000..c0be1d7c491147540d199ce55f0721012b7ff7b5
--- /dev/null
+++ b/MultipleImage/.idea/modules/MultipleImage.iml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MultipleImage/.idea/modules/entry/entry.iml b/MultipleImage/.idea/modules/entry/entry.iml
new file mode 100644
index 0000000000000000000000000000000000000000..b630fe7f2a024b997f55fc5a52dea6c90a18c45d
--- /dev/null
+++ b/MultipleImage/.idea/modules/entry/entry.iml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MultipleImage/AppScope/app.json5 b/MultipleImage/AppScope/app.json5
new file mode 100644
index 0000000000000000000000000000000000000000..f44d8a0caa2a224e7655efa91e67251de411c9bb
--- /dev/null
+++ b/MultipleImage/AppScope/app.json5
@@ -0,0 +1,10 @@
+{
+ "app": {
+ "bundleName": "com.example.multipleimages",
+ "vendor": "example",
+ "versionCode": 1000000,
+ "versionName": "1.0.0",
+ "icon": "$media:app_icon",
+ "label": "$string:app_name"
+ }
+}
diff --git a/MultipleImage/AppScope/resources/base/element/string.json b/MultipleImage/AppScope/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..f627990995eebc9df9600a893501631c3ceab64c
--- /dev/null
+++ b/MultipleImage/AppScope/resources/base/element/string.json
@@ -0,0 +1,8 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "MultipleImages"
+ }
+ ]
+}
diff --git a/MultipleImage/AppScope/resources/base/media/app_icon.png b/MultipleImage/AppScope/resources/base/media/app_icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..a39445dc87828b76fed6d2ec470dd455c45319e3
Binary files /dev/null and b/MultipleImage/AppScope/resources/base/media/app_icon.png differ
diff --git a/MultipleImage/LICENSE b/MultipleImage/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..338e5b0bc22082e0ffcc7121c2ed3897a3ddccb0
--- /dev/null
+++ b/MultipleImage/LICENSE
@@ -0,0 +1,78 @@
+ Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved.
+
+ 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.
+
+Apache License, Version 2.0
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
+
+"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
+
+2. Grant of Copyright License.
+
+Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License.
+
+Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution.
+
+You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
+1.You must give any other recipients of the Work or Derivative Works a copy of this License; and
+2.You must cause any modified files to carry prominent notices stating that You changed the files; and
+3.You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
+4.If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
+
+You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
+
+5. Submission of Contributions.
+
+Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
+
+6. Trademarks.
+
+This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty.
+
+Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability.
+
+In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability.
+
+While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
\ No newline at end of file
diff --git a/MultipleImage/README.md b/MultipleImage/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..4faa63c59e3c0e71461264cb0c472d27d1dfa618
--- /dev/null
+++ b/MultipleImage/README.md
@@ -0,0 +1,51 @@
+# **多图片合集**
+## 介绍
+基于Swiper组件和自定义指示器实现多图片合计功能。
+
+在短视频平台上,经常可以见到多图片合集。它的特点是:由多张图片组成一个合集,图片可以自动进行轮播,也可以手动去进行图片切换。图片下方的进度条
+会跟随图片的切换而切换。
+
+多图片合集展示效果是一个常见的UI效果:
+* 当作品自动播放时,图片可自动切换,下方进度条缓慢增长,且进度与该图片停留时间匹配。
+* 当作品手动播放时,下方进度条会根据图片切换改变为未完成进度状态或已完成进度状态。
+
+## 预览效果
+
+## 工程目录
+```
+├──entry/src/main/ets // 代码区
+│ ├──common
+│ │ └──CommonConstants.ets // 常量
+│ ├──entryability
+│ │ └──EntryAbility.ets // 程序入口类
+│ ├──entrybackupability
+│ │ └──EntryBackupAbility.ets
+│ ├──pages
+│ │ └──Index.ets // 多图片合集页
+│ └──utils.ets
+│ └──DataSource.ets // 图片数据资源类
+└──entry/src/main/resources // 应用资源目录
+```
+## 使用说明
+运行应用后,不滑动屏幕时,图片自动轮播,且下方进度条缓慢增长至已完成状态,播放完成时,会继续循环播放。
+
+滑动屏幕时,图片跟随滑动方向而进行切换,此时会关闭自动轮播和循环播放的效果,且下方进度条瞬间增长至已完成状态。
+## 实现说明
+上面图片的轮播部分使用Swiper组件实现。
+
+下面的指示器,需要关闭原生指示器,自定义指示器(进度条)来实现。
+
+进度条可以使用Row容器来实现对应的效果,通过层叠布局方式将Row容器叠放在一起。进度条缓慢增长,可以通过animation属性来设置对应的动画效果。进度条的完成态和未完成态的实现,
+只需要设置对应的背景颜色即可。
+
+## 相关权限
+无
+
+## 约束与限制
+* 本示例仅支持标准系统上运行,支持设备:华为手机。
+
+* HarmonyOS系统:HarmonyOS NEXT Developer Beta5及以上。
+
+* DevEco Studio版本:DevEco Studio NEXT Developer Beta5及以上。
+
+* HarmonyOS SDK版本:HarmonyOS NEXT Developer Beta5 SDK及以上。
\ No newline at end of file
diff --git a/MultipleImage/build-profile.json5 b/MultipleImage/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..c033ce4278fb0641d84107c3c134047ac487368e
--- /dev/null
+++ b/MultipleImage/build-profile.json5
@@ -0,0 +1,35 @@
+{
+ "app": {
+ "signingConfigs": [],
+ "products": [
+ {
+ "name": "default",
+ "signingConfig": "default",
+ "compatibleSdkVersion": "5.0.0(12)",
+ "runtimeOS": "HarmonyOS",
+ }
+ ],
+ "buildModeSet": [
+ {
+ "name": "debug",
+ },
+ {
+ "name": "release"
+ }
+ ]
+ },
+ "modules": [
+ {
+ "name": "entry",
+ "srcPath": "./entry",
+ "targets": [
+ {
+ "name": "default",
+ "applyToProducts": [
+ "default"
+ ]
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/MultipleImage/entry/build-profile.json5 b/MultipleImage/entry/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..022da48cdeeb580b0259d8145daa90ecd7e3c09e
--- /dev/null
+++ b/MultipleImage/entry/build-profile.json5
@@ -0,0 +1,27 @@
+{
+ "apiType": "stageMode",
+ "buildOption": {
+ },
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation" : {
+ "ruleOptions":{
+ "enable": true,
+ "files": ["./obfuscation-rules.txt"]
+ }
+ }
+ }
+ },
+ ],
+ "targets": [
+ {
+ "name": "default"
+ }
+ ,
+ {
+ "name": "ohosTest",
+ }
+ ]
+}
\ No newline at end of file
diff --git a/MultipleImage/entry/hvigorfile.ts b/MultipleImage/entry/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..c6edcd90486dd5a853cf7d34c8647f08414ca7a3
--- /dev/null
+++ b/MultipleImage/entry/hvigorfile.ts
@@ -0,0 +1,6 @@
+import { hapTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/MultipleImage/entry/obfuscation-rules.txt b/MultipleImage/entry/obfuscation-rules.txt
new file mode 100644
index 0000000000000000000000000000000000000000..69c4d6a8a5531548e4886fa766090c5c157a87d9
--- /dev/null
+++ b/MultipleImage/entry/obfuscation-rules.txt
@@ -0,0 +1,18 @@
+# Define project specific obfuscation rules here.
+# You can include the obfuscation configuration files in the current module's build-profile.json5.
+#
+# For more details, see
+# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
+
+# Obfuscation options:
+# -disable-obfuscation: disable all obfuscations
+# -enable-property-obfuscation: obfuscate the property names
+# -enable-toplevel-obfuscation: obfuscate the names in the global scope
+# -compact: remove unnecessary blank spaces and all line feeds
+# -remove-log: remove all console.* statements
+# -print-namecache: print the name cache that contains the mapping from the old names to new names
+# -apply-namecache: reuse the given cache file
+
+# Keep options:
+# -keep-property-name: specifies property names that you want to keep
+# -keep-global-name: specifies names that you want to keep in the global scope
\ No newline at end of file
diff --git a/MultipleImage/entry/oh-package.json5 b/MultipleImage/entry/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..248c3b7541a589682a250f86a6d3ecf7414d2d6a
--- /dev/null
+++ b/MultipleImage/entry/oh-package.json5
@@ -0,0 +1,10 @@
+{
+ "name": "entry",
+ "version": "1.0.0",
+ "description": "Please describe the basic information.",
+ "main": "",
+ "author": "",
+ "license": "",
+ "dependencies": {}
+}
+
diff --git a/MultipleImage/entry/src/main/ets/common/CommonConstants.ets b/MultipleImage/entry/src/main/ets/common/CommonConstants.ets
new file mode 100644
index 0000000000000000000000000000000000000000..eac9bc06a9b65429ed9da7ce8cb7a858ad5c9848
--- /dev/null
+++ b/MultipleImage/entry/src/main/ets/common/CommonConstants.ets
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 2024 Huawei Device 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.
+ */
+
+export class CommonConstants {
+ /**
+ * Full percent.
+ */
+ static readonly FULL_PERCENT: string = '100%';
+
+ /**
+ * Foldable percent.
+ */
+ static readonly Foldable_PERCENT: string = '70%';
+
+ /**
+ * None percent.
+ */
+ static readonly NONE_PERCENT: string = '0';
+
+ /**
+ * Swiper initially currentIndex.
+ */
+ static readonly INITIALLY_CURRENT_INDEX: number = -1;
+
+ /**
+ * Swiper slide index.
+ */
+ static readonly SLIDE_INDEX: number = -1;
+
+ /**
+ * Swiper image duration.
+ */
+ static readonly IMAGE_DURATION: number = 300;
+
+ /**
+ * Swiper duration.
+ */
+ static readonly DURATION: number = 3000;
+
+ /**
+ * Swiper interval.
+ */
+ static readonly INTERVAL: number = 3000;
+
+ /**
+ * Swiper item space.
+ */
+ static readonly ITEM_SPACE: number = 0;
+
+ /**
+ * Swiper interval duration.
+ */
+ static readonly INITIALLY_DURATION: number = 300;
+
+ /**
+ * Swiper duration.
+ */
+ static readonly NO_DURATION: number = 0;
+
+ /**
+ * Swiper max height.
+ */
+ static readonly SWIPER_MAX_HEIGHT: number = 333;
+
+ /**
+ * Swiper cached count.
+ */
+ static readonly SWIPER_CACHED_COUNT: number = 2;
+
+ /**
+ * Progress wrap height.
+ */
+ static readonly PROGRESS_WRAP_HEIGHT: number = 50;
+
+ /**
+ * zIndex.
+ */
+ static readonly Z_INDEX_0: number = 0;
+
+ /**
+ * zIndex.
+ */
+ static readonly Z_INDEX_1: number = 1;
+
+ /**
+ * zIndex.
+ */
+ static readonly Z_INDEX_2: number = 2;
+
+ /**
+ * Progress height.
+ */
+ static readonly PROGRESS_HEIGHT: number = 2;
+
+ /**
+ * Swiper initially Index.
+ */
+ static readonly INITIALLY_INDEX: number = 0;
+
+ /**
+ * Layout weight.
+ */
+ static readonly LAYOUT_WEIGHT: number = 1;
+
+ /**
+ * Column height.
+ */
+ static readonly COLUMN_HEIGHT: number = 100;
+
+ /**
+ * Multipart form text weight.
+ */
+ static readonly FORM_TEXT_FONT_WEIGHT: number = 500;
+
+ /**
+ * Row space.
+ */
+ static readonly ROW_SPACE: number = 5;
+
+ /**
+ * Column space.
+ */
+ static readonly COLUMN_SPACE: number = 16;
+
+ /**
+ * Column space inside.
+ */
+ static readonly COLUMN_SPACE_INSIDE: number = 8;
+}
\ No newline at end of file
diff --git a/MultipleImage/entry/src/main/ets/entryability/EntryAbility.ets b/MultipleImage/entry/src/main/ets/entryability/EntryAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..7592f47e01b4717265b8cd910855e6ee0779ec2a
--- /dev/null
+++ b/MultipleImage/entry/src/main/ets/entryability/EntryAbility.ets
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2024 Huawei Device 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 { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { window } from '@kit.ArkUI';
+import { BusinessError } from '@kit.BasicServicesKit';
+
+export default class EntryAbility extends UIAbility {
+ onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
+ }
+
+ onDestroy(): void {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
+ }
+
+ onWindowStageCreate(windowStage: window.WindowStage): void {
+ // Main window is created, set main page for this ability
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
+
+ windowStage.loadContent('pages/Index', (err) => {
+ 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.');
+ });
+
+ let windowClass: window.Window | null = null;
+ windowStage.getMainWindow((err: BusinessError, data) => {
+ let errCode: number = err.code;
+ if (errCode) {
+ hilog.error(0x0000, 'testTag', 'Failed to obtain the main window. Cause: %{public}s',
+ JSON.stringify(err) ?? '');
+ return;
+ }
+ windowClass = data;
+ hilog.info(0x0000, 'testTag', 'Succeeded in obtaining the main window.');
+
+ windowClass.setWindowLayoutFullScreen(true);
+ let sysBarProps: window.SystemBarProperties = {
+ statusBarColor: '#000000',
+ navigationBarColor: '#000000',
+ statusBarContentColor: '#ffffff',
+ navigationBarContentColor: '#ffffff'
+ };
+ windowClass.setWindowSystemBarProperties(sysBarProps);
+ })
+ }
+
+ onWindowStageDestroy(): void {
+ // Main window is destroyed, release UI related resources
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
+ }
+
+ onForeground(): void {
+ // Ability has brought to foreground
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
+ }
+
+ onBackground(): void {
+ // Ability has back to background
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
+ }
+}
diff --git a/MultipleImage/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets b/MultipleImage/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..f761896856d183e1085b804cfde0d84aeab41ee8
--- /dev/null
+++ b/MultipleImage/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2024 Huawei Device 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 '@kit.PerformanceAnalysisKit';
+import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit';
+
+export default class EntryBackupAbility extends BackupExtensionAbility {
+ async onBackup () {
+ hilog.info(0x0000, 'testTag', 'onBackup ok');
+ }
+
+ async onRestore (bundleVersion : BundleVersion) {
+ hilog.info(0x0000, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion));
+ }
+}
\ No newline at end of file
diff --git a/MultipleImage/entry/src/main/ets/pages/Index.ets b/MultipleImage/entry/src/main/ets/pages/Index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..58af402eb3fd63a0123b3412d9fc4ebc47e4e8d0
--- /dev/null
+++ b/MultipleImage/entry/src/main/ets/pages/Index.ets
@@ -0,0 +1,281 @@
+/*
+ * Copyright (c) 2024 Huawei Device 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 { DataSource, PhotoData } from '../util/DataSource';
+import { CommonConstants } from '../common//CommonConstants';
+import { common } from '@kit.AbilityKit';
+import { display } from '@kit.ArkUI';
+
+@Entry
+@Component
+struct Index {
+ private swiperController: SwiperController = new SwiperController();
+ @State progressData: PhotoData[] = [];
+ @State data: DataSource = new DataSource([]);
+ @State currentIndex: number = CommonConstants.INITIALLY_CURRENT_INDEX;
+ @State slideIndex: number = CommonConstants.SLIDE_INDEX;
+ @State duration: number = CommonConstants.DURATION;
+ @State swiperMaxHeight: number = CommonConstants.SWIPER_MAX_HEIGHT;
+ @State progressHeight: number = CommonConstants.PROGRESS_WRAP_HEIGHT;
+ @State slide: boolean = false;
+ @State foldStatus: number = 2;
+ @State isFoldable: boolean = false;
+ scroller: Scroller = new Scroller();
+
+ aboutToAppear(): void {
+ this.isFoldable = display.isFoldable();
+ let foldStatus: display.FoldStatus = display.getFoldStatus();
+ if (this.isFoldable) {
+ this.foldStatus = foldStatus;
+ let callback: Callback = () => {
+ let data: display.FoldStatus = display.getFoldStatus();
+ this.foldStatus = data;
+ }
+ display.on('change', callback);
+ }
+ let list: PhotoData[] = [];
+ for (let i = 1; i <= 7; i++) {
+ let newPhotoData = new PhotoData();
+ newPhotoData.id = i;
+ list.push(newPhotoData);
+ }
+ this.progressData = list;
+ this.data = new DataSource(list);
+ }
+
+ // DocsCode 2
+ // [Start progress_component]
+ @Builder
+ progressComponent() {
+ Row({ space: 5 }) {
+ ForEach(this.progressData, (item: PhotoData, index: number) => {
+ Stack({ alignContent: Alignment.Start }) {
+ Row()
+ .zIndex(1)
+ .width(this.currentIndex >= index && !this.slide ? '100%' : '0')
+ .height(2)
+ .borderRadius(2)
+ .backgroundColor(Color.White)
+ .animation(!this.slide ? {
+ duration: this.duration - 400,
+ curve: Curve.Linear,
+ iterations: 1,
+ playMode: PlayMode.Normal,
+ onFinish: () => {
+ if (this.currentIndex === this.progressData.length - 1) {
+ this.duration = 400;
+ this.currentIndex = -1;
+ }
+ }
+ } : { duration: 0, iterations: 1 })
+ }
+ .width('100%')
+ .height(2)
+ .borderRadius(2)
+ .backgroundColor(this.currentIndex >= index && this.slide ? Color.White : Color.Grey)
+ .layoutWeight(1)
+ }, (item: PhotoData) => JSON.stringify(item))
+ }
+ .width('100%')
+ .height(50)
+ }
+ // [End progress_component]
+ // DocsCode 2
+
+ build() {
+ Column() {
+ Row() {
+ Image($r('app.media.back'))
+ .width($r('app.float.image_width'))
+ .height($r('app.float.image_height'))
+ .margin({ top: $r('app.float.image_margin_top') })
+ }
+ .width(CommonConstants.FULL_PERCENT)
+ .height($r('app.float.row_image_height'))
+ .padding({ left: $r('app.float.padding_left'), right: $r('app.float.padding_right') })
+
+ Stack({ alignContent: Alignment.BottomStart }) {
+ Scroll() {
+ List() {
+ ListItem() {
+ // DocsCode 1
+ // [Start Index_swiper_part_one]
+ // [Start Index_swiper_part_two]
+ Swiper(this.swiperController) {
+ // [StartExclude Index_swiper_part_two]
+ LazyForEach(this.data, (item: PhotoData, index: number) => {
+ Image($r(`app.media.` + item.id))
+ .width(this.foldStatus === 2 ? '100%' : '70%')
+ .height('100%')
+ }, (item: PhotoData) => JSON.stringify(item))
+ // [EndExclude Index_swiper_part_two]
+ }
+ // [End Index_swiper_part_two]
+ .loop(!this.slide ? true : false)
+ .autoPlay(!this.slide ? true : false)
+ .interval(3000)
+ .indicator(false)
+ // [End Index_swiper_part_one]
+ // DocsCode 1
+ // [Start Index_swiper_part_two]
+ .onGestureSwipe((index: number, extraInfo: SwiperAnimationEvent) => {
+ // [End Index_swiper_part_two]
+ if (extraInfo.currentOffset > 0 && index === 0 && !this.slide) {
+ let context = this.getUIContext().getHostContext() as common.UIAbilityContext;
+ context.terminateSelf();
+ }
+ // [Start Index_swiper_part_two]
+ this.slide = true;
+ // [End Index_swiper_part_two]
+ if (extraInfo.currentOffset > 0 && this.currentIndex > 0) {
+ this.currentIndex = index - 1;
+ }
+ // [Start Index_swiper_part_two]
+ })
+ // [End Index_swiper_part_two]
+ .cachedCount(CommonConstants.SWIPER_CACHED_COUNT)
+ .index($$this.slideIndex)
+ .indicatorInteractive(false)
+ .duration(CommonConstants.IMAGE_DURATION)
+ .itemSpace(CommonConstants.ITEM_SPACE)
+ .displayArrow(false)
+ .curve(Curve.Linear)
+ .onChange((index: number) => {
+ this.duration = 3000;
+ this.currentIndex = index;
+ })
+ .onAppear(() => {
+ this.currentIndex = 0;
+ })
+ }
+ .width(CommonConstants.FULL_PERCENT)
+ .height(this.swiperMaxHeight)
+ }
+ .width(CommonConstants.FULL_PERCENT)
+ .height(CommonConstants.FULL_PERCENT)
+ .sticky(StickyStyle.Footer)
+ }
+ .layoutWeight(CommonConstants.LAYOUT_WEIGHT)
+
+ Column() {
+ Column({ space: CommonConstants.COLUMN_SPACE }) {
+ Image($r('app.media.avatar'))
+ .width($r('app.float.image_width'))
+ .height($r('app.float.image_height'))
+ .borderRadius($r('app.float.image_borderRadius'))
+ Column({ space: CommonConstants.COLUMN_SPACE_INSIDE }) {
+ Image($r("app.media.favor"))
+ .width($r('app.float.image_width_inside'))
+ .height($r('app.float.image_height_inside'))
+ Text($r('app.string.collection'))
+ .fontSize($r('app.float.text_font_size'))
+ .fontColor(Color.White)
+ }
+ .width($r('app.float.column_width'))
+ .height($r('app.float.column_height'))
+
+ Column({ space: CommonConstants.COLUMN_SPACE_INSIDE }) {
+ Image($r('app.media.comments'))
+ .width($r('app.float.image_width_inside'))
+ .height($r('app.float.image_height_inside'))
+ Text($r('app.string.Comments'))
+ .fontSize($r('app.float.text_font_size'))
+ .fontColor(Color.White)
+ }
+ .width($r('app.float.column_width'))
+ .height($r('app.float.column_height'))
+
+ Column({ space: CommonConstants.COLUMN_SPACE_INSIDE }) {
+ Image($r('app.media.share'))
+ .width($r('app.float.image_width_inside'))
+ .height($r('app.float.image_height_inside'))
+ Text($r('app.string.share'))
+ .fontSize($r('app.float.text_font_size'))
+ .fontColor(Color.White)
+ }
+ .width($r('app.float.column_width'))
+ .height($r('app.float.column_height'))
+
+ Image($r('app.media.recording'))
+ .width($r('app.float.image_width'))
+ .height($r('app.float.image_height'))
+ .borderRadius($r('app.float.image_borderRadius'))
+ }
+ .margin({ top: $r('app.float.column_image_margin_top') })
+ }
+ .width(CommonConstants.FULL_PERCENT)
+ .height(CommonConstants.FULL_PERCENT)
+ .alignItems(HorizontalAlign.End)
+ .justifyContent(FlexAlign.Center)
+ .padding({ left: $r('app.float.column_padding_left'), right: $r('app.float.column_padding_right') })
+ .hitTestBehavior(HitTestMode.Transparent)
+
+ Column() {
+ Column({ space: CommonConstants.COLUMN_SPACE_INSIDE }) {
+ Row() {
+ Text($r('app.string.cute_pet'))
+ .fontWeight(FontWeight.Bold)
+ .fontColor(Color.White)
+ Text($r('app.string.dots'))
+ .fontColor(Color.White)
+ .margin({ left: 6, right: 6 })
+ Text($r('app.string.date'))
+ .fontColor(Color.White)
+ }
+ .width(CommonConstants.FULL_PERCENT)
+ .justifyContent(FlexAlign.Start)
+ .margin({ top: $r('app.float.row_margin_top') })
+
+ Row() {
+ Text($r('app.string.pets'))
+ .fontWeight(FontWeight.Bold)
+ .fontColor(Color.White)
+ Text($r('app.string.dog'))
+ .fontColor(Color.White)
+ .margin({ left: $r('app.float.text_margin_left'), right: $r('app.float.text_margin_right') })
+ Text($r('app.string.spoiled'))
+ .fontColor(Color.White)
+ }
+ .width(CommonConstants.FULL_PERCENT)
+ .justifyContent(FlexAlign.Start)
+
+ this.progressComponent();
+ }
+
+ TextInput({ placeholder: $r('app.string.placeholder') })
+ .width(CommonConstants.FULL_PERCENT)
+ .backgroundColor($r('app.color.textInput_backgroundColor'))
+ .fontColor(Color.White)
+ .placeholderColor(Color.White)
+ .focusable(false)
+ }
+ .width(CommonConstants.FULL_PERCENT)
+ .height($r('app.float.description_column_height'))
+ .padding({
+ left: $r('app.float.padding_left'),
+ right: $r('app.float.padding_right'),
+ bottom: $r('app.float.padding_bottom')
+ })
+ .hitTestBehavior(HitTestMode.Transparent)
+ .justifyContent(FlexAlign.SpaceBetween)
+ }
+ .margin({ top: $r('app.float.stack_margin_top'), })
+ .height($r('app.float.stack_height'))
+ }
+ .backgroundColor(Color.Black)
+ .height(CommonConstants.FULL_PERCENT)
+ .width(CommonConstants.FULL_PERCENT)
+ }
+}
\ No newline at end of file
diff --git a/MultipleImage/entry/src/main/ets/util/DataSource.ets b/MultipleImage/entry/src/main/ets/util/DataSource.ets
new file mode 100644
index 0000000000000000000000000000000000000000..18b7523141a672f67c344e799086512bb48f0be3
--- /dev/null
+++ b/MultipleImage/entry/src/main/ets/util/DataSource.ets
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2024 Huawei Device 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.
+ */
+
+class DataSource implements IDataSource {
+ private list: Array = [];
+
+ constructor(list: Array) {
+ this.list = list;
+ }
+
+ totalCount(): number {
+ return this.list.length;
+ }
+
+ getData(index: number): PhotoData {
+ return this.list[index];
+ }
+
+ registerDataChangeListener(listener: DataChangeListener): void {
+ }
+
+ unregisterDataChangeListener(listener: DataChangeListener): void {
+ }
+}
+
+class PhotoData {
+ total: number = 7;
+ value: number = 0;
+ id: number = -1;
+}
+
+export { DataSource, PhotoData }
\ No newline at end of file
diff --git a/MultipleImage/entry/src/main/module.json5 b/MultipleImage/entry/src/main/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..ad219d733f6afa5ea07f85f580208b08cc3b9041
--- /dev/null
+++ b/MultipleImage/entry/src/main/module.json5
@@ -0,0 +1,50 @@
+{
+ "module": {
+ "name": "entry",
+ "type": "entry",
+ "description": "$string:module_desc",
+ "mainElement": "EntryAbility",
+ "deviceTypes": [
+ "phone"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false,
+ "pages": "$profile:main_pages",
+ "abilities": [
+ {
+ "name": "EntryAbility",
+ "srcEntry": "./ets/entryability/EntryAbility.ets",
+ "description": "$string:EntryAbility_desc",
+ "icon": "$media:layered_image",
+ "label": "$string:EntryAbility_label",
+ "startWindowIcon": "$media:startIcon",
+ "startWindowBackground": "$color:start_window_background",
+ "exported": true,
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ]
+ }
+ ],
+ "extensionAbilities": [
+ {
+ "name": "EntryBackupAbility",
+ "srcEntry": "./ets/entrybackupability/EntryBackupAbility.ets",
+ "type": "backup",
+ "exported": false,
+ "metadata": [
+ {
+ "name": "ohos.extension.backup",
+ "resource": "$profile:backup_config"
+ }
+ ],
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/MultipleImage/entry/src/main/resources/base/element/color.json b/MultipleImage/entry/src/main/resources/base/element/color.json
new file mode 100644
index 0000000000000000000000000000000000000000..6db519bef8d786bf5bea73d37a8fa2027fbfea64
--- /dev/null
+++ b/MultipleImage/entry/src/main/resources/base/element/color.json
@@ -0,0 +1,12 @@
+{
+ "color": [
+ {
+ "name": "start_window_background",
+ "value": "#FFFFFF"
+ },
+ {
+ "name": "textInput_backgroundColor",
+ "value": "#33FFFFFF"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/MultipleImage/entry/src/main/resources/base/element/float.json b/MultipleImage/entry/src/main/resources/base/element/float.json
new file mode 100644
index 0000000000000000000000000000000000000000..e5028a02854a71d191f708a31721e529f2d87b97
--- /dev/null
+++ b/MultipleImage/entry/src/main/resources/base/element/float.json
@@ -0,0 +1,96 @@
+{
+ "float": [
+ {
+ "name": "row_borderRadius",
+ "value": "2vp"
+ },
+ {
+ "name": "image_width",
+ "value": "40vp"
+ },
+ {
+ "name": "image_margin_top",
+ "value": "72vp"
+ },
+ {
+ "name": "image_height",
+ "value": "40vp"
+ },
+ {
+ "name": "image_borderRadius",
+ "value": "40vp"
+ },
+ {
+ "name": "image_width_inside",
+ "value": "29vp"
+ },
+ {
+ "name": "image_height_inside",
+ "value": "25vp"
+ },
+ {
+ "name": "column_image_margin_top",
+ "value": "80vp"
+ },
+ {
+ "name": "row_image_height",
+ "value": "56vp"
+ },
+ {
+ "name": "padding_left",
+ "value": "16vp"
+ },
+ {
+ "name": "column_padding_left",
+ "value": "12vp"
+ },
+ {
+ "name": "column_padding_right",
+ "value": "12vp"
+ },
+ {
+ "name": "padding_right",
+ "value": "16vp"
+ },
+ {
+ "name": "padding_bottom",
+ "value": "32vp"
+ },
+ {
+ "name": "text_font_size",
+ "value": "12vp"
+ },
+ {
+ "name": "column_width",
+ "value": "60vp"
+ },
+ {
+ "name": "column_height",
+ "value": "52vp"
+ },
+ {
+ "name": "text_margin_left",
+ "value": "6vp"
+ },
+ {
+ "name": "text_margin_right",
+ "value": "6vp"
+ },
+ {
+ "name": "row_margin_top",
+ "value": "24vp"
+ },
+ {
+ "name": "description_column_height",
+ "value": "200vp"
+ },
+ {
+ "name": "stack_height",
+ "value": "640vp"
+ },
+ {
+ "name": "stack_margin_top",
+ "value": "120vp"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/MultipleImage/entry/src/main/resources/base/element/string.json b/MultipleImage/entry/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..0d958bd80f746369c3ba51bc092b7e5cb24c188d
--- /dev/null
+++ b/MultipleImage/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,56 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "Multiple Images"
+ },
+ {
+ "name": "cute_pet",
+ "value": "@Cute Pet"
+ },
+ {
+ "name": "dots",
+ "value": "·"
+ },
+ {
+ "name": "date",
+ "value": "08-14"
+ },
+ {
+ "name": "pets",
+ "value": "#Pets"
+ },
+ {
+ "name": "dog",
+ "value": "#Dog"
+ },
+ {
+ "name": "spoiled",
+ "value": "#Spoiled"
+ },
+ {
+ "name": "placeholder",
+ "value": "Commentary"
+ },
+ {
+ "name": "collection",
+ "value": "12"
+ },
+ {
+ "name": "Comments",
+ "value": "Comments"
+ },
+ {
+ "name": "share",
+ "value": "5"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/MultipleImage/entry/src/main/resources/base/media/1.jpg b/MultipleImage/entry/src/main/resources/base/media/1.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..288336ad1a3047d23a1efb8a1f4197a0eb158f0f
Binary files /dev/null and b/MultipleImage/entry/src/main/resources/base/media/1.jpg differ
diff --git a/MultipleImage/entry/src/main/resources/base/media/2.jpg b/MultipleImage/entry/src/main/resources/base/media/2.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..dee92d99ec2b8094d62c505f044a2cae8acf08d7
Binary files /dev/null and b/MultipleImage/entry/src/main/resources/base/media/2.jpg differ
diff --git a/MultipleImage/entry/src/main/resources/base/media/3.jpg b/MultipleImage/entry/src/main/resources/base/media/3.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..d57f20d03d74e980878e44292e7d89132020e097
Binary files /dev/null and b/MultipleImage/entry/src/main/resources/base/media/3.jpg differ
diff --git a/MultipleImage/entry/src/main/resources/base/media/4.jpg b/MultipleImage/entry/src/main/resources/base/media/4.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..679228c56459fb4701894c558aaa567b822cdfe8
Binary files /dev/null and b/MultipleImage/entry/src/main/resources/base/media/4.jpg differ
diff --git a/MultipleImage/entry/src/main/resources/base/media/5.jpg b/MultipleImage/entry/src/main/resources/base/media/5.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..f6e47f8c6b51bafd7165394e263fc12026dda082
Binary files /dev/null and b/MultipleImage/entry/src/main/resources/base/media/5.jpg differ
diff --git a/MultipleImage/entry/src/main/resources/base/media/6.jpg b/MultipleImage/entry/src/main/resources/base/media/6.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..6497585c09712892c5b638937f6866f63932ca2b
Binary files /dev/null and b/MultipleImage/entry/src/main/resources/base/media/6.jpg differ
diff --git a/MultipleImage/entry/src/main/resources/base/media/7.jpg b/MultipleImage/entry/src/main/resources/base/media/7.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..6bd3b541382433a660ecf3c60120ff11ae824a88
Binary files /dev/null and b/MultipleImage/entry/src/main/resources/base/media/7.jpg differ
diff --git a/MultipleImage/entry/src/main/resources/base/media/avatar.svg b/MultipleImage/entry/src/main/resources/base/media/avatar.svg
new file mode 100644
index 0000000000000000000000000000000000000000..8d8aee10e5dcdf791ec3039a0da016e3f74390ab
--- /dev/null
+++ b/MultipleImage/entry/src/main/resources/base/media/avatar.svg
@@ -0,0 +1,13 @@
+
diff --git a/MultipleImage/entry/src/main/resources/base/media/back.png b/MultipleImage/entry/src/main/resources/base/media/back.png
new file mode 100644
index 0000000000000000000000000000000000000000..d781ec00721fe355c96204bedf517ff3062c5ef2
Binary files /dev/null and b/MultipleImage/entry/src/main/resources/base/media/back.png differ
diff --git a/MultipleImage/entry/src/main/resources/base/media/background.png b/MultipleImage/entry/src/main/resources/base/media/background.png
new file mode 100644
index 0000000000000000000000000000000000000000..f939c9fa8cc8914832e602198745f592a0dfa34d
Binary files /dev/null and b/MultipleImage/entry/src/main/resources/base/media/background.png differ
diff --git a/MultipleImage/entry/src/main/resources/base/media/comments.svg b/MultipleImage/entry/src/main/resources/base/media/comments.svg
new file mode 100644
index 0000000000000000000000000000000000000000..8541166dce4f5ea8f9b5f3ccf24fa5b2649ead71
--- /dev/null
+++ b/MultipleImage/entry/src/main/resources/base/media/comments.svg
@@ -0,0 +1,14 @@
+
diff --git a/MultipleImage/entry/src/main/resources/base/media/favor.svg b/MultipleImage/entry/src/main/resources/base/media/favor.svg
new file mode 100644
index 0000000000000000000000000000000000000000..d79b33902c6a45a8603b39c7dc5c486592e8d214
--- /dev/null
+++ b/MultipleImage/entry/src/main/resources/base/media/favor.svg
@@ -0,0 +1,14 @@
+
diff --git a/MultipleImage/entry/src/main/resources/base/media/foreground.png b/MultipleImage/entry/src/main/resources/base/media/foreground.png
new file mode 100644
index 0000000000000000000000000000000000000000..4483ddad1f079e1089d685bd204ee1cfe1d01902
Binary files /dev/null and b/MultipleImage/entry/src/main/resources/base/media/foreground.png differ
diff --git a/MultipleImage/entry/src/main/resources/base/media/layered_image.json b/MultipleImage/entry/src/main/resources/base/media/layered_image.json
new file mode 100644
index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a
--- /dev/null
+++ b/MultipleImage/entry/src/main/resources/base/media/layered_image.json
@@ -0,0 +1,7 @@
+{
+ "layered-image":
+ {
+ "background" : "$media:background",
+ "foreground" : "$media:foreground"
+ }
+}
\ No newline at end of file
diff --git a/MultipleImage/entry/src/main/resources/base/media/recording.svg b/MultipleImage/entry/src/main/resources/base/media/recording.svg
new file mode 100644
index 0000000000000000000000000000000000000000..1395e9529be0fe0b39f83a29b7338a92e10b8279
--- /dev/null
+++ b/MultipleImage/entry/src/main/resources/base/media/recording.svg
@@ -0,0 +1,15 @@
+
diff --git a/MultipleImage/entry/src/main/resources/base/media/share.svg b/MultipleImage/entry/src/main/resources/base/media/share.svg
new file mode 100644
index 0000000000000000000000000000000000000000..2cad06df681ccf667bf2a18ee979bcd87084a881
--- /dev/null
+++ b/MultipleImage/entry/src/main/resources/base/media/share.svg
@@ -0,0 +1,14 @@
+
diff --git a/MultipleImage/entry/src/main/resources/base/media/startIcon.png b/MultipleImage/entry/src/main/resources/base/media/startIcon.png
new file mode 100644
index 0000000000000000000000000000000000000000..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b
Binary files /dev/null and b/MultipleImage/entry/src/main/resources/base/media/startIcon.png differ
diff --git a/MultipleImage/entry/src/main/resources/base/profile/backup_config.json b/MultipleImage/entry/src/main/resources/base/profile/backup_config.json
new file mode 100644
index 0000000000000000000000000000000000000000..78f40ae7c494d71e2482278f359ec790ca73471a
--- /dev/null
+++ b/MultipleImage/entry/src/main/resources/base/profile/backup_config.json
@@ -0,0 +1,3 @@
+{
+ "allowToBackupRestore": true
+}
\ No newline at end of file
diff --git a/MultipleImage/entry/src/main/resources/base/profile/main_pages.json b/MultipleImage/entry/src/main/resources/base/profile/main_pages.json
new file mode 100644
index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce
--- /dev/null
+++ b/MultipleImage/entry/src/main/resources/base/profile/main_pages.json
@@ -0,0 +1,5 @@
+{
+ "src": [
+ "pages/Index"
+ ]
+}
diff --git a/MultipleImage/entry/src/main/resources/en_US/element/string.json b/MultipleImage/entry/src/main/resources/en_US/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..0d958bd80f746369c3ba51bc092b7e5cb24c188d
--- /dev/null
+++ b/MultipleImage/entry/src/main/resources/en_US/element/string.json
@@ -0,0 +1,56 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "Multiple Images"
+ },
+ {
+ "name": "cute_pet",
+ "value": "@Cute Pet"
+ },
+ {
+ "name": "dots",
+ "value": "·"
+ },
+ {
+ "name": "date",
+ "value": "08-14"
+ },
+ {
+ "name": "pets",
+ "value": "#Pets"
+ },
+ {
+ "name": "dog",
+ "value": "#Dog"
+ },
+ {
+ "name": "spoiled",
+ "value": "#Spoiled"
+ },
+ {
+ "name": "placeholder",
+ "value": "Commentary"
+ },
+ {
+ "name": "collection",
+ "value": "12"
+ },
+ {
+ "name": "Comments",
+ "value": "Comments"
+ },
+ {
+ "name": "share",
+ "value": "5"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/MultipleImage/entry/src/main/resources/zh_CN/element/string.json b/MultipleImage/entry/src/main/resources/zh_CN/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..20307eb0072b108e55f6f54317eb7f8df6e36da2
--- /dev/null
+++ b/MultipleImage/entry/src/main/resources/zh_CN/element/string.json
@@ -0,0 +1,56 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "多图片合集"
+ },
+ {
+ "name": "cute_pet",
+ "value": "@欢乐萌宠"
+ },
+ {
+ "name": "dots",
+ "value": "·"
+ },
+ {
+ "name": "date",
+ "value": "08-14"
+ },
+ {
+ "name": "pets",
+ "value": "#宠物"
+ },
+ {
+ "name": "dog",
+ "value": "#小狗"
+ },
+ {
+ "name": "spoiled",
+ "value": "#萌坏了"
+ },
+ {
+ "name": "placeholder",
+ "value": "评论"
+ },
+ {
+ "name": "collection",
+ "value": "12"
+ },
+ {
+ "name": "Comments",
+ "value": "评论"
+ },
+ {
+ "name": "share",
+ "value": "5"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/MultipleImage/hvigor/hvigor-config.json5 b/MultipleImage/hvigor/hvigor-config.json5
new file mode 100644
index 0000000000000000000000000000000000000000..06b2783670a348f95533b352c1ceda909a842bbc
--- /dev/null
+++ b/MultipleImage/hvigor/hvigor-config.json5
@@ -0,0 +1,22 @@
+{
+ "modelVersion": "5.0.0",
+ "dependencies": {
+ },
+ "execution": {
+ // "analyze": "normal", /* Define the build analyze mode. Value: [ "normal" | "advanced" | false ]. Default: "normal" */
+ // "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */
+ // "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */
+ // "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */
+ // "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */
+ },
+ "logging": {
+ // "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */
+ },
+ "debugging": {
+ // "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */
+ },
+ "nodeOptions": {
+ // "maxOldSpaceSize": 8192 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process. Default: 8192*/
+ // "exposeGC": true /* Enable to trigger garbage collection explicitly. Default: true*/
+ }
+}
diff --git a/MultipleImage/hvigorfile.ts b/MultipleImage/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..f3cb9f1a87a81687554a76283af8df27d8bda775
--- /dev/null
+++ b/MultipleImage/hvigorfile.ts
@@ -0,0 +1,6 @@
+import { appTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/MultipleImage/oh-package-lock.json5 b/MultipleImage/oh-package-lock.json5
new file mode 100644
index 0000000000000000000000000000000000000000..d3e54c94dcaeaa389813c16ca70e69f962cdefd8
--- /dev/null
+++ b/MultipleImage/oh-package-lock.json5
@@ -0,0 +1,27 @@
+{
+ "meta": {
+ "stableOrder": true
+ },
+ "lockfileVersion": 3,
+ "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
+ "specifiers": {
+ "@ohos/hamock@1.0.0": "@ohos/hamock@1.0.0",
+ "@ohos/hypium@1.0.18": "@ohos/hypium@1.0.18"
+ },
+ "packages": {
+ "@ohos/hamock@1.0.0": {
+ "name": "@ohos/hamock",
+ "version": "1.0.0",
+ "integrity": "sha512-K6lDPYc6VkKe6ZBNQa9aoG+ZZMiwqfcR/7yAVFSUGIuOAhPvCJAo9+t1fZnpe0dBRBPxj2bxPPbKh69VuyAtDg==",
+ "resolved": "https://repo.harmonyos.com/ohpm/@ohos/hamock/-/hamock-1.0.0.har",
+ "registryType": "ohpm"
+ },
+ "@ohos/hypium@1.0.18": {
+ "name": "@ohos/hypium",
+ "version": "1.0.18",
+ "integrity": "sha512-RGe/iLGdeywdQilMWZsHKUoiE9OJ+9QxQsorF92R2ImLNVHVhbpSePNITGpW7TnvLgOIP/jscOqfIOhk6X7XRQ==",
+ "resolved": "https://repo.harmonyos.com/ohpm/@ohos/hypium/-/hypium-1.0.18.har",
+ "registryType": "ohpm"
+ }
+ }
+}
\ No newline at end of file
diff --git a/MultipleImage/oh-package.json5 b/MultipleImage/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..62b1c6e70b72320b7005315f5efd9cc089d62ba2
--- /dev/null
+++ b/MultipleImage/oh-package.json5
@@ -0,0 +1,11 @@
+{
+ "modelVersion": "5.0.0",
+ "description": "Please describe the basic information.",
+ "dependencies": {
+ },
+ "devDependencies": {
+ "@ohos/hypium": "1.0.18"
+ ,
+ "@ohos/hamock": "1.0.0"
+ }
+}
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/CHANGELOG.md b/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/CHANGELOG.md
new file mode 100644
index 0000000000000000000000000000000000000000..22a35bda8a1fab36dd81c1c7ae86addcc1f111cc
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/CHANGELOG.md
@@ -0,0 +1,4 @@
+## 1.0.0
+- 修复once断言问题
+## 1.0.0-rc
+- 提供DevEco Studio预览器场景使能的MockSetup装饰器
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/LICENSE b/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..4947287f7b5ccb5d1e8b7b2d3aa5d89f322c160d
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/README.md b/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..c46981eb6b9163cb82723dd4c410b69b5e6a66cd
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/README.md
@@ -0,0 +1,82 @@
+# Hamock
+
+## 简介
+
+Hamock 是 OpenHarmony 上的模拟框架,提供预览场景的模拟功能。
+
+## 下载安装
+
+```bash
+ohpm install @ohos/hamock
+```
+
+OpenHarmony ohpm 环境配置等更多内容,请参考[如何安装 OpenHarmony ohpm 包](https://gitee.com/openharmony-tpc/docs/blob/master/OpenHarmony_har_usage.md)
+
+## 使用示例
+
+Hamock 提供了 @MockSetup 用于修饰 Mock 方法,仅支持声明式范式的组件。当开发者预览该组件时,预览运行时将在组件初始化时执行被 @MockSetup 修饰的方法。因此,开发者可以在这个被修饰的方法内重定义组件的方法或重赋值组件的属性,其将在预览时生效。
+
+> 说明:
+> @MockSetup 修饰的方法仅在预览场景会自动触发,并先于组件的 aboutToAppear 执行。
+
+### UI组件的方法
+
+在 ArkTS 页面代码中引入 Hamock。在目标组件中定义一个方法,并用 @MockSetup 修饰该方法。在这个方法中,使用 MockKit 模拟目标方法。
+
+```typescript
+import { MockKit, when, MockSetup } from '@ohos/hamock';
+
+@Entry
+@Component
+struct Index {
+ ...
+ @MockSetup
+ randomName() {
+ let mocker: MockKit = new MockKit();
+ let mockfunc: Object = mocker.mockFunc(this, this.method1);
+ // mock 指定的方法在指定入参的返回值
+ when(mockfunc)('test').afterReturn(1);
+ }
+ ...
+ // 业务场景调用方法
+ const result: number = this.method1('test'); // in previewer, result = 1
+}
+```
+
+### UI组件的属性
+
+在 ArkTS 页面代码中引入 Hamock。在目标组件中定义一个方法,并用 @MockSetup 修饰该方法。在这个方法中,对于需要 Mock 的属性,可以重新赋值。
+
+```typescript
+import { MockSetup } from '@ohos/hamock';
+
+@Component
+struct Person {
+ @Prop species: string;
+ ...
+ // 在 @MockSetup 片段中,定义对象属性
+ @MockSetup
+ randomName() {
+ this.species = 'primates';
+ }
+ ...
+ // 业务场景调用属性(如果从初始化到调用期间,该属性无变化)
+ const result: string = this.species; // in previewer, result = primates
+}
+```
+
+## 约束与限制
+
+在下述版本验证通过:
+
+DevEco Studio: 4.1 (4.1.3.400), SDK: API11 (4.1.0.36)
+
+MockSetup 仅在 API11 支持。
+
+## 贡献代码
+
+使用过程中发现任何问题都可以提[Issue](https://gitee.com/openharmony/testfwk_arkxtest/issues) 给我们,当然,我们也非常欢迎你给我们提[PR](https://gitee.com/openharmony/testfwk_arkxtest/pulls) 。
+
+## 开源协议
+
+本项目基于 [Apache License 2.0](https://gitee.com/openharmony/testfwk_arkxtest/blob/master/hamock/LICENSE) ,请自由地享受和参与开源。
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/build-profile.json5 b/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..12fe2d844bdb69584fd05ebaa3e1cb197a25c3f1
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/build-profile.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2023 Huawei Device 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.
+ */
+
+{
+ "apiType": "stageMode",
+ "buildOption": {
+ },
+ "targets": [
+ {
+ "name": "default"
+ }
+ ]
+}
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/hvigorfile.js b/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/hvigorfile.js
new file mode 100644
index 0000000000000000000000000000000000000000..d7bda561c9bf09b92a7fac485141cc8648907388
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/hvigorfile.js
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2023 Huawei Device 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.
+ */
+
+// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
+export { harTasks } from '@ohos/hvigor-ohos-plugin';
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/hvigorfile.ts b/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..960be7d7df0790853d6bdab1f52a3ec8c8e4a1ca
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/hvigorfile.ts
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2023 Huawei Device 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.
+ */
+
+// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
+export { harTasks } from '@ohos/hvigor-ohos-plugin';
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/index.d.ts b/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/index.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..6bc7929ba5718da0e459721be04e903ec59289c0
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/index.d.ts
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2023 Huawei Device 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.
+ */
+
+export class ArgumentMatchers {
+ static any;
+ static anyString;
+ static anyBoolean;
+ static anyNumber;
+ static anyObj;
+ static anyFunction;
+ static matchRegexs(Regex: RegExp): void
+}
+
+declare interface when {
+ afterReturn(value: any): any
+ afterReturnNothing(): undefined
+ afterAction(action: any): any
+ afterThrow(e_msg: string): string
+ (argMatchers?: any): when;
+}
+
+export const when: when;
+
+export interface VerificationMode {
+ times(count: Number): void
+ never(): void
+ once(): void
+ atLeast(count: Number): void
+ atMost(count: Number): void
+}
+
+export class MockKit {
+ constructor()
+ mockFunc(obj: Object, func: Function): Function
+ mockObject(obj: Object): Object
+ verify(methodName: String, argsArray: Array): VerificationMode
+ ignoreMock(obj: Object, func: Function): void
+ clear(obj: Object): void
+ clearAll(): void
+}
+
+export declare function MockSetup(
+ target: Object,
+ propertyName: string | Symbol,
+ descriptor: TypedPropertyDescriptor<() => void>
+): void;
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/index.ets b/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..c3a47320c2b674216cccde0fe217dbb8423625cc
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/index.ets
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2023 Huawei Device 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.
+ */
+
+export { MockSetup, MockKit, when } from './src/main/mock/MockKit';
+export { ArgumentMatchers } from './src/main/mock/ArgumentMatchers';
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/index.js b/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..1cb2b5e0256e00aa9276867f0753a89a7ac5e16f
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/index.js
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2021-2023 Huawei Device 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.
+ */
+export { MockSetup, MockKit, when } from './src/main/mock/MockKit.js';
+export { ArgumentMatchers } from './src/main/mock/ArgumentMatchers.js';
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/index.ts b/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/index.ts
new file mode 100644
index 0000000000000000000000000000000000000000..608eb4fe72aaf0f6cca0ccb3baad94e9b6101de0
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/index.ts
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2021-2023 Huawei Device 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.
+ */
+
+export { MockSetup, MockKit, when } from './src/main/mock/MockKit.js';
+export { ArgumentMatchers } from './src/main/mock/ArgumentMatchers.js';
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/oh-package.json5 b/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..0ef4eeed251a93463c2abf85b262c3e1fb6733bc
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/oh-package.json5
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2023 Huawei Device 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.
+ */
+
+{
+ name: '@ohos/hamock',
+ version: '1.0.0',
+ description: 'A mock framework for OpenHarmony application.',
+ main: 'index.ets',
+ author: 'huawei',
+ license: 'Apache-2.0',
+ dependencies: {},
+ ohos: {
+ org: 'ohos',
+ },
+ types: 'index.d.ts'
+}
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/ArgumentMatchers.js b/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/ArgumentMatchers.js
new file mode 100644
index 0000000000000000000000000000000000000000..f06bbca0b287aac612f42f9263c064c0157ae03a
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/ArgumentMatchers.js
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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.
+ */
+export class ArgumentMatchers {
+ constructor() {
+ this.ANY = "";
+ this.ANY_STRING = "";
+ this.ANY_BOOLEAN = "";
+ this.ANY_NUMBER = "";
+ this.ANY_OBJECT = "";
+ this.ANY_FUNCTION = "";
+ this.MATCH_REGEXS = "";
+ }
+ static any() {
+ }
+ static anyString() {
+ }
+ static anyBoolean() {
+ }
+ static anyNumber() {
+ }
+ static anyObj() {
+ }
+ static anyFunction() {
+ }
+ static matchRegexs(regex) {
+ if (ArgumentMatchers.isRegExp(regex)) {
+ return regex;
+ }
+ throw Error("not a regex");
+ }
+ static isRegExp(value) {
+ return Object.prototype.toString.call(value) === "[object RegExp]";
+ }
+ matcheReturnKey(...args) {
+ let arg = args[0];
+ let regex = args[1];
+ let stubSetKey = args[2];
+ if (stubSetKey && stubSetKey == this.ANY) {
+ return this.ANY;
+ }
+ if (typeof arg === "string" && !regex) {
+ return this.ANY_STRING;
+ }
+ if (typeof arg === "boolean" && !regex) {
+ return this.ANY_BOOLEAN;
+ }
+ if (typeof arg === "number" && !regex) {
+ return this.ANY_NUMBER;
+ }
+ if (typeof arg === "object" && !regex) {
+ return this.ANY_OBJECT;
+ }
+ if (typeof arg === "function" && !regex) {
+ return this.ANY_FUNCTION;
+ }
+ if (typeof arg === "string" && regex) {
+ return regex.test(arg);
+ }
+ return null;
+ }
+ matcheStubKey(key) {
+ if (key === ArgumentMatchers.any) {
+ return this.ANY;
+ }
+ if (key === ArgumentMatchers.anyString) {
+ return this.ANY_STRING;
+ }
+ if (key === ArgumentMatchers.anyBoolean) {
+ return this.ANY_BOOLEAN;
+ }
+ if (key === ArgumentMatchers.anyNumber) {
+ return this.ANY_NUMBER;
+ }
+ if (key === ArgumentMatchers.anyObj) {
+ return this.ANY_OBJECT;
+ }
+ if (key === ArgumentMatchers.anyFunction) {
+ return this.ANY_FUNCTION;
+ }
+ if (ArgumentMatchers.isRegExp(key)) {
+ return key;
+ }
+ return null;
+ }
+}
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/ArgumentMatchers.ts b/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/ArgumentMatchers.ts
new file mode 100644
index 0000000000000000000000000000000000000000..262bea1afbeb611029db0cfaeb65767b92f97b91
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/ArgumentMatchers.ts
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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.
+ */
+
+export class ArgumentMatchers {
+ ANY = "";
+ ANY_STRING = "";
+ ANY_BOOLEAN = "";
+ ANY_NUMBER = "";
+ ANY_OBJECT = "";
+ ANY_FUNCTION = "";
+ MATCH_REGEXS = "";
+
+ static any() {
+ }
+
+ static anyString() {
+ }
+
+ static anyBoolean() {
+ }
+
+ static anyNumber() {
+ }
+
+ static anyObj() {
+ }
+
+ static anyFunction() {
+ }
+
+ static matchRegexs(regex: any) {
+ if (ArgumentMatchers.isRegExp(regex)) {
+ return regex;
+ }
+ throw Error("not a regex");
+ }
+
+ static isRegExp(value: string) {
+ return Object.prototype.toString.call(value) === "[object RegExp]";
+ }
+
+ matcheReturnKey(...args: Array) {
+ let arg = args[0];
+ let regex = args[1];
+ let stubSetKey = args[2];
+
+ if (stubSetKey && stubSetKey == this.ANY) {
+ return this.ANY;
+ }
+
+ if (typeof arg === "string" && !regex) {
+ return this.ANY_STRING;
+ }
+
+ if (typeof arg === "boolean" && !regex) {
+ return this.ANY_BOOLEAN;
+ }
+
+ if (typeof arg === "number" && !regex) {
+ return this.ANY_NUMBER;
+ }
+
+ if (typeof arg === "object" && !regex) {
+ return this.ANY_OBJECT;
+ }
+
+ if (typeof arg === "function" && !regex) {
+ return this.ANY_FUNCTION;
+ }
+
+ if (typeof arg === "string" && regex) {
+ return regex.test(arg);
+ }
+
+ return null;
+ }
+
+ matcheStubKey(key: any) {
+
+ if (key === ArgumentMatchers.any) {
+ return this.ANY;
+ }
+
+ if (key === ArgumentMatchers.anyString) {
+ return this.ANY_STRING;
+ }
+ if (key === ArgumentMatchers.anyBoolean) {
+ return this.ANY_BOOLEAN;
+ }
+ if (key === ArgumentMatchers.anyNumber) {
+ return this.ANY_NUMBER;
+ }
+ if (key === ArgumentMatchers.anyObj) {
+ return this.ANY_OBJECT;
+ }
+ if (key === ArgumentMatchers.anyFunction) {
+ return this.ANY_FUNCTION;
+ }
+
+ if (ArgumentMatchers.isRegExp(key)) {
+ return key;
+ }
+
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/ExtendInterface.js b/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/ExtendInterface.js
new file mode 100644
index 0000000000000000000000000000000000000000..52f9dff07f7b719900ca47d56c3020586db31d5b
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/ExtendInterface.js
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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.
+ */
+class ExtendInterface {
+ constructor(mocker) {
+ this.mocker = mocker;
+ }
+ stub() {
+ this.params = arguments;
+ return this;
+ }
+ stubMockedCall(returnInfo) {
+ this.mocker.stubApply(this, this.params, returnInfo);
+ }
+ afterReturn(value) {
+ this.stubMockedCall(function () {
+ return value;
+ });
+ }
+ afterReturnNothing() {
+ this.stubMockedCall(function () {
+ return undefined;
+ });
+ }
+ afterAction(action) {
+ this.stubMockedCall(action);
+ }
+ afterThrow(msg) {
+ this.stubMockedCall(function () {
+ throw msg;
+ });
+ }
+ clear(obj) {
+ this.mocker.clear(obj);
+ }
+}
+export default ExtendInterface;
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/ExtendInterface.ts b/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/ExtendInterface.ts
new file mode 100644
index 0000000000000000000000000000000000000000..55f7a0b36bc2895e17a2e6b32a6c1980853cbce9
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/ExtendInterface.ts
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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 { MockKit } from "./MockKit.js";
+
+class ExtendInterface {
+
+ private mocker: MockKit
+ private params: any
+
+ constructor(mocker: MockKit) {
+ this.mocker = mocker;
+ }
+
+ stub() {
+ this.params = arguments;
+ return this;
+ }
+
+ stubMockedCall(returnInfo: any) {
+ this.mocker.stubApply(this, this.params, returnInfo);
+ }
+
+ afterReturn(value: any) {
+ this.stubMockedCall(function () {
+ return value;
+ });
+ }
+
+ afterReturnNothing() {
+ this.stubMockedCall(function () {
+ return undefined;
+ });
+ }
+
+ afterAction(action: Function) {
+ this.stubMockedCall(action);
+ }
+
+ afterThrow(msg: string) {
+ this.stubMockedCall(function () {
+ throw msg;
+ });
+ }
+
+ clear(obj?: any) {
+ this.mocker.clear(obj);
+ }
+}
+
+export default ExtendInterface;
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/MockKit.js b/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/MockKit.js
new file mode 100644
index 0000000000000000000000000000000000000000..c1ca51614abe9f9c149094f5186eeb750b00a074
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/MockKit.js
@@ -0,0 +1,253 @@
+/*
+ * Copyright (c) 2022-2023 Huawei Device 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 ExtendInterface from "./ExtendInterface.js";
+import VerificationMode from "./VerificationMode.js";
+import { ArgumentMatchers } from "./ArgumentMatchers.js";
+class MockKit {
+ constructor() {
+ this.mFunctions = [];
+ this.stubs = new Map();
+ this.recordCalls = new Map();
+ this.currentSetKey = new Map();
+ this.mockObj = null;
+ this.recordMockedMethod = new Map();
+ this.mFunctions = [];
+ this.stubs = new Map();
+ this.recordCalls = new Map();
+ this.currentSetKey = new Map();
+ this.mockObj = null;
+ this.recordMockedMethod = new Map();
+ }
+ init() {
+ this.reset();
+ }
+ reset() {
+ this.mFunctions = [];
+ this.stubs = new Map();
+ this.recordCalls = new Map();
+ this.currentSetKey = new Map();
+ this.mockObj = null;
+ this.recordMockedMethod = new Map();
+ }
+ clearAll() {
+ this.reset();
+ }
+ clear(obj) {
+ if (!obj) throw Error("Please enter an object to be cleaned");
+ if (typeof (obj) !== 'object' && typeof (obj) !== 'function') throw new Error('Not a object or static class');
+ this.recordMockedMethod.forEach(function (value, key, map) {
+ if (key) {
+ obj[key] = value;
+ }
+ });
+ }
+ ignoreMock(obj, method) {
+ if (typeof (obj) !== 'object' && typeof (obj) !== 'function') throw new Error('Not a object or static class');
+ if (typeof (method) !== 'function') throw new Error('Not a function');
+ let og = this.recordMockedMethod.get(method.propName);
+ if (og) {
+ obj[method.propName] = og;
+ this.recordMockedMethod.set(method.propName, undefined);
+ }
+ }
+ extend(dest, source) {
+ dest["stub"] = source["stub"];
+ dest["afterReturn"] = source["afterReturn"];
+ dest["afterReturnNothing"] = source["afterReturnNothing"];
+ dest["afterAction"] = source["afterAction"];
+ dest["afterThrow"] = source["afterThrow"];
+ dest["stubMockedCall"] = source["stubMockedCall"];
+ dest["clear"] = source["clear"];
+ return dest;
+ }
+ stubApply(f, params, returnInfo) {
+ let values = this.stubs.get(f);
+ if (!values) {
+ values = new Map();
+ }
+ let key = params[0];
+ if (typeof key === "undefined") {
+ key = "anonymous-mock-" + f.propName;
+ }
+ let matcher = new ArgumentMatchers();
+ if (matcher.matcheStubKey(key)) {
+ key = matcher.matcheStubKey(key);
+ if (key) {
+ this.currentSetKey.set(f, key);
+ }
+ }
+ values.set(key, returnInfo);
+ this.stubs.set(f, values);
+ }
+ getReturnInfo(f, params) {
+ let values = this.stubs.get(f);
+ if (!values) {
+ return undefined;
+ }
+ let retrunKet = params[0];
+ if (typeof retrunKet === "undefined") {
+ retrunKet = "anonymous-mock-" + f.propName;
+ }
+ let stubSetKey = this.currentSetKey.get(f);
+
+ if (stubSetKey && (typeof (retrunKet) !== "undefined")) {
+ retrunKet = stubSetKey;
+ }
+ let matcher = new ArgumentMatchers();
+ if (matcher.matcheReturnKey(params[0], undefined, stubSetKey) && matcher.matcheReturnKey(params[0], undefined, stubSetKey) !== stubSetKey) {
+ retrunKet = params[0];
+ }
+ values.forEach(function (value, key, map) {
+ if (ArgumentMatchers.isRegExp(key) && matcher.matcheReturnKey(params[0], key)) {
+ retrunKet = key;
+ }
+ });
+ return values.get(retrunKet);
+ }
+ findName(obj, value) {
+ let properties = this.findProperties(obj);
+ let name = '';
+ properties.filter((item) => (item !== 'caller' && item !== 'arguments')).forEach(function (va1, idx, array) {
+ if (obj[va1] === value) {
+ name = va1;
+ }
+ });
+ return name;
+ }
+ isFunctionFromPrototype(f, container, propName) {
+ if (container.constructor !== Object && container.constructor.prototype !== container) {
+ return container.constructor.prototype[propName] === f;
+ }
+ return false;
+ }
+ findProperties(obj, ...arg) {
+ function getProperty(new_obj) {
+ if (new_obj.__proto__ === null) {
+ return [];
+ }
+ let properties = Object.getOwnPropertyNames(new_obj);
+ return [...properties, ...getProperty(new_obj.__proto__)];
+ }
+ return getProperty(obj);
+ }
+ recordMethodCall(originalMethod, args) {
+ originalMethod['getName'] = function () {
+ return this.name || this.toString().match(/function\s*([^(]*)\(/)[1];
+ };
+ let name = originalMethod.getName();
+ let arglistString = name + '(' + Array.from(args).toString() + ')';
+ let records = this.recordCalls.get(arglistString);
+ if (!records) {
+ records = 0;
+ }
+ records++;
+ this.recordCalls.set(arglistString, records);
+ }
+ mockFunc(originalObject, originalMethod) {
+ let tmp = this;
+ this.originalMethod = originalMethod;
+ const _this = this;
+ let f = function () {
+ let args = arguments;
+ let action = tmp.getReturnInfo(f, args);
+ if (originalMethod) {
+ tmp.recordMethodCall(originalMethod, args);
+ }
+ if (action) {
+ return action.apply(_this, args);
+ }
+ };
+ f.container = null || originalObject;
+ f.original = originalMethod || null;
+ if (originalObject && originalMethod) {
+ if (typeof (originalMethod) != 'function')
+ throw new Error('Not a function');
+ var name = this.findName(originalObject, originalMethod);
+ originalObject[name] = f;
+ this.recordMockedMethod.set(name, originalMethod);
+ f.propName = name;
+ f.originalFromPrototype = this.isFunctionFromPrototype(f.original, originalObject, f.propName);
+ }
+ f.mocker = this;
+ this.mFunctions.push(f);
+ this.extend(f, new ExtendInterface(this));
+ return f;
+ }
+ verify(methodName, argsArray) {
+ if (!methodName) {
+ throw Error("not a function name");
+ }
+ let a = this.recordCalls.get(methodName + '(' + argsArray.toString() + ')');
+ return new VerificationMode(a ? a : 0);
+ }
+ mockObject(object) {
+ if (!object || typeof object === "string") {
+ throw Error(`this ${object} cannot be mocked`);
+ }
+ const _this = this;
+ let mockedObject = {};
+ let keys = Reflect.ownKeys(object);
+ keys.filter(key => (typeof Reflect.get(object, key)) === 'function')
+ .forEach((key) => {
+ mockedObject[key] = object[key];
+ mockedObject[key] = _this.mockFunc(mockedObject, mockedObject[key]);
+ });
+ return mockedObject;
+ }
+}
+function ifMockedFunction(f) {
+ if (Object.prototype.toString.call(f) != "[object Function]" &&
+ Object.prototype.toString.call(f) != "[object AsyncFunction]") {
+ throw Error("not a function");
+ }
+ if (!f.stub) {
+ throw Error("not a mock function");
+ }
+ return true;
+}
+function when(f) {
+ if (ifMockedFunction(f)) {
+ return f.stub.bind(f);
+ }
+}
+function MockSetup(target, propertyName, descriptor) {
+ const aboutToAppearOrigin = target.aboutToAppear;
+ const setup = descriptor.value;
+ target.aboutToAppear = function (...args) {
+ if (target.__Param) { // copy attributes and params of the original context
+ try {
+ const map = target.__Param;
+ for (const [key, val] of map) {
+ this[key] = val; // 'this' refers to context of current function
+ }
+ }
+ catch (e) {
+ throw new Error(`Mock setup param error: ${e}`);
+ }
+ }
+ if (setup) { // apply the mock content
+ try {
+ setup.apply(this);
+ }
+ catch (e) {
+ throw new Error(`Mock setup apply error: ${e}`);
+ }
+ }
+ if (aboutToAppearOrigin) { // append to aboutToAppear function of the original context
+ aboutToAppearOrigin.apply(this, args);
+ }
+ };
+}
+export { MockSetup, MockKit, when };
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/MockKit.ts b/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/MockKit.ts
new file mode 100644
index 0000000000000000000000000000000000000000..2807643e29d6da16ee7061ce5674b696a4fc3ca6
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/MockKit.ts
@@ -0,0 +1,294 @@
+/*
+ * Copyright (c) 2023 Huawei Device 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 ExtendInterface from "./ExtendInterface.js";
+import VerificationMode from "./VerificationMode.js";
+import { ArgumentMatchers } from "./ArgumentMatchers.js";
+
+interface IFunction extends Function {
+ container: any;
+ original: any;
+ propName: string;
+ originalFromPrototype: boolean
+ mocker: MockKit
+}
+
+class MockKit {
+
+ private mFunctions:Array = [];
+ private stubs = new Map();
+ private recordCalls = new Map();
+ private currentSetKey = new Map();
+ private mockObj = null;
+ private recordMockedMethod = new Map();
+ private originalMethod: any;
+
+ constructor() {
+ this.mFunctions = [];
+ this.stubs = new Map();
+ this.recordCalls = new Map();
+ this.currentSetKey = new Map();
+ this.mockObj = null;
+ this.recordMockedMethod = new Map();
+ }
+
+ init() {
+ this.reset();
+ }
+
+ reset() {
+ this.mFunctions = [];
+ this.stubs = new Map()
+ this.recordCalls = new Map();
+ this.currentSetKey = new Map();
+ this.mockObj = null;
+ this.recordMockedMethod = new Map();
+ }
+
+ clearAll() {
+ this.reset();
+ }
+
+ clear(obj: any) {
+ if (!obj) throw Error("Please enter an object to be cleaned");
+ if (typeof (obj) != 'object') throw new Error('Not a object');
+ this.recordMockedMethod.forEach(function (value, key, map) {
+ if (key) {
+ obj[key] = value;
+ }
+ });
+ }
+
+ ignoreMock(obj:any, method: any) {
+ if (typeof (obj) != 'object') throw new Error('Not a object');
+ if (typeof (method) != 'function') throw new Error('Not a function');
+ let og = this.recordMockedMethod.get(method.propName);
+ if (og) {
+ obj[method.propName] = og;
+ this.recordMockedMethod.set(method.propName, undefined);
+ }
+ }
+
+ extend(dest: any, source:any) {
+ dest["stub"] = source["stub"];
+ dest["afterReturn"] = source["afterReturn"];
+ dest["afterReturnNothing"] = source["afterReturnNothing"];
+ dest["afterAction"] = source["afterAction"];
+ dest["afterThrow"] = source["afterThrow"];
+ dest["stubMockedCall"] = source["stubMockedCall"];
+ dest["clear"] = source["clear"];
+ return dest;
+ }
+
+ stubApply(f: any, params:any, returnInfo:any) {
+ let values = this.stubs.get(f);
+ if (!values) {
+ values = new Map();
+ }
+ let key = params[0];
+ if (typeof key == "undefined") {
+ key = "anonymous-mock-" + f.propName;
+ }
+ let matcher = new ArgumentMatchers();
+ if (matcher.matcheStubKey(key)) {
+ key = matcher.matcheStubKey(key);
+ if (key) {
+ this.currentSetKey.set(f, key);
+ }
+ }
+ values.set(key, returnInfo);
+ this.stubs.set(f, values);
+ }
+
+ getReturnInfo(f: any, params:any) {
+ let values = this.stubs.get(f);
+ if (!values) {
+ return undefined;
+ }
+ let retrunKet = params[0];
+ if (typeof retrunKet == "undefined") {
+ retrunKet = "anonymous-mock-" + f.propName;
+ }
+ let stubSetKey = this.currentSetKey.get(f);
+
+ if (stubSetKey && (typeof (retrunKet) != "undefined")) {
+ retrunKet = stubSetKey;
+ }
+ let matcher = new ArgumentMatchers();
+ if (matcher.matcheReturnKey(params[0], undefined, stubSetKey) && matcher.matcheReturnKey(params[0], undefined, stubSetKey) != stubSetKey) {
+ retrunKet = params[0];
+ }
+
+ values.forEach(function (value: any, key: any, map: any) {
+ if (ArgumentMatchers.isRegExp(key) && matcher.matcheReturnKey(params[0], key)) {
+ retrunKet = key;
+ }
+ });
+
+ return values.get(retrunKet);
+ }
+
+ findName(obj: any, value: any) {
+ let properties = this.findProperties(obj);
+ let name = '';
+ properties.filter((item:any) => (item !== 'caller' && item !== 'arguments')).forEach(
+ function (va1:any, idx:any, array:any) {
+ if (obj[va1] === value) {
+ name = va1;
+ }
+ }
+ );
+ return name;
+ }
+
+ isFunctionFromPrototype(f: Function, container:Function, propName: string) {
+ if (container.constructor != Object && container.constructor.prototype !== container) {
+ return container.constructor.prototype[propName] === f;
+ }
+ return false;
+ }
+
+ findProperties(obj: any, ...arg: Array) {
+ function getProperty(new_obj:any): Array {
+ if (new_obj.__proto__ === null) {
+ return [];
+ }
+ let properties = Object.getOwnPropertyNames(new_obj);
+ return [...properties, ...getProperty(new_obj.__proto__)];
+ }
+ return getProperty(obj);
+ }
+
+ recordMethodCall(originalMethod: any, args: any) {
+ originalMethod['getName'] = function () {
+ return this.name || this.toString().match(/function\s*([^(]*)\(/)[1];
+ }
+ let name = originalMethod.getName();
+ let arglistString = name + '(' + Array.from(args).toString() + ')';
+ let records = this.recordCalls.get(arglistString);
+ if (!records) {
+ records = 0;
+ }
+ records++;
+ this.recordCalls.set(arglistString, records);
+ }
+
+ mockFunc(originalObject:any, originalMethod:any) {
+ let tmp = this;
+ this.originalMethod = originalMethod;
+ const _this = this;
+ let f:any = function () {
+ let args = arguments;
+ let action = tmp.getReturnInfo(f, args);
+ if (originalMethod) {
+ tmp.recordMethodCall(originalMethod, args);
+ }
+ if (action) {
+ return action.apply(_this, args);
+ }
+ };
+
+ f.container = null || originalObject;
+ f.original = originalMethod || null;
+
+ if (originalObject && originalMethod) {
+ if (typeof (originalMethod) != 'function') throw new Error('Not a function');
+ var name = this.findName(originalObject, originalMethod);
+ originalObject[name] = f;
+ this.recordMockedMethod.set(name, originalMethod);
+ f.propName = name;
+ f.originalFromPrototype = this.isFunctionFromPrototype(f.original, originalObject, f.propName);
+ }
+ f.mocker = this;
+ this.mFunctions.push(f);
+ this.extend(f, new ExtendInterface(this));
+ return f;
+ }
+
+ verify(methodName:any, argsArray:any) {
+ if (!methodName) {
+ throw Error("not a function name");
+ }
+ let a = this.recordCalls.get(methodName + '(' + argsArray.toString() + ')');
+ return new VerificationMode(a ? a : 0);
+ }
+
+ mockObject(object: any) {
+ if (!object || typeof object === "string") {
+ throw Error(`this ${object} cannot be mocked`);
+ }
+ const _this = this;
+ let mockedObject:any = {};
+ let keys = Reflect.ownKeys(object);
+ keys.filter(key => (typeof Reflect.get(object, key)) === 'function')
+ .forEach((key:any) => {
+ mockedObject[key] = object[key];
+ mockedObject[key] = _this.mockFunc(mockedObject, mockedObject[key]);
+ });
+ return mockedObject;
+ }
+}
+
+function ifMockedFunction(f: any) {
+ if (Object.prototype.toString.call(f) != "[object Function]" &&
+ Object.prototype.toString.call(f) != "[object AsyncFunction]") {
+ throw Error("not a function");
+ }
+ if (!f.stub) {
+ throw Error("not a mock function");
+ }
+ return true;
+}
+
+function when(f: any) {
+ if (ifMockedFunction(f)) {
+ return f.stub.bind(f);
+ }
+}
+
+function MockSetup(target: Object, propertyName: string | Symbol, descriptor: TypedPropertyDescriptor<() => void>): void {
+ const aboutToAppearOrigin = target.aboutToAppear;
+ const setup = descriptor.value;
+ target.aboutToAppear = function (...args: any[]) {
+ if (target.__Param) { // copy attributes and params of the original context
+ try {
+ const map = target.__Param as Map;
+ for (const [key, val] of map) {
+ this[key] = val; // 'this' refers to context of current function
+ }
+ } catch (e) {
+ throw new Error(`Mock setup param error: ${e}`);
+ }
+ }
+
+ if (setup) { // apply the mock content
+ try {
+ setup.apply(this);
+ } catch (e) {
+ throw new Error(`Mock setup apply error: ${e}`);
+ }
+ }
+
+ if (aboutToAppearOrigin) { // append to aboutToAppear function of the original context
+ aboutToAppearOrigin.apply(this, args);
+ }
+ }
+}
+
+export {
+ MockSetup,
+ MockKit,
+ when
+};
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/VerificationMode.js b/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/VerificationMode.js
new file mode 100644
index 0000000000000000000000000000000000000000..21e10fb8037f59475510b2821fcf7432c9459a4a
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/VerificationMode.js
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2022-2023 Huawei Device 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.
+ */
+class VerificationMode {
+ constructor(times) {
+ this.doTimes = times;
+ }
+ times(count) {
+ if (count !== this.doTimes) {
+ throw Error(`expect ${count} actual ${this.doTimes}`);
+ }
+ }
+ never() {
+ if (this.doTimes !== 0) {
+ throw Error(`expect 0 actual ${this.doTimes}`);
+ }
+ }
+ once() {
+ if (this.doTimes !== 1) {
+ throw Error(`expect 1 actual ${this.doTimes}`);
+ }
+ }
+ atLeast(count) {
+ if (count > this.doTimes) {
+ throw Error('failed ' + count + ' greater than the actual execution times of method');
+ }
+ }
+ atMost(count) {
+ if (count < this.doTimes) {
+ throw Error('failed ' + count + ' less than the actual execution times of method');
+ }
+ }
+}
+export default VerificationMode;
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/VerificationMode.ts b/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/VerificationMode.ts
new file mode 100644
index 0000000000000000000000000000000000000000..93d976ce73b2fbde199d31b3efd30eb3544179d8
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/mock/VerificationMode.ts
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2022-2023 Huawei Device 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.
+ */
+
+
+class VerificationMode {
+
+ private doTimes: number
+
+ constructor(times: number) {
+ this.doTimes = times;
+ }
+
+ times(count: number) {
+ if(count !== this.doTimes) {
+ throw Error(`expect ${count} actual ${this.doTimes}`);
+ }
+ }
+
+ never() {
+ if (this.doTimes !== 0) {
+ throw Error(`expect 0 actual ${this.doTimes}`);
+ }
+ }
+
+ once() {
+ if (this.doTimes !== 1) {
+ throw Error(`expect 1 actual ${this.doTimes}`);
+ }
+ }
+
+ atLeast(count: number) {
+ if (count > this.doTimes) {
+ throw Error('failed ' + count + ' greater than the actual execution times of method');
+ }
+ }
+
+ atMost(count: number) {
+ if (count < this.doTimes) {
+ throw Error('failed ' + count + ' less than the actual execution times of method');
+ }
+ }
+}
+
+export default VerificationMode;
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/module.json b/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/module.json
new file mode 100644
index 0000000000000000000000000000000000000000..384ae72f9bd2353fea8a5c9c5d6696ab5e67cb21
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/main/module.json
@@ -0,0 +1,22 @@
+{
+ "app": {
+ "bundleName": "com.example.hamock",
+ "debug": true,
+ "versionCode": 1000000,
+ "versionName": "1.0.0",
+ "minAPIVersion": 9,
+ "targetAPIVersion": 9,
+ "apiReleaseType": "Release"
+ },
+ "module": {
+ "name": "hamock",
+ "type": "har",
+ "deviceTypes": [
+ "default",
+ "tablet",
+ "tv",
+ "wearable",
+ "car"
+ ]
+ }
+}
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/res/schemas/mock-config-json5-schema.json b/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/res/schemas/mock-config-json5-schema.json
new file mode 100644
index 0000000000000000000000000000000000000000..96036325a316d827cb9fcb6908b3de23c53b4b79
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hamock@1.0.0/oh_modules/@ohos/hamock/src/res/schemas/mock-config-json5-schema.json
@@ -0,0 +1,25 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "title": "JSON schema for mock-config.json5 file",
+ "definitions": {
+ "sourceRedirection": {
+ "description": "A source redirection for mocked module.",
+ "type": "object",
+ "required": [
+ "source"
+ ],
+ "properties": {
+ "source": {
+ "type": "string",
+ "maxLength": 128,
+ "minLength": 1
+ }
+ }
+ }
+ },
+ "patternProperties": {
+ ".+": {
+ "$ref": "#/definitions/sourceRedirection"
+ }
+ }
+}
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/BuildProfile.ets b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/BuildProfile.ets
new file mode 100644
index 0000000000000000000000000000000000000000..e84ee338f70bbfe5512c648fc7cc88b019557243
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/BuildProfile.ets
@@ -0,0 +1,5 @@
+export default class BuildProfile {
+ static readonly HAR_VERSION = '1.0.18';
+ static readonly BUILD_MODE_NAME = 'debug';
+ static readonly DEBUG = true;
+}
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/CHANGELOG.md b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/CHANGELOG.md
new file mode 100644
index 0000000000000000000000000000000000000000..b7e0113af1ceafe3ba8abc35ecf69aa9746088be
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/CHANGELOG.md
@@ -0,0 +1,18 @@
+## 1.0.14
+- 堆栈信息打印到cmd
+## 1.0.15
+- 支持获取测试代码的失败堆栈信息
+- mock代码迁移至harmock包
+- 适配arkts语法
+- 修复覆盖率数据容易截断的bug
+## 1.0.16
+- 修改覆盖率文件生成功能
+- 修改静态方法无法ignoreMock函数
+- ## 1.0.17
+- 修改not断言失败提示日志
+- 自定义错误message信息
+- 添加xdescribe, xit API功能
+- ## 1.0.18
+- 添加全局变量存储API get set
+- 自定义断言功能
+
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/LICENSE b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..4947287f7b5ccb5d1e8b7b2d3aa5d89f322c160d
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/README.md b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..50cdf9dc5e11bba059f2147354273225bd3781b0
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/README.md
@@ -0,0 +1,220 @@
+
Hypium
+
A unit test framework for OpenHarmonyOS application
+
+## Hypium是什么?
+***
+- Hypium是OpenHarmony上的测试框架,提供测试用例编写、执行、结果显示能力,用于OpenHarmony系统应用接口以及应用界面测试。
+- Hypium结构化模型:hypium工程主要由List.test.js与TestCase.test.js组成。
+```
+rootProject // Hypium工程根目录
+├── moduleA
+│ ├── src
+│ ├── main // 被测试应用目录
+│ ├── ohosTest // 测试用例目录
+│ ├── js/ets
+│ └── test
+│ └── List.test.js // 测试用例加载脚本,ets目录下为.ets后缀
+│ └── TestCase.test.js // 测试用例脚本,ets目录下为.ets后缀
+└── moduleB
+ ...
+│ └── List.test.js // 测试用例加载脚本,ets目录下为.ets后缀
+│ └── TestCase.test.js // 测试用例脚本,ets目录下为.ets后缀
+```
+
+## 安装使用
+***
+- 在DevEco Studio内使用Hypium
+- 工程级package.json内配置:
+```json
+"dependencies": {
+ "@ohos/hypium": "1.0.18"
+}
+```
+注:
+hypium服务于OpenHarmonyOS应用对外接口测试、系统对外接口测试(SDK中接口),完成HAP自动化测试。详细指导:
+[Deveco Studio](https://developer.harmonyos.com/cn/develop/deveco-studio)
+
+#### 通用语法
+
+- 测试用例采用业内通用语法,describe代表一个测试套, it代表一条用例。
+
+| No. | API | 功能说明 |
+|-----| ---------- | ---------------------------------------------------------------------------------------------------------------------- |
+| 1 | describe | 定义一个测试套,支持两个参数:测试套名称和测试套函数 |
+| 2 | beforeAll | 在测试套内定义一个预置条件,在所有测试用例开始前执行且仅执行一次,支持一个参数:预置动作函数 |
+| 3 | beforeEach | 在测试套内定义一个单元预置条件,在每条测试用例开始前执行,执行次数与it定义的测试用例数一致,支持一个参数:预置动作函数 |
+| 4 | afterEach | 在测试套内定义一个单元清理条件,在每条测试用例结束后执行,执行次数与it定义的测试用例数一致,支持一个参数:清理动作函数 |
+| 5 | afterAll | 在测试套内定义一个清理条件,在所有测试用例结束后执行且仅执行一次,支持一个参数:清理动作函数 |
+| 6 | it | 定义一条测试用例,支持三个参数:用例名称,过滤参数和用例函数 |
+| 7 | expect | 支持bool类型判断等多种断言方法 |
+| 8 | xdescribe | @since1.0.17定义一个跳过的测试套,支持两个参数:测试套名称和测试套函数。 |
+| 9 | xit | @since1.0.17定义一条跳过的测试用例,支持三个参数:用例名称,过滤参数和用例函数。 |
+#### 断言库
+
+- 示例代码:
+
+```javascript
+ expect(${actualvalue}).assertX(${expectvalue})
+```
+
+- 断言功能列表:
+
+| No. | API | 功能说明 |
+| :--- | :------------------------------- | ---------------------------------------------------------------------------------------------- |
+| 1 | assertClose | 检验actualvalue和expectvalue(0)的接近程度是否是expectValue(1) |
+| 2 | assertContain | 检验actualvalue中是否包含expectvalue |
+| 3 | assertDeepEquals | @since1.0.4 检验actualvalue和expectvalue(0)是否是同一个对象 |
+| 4 | assertEqual | 检验actualvalue是否等于expectvalue[0] |
+| 5 | assertFail | 抛出一个错误 |
+| 6 | assertFalse | 检验actualvalue是否是false |
+| 7 | assertTrue | 检验actualvalue是否是true |
+| 8 | assertInstanceOf | 检验actualvalue是否是expectvalue类型 |
+| 9 | assertLarger | 检验actualvalue是否大于expectvalue |
+| 10 | assertLess | 检验actualvalue是否小于expectvalue |
+| 11 | assertNaN | @since1.0.4 检验actualvalue是否是NaN |
+| 12 | assertNegUnlimited | @since1.0.4 检验actualvalue是否等于Number.NEGATIVE_INFINITY |
+| 13 | assertNull | 检验actualvalue是否是null |
+| 14 | assertPosUnlimited | @since1.0.4 检验actualvalue是否等于Number.POSITIVE_INFINITY |
+| 15 | assertPromiseIsPending | @since1.0.4 检验actualvalue是否处于Pending状态【actualvalue为promse对象】 |
+| 16 | assertPromiseIsRejected | @since1.0.4 检验actualvalue是否处于Rejected状态【同15】 |
+| 17 | assertPromiseIsRejectedWith | @since1.0.4 检验actualvalue是否处于Rejected状态,并且比较执行的结果值【同15】 |
+| 18 | assertPromiseIsRejectedWithError | @since1.0.4 检验actualvalue是否处于Rejected状态并有异常,同时比较异常的类型和message值【同15】 |
+| 19 | assertPromiseIsResolved | @since1.0.4 检验actualvalue是否处于Resolved状态【同15】 |
+| 20 | assertPromiseIsResolvedWith | @since1.0.4 检验actualvalue是否处于Resolved状态,并且比较执行的结果值【同15】 |
+| 21 | assertThrowError | 检验actualvalue抛出Error内容是否是expectValue |
+| 22 | assertUndefined | 检验actualvalue是否是undefined |
+| 23 | not | @since1.0.4 断言结果取反 |
+| 24 | message | @since1.0.17自定义断言异常信息 |
+
+示例代码:
+
+```javascript
+ import { describe, it, expect } from '@ohos/hypium';
+
+ export default async function assertCloseTest() {
+ describe('assertClose', function () {
+ it('assertClose_success', 0, function () {
+ let a = 100;
+ let b = 0.1;
+ expect(a).assertClose(99, b);
+ })
+ })
+ }
+```
+
+#### 公共系统能力
+
+| No. | API | 功能描述 |
+| ---- | ------------------------------------------------------- | ------------------------------------------------------------ |
+| 1 | existKeyword(keyword: string, timeout: number): boolean | @since1.0.3 hilog日志中查找指定字段是否存在,keyword是待查找关键字,timeout为设置的查找时间 |
+| 2 | actionStart(tag: string): void | @since1.0.3 cmd窗口输出开始tag |
+| 3 | actionEnd(tag: string): void | @since1.0.3 cmd窗口输出结束tag |
+
+示例代码:
+
+```javascript
+import { describe, it, expect, SysTestKit} from '@ohos/hypium';
+
+export default function existKeywordTest() {
+ describe('existKeywordTest', function () {
+ it('existKeyword',DEFAULT, async function () {
+ console.info("HelloTest");
+ let isExist = await SysTestKit.existKeyword('HelloTest');
+ console.info('isExist ------>' + isExist);
+ })
+ })
+}
+```
+```javascript
+import { describe, it, expect, SysTestKit} from '@ohos/hypium';
+
+export default function actionTest() {
+ describe('actionTest', function () {
+ it('existKeyword',DEFAULT, async function () {
+ let tag = '[MyTest]';
+ SysTestKit.actionStart(tag);
+ //do something
+ SysTestKit.actionEnd(tag);
+ })
+ })
+}
+```
+
+#### 专项能力
+
+- 测试用例属性筛选能力:hypium支持根据用例属性筛选执行指定测试用例,使用方式是先在测试用例上标记用例属性后,再在测试应用的启动shell命令后新增" -s ${Key} ${Value}"。
+
+| Key | 含义说明 | Value取值范围 |
+| -------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
+| level | 用例级别 | "0","1","2","3","4", 例如:-s level 1 |
+| size | 用例粒度 | "small","medium","large", 例如:-s size small |
+| testType | 用例测试类型 | "function","performance","power","reliability","security","global","compatibility","user","standard","safety","resilience", 例如:-s testType function |
+
+示例代码
+
+```javascript
+import { describe, it, expect, TestType, Size, Level } from '@ohos/hypium';
+
+export default function attributeTest() {
+ describe('attributeTest', function () {
+ it("testAttributeIt", TestType.FUNCTION | Size.SMALLTEST | Level.LEVEL0, function () {
+ console.info('Hello Test');
+ })
+ })
+}
+```
+
+示例命令
+```shell
+XX -s level 1 -s size small -s testType function
+```
+该命令的作用是:筛选测试应用中同时满足a)用例级别是1 b)用例粒度是small c)用例测试类型是function 三个条件的用例执行。
+
+- 测试套/测试用例名称筛选能力(测试套与用例名称用“#”号连接,多个用“,”英文逗号分隔)
+
+| Key | 含义说明 | Value取值范围 |
+| -------- | ----------------------- | -------------------------------------------------------------------------------------------- |
+| class | 指定要执行的测试套&用例 | ${describeName}#${itName},${describeName} , 例如:-s class attributeTest#testAttributeIt |
+| notClass | 指定不执行的测试套&用例 | ${describeName}#${itName},${describeName} , 例如:-s notClass attributeTest#testAttributeIt |
+
+示例命令
+```shell
+XX -s class attributeTest#testAttributeIt,abilityTest#testAbilityIt
+```
+该命令的作用是:筛选测试应用中attributeTest测试套下的testAttributeIt测试用例,abilityTest测试套下的testAbilityIt测试用例,只执行这两条用例。
+
+- 其他能力
+
+| 能力项 | Key | 含义说明 | Value取值范围 |
+| ------------ | ------- | ---------------------------- | ---------------------------------------------- |
+| 随机执行能力 | random | 测试套&测试用例随机执行 | true, 不传参默认为false, 例如:-s random true |
+| 空跑能力 | dryRun | 显示要执行的测试用例信息全集 | true , 不传参默认为false,例如:-s dryRun true |
+| 异步超时能力 | timeout | 异步用例执行的超时时间 | 正整数 , 单位ms,例如:-s timeout 5000 |
+
+##### 约束限制
+随机执行能力和空跑能力从npm包1.0.3版本开始支持
+
+#### Mock能力
+
+##### 约束限制
+
+单元测试框架Mock能力从npm包[1.0.1版本](https://repo.harmonyos.com/#/cn/application/atomService/@ohos%2Fhypium/v/1.0.1)开始支持
+
+## 约束
+
+***
+ 本模块首批接口从OpenHarmony SDK API version 8开始支持。
+
+## Hypium开放能力隐私声明
+
+- 我们如何收集和使用您的个人信息
+ 您在使用集成了Hypium开放能力的测试应用时,Hypium不会处理您的个人信息。
+- SDK处理的个人信息
+ 不涉及。
+- SDK集成第三方服务声明
+ 不涉及。
+- SDK数据安全保护
+ 不涉及。
+- SDK版本更新声明
+ 为了向您提供最新的服务,我们会不时更新Hypium版本。我们强烈建议开发者集成使用最新版本的Hypium。
+
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/build-profile.json5 b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..312d38eb08629793b3484c7373213f22840c8d82
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/build-profile.json5
@@ -0,0 +1,28 @@
+{
+ "apiType": "stageMode",
+ "buildOption": {
+ },
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": true,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ },
+ "consumerFiles": [
+ "./consumer-rules.txt"
+ ]
+ }
+ },
+ },
+ ],
+ "targets": [
+ {
+ "name": "default"
+ }
+ ]
+}
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/hvigorfile.ts b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..42187071482d292588ad40babeda74f7b8d97a23
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/hvigorfile.ts
@@ -0,0 +1,6 @@
+import { harTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/index.d.ts b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/index.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..54fc0420f7b872b8ffd6f9e6c3623e32be6ff606
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/index.d.ts
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2021-2024 Huawei Device 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.
+ */
+
+export const DEFAULT = 0B0000
+
+export const when: when;
+
+export enum TestType {
+ FUNCTION = 0B1,
+ PERFORMANCE = 0B1 << 1,
+ POWER = 0B1 << 2,
+ RELIABILITY = 0B1 << 3,
+ SECURITY = 0B1 << 4,
+ GLOBAL = 0B1 << 5,
+ COMPATIBILITY = 0B1 << 6,
+ USER = 0B1 << 7,
+ STANDARD = 0B1 << 8,
+ SAFETY = 0B1 << 9,
+ RESILIENCE = 0B1 << 10
+}
+
+export enum Size {
+ SMALLTEST = 0B1 << 16,
+ MEDIUMTEST = 0B1 << 17,
+ LARGETEST = 0B1 << 18
+}
+
+export enum Level {
+ LEVEL0 = 0B1 << 24,
+ LEVEL1 = 0B1 << 25,
+ LEVEL2 = 0B1 << 26,
+ LEVEL3 = 0B1 << 27,
+ LEVEL4 = 0B1 << 28
+}
+export { xdescribe, xit, describe, it } from './index';
+
+
+
+export function beforeItSpecified(testCaseNames: Array | string, callback: Function): void
+
+export function afterItSpecified(testCaseNames: Array | string, callback: Function): void
+
+export function beforeEach(callback: Function): void
+
+export function afterEach(callback: Function): void
+
+export function beforeAll(callback: Function): void
+
+export function afterAll(callback: Function): void
+
+
+export interface Assert {
+ assertClose(expectValue: number, precision: number): void
+ assertContain(expectValue: any): void
+ assertEqual(expectValue: any): void
+ assertFail(): void
+ assertFalse(): void
+ assertTrue(): void
+ assertInstanceOf(expectValue: string): void
+ assertLarger(expectValue: number): void
+ assertLess(expectValue: number): void
+ assertNull(): void
+ assertThrowError(expectValue: string): void
+ assertUndefined(): void
+ assertLargerOrEqual(expectValue: number): void
+ assertLessOrEqual(expectValue: number): void
+ assertNaN(): void
+ assertNegUnlimited(): void
+ assertPosUnlimited(): void
+ not(): Assert;
+ assertDeepEquals(expectValue: any): void
+ assertPromiseIsPending(): void
+ assertPromiseIsRejected(): void
+ assertPromiseIsRejectedWith(expectValue?: any): void
+ assertPromiseIsRejectedWithError(...expectValue): void
+ assertPromiseIsResolved(): void
+ assertPromiseIsResolvedWith(expectValue?: any): void
+ message(msg: string): Assert
+}
+
+export function expect(actualValue?: any): Assert
+
+export class ArgumentMatchers {
+ static any;
+ static anyString;
+ static anyBoolean;
+ static anyNumber;
+ static anyObj;
+ static anyFunction;
+ static matchRegexs(Regex: RegExp): void
+}
+
+declare interface when {
+ afterReturn(value: any): any
+ afterReturnNothing(): undefined
+ afterAction(action: any): any
+ afterThrow(e_msg: string): string
+ (argMatchers?: any): when;
+}
+
+export interface VerificationMode {
+ times(count: Number): void
+ never(): void
+ once(): void
+ atLeast(count: Number): void
+ atMost(count: Number): void
+}
+
+export class MockKit {
+ constructor()
+ mockFunc(obj: Object, func: Function): Function
+ mockObject(obj: Object): Object
+ verify(methodName: String, argsArray: Array): VerificationMode
+ ignoreMock(obj: Object, func: Function): void
+ clear(obj: Object): void
+ clearAll(): void
+}
+
+export class SysTestKit {
+ static getDescribeName(): string;
+ static getItName(): string;
+ static getItAttribute(): TestType | Size | Level
+ static actionStart(tag: string): void
+ static actionEnd(tag: string): void
+ static existKeyword(keyword: string, timeout?: number): boolean
+}
+
+export class Hypium {
+ static setData(data: { [key: string]: any }): void
+ static setTimeConfig(systemTime: any)
+ static hypiumTest(abilityDelegator: any, abilityDelegatorArguments: any, testsuite: Function): void
+ static set(key: string, value: any): void
+ static get(key: string): any
+ static registerAssert(customAssertion: Function): void
+ static unregisterAssert(customAssertion: string | Function): void
+}
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/index.ets b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..1a9b707e35e58e5819594321bac6e36997a90713
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/index.ets
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2021-2024 Huawei Device 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 Core from './src/main/core';
+import {TestType, Size, Level, DEFAULT} from './src/main/Constant';
+import DataDriver from './src/main/module/config/DataDriver';
+import ExpectExtend from './src/main/module/assert/ExpectExtend';
+import OhReport from './src/main/module/report/OhReport';
+export { xdescribe, xit, describe, it } from './index.ts';
+
+export declare class Hypium {
+ static setData(data: Object): void
+ static setTimeConfig(systemTime: Object): void
+ static hypiumTest(abilityDelegator: Object, abilityDelegatorArguments: Object, testsuite: Function): void
+ static set(key: string, value: Object): void
+ static get(key: string): Object
+ static registerAssert(customAssertion: Function): void
+ static unregisterAssert(customAssertion: string | Function): void
+}
+
+export {
+ Core,
+ DataDriver,
+ ExpectExtend,
+ OhReport,
+ TestType,
+ Size,
+ Level,
+ DEFAULT
+};
+
+type allExpectType = Object | undefined | null
+
+export declare function beforeItSpecified(testCaseNames: Array | string, callback: Function): void
+
+export declare function afterItSpecified(testCaseNames: Array | string, callback: Function): void
+
+export declare function beforeEach(callback: Function): void
+
+export declare function afterEach(callback: Function): void
+
+export declare function beforeAll(callback: Function): void
+
+export declare function afterAll(callback: Function): void
+
+export declare interface Assert {
+ assertClose(expectValue: number, precision: number): void
+ assertContain(expectValue: allExpectType): void
+ assertEqual(expectValue: allExpectType): void
+ assertFail(): void
+ assertFalse(): void
+ assertTrue(): void
+ assertInstanceOf(expectValue: string): void
+ assertLarger(expectValue: number): void
+ assertLess(expectValue: number): void
+ assertNull(): void
+ assertThrowError(expectValue: string): void
+ assertUndefined(): void
+ assertLargerOrEqual(expectValue: number):void
+ assertLessOrEqual(expectValue: number):void
+ assertNaN():void
+ assertNegUnlimited(): void
+ assertPosUnlimited(): void
+ not(): Assert;
+ assertDeepEquals(expectValue: allExpectType):void
+ assertPromiseIsPending(): void
+ assertPromiseIsRejected(): void
+ assertPromiseIsRejectedWith(expectValue?: allExpectType): void
+ assertPromiseIsRejectedWithError(...expectValue: allExpectType[]): void
+ assertPromiseIsResolved(): void
+ assertPromiseIsResolvedWith(expectValue?: allExpectType): void
+ message(msg: string): Assert
+}
+
+export declare function expect(actualValue?: allExpectType): Assert
+
+export declare class ArgumentMatchers {
+ static any: allExpectType;
+ static anyString: string;
+ static anyBoolean: Boolean;
+ static anyNumber: Number;
+ static anyObj: Object;
+ static anyFunction: Function;
+ static matchRegexs(Regex: RegExp): void
+}
+
+declare interface whenResult {
+ afterReturn: (value: allExpectType) => allExpectType
+ afterReturnNothing: () => undefined
+ afterAction: (action: allExpectType) => allExpectType
+ afterThrow: (e_msg: string) => string
+}
+
+export declare function when(f:Function): (f?: allExpectType | void) => whenResult
+
+export declare interface VerificationMode {
+ times(count: Number): void
+ never(): void
+ once(): void
+ atLeast(count: Number): void
+ atMost(count: Number): void
+}
+
+export declare class MockKit {
+ constructor()
+ mockFunc(obj: Object, func: Function): Function
+ mockObject(obj: Object): Object
+ verify(methodName: String, argsArray: Array): VerificationMode
+ ignoreMock(obj: Object, func: Function): void
+ clear(obj: Object): void
+ clearAll(): void
+}
+
+export declare class SysTestKit {
+ static actionStart(tag: string): void
+ static actionEnd(tag: string): void
+ static existKeyword(keyword: string, timeout?: number): boolean
+}
+
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/index.js b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..320cff5bd99bfe6c13665e558f0845b98b2c8619
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/index.js
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2021-2024 Huawei Device 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 Core from './src/main/core';
+import { DEFAULT, TestType, Size, Level, TAG } from './src/main/Constant';
+import DataDriver from './src/main/module/config/DataDriver';
+import ExpectExtend from './src/main/module/assert/ExpectExtend';
+import OhReport from './src/main/module/report/OhReport';
+import SysTestKit from './src/main/module/kit/SysTestKit';
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, beforeItSpecified, afterItSpecified, xdescribe, xit } from './src/main/interface';
+import { MockKit, when } from './src/main/module/mock/MockKit';
+import ArgumentMatchers from './src/main/module/mock/ArgumentMatchers';
+
+class Hypium {
+ static context = new Map();
+ static setData(data) {
+ const core = Core.getInstance();
+ const dataDriver = new DataDriver({ data });
+ core.addService('dataDriver', dataDriver);
+ }
+
+ static setTimeConfig(systemTime) {
+ SysTestKit.systemTime = systemTime;
+ }
+
+ static set(key, value) {
+ Hypium.context.set(key, value);
+ }
+
+ static get(key) {
+ return Hypium.context.get(key);
+ }
+
+ static hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) {
+ const core = Core.getInstance();
+ const expectExtend = new ExpectExtend({
+ 'id': 'extend'
+ });
+ core.addService('expect', expectExtend);
+ const ohReport = new OhReport({
+ 'delegator': abilityDelegator,
+ 'abilityDelegatorArguments': abilityDelegatorArguments
+ });
+ SysTestKit.delegator = abilityDelegator;
+ core.addService('report', ohReport);
+ core.init();
+ core.subscribeEvent('spec', ohReport);
+ core.subscribeEvent('suite', ohReport);
+ core.subscribeEvent('task', ohReport);
+ const configService = core.getDefaultService('config');
+ if (abilityDelegatorArguments !== null) {
+ let testParameters = configService.translateParams(abilityDelegatorArguments.parameters);
+ console.info(`${TAG}parameters:${JSON.stringify(testParameters)}`);
+ configService.setConfig(testParameters);
+ }
+ testsuite();
+ core.execute(abilityDelegator);
+ }
+
+ static registerAssert(customAssertion) {
+ const core = Core.getInstance();
+ const expectService = core.getDefaultService('expect');
+ let matchers = {};
+ matchers[customAssertion.name] = customAssertion;
+ expectService.addMatchers(matchers);
+ expectService.customMatchers.push(customAssertion.name);
+ console.log(`${TAG}success to register the ${customAssertion.name}`);
+ }
+
+ static unregisterAssert(customAssertion) {
+ const core = Core.getInstance();
+ const expectService = core.getDefaultService('expect');
+ let customAssertionName = typeof customAssertion === 'function' ? customAssertion.name : customAssertion;
+ expectService.removeMatchers(customAssertionName);
+ console.log(`${TAG}success to unregister the ${customAssertionName}`);
+ }
+
+}
+
+export {
+ Hypium,
+ Core,
+ DEFAULT,
+ TestType,
+ Size,
+ Level,
+ DataDriver,
+ ExpectExtend,
+ OhReport,
+ SysTestKit,
+ describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, beforeItSpecified, afterItSpecified, xdescribe, xit,
+ MockKit, when,
+ ArgumentMatchers
+};
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/index.ts b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/index.ts
new file mode 100644
index 0000000000000000000000000000000000000000..b7082ebc98214b58d41e8681791809f1aee48f12
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/index.ts
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2024 Huawei Device 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 { TestType, Size, Level } from "./src/main/Constant";
+
+export declare function xdescribe(testSuiteName: string, func: Function): void;
+
+export declare namespace xdescribe {
+ function reason(reason: string): any;
+};
+
+export declare function describe(testSuiteName: string, func: Function): void;
+
+export declare function xit(testCaseName: string, attribute: TestType | Size | Level, func: Function): void;
+
+export declare namespace xit {
+ function reason(reason: string): any;
+};
+
+export declare function it(testCaseName: string, attribute: TestType | Size | Level, func: Function): void;
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/oh-package.json5 b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..9cd9da2c41f9f31a6c14b8fe792c87bcf4183554
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/oh-package.json5
@@ -0,0 +1 @@
+{"name":"@ohos/hypium","version":"1.0.18","description":"A unit test framework for OpenHarmony application","main":"index.js","keywords":["测试框架","except","mock"],"author":"huawei","license":"Apache-2.0","repository":"https://gitee.com/openharmony/testfwk_arkxtest","homepage":"https://gitee.com/openharmony/testfwk_arkxtest","dependencies":{}}
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/Constant.js b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/Constant.js
new file mode 100644
index 0000000000000000000000000000000000000000..7a24b2130e3c6e3f2f7bc75d425247e9b355c6b6
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/Constant.js
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2021-2024 Huawei Device 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.
+ */
+
+/**
+ * define the testcase type : TestType, Size , Level
+ */
+export const TAG = '[Hypium]';
+
+export const DEFAULT = 0B0000;
+
+export class TestType {
+ static FUNCTION = 0B1;
+ static PERFORMANCE = 0B1 << 1;
+ static POWER = 0B1 << 2;
+ static RELIABILITY = 0B1 << 3;
+ static SECURITY = 0B1 << 4;
+ static GLOBAL = 0B1 << 5;
+ static COMPATIBILITY = 0B1 << 6;
+ static USER = 0B1 << 7;
+ static STANDARD = 0B1 << 8;
+ static SAFETY = 0B1 << 9;
+ static RESILIENCE = 0B1 << 10;
+}
+
+export class Size {
+ static SMALLTEST = 0B1 << 16;
+ static MEDIUMTEST = 0B1 << 17;
+ static LARGETEST = 0B1 << 18;
+}
+
+export class Level {
+ static LEVEL0 = 0B1 << 24;
+ static LEVEL1 = 0B1 << 25;
+ static LEVEL2 = 0B1 << 26;
+ static LEVEL3 = 0B1 << 27;
+ static LEVEL4 = 0B1 << 28;
+}
+
+export const TESTTYPE = {
+ 'function': 1,
+ 'performance': 1 << 1,
+ 'power': 1 << 2,
+ 'reliability': 1 << 3,
+ 'security': 1 << 4,
+ 'global': 1 << 5,
+ 'compatibility': 1 << 6,
+ 'user': 1 << 7,
+ 'standard': 1 << 8,
+ 'safety': 1 << 9,
+ 'resilience': 1 << 10,
+}
+
+export const LEVEL = {
+ '0': 1 << 24,
+ '1': 1 << 25,
+ '2': 1 << 26,
+ '3': 1 << 27,
+ '4': 1 << 28,
+}
+
+export const SIZE = {
+ 'small': 1 << 16,
+ 'medium': 1 << 17,
+ 'large': 1 << 18,
+}
+
+export const KEYSET = [
+ '-s class', '-s notClass', '-s suite', '-s itName',
+ '-s level', '-s testType', '-s size', '-s timeout',
+ '-s dryRun', '-s random', '-s breakOnError', '-s stress',
+ '-s coverage', '-s skipMessage', '-s runSkipped',
+ 'class', 'notClass', 'suite', 'itName',
+ 'level', 'testType', 'size', 'timeout', 'dryRun', 'random',
+ 'breakOnError', 'stress', 'coverage', 'skipMessage', 'runSkipped'
+]
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/core.js b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/core.js
new file mode 100644
index 0000000000000000000000000000000000000000..cfcb5f17287208f5e6869b4248faf6c9093002d9
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/core.js
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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 {SuiteService, SpecService, ExpectService, ReportService} from './service';
+import {ConfigService} from './module/config/configService';
+import {SpecEvent, TaskEvent, SuiteEvent} from './event';
+
+/**
+ * core service for execute testcase.
+ */
+class Core {
+ static getInstance() {
+ if (!this.instance) {
+ this.instance = new Core();
+ }
+ return this.instance;
+ }
+
+ constructor() {
+ this.instance = null;
+ this.services = {
+ suite: {},
+ spec: {},
+ config: {},
+ expect: {},
+ log: {},
+ report: {}
+
+ };
+ this.events = {
+ suite: {},
+ spec: {},
+ task: {}
+ };
+ }
+
+ addService(name, service) {
+ let serviceObj = {};
+ if (!this.services[name]) {
+ this.services[name] = serviceObj;
+ } else {
+ serviceObj = this.services[name];
+ }
+ serviceObj[service.id] = service;
+ }
+
+ getDefaultService(name) {
+ return this.services[name].default;
+ }
+
+ getServices(name) {
+ return this.services[name];
+ }
+
+ registerEvent(serviceName, event) {
+ let eventObj = {};
+ if (!this.events[serviceName]) {
+ this.events[serviceName] = eventObj;
+ } else {
+ eventObj = this.events[serviceName];
+ }
+ eventObj[event.id] = event;
+ }
+
+ unRegisterEvent(serviceName, eventID) {
+ const eventObj = this.events[serviceName];
+ if (eventObj) {
+ delete eventObj[eventID];
+ }
+ }
+
+ subscribeEvent(serviceName, serviceObj) {
+ const eventObj = this.events[serviceName];
+ if (eventObj) {
+ for (const attr in eventObj) {
+ eventObj[attr]['subscribeEvent'](serviceObj);
+ }
+ }
+ }
+
+ async fireEvents(serviceName, eventName) {
+ const eventObj = this.events[serviceName];
+ if (!eventObj) {
+ return;
+ }
+ for (const attr in eventObj) {
+ await eventObj[attr][eventName]();
+ }
+ }
+
+ addToGlobal(apis) {
+ if (typeof globalThis !== 'undefined') {
+ for (let api in apis) {
+ globalThis[api] = apis[api];
+ }
+ }
+ for (const api in apis) {
+ this[api] = apis[api];
+ }
+ }
+
+ init() {
+ this.addService('suite', new SuiteService({id: 'default'}));
+ this.addService('spec', new SpecService({id: 'default'}));
+ this.addService('expect', new ExpectService({id: 'default'}));
+ this.addService('report', new ReportService({id: 'default'}));
+ this.addService('config', new ConfigService({id: 'default'}));
+ this.registerEvent('task', new TaskEvent({id: 'default', coreContext: this}));
+ this.registerEvent('suite', new SuiteEvent({id: 'default', coreContext: this}));
+ this.registerEvent('spec', new SpecEvent({id: 'default', coreContext: this}));
+ this.subscribeEvent('spec', this.getDefaultService('report'));
+ this.subscribeEvent('suite', this.getDefaultService('report'));
+ this.subscribeEvent('task', this.getDefaultService('report'));
+ const context = this;
+ for (const key in this.services) {
+ const serviceObj = this.services[key];
+ for (const serviceID in serviceObj) {
+ const service = serviceObj[serviceID];
+ service.init(context);
+
+ if (typeof service.apis !== 'function') {
+ continue;
+ }
+ const apis = service.apis();
+ if (apis) {
+ this.addToGlobal(apis);
+ }
+ }
+ }
+ }
+
+ execute(abilityDelegator) {
+ const suiteService = this.getDefaultService('suite');
+ const configService = this.getDefaultService('config');
+ if (configService['dryRun'] === 'true') {
+ (async function () {
+ await suiteService.dryRun(abilityDelegator);
+ })();
+ return;
+ }
+ setTimeout(() => {
+ suiteService.execute();
+ }, 10);
+ }
+}
+
+export default Core;
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/event.js b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/event.js
new file mode 100644
index 0000000000000000000000000000000000000000..3be0211f01646c9c269c2425cbee82c87ac6d9ea
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/event.js
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2021-2024 Huawei Device 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.
+ */
+
+class SpecEvent {
+ constructor(attr) {
+ this.id = attr.id;
+ this.coreContext = attr.context;
+ this.eventMonitors = [];
+ }
+
+ subscribeEvent(service) {
+ this.eventMonitors.push(service);
+ }
+
+ async specStart() {
+ for (const monitor of this.eventMonitors) {
+ await monitor['specStart']();
+ }
+ }
+
+ async specDone() {
+ for (const monitor of this.eventMonitors) {
+ await monitor['specDone']();
+ }
+ }
+}
+
+class SuiteEvent {
+ constructor(attr) {
+ this.id = attr.id;
+ this.suiteContext = attr.coreContext;
+ this.eventMonitors = [];
+ }
+
+ subscribeEvent(service) {
+ this.eventMonitors.push(service);
+ }
+
+ async suiteStart() {
+ for (const monitor of this.eventMonitors) {
+ await monitor['suiteStart']();
+ }
+ }
+
+ async suiteDone() {
+ for (const monitor of this.eventMonitors) {
+ await monitor['suiteDone']();
+ }
+ }
+}
+
+class TaskEvent {
+ constructor(attr) {
+ this.id = attr.id;
+ this.coreContext = attr.coreContext;
+ this.eventMonitors = [];
+ }
+
+ subscribeEvent(service) {
+ this.eventMonitors.push(service);
+ }
+
+ async taskStart() {
+ for (const monitor of this.eventMonitors) {
+ await monitor['taskStart']();
+ }
+ }
+
+ async taskDone() {
+ for (const monitor of this.eventMonitors) {
+ await monitor['taskDone']();
+ }
+ }
+
+ incorrectFormat() {
+ for (const monitor of this.eventMonitors) {
+ monitor['incorrectFormat']();
+ }
+ }
+
+ incorrectTestSuiteFormat() {
+ for (const monitor of this.eventMonitors) {
+ monitor.incorrectTestSuiteFormat();
+ }
+ }
+}
+
+export { SpecEvent, TaskEvent, SuiteEvent };
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/interface.js b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/interface.js
new file mode 100644
index 0000000000000000000000000000000000000000..44c345543313b6bad3108a8fa8824dfd92c39c79
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/interface.js
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2021-2024 Huawei Device 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 Core from './core';
+
+const core = Core.getInstance();
+
+const describe = function (desc, func) {
+ return Reflect.has(core, 'describe') ? core.describe(desc, func) : (desc, func) => { };
+};
+const it = function (desc, filter, func) {
+ return Reflect.has(core, 'it') ? core.it(desc, filter, func) : (desc, filter, func) => { };
+};
+const beforeItSpecified = function (itDescs, func) {
+ return Reflect.has(core, 'beforeItSpecified') ? core.beforeItSpecified(itDescs, func) : (itDescs, func) => { };
+};
+
+const afterItSpecified = function (itDescs, func) {
+ return Reflect.has(core, 'afterItSpecified') ? core.afterItSpecified(itDescs, func) : (itDescs, func) => { };
+};
+const beforeEach = function (func) {
+ return Reflect.has(core, 'beforeEach') ? core.beforeEach(func) : (func) => { };
+};
+const afterEach = function (func) {
+ return Reflect.has(core, 'afterEach') ? core.afterEach(func) : (func) => { };
+};
+const beforeAll = function (func) {
+ return Reflect.has(core, 'beforeAll') ? core.beforeAll(func) : (func) => { };
+};
+const afterAll = function (func) {
+ return Reflect.has(core, 'afterAll') ? core.afterAll(func) : (func) => { };
+};
+const expect = function (actualValue) {
+ return Reflect.has(core, 'expect') ? core.expect(actualValue) : (actualValue) => { };
+};
+
+const xdescribe = function (desc, func) {
+ return Reflect.has(core, 'xdescribe') ? core.xdescribe(desc, func, null) : (desc, func, reason) => { };
+};
+xdescribe.reason = (reason) => {
+ return (desc, func) => {
+ return Reflect.has(core, 'xdescribe') ? core.xdescribe(desc, func, reason) : (desc, func, reason) => { };
+ }
+}
+const xit = function (desc, filter, func) {
+ return Reflect.has(core, 'xit') ? core.xit(desc, filter, func, null) : (desc, filter, func, reason) => { };
+};
+xit.reason = (reason) => {
+ return (desc, filter, func) => {
+ return Reflect.has(core, 'xit') ? core.xit(desc, filter, func, reason) : (desc, filter, func, reason) => { };
+ }
+}
+
+export {
+ describe, it, beforeAll, beforeEach, afterEach, afterAll, expect, beforeItSpecified, afterItSpecified, xdescribe, xit
+};
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module.json b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module.json
new file mode 100644
index 0000000000000000000000000000000000000000..1fd46ff69422297a5b9139cf75e4a5ab55e38c19
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module.json
@@ -0,0 +1,26 @@
+{
+ "app": {
+ "bundleName": "com.ohos.hypium",
+ "debug": true,
+ "versionCode": 1000000,
+ "versionName": "1.0.0",
+ "minAPIVersion": 40100011,
+ "targetAPIVersion": 40100011,
+ "apiReleaseType": "Beta1",
+ "compileSdkVersion": "4.1.0.55",
+ "compileSdkType": "HarmonyOS",
+ "bundleType": "app"
+ },
+ "module": {
+ "name": "hypium",
+ "type": "har",
+ "deviceTypes": [
+ "default",
+ "tablet",
+ "tv",
+ "wearable",
+ "car"
+ ],
+ "installationFree": false
+ }
+}
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/ExpectExtend.js b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/ExpectExtend.js
new file mode 100644
index 0000000000000000000000000000000000000000..d10d15e6f9955c6d04610101f8766c951ee1a35d
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/ExpectExtend.js
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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 assertNull from './assertNull';
+import assertClose from './assertClose';
+import assertContain from './assertContain';
+import assertLess from './assertLess';
+import assertLarger from './assertLarger';
+import assertFail from './assertFail';
+import assertUndefined from './assertUndefined';
+import assertFalse from './assertFalse';
+import assertInstanceOf from './assertInstanceOf';
+import assertThrowError from './assertThrowError';
+import assertLargerOrEqual from './assertLargerOrEqual'
+import assertLessOrEqual from './assertLessOrEqual'
+import assertNaN from './assertNaN'
+import assertNegUnlimited from './assertNegUnlimited'
+import assertPosUnlimited from './assertPosUnlimited'
+import assertDeepEquals from './deepEquals/assertDeepEquals'
+import assertPromiseIsPending from './assertPromiseIsPending';
+import assertPromiseIsRejected from './assertPromiseIsRejected';
+import assertPromiseIsRejectedWith from './assertPromiseIsRejectedWith';
+import assertPromiseIsRejectedWithError from './assertPromiseIsRejectedWithError';
+import assertPromiseIsResolved from './assertPromiseIsResolved';
+import assertPromiseIsResolvedWith from './assertPromiseIsResolvedWith';
+class ExpectExtend {
+ constructor(attr) {
+ this.id = attr.id;
+ this.matchers = {};
+ }
+
+ extendsMatchers() {
+ this.matchers.assertNull = assertNull;
+ this.matchers.assertClose = assertClose;
+ this.matchers.assertContain = assertContain;
+ this.matchers.assertLess = assertLess;
+ this.matchers.assertLarger = assertLarger;
+ this.matchers.assertFail = assertFail;
+ this.matchers.assertUndefined = assertUndefined;
+ this.matchers.assertFalse = assertFalse;
+ this.matchers.assertInstanceOf = assertInstanceOf;
+ this.matchers.assertThrowError = assertThrowError;
+ this.matchers.assertLargerOrEqual = assertLargerOrEqual;
+ this.matchers.assertLessOrEqual = assertLessOrEqual;
+ this.matchers.assertNaN = assertNaN;
+ this.matchers.assertNegUnlimited = assertNegUnlimited;
+ this.matchers.assertPosUnlimited = assertPosUnlimited;
+ this.matchers.assertDeepEquals = assertDeepEquals;
+ this.matchers.assertPromiseIsPending = assertPromiseIsPending;
+ this.matchers.assertPromiseIsRejected = assertPromiseIsRejected;
+ this.matchers.assertPromiseIsRejectedWith = assertPromiseIsRejectedWith;
+ this.matchers.assertPromiseIsRejectedWithError = assertPromiseIsRejectedWithError;
+ this.matchers.assertPromiseIsResolved = assertPromiseIsResolved;
+ this.matchers.assertPromiseIsResolvedWith = assertPromiseIsResolvedWith;
+ }
+
+ init(coreContext) {
+ this.coreContext = coreContext;
+ this.extendsMatchers();
+ const expectService = this.coreContext.getDefaultService('expect');
+ expectService.addMatchers(this.matchers);
+ }
+
+ apis() {
+ return {
+ 'expect': function (actualValue) {
+ return this.coreContext.getDefaultService('expect').expect(actualValue);
+ }
+ };
+ }
+}
+
+export default ExpectExtend;
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertClose.js b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertClose.js
new file mode 100644
index 0000000000000000000000000000000000000000..63635bea5bf1298776de565260e0e0babae56857
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertClose.js
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+function assertClose(actualValue, expected) {
+ console.log('expected:' + expected[0] + ',precision:' + expected[1]);
+ if (actualValue === null && expected[0] === null) {
+ throw new Error('actualValue and expected can not be both null!!!');
+ }
+ let result;
+ let diff = Math.abs(expected[0] - actualValue);
+ let actualAbs = Math.abs(actualValue);
+ if ((actualAbs - 0) === 0) {
+ if ((diff - 0) === 0) {
+ result = true;
+ } else {
+ result = false;
+ }
+ } else if (diff / actualAbs < expected[1]) {
+ result = true;
+ } else {
+ result = false;
+ }
+ return {
+ pass: result,
+ message: '|' + actualValue + ' - ' + expected[0] + '|/' + actualValue + ' is not less than ' + expected[1]
+ };
+}
+
+export default assertClose;
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertContain.js b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertContain.js
new file mode 100644
index 0000000000000000000000000000000000000000..7fba0d9755503e5e926f6c1a4e425e0d1cf47570
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertContain.js
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+function assertContain(actualValue, expect) {
+ let result = false;
+ if (Object.prototype.toString.call(actualValue).indexOf('Array')) {
+ for (let i in actualValue) {
+ if (actualValue[i] == expect[0]) {
+ result = true;
+ }
+ }
+ }
+ let type = Object.prototype.toString.call(actualValue);
+ if (type === '[object String]') {
+ result = actualValue.indexOf(expect[0]) >= 0;
+ }
+ return {
+ pass: result,
+ message: 'expect false, ' + actualValue + ' do not have ' + expect[0]
+ };
+}
+
+export default assertContain;
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertFail.js b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertFail.js
new file mode 100644
index 0000000000000000000000000000000000000000..8ab4ac5caef712c75c4eac49dfbbb91d33669d9a
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertFail.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+function assertFail() {
+ return {
+ pass: false,
+ message: 'fail '
+ };
+}
+
+export default assertFail;
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertFalse.js b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertFalse.js
new file mode 100644
index 0000000000000000000000000000000000000000..c5008e94f4b2ce13ed35b604811793c76b542347
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertFalse.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+function assertFalse(actualValue) {
+ return {
+ pass: (actualValue) === false,
+ message: 'expect false, actualValue is ' + actualValue
+ };
+}
+
+export default assertFalse;
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertInstanceOf.js b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertInstanceOf.js
new file mode 100644
index 0000000000000000000000000000000000000000..1e11b93f7251c67f5455c5007cd7be268aa53b32
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertInstanceOf.js
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+function assertInstanceOf(actualValue, expected) {
+ if (Object.prototype.toString.call(actualValue) == '[object ' + expected[0] + ']') {
+ return {
+ pass: true
+ };
+ } else {
+ return {
+ pass: false,
+ message: actualValue + ' is ' + Object.prototype.toString.call(actualValue) + 'not ' + expected[0]
+ };
+ }
+}
+
+export default assertInstanceOf;
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertLarger.js b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertLarger.js
new file mode 100644
index 0000000000000000000000000000000000000000..a74f4a8cedaf3add9c2dc2d3799081a83198732f
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertLarger.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+function assertLarger(actualValue, expected) {
+ return {
+ pass: (actualValue) > expected[0],
+ message: (actualValue) + ' is not larger than ' + expected[0]
+ };
+}
+
+export default assertLarger;
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertLargerOrEqual.js b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertLargerOrEqual.js
new file mode 100644
index 0000000000000000000000000000000000000000..e847e6c217364b7f69c173c66fb98d10efc45ef1
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertLargerOrEqual.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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.
+ */
+
+function assertLargerOrEqual(actualValue, expected) {
+ return {
+ pass: (actualValue) >= expected[0],
+ message: (actualValue) + ' is not larger than ' + expected[0]
+ };
+}
+
+export default assertLargerOrEqual;
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertLess.js b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertLess.js
new file mode 100644
index 0000000000000000000000000000000000000000..17e84b0abaeb20804048a5a15c19e0603634846d
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertLess.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+function assertLess(actualValue, expected) {
+ return {
+ pass: (actualValue) < expected[0],
+ message: (actualValue) + ' is not less than ' + expected[0]
+ };
+}
+
+export default assertLess;
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertLessOrEqual.js b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertLessOrEqual.js
new file mode 100644
index 0000000000000000000000000000000000000000..f754f97ffa9d24e7852efe2423a1dd35d448af82
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertLessOrEqual.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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.
+ */
+
+function assertLessOrEqual(actualValue, expected) {
+ return {
+ pass: (actualValue) <= expected[0],
+ message: (actualValue) + ' is not less than ' + expected[0]
+ };
+}
+
+export default assertLessOrEqual;
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertNaN.js b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertNaN.js
new file mode 100644
index 0000000000000000000000000000000000000000..8d45d6a93b86c5ed325a68b32ff014835993a58e
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertNaN.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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.
+ */
+
+function assertNaN(actualValue) {
+ return {
+ pass: actualValue !== actualValue,
+ message: 'expect NaN, actualValue is ' + actualValue
+ };
+}
+
+export default assertNaN;
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertNegUnlimited.js b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertNegUnlimited.js
new file mode 100644
index 0000000000000000000000000000000000000000..ceac555afc826e057970e6cfe9c73b322c672aa2
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertNegUnlimited.js
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2022 Huawei Device 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.
+*/
+
+function assertNegUnlimited(actualValue) {
+ return {
+ pass: actualValue === Number.NEGATIVE_INFINITY,
+ message: 'Expected actualValue not to be -Infinity. actualValue is,' + actualValue
+ };
+}
+
+export default assertNegUnlimited;
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertNull.js b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertNull.js
new file mode 100644
index 0000000000000000000000000000000000000000..53a7bad827323a98d3302a4e7eea679551b459c5
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertNull.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+function assertNull(actualValue) {
+ return {
+ pass: (actualValue) === null,
+ message: 'expect null, actualValue is ' + (actualValue)
+ };
+}
+
+export default assertNull;
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPosUnlimited.js b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPosUnlimited.js
new file mode 100644
index 0000000000000000000000000000000000000000..6e68c0e2b6c499f4dc3dd56c13e9ea1073a3c54c
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPosUnlimited.js
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2022 Huawei Device 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.
+*/
+
+function assertPosUnlimited(actualValue) {
+ return {
+ pass: actualValue === Number.POSITIVE_INFINITY,
+ message: 'Expected actualValue is POSITIVE_INFINITY. actualValue is,' + actualValue
+ };
+}
+
+export default assertPosUnlimited;
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsPending.js b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsPending.js
new file mode 100644
index 0000000000000000000000000000000000000000..7e2ca2ce14d50c39554fc1157d6d4eb9329d5c39
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsPending.js
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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 isPromiseLike from './isPromiseLike';
+
+function assertPromiseIsPending(actualPromise) {
+ if (!isPromiseLike(actualPromise)) {
+ return Promise.reject().then(function () {
+ }, function () {
+ return {pass: false, message: 'Expected not be called on a promise.'};
+ });
+ }
+ const helper = {};
+ return Promise.race([actualPromise, Promise.resolve(helper)]).then(
+ function (got) {
+ return helper === got ? {pass: true, message: 'actualValue is isPending'}
+ : {
+ pass: false,
+ message: 'expect isPending, actualValue is resolve'
+ };
+ },
+ function () {
+ return {
+ pass: false
+ , message: 'expect isPending, actualValue is reject'
+ };
+ });
+}
+
+export default assertPromiseIsPending;
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsRejected.js b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsRejected.js
new file mode 100644
index 0000000000000000000000000000000000000000..eb8e65c7d70d5750a9ccebb55c2cf5049cf144fc
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsRejected.js
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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 isPromiseLike from './isPromiseLike';
+
+function assertPromiseIsRejected(actualPromise) {
+ if (!isPromiseLike(actualPromise)) {
+ return Promise.reject().then(function () {
+ }, function () {
+ return {pass: false, message: 'Expected not be called on a promise.'};
+ });
+ }
+ const helper = {};
+ return Promise.race([actualPromise, Promise.resolve(helper)]).then(
+ function (got) {
+ return {
+ pass: false,
+ message: 'expect isRejected, but actualValue is '
+ + (helper === got ? 'isPending' : 'resolve')
+ };
+ },
+ function () {
+ return {pass: true, message: 'actualValue is isRejected'};
+ }
+ );
+}
+
+export default assertPromiseIsRejected;
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsRejectedWith.js b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsRejectedWith.js
new file mode 100644
index 0000000000000000000000000000000000000000..48eaf7859279a70ea2ad85509296b5da1c7b69f9
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsRejectedWith.js
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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 isPromiseLike from './isPromiseLike';
+
+function assertPromiseIsRejectedWith(actualPromise, expectedValue) {
+
+ if (!isPromiseLike(actualPromise)) {
+ return Promise.reject().then(function () {
+ }, function () {
+ return {pass: false, message: 'Expected not be called on a promise.'};
+ });
+ }
+
+ function tips(passed) {
+ return ('Expected a promise ' + (passed ? 'not ' : '') +
+ 'to be rejected with ' + JSON.stringify(expectedValue[0]));
+ }
+
+ const helper = {};
+ return Promise.race([actualPromise, Promise.resolve(helper)]).then(
+ function (got) {
+ return {
+ pass: false,
+ message: tips(false) + ' but actualValue is '
+ + (helper === got ? 'isPending' : 'resolve')
+ };
+ },
+ function (actualValue) {
+ if (JSON.stringify(actualValue) == JSON.stringify(expectedValue[0])) {
+ return {
+ pass: true,
+ message: 'actualValue was rejected with ' + JSON.stringify(actualValue) + '.'
+ };
+ } else {
+ return {
+ pass: false,
+ message: tips(false) + ' but it was rejected with ' + JSON.stringify(actualValue) + '.'
+ };
+ }
+ }
+ );
+}
+
+export default assertPromiseIsRejectedWith;
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsRejectedWithError.js b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsRejectedWithError.js
new file mode 100644
index 0000000000000000000000000000000000000000..20f236fc11dd66f270322efa12a1b3f6b543407c
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsRejectedWithError.js
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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 isPromiseLike from './isPromiseLike';
+
+function assertPromiseIsRejectedWithError(actualPromise, expectedValue) {
+ if (!isPromiseLike(actualPromise)) {
+ return Promise.reject().then(function () {
+ }, function () {
+ return {pass: false, message: 'Expected not be called on a promise.'};
+ });
+ }
+ const helper = {};
+ return Promise.race([actualPromise, Promise.resolve(helper)]).then(
+ function (got) {
+ return {
+ pass: false,
+ message: 'Expected a promise to be rejected but actualValue is '
+ + (helper === got ? 'isPending' : 'resolve')
+ };
+ },
+ function (actualValue) {
+ return matchError(actualValue, expectedValue);
+ }
+ );
+
+}
+
+function matchError(actualValue, expectedValue) {
+ if (expectedValue.length == 1 && typeof expectedValue[0] === 'function') {
+ if (expectedValue[0].name === actualValue.__proto__.name) {
+ return {pass: true, message: 'actual error type is ' + actualValue.name + '.'};
+ }
+ return {pass: false, message: `except error type is ${expectedValue[0].name},but actual is ${actualValue.name}.`};
+ }
+
+ if (expectedValue.length == 1 && typeof expectedValue[0] === 'string') {
+ if (expectedValue[0] === actualValue.message) {
+ return {pass: true, message: `actual error message is ${actualValue.message}.`};
+ }
+ return {pass: false, message: `except error message ${expectedValue[0]},but actual is ${actualValue.message}.`};
+ }
+
+ if (expectedValue.length == 1) {
+ return {pass: false, message: 'When only one parameter, it should be error type or error message.'};
+ }
+
+ if (expectedValue.length == 2 && typeof expectedValue[0] === 'function' && expectedValue[0].name === actualValue.name) {
+ if (typeof expectedValue[1] === 'string' && actualValue.message === expectedValue[1]) {
+ return {pass: true, message: 'actual error message is ' + actualValue.message + '.'};
+ }
+ return {pass: false, message: `except error message is ${expectedValue[1]},but actual is ${actualValue.message}.`};
+ }
+
+ if (expectedValue.length == 2 && typeof expectedValue[0] === 'function' && expectedValue[0].name !== actualValue.name) {
+ if (typeof expectedValue[1] === 'string' && actualValue.message === expectedValue[1]) {
+ return {pass: false, message: `except error type is ${expectedValue[0].name},but actual is ${actualValue.name}.`};
+ }
+ return {pass: false, message: 'except error type and message are incorrect.'};
+ }
+ if (expectedValue.length > 2) {
+ return {pass: false, message: 'Up to two parameters are supported.'};
+ }
+}
+
+export default assertPromiseIsRejectedWithError;
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsResolved.js b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsResolved.js
new file mode 100644
index 0000000000000000000000000000000000000000..855426ca79e5002428e53d4fcb5f843cdf7119f7
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsResolved.js
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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 isPromiseLike from './isPromiseLike';
+
+function assertPromiseIsResolved(actualPromise) {
+ if (!isPromiseLike(actualPromise)) {
+ return Promise.reject().then(function () {
+ }, function () {
+ return {pass: false, message: 'Expected not be called on a promise.'};
+ });
+ }
+
+ const helper = {};
+ return Promise.race([actualPromise, Promise.resolve(helper)]).then(
+ function (got) {
+ return helper === got ? {
+ pass: false,
+ message: 'expect resolve, actualValue is isPending'
+ }
+ : {pass: true, message: 'actualValue is isResolved'};
+ },
+ function (rej) {
+ return {
+ pass: false,
+ message: 'Expected a promise to be resolved but it was ' +
+ 'rejected with ' + JSON.stringify(rej) + '.'
+ };
+ }
+ );
+}
+
+export default assertPromiseIsResolved;
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsResolvedWith.js b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsResolvedWith.js
new file mode 100644
index 0000000000000000000000000000000000000000..d5eb01e32491b281a1e1d650a307723253a61e39
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsResolvedWith.js
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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 isPromiseLike from './isPromiseLike';
+
+function assertPromiseIsResolvedWith(actualPromise, expectedValue) {
+ if (!isPromiseLike(actualPromise)) {
+ return Promise.reject().then(function () {
+ }, function () {
+ return {pass: false, message: 'Expected not be called on a promise.'};
+ });
+ }
+
+ function tips(passed) {
+ return (
+ 'Expected a promise ' + (passed ? 'not ' : '') +
+ 'to be resolved with ' + JSON.stringify(expectedValue[0]));
+ }
+
+ const helper = {};
+ return Promise.race([actualPromise, Promise.resolve(helper)]).then(
+ function (got) {
+ if (helper === got) {
+ return {pass: false, message: 'expect resolve, actualValue is isPending'};
+ }
+ if (JSON.stringify(got) == JSON.stringify(expectedValue[0])) {
+ return {
+ pass: true,
+ message: 'actualValue was resolved with ' + JSON.stringify(got) + '.'
+ };
+ }
+ return {
+ pass: false,
+ message: tips(false) + ' but it was resolved with ' +
+ JSON.stringify(got) + '.'
+ };
+ },
+ function (rej) {
+ return {
+ pass: false,
+ message: tips(false) + ' but it was rejected with ' + JSON.stringify(rej) + '.'
+ };
+ }
+ );
+}
+
+export default assertPromiseIsResolvedWith;
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertThrowError.js b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertThrowError.js
new file mode 100644
index 0000000000000000000000000000000000000000..749cab0daee3f156909f60c9375146c23d7aa322
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertThrowError.js
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+function assertThrowError(actualValue, expected) {
+ let result = false;
+ let err;
+ if (typeof actualValue !== 'function') {
+ throw new Error('actualValue is not a function');
+ }
+ try {
+ actualValue();
+ return {
+ pass: result,
+ message: ' An error is not thrown while it is expected!'
+ };
+ } catch (e) {
+ err = e;
+ }
+
+ if (err instanceof Error) {
+ console.log(err.message);
+ if (err.message == expected[0]) {
+ result = true;
+ }
+ }
+ return {
+ pass: result,
+ message: 'expected throw failed , ' + err.message + ' is not ' + expected[0]
+ };
+}
+
+export default assertThrowError;
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertUndefined.js b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertUndefined.js
new file mode 100644
index 0000000000000000000000000000000000000000..61f092d715dd1630297518b59ff13ef0940991e1
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/assertUndefined.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+function assertUndefined(actualValue) {
+ return {
+ pass: undefined === (actualValue),
+ message: 'expect Undefined, actualValue is ' + (actualValue)
+ };
+}
+
+export default assertUndefined;
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/deepEquals/DeepTypeUtils.js b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/deepEquals/DeepTypeUtils.js
new file mode 100644
index 0000000000000000000000000000000000000000..627fb3b3ae7e315808b5ee2927d4bfbf17cc64b2
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/deepEquals/DeepTypeUtils.js
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2022-2023 Huawei Device 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.
+ */
+
+class DeepTypeUtils {
+ static getType_(value) {
+ return Object.prototype.toString.apply(value);
+ }
+ static isA_(typeName, value) {
+ return this.getType_(value) === '[object ' + typeName + ']';
+ }
+ static isAsymmetricEqualityTester_(obj) {
+ return obj ? this.isA_('Function', obj.asymmetricMatch) : false;
+ }
+
+ /**
+ * 是否是function
+ * @param value
+ */
+ static isFunction_(value) {
+ return this.isA_('Function', value);
+ }
+
+ /**
+ * 是否是undefined
+ * @param obj
+ */
+ static isUndefined(obj) {
+ return obj === void 0;
+ }
+
+ /**
+ * 是否是Node
+ * @param obj
+ */
+ static isDomNode(obj) {
+ return obj !== null &&
+ typeof obj === 'object' &&
+ typeof obj.nodeType === 'number' &&
+ typeof obj.nodeName === 'string';
+ }
+
+ /**
+ * 是否是promise对象
+ * @param obj
+ */
+ static isPromise (obj) {
+ return !!obj && obj.constructor === Promise;
+ };
+ /**
+ * 是否是map对象
+ * @param obj
+ */
+ static isMap(obj) {
+ return (
+ obj !== null &&
+ typeof obj !== 'undefined' &&
+ obj.constructor === Map
+ );
+ }
+
+ /**
+ * 是否是set对象
+ * @param obj 对象
+ */
+ static isSet(obj) {
+ return (
+ obj !== null &&
+ typeof obj !== 'undefined' &&
+ obj.constructor === Set
+ );
+ }
+
+ /**
+ * 对象是否有key属性
+ * @param obj 对象
+ * @param key 对象属性名称
+ */
+ static has(obj, key) {
+ return Object.prototype.hasOwnProperty.call(obj, key);
+ }
+
+ /**
+ * 获取对象的自有属性
+ * @param obj 对象
+ * @param isArray 是否是数组,[object Array]
+ */
+ static keys(obj, isArray) {
+ const extraKeys = [];
+ // 获取对象所有属性
+ const allKeys = this.getAllKeys(obj);
+ if (!isArray) {
+ return allKeys;
+ }
+ if (allKeys.length === 0) {
+ return allKeys;
+ }
+ for (const k of allKeys) {
+ if (typeof k === 'symbol' || !/^[0-9]+$/.test(k)) {
+ extraKeys.push(k);
+ }
+ }
+ return extraKeys;
+ }
+
+ /**
+ * 获取obj对象的所有属性
+ * @param obj obj对象
+ */
+ static getAllKeys(obj) {
+ const keys = [];
+ for (let key in obj) {
+ if(this.has(obj, key)) {
+ keys.push(key);
+ }
+ }
+ const symbols = Object.getOwnPropertySymbols(obj);
+ for (const sym of symbols) {
+ if (obj.propertyIsEnumerable(sym)) {
+ keys.push(sym);
+ }
+ }
+ return keys;
+ }
+
+}
+export default DeepTypeUtils;
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/deepEquals/assertDeepEquals.js b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/deepEquals/assertDeepEquals.js
new file mode 100644
index 0000000000000000000000000000000000000000..482e28e6af45482f8c2d9d0f61130730b07eba70
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/deepEquals/assertDeepEquals.js
@@ -0,0 +1,315 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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 DeepTypeUtils from './DeepTypeUtils'
+function assertDeepEquals(actualValue, expected) {
+ console.log('actualValue:' + actualValue + ',expected:' + expected[0]);
+ let result = eq(actualValue, expected[0],[], [])
+ let msg = logMsg(actualValue, expected[0]);
+ return {
+ pass: result,
+ message: msg
+ };
+}
+
+/**
+ * 获取失败显示日志
+ * @param actualValue 实际对象
+ * @param expected 期待比较对象
+ */
+function logMsg(actualValue, expected) {
+ // 获取a的对象名称
+ const aClassName = Object.prototype.toString.call(actualValue);
+ const bClassName = Object.prototype.toString.call(expected);
+ let actualMsg;
+ let expectMsg;
+ if(aClassName == "[object Function]") {
+ actualMsg = "actualValue Function"
+ }else if(aClassName == "[object Promise]") {
+ actualMsg = "actualValue Promise"
+ }else if(aClassName == "[object Set]" || aClassName == "[object Map]") {
+ actualMsg = JSON.stringify(Array.from(actualValue));;
+ }else if(aClassName == "[object RegExp]") {
+ actualMsg = JSON.stringify(actualValue.source.replace("\\",""));;
+ }else if(aClassName == "[object BigInt]") {
+ actualMsg = actualValue;
+ }
+ else{
+ actualMsg = JSON.stringify(actualValue);
+ }
+ if(bClassName == "[object Function]") {
+ expectMsg = "expected Function"
+ }else if(bClassName == "[object Promise]") {
+ expectMsg = "expected Promise"
+ }else if(bClassName == "[object Set]" || bClassName == "[object Map]") {
+ expectMsg = JSON.stringify(Array.from(expected));
+ }else if(bClassName == "[object RegExp]") {
+ expectMsg = JSON.stringify(expected.source.replace("\\",""));;
+ }else if(bClassName == "[object BigInt]") {
+ expectMsg = expected;
+ }
+ else{
+ expectMsg = JSON.stringify(expected);
+ }
+ return actualMsg + " is not deep equal " + expectMsg;
+}
+
+function eq(a, b, aStack, bStack) {
+ let result = true;
+ console.log('a is:' + a + ',b is:' + b);
+ const asymmetricResult = asymmetricMatch_(a,b);
+ if (!DeepTypeUtils.isUndefined(asymmetricResult)) {
+ return asymmetricResult;
+ }
+
+ if (a instanceof Error && b instanceof Error) {
+ result = a.message == b.message;
+ return result;
+ }
+
+ if (a === b) {
+ result = a !== 0 || 1 / a == 1 / b;
+ return result;
+ }
+
+ if (a === null || b === null) {
+ result = a === b;
+ return result;
+ }
+ // 获取a的对象名称
+ const aClassName = Object.prototype.toString.call(a);
+ const bClassName = Object.prototype.toString.call(b);
+ console.log('aClassName is:' + aClassName);
+ console.log('bClassName is:' + bClassName);
+ // 不同类型不同对象
+ if (aClassName != bClassName) {
+ return false;
+ }
+ // 俩个string对象
+ if(aClassName === '[object String]') {
+ result = a == String(b);
+ return result;
+ }
+ // 俩个Number对象
+ if(aClassName === '[object Number]') {
+ result = a != +a ? b != +b : a === 0 && b === 0 ? 1 / a == 1 / b : a == +b;
+ return result;
+ }
+
+ if(aClassName === '[object Date]' || aClassName === '[object Boolean]') {
+ result = +a == +b;
+ return result;
+ }
+
+ // 数组
+ if(aClassName === '[object ArrayBuffer]') {
+ return eq(new Uint8Array(a), new Uint8Array(b), aStack, bStack);
+ }
+
+ // 正则表达式
+ if(aClassName === '[object RegExp]') {
+ return (
+ a.source == b.source &&
+ a.global == b.global &&
+ a.multiline == b.multiline &&
+ a.ignoreCase == b.ignoreCase
+ );
+ }
+
+ if (typeof a != 'object' || typeof b != 'object') {
+ return false;
+ }
+
+ const aIsDomNode = DeepTypeUtils.isDomNode(a);
+ const bIsDomNode = DeepTypeUtils.isDomNode(b);
+ if (aIsDomNode && bIsDomNode) {
+ // At first try to use DOM3 method isEqualNode
+ result = a.isEqualNode(b);
+ return result;
+ }
+ if (aIsDomNode || bIsDomNode) {
+ return false;
+ }
+ const aIsPromise = DeepTypeUtils.isPromise(a);
+ const bIsPromise = DeepTypeUtils.isPromise(b);
+ if (aIsPromise && bIsPromise) {
+ return a === b;
+ }
+ let length = aStack.length;
+ while (length--) {
+ if (aStack[length] == a) {
+ return bStack[length] == b;
+ }
+ }
+ aStack.push(a);
+ bStack.push(b);
+ let size = 0;
+
+ // 都是数组
+ if(aClassName == '[object Array]') {
+ const aLength = a.length;
+ const bLength = b.length;
+ if (aLength !== bLength) {
+ // 数组长度不同,不是同一个对象
+ return false;
+ }
+ for (let i = 0; i < aLength || i < bLength; i++) {
+ // 递归每一个元素是否相同
+ result = eq(i < aLength ? a[i] : void 0, i < bLength ? b[i] : void 0, aStack, bStack) && result;
+ }
+ if (!result) {
+ return false;
+ }
+ } else if(DeepTypeUtils.isMap(a) && DeepTypeUtils.isMap(b)) {
+ if (a.size != b.size) {
+ return false;
+ }
+ const keysA = [];
+ const keysB = [];
+ a.forEach(function(valueA, keyA) {
+ keysA.push(keyA);
+ });
+ b.forEach(function(valueB, keyB) {
+ keysB.push(keyB);
+ });
+ const mapKeys = [keysA, keysB];
+ const cmpKeys = [keysB, keysA];
+ for (let i = 0; result && i < mapKeys.length; i++) {
+ const mapIter = mapKeys[i];
+ const cmpIter = cmpKeys[i];
+
+ for (let j = 0; result && j < mapIter.length; j++) {
+ const mapKey = mapIter[j];
+ const cmpKey = cmpIter[j];
+ const mapValueA = a.get(mapKey);
+ let mapValueB;
+ if (
+ DeepTypeUtils.isAsymmetricEqualityTester_(mapKey) ||
+ (DeepTypeUtils.isAsymmetricEqualityTester_(cmpKey) &&
+ eq(mapKey, cmpKey))
+ ) {
+ mapValueB = b.get(cmpKey);
+ } else {
+ mapValueB = b.get(mapKey);
+ }
+ result = eq(mapValueA, mapValueB, aStack, bStack);
+ }
+ }
+ if (!result) {
+ return false;
+ }
+ } else if(DeepTypeUtils.isSet(a) && DeepTypeUtils.isSet(b)) {
+ if (a.size != b.size) {
+ return false;
+ }
+ const valuesA = [];
+ a.forEach(function(valueA) {
+ valuesA.push(valueA);
+ });
+ const valuesB = [];
+ b.forEach(function(valueB) {
+ valuesB.push(valueB);
+ });
+ const setPairs = [[valuesA, valuesB], [valuesB, valuesA]];
+ const stackPairs = [[aStack, bStack], [bStack, aStack]];
+ for (let i = 0; result && i < setPairs.length; i++) {
+ const baseValues = setPairs[i][0];
+ const otherValues = setPairs[i][1];
+ const baseStack = stackPairs[i][0];
+ const otherStack = stackPairs[i][1];
+ for (const baseValue of baseValues) {
+ let found = false;
+ for (let j = 0; !found && j < otherValues.length; j++) {
+ const otherValue = otherValues[j];
+ const prevStackSize = baseStack.length;
+ // 深度比较对象
+ found = eq(baseValue, otherValue, baseStack, otherStack);
+ if (!found && prevStackSize !== baseStack.length) {
+ baseStack.splice(prevStackSize);
+ otherStack.splice(prevStackSize);
+ }
+ }
+ result = result && found;
+ }
+ }
+ if (!result) {
+ return false;
+ }
+ } else {
+ const aCtor = a.constructor,
+ bCtor = b.constructor;
+ if (
+ aCtor !== bCtor &&
+ DeepTypeUtils.isFunction_(aCtor) &&
+ DeepTypeUtils.isFunction_(bCtor) &&
+ a instanceof aCtor &&
+ b instanceof bCtor &&
+ !(aCtor instanceof aCtor && bCtor instanceof bCtor)
+ ) {
+ return false;
+ }
+ }
+
+ // 获取对象所有的属性集合
+ const aKeys = DeepTypeUtils.keys(a, aClassName == '[object Array]');
+ size = aKeys.length;
+
+ // 俩个对象属性长度不一致, 俩对象不相同
+ if (DeepTypeUtils.keys(b, bClassName == '[object Array]').length !== size) {
+ return false;
+ }
+
+ // 俩对象属性数量相同, 递归比较每个属性值得值
+ for (const key of aKeys) {
+ console.log('key is:' + key);
+ // b 没有 key 属性
+ if(!DeepTypeUtils.has(b, key)) {
+ result = false;
+ continue;
+ }
+ if (!eq(a[key], b[key], aStack, bStack)) {
+ result = false;
+ }
+ }
+ if (!result) {
+ return false;
+ }
+ aStack.pop();
+ bStack.pop();
+ return result;
+}
+
+function asymmetricMatch_(a, b) {
+ const asymmetricA = DeepTypeUtils.isAsymmetricEqualityTester_(a);
+ const asymmetricB = DeepTypeUtils.isAsymmetricEqualityTester_(b);
+
+ if (asymmetricA === asymmetricB) {
+ return undefined;
+ }
+
+}
+
+/**
+ * 获取对象的自有属性
+ *
+ * @param obj 对象
+ * @param isArray 是否是一个数组
+ */
+function keys(obj, isArray) {
+ const keys = [];
+
+}
+
+export default assertDeepEquals;
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/isPromiseLike.js b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/isPromiseLike.js
new file mode 100644
index 0000000000000000000000000000000000000000..015ab19a2a0c4872d7cb490b61f8e1dd6a8ac90b
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/assert/isPromiseLike.js
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+function isPromiseLike(obj) {
+ return !!obj && isFunction_(obj.then);
+}
+
+function isFunction_(value) {
+ return isA_('Function', value);
+}
+
+function isA_(typeName, value) {
+ return getType_(value) === '[object ' + typeName + ']';
+}
+
+function getType_(value) {
+ return Object.prototype.toString.apply(value);
+}
+
+export default isPromiseLike;
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/config/DataDriver.js b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/config/DataDriver.js
new file mode 100644
index 0000000000000000000000000000000000000000..639dffc9cdb912f1f33a6ccb61868c9ed7c695bf
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/config/DataDriver.js
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+const SUITES_KEY = 'suites';
+const SPECS_KEY = 'items';
+const DESCRIBE_KEY = 'describe';
+const IT_KEY = 'it';
+const PARAMS_KEY = 'params';
+const STRESS_KEY = 'stress';
+
+class ObjectUtils {
+ static get(object, name, defaultValue) {
+ let result = defaultValue;
+ for (const key in object) {
+ if (key === name) {
+ return object[key];
+ }
+ }
+ return result;
+ }
+
+ static has(object, key) {
+ return Object.prototype.hasOwnProperty.call(object, key);
+ }
+}
+
+class DataDriver {
+ constructor(attr) {
+ this.id = 'dataDriver';
+ this.data = attr.data || {};
+ }
+
+ init(coreContext) {
+ this.coreContext = coreContext;
+ this.suiteService = this.coreContext.getDefaultService('suite');
+ this.specService = this.coreContext.getDefaultService('spec');
+ }
+
+ getSpecParams() {
+ let specParams = [];
+ let suiteDesc = this.suiteService.getCurrentRunningSuite().description;
+ let specDesc = this.specService.getCurrentRunningSpec().description;
+ let suites = ObjectUtils.get(this.data, SUITES_KEY, []);
+ for (const suiteItem of suites) {
+ let describeValue = ObjectUtils.get(suiteItem, DESCRIBE_KEY, '');
+ if (ObjectUtils.has(suiteItem, DESCRIBE_KEY) && (typeof describeValue === 'object') && describeValue.constructor === Array && describeValue.includes(suiteDesc)) {
+ let specs = ObjectUtils.get(suiteItem, SPECS_KEY, []);
+ for (const specItem of specs) {
+ if (ObjectUtils.has(specItem, IT_KEY) && ObjectUtils.get(specItem, IT_KEY) === specDesc) {
+ return ObjectUtils.get(specItem, PARAMS_KEY, specParams);
+ }
+ }
+ }
+ }
+ return specParams;
+ }
+
+ getSuiteParams() {
+ let suiteParams = {};
+ let suiteDesc = this.suiteService.getCurrentRunningSuite().description;
+ let suites = ObjectUtils.get(this.data, SUITES_KEY, []);
+ for (const suiteItem of suites) {
+ let describeValue = ObjectUtils.get(suiteItem, DESCRIBE_KEY, []);
+ if (ObjectUtils.has(suiteItem, DESCRIBE_KEY) && (typeof describeValue === 'object') && describeValue.constructor === Array && describeValue.includes(suiteDesc)) {
+ suiteParams = Object.assign({}, suiteParams, ObjectUtils.get(suiteItem, PARAMS_KEY, suiteParams));
+ }
+ }
+ return suiteParams;
+ }
+
+ getSpecStress(specDesc) {
+ let stress = 1;
+ let suiteDesc = this.suiteService.getCurrentRunningSuite().description;
+ let suites = ObjectUtils.get(this.data, SUITES_KEY, []);
+ for (const suiteItem of suites) {
+ let describeValue = ObjectUtils.get(suiteItem, DESCRIBE_KEY, '');
+ if (ObjectUtils.has(suiteItem, DESCRIBE_KEY) && (typeof describeValue === 'object') && describeValue.constructor === Array && describeValue.includes(suiteDesc)) {
+ let specs = ObjectUtils.get(suiteItem, SPECS_KEY, []);
+ for (const specItem of specs) {
+ if (ObjectUtils.has(specItem, IT_KEY) && ObjectUtils.get(specItem, IT_KEY) === specDesc) {
+ let tempStress = ObjectUtils.get(specItem, STRESS_KEY, stress);
+ return (Number.isInteger(tempStress) && tempStress >= 1) ? tempStress : stress;
+ }
+ }
+ }
+ }
+ return stress;
+ }
+
+ getSuiteStress(suiteDesc) {
+ let stress = 1;
+ let suites = ObjectUtils.get(this.data, SUITES_KEY, []);
+ for (const suiteItem of suites) {
+ let describeValue = ObjectUtils.get(suiteItem, DESCRIBE_KEY, []);
+ if (ObjectUtils.has(suiteItem, DESCRIBE_KEY) && (typeof describeValue === 'object') && describeValue.constructor === Array && describeValue.includes(suiteDesc)) {
+ let tempStress = ObjectUtils.get(suiteItem, STRESS_KEY, stress);
+ return (Number.isInteger(tempStress) && tempStress >= 1) ? tempStress : stress;
+ }
+ }
+ return stress;
+ }
+}
+
+export default DataDriver;
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/config/Filter.js b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/config/Filter.js
new file mode 100644
index 0000000000000000000000000000000000000000..2720b73ea2cebd148ee8d2a337b8fe9529912a0d
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/config/Filter.js
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2021-2024 Huawei Device 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 { LEVEL, SIZE, TESTTYPE } from "../../Constant";
+
+class ClassFilter {
+ constructor(suiteName, itName, params) {
+ this.suiteName = suiteName;
+ this.itName = itName;
+ this.params = params;
+ }
+
+ filterSuite() {
+ return !this.params.split(',').map(item => item.split('#')[0]).map(item => item == this.suiteName).reduce((pre, cur) => pre || cur, false);
+ }
+
+ filterIt() {
+ let classArray = this.params.split(',') || [];
+ let suiteFilterResult = classArray.filter(item => !item.includes('#')).map(item => item == this.suiteName).reduce((pre, cur) => pre || cur, false);
+ let itFilterResult = classArray.filter(item => item.includes('#')).map(item => item == (this.suiteName + '#' + this.itName)).reduce((pre, cur) => pre || cur, false);
+ return !(suiteFilterResult || itFilterResult);
+ }
+}
+
+class NotClassFilter {
+ constructor(suiteName, itName, params) {
+ this.suiteName = suiteName;
+ this.itName = itName;
+ this.params = params;
+ }
+
+ filterSuite() {
+ return this.params.split(',').map(item => item == this.suiteName).reduce((pre, cur) => pre || cur, false);
+ }
+
+ filterIt() {
+ return this.params.split(',').some(item => item == (this.suiteName + '#' + this.itName));
+ }
+}
+
+class SuiteAndItNameFilter {
+ constructor(suiteName, itName, params) {
+ this.suiteName = suiteName;
+ this.itName = itName;
+ this.params = params;
+ }
+
+ filterSuite() {
+ return !this.params.split(',').map(item => item == this.suiteName).reduce((pre, cur) => pre || cur, false);
+ }
+
+ filterIt() {
+ return !this.params.split(',').map(item => item == this.itName).reduce((pre, cur) => pre || cur, false);
+ }
+}
+
+
+class TestTypesFilter {
+ constructor(suiteName, itName, fi, params) {
+ this.suiteName = suiteName;
+ this.itName = itName;
+ this.params = params;
+ this.fi = fi;
+ }
+
+ filterIt() {
+ return !((this.params === (this.fi & this.params)) || this.fi === 0);
+ }
+}
+
+class NestFilter {
+ filterNestName(targetSuiteArray, targetSpecArray, suiteStack, desc) {
+ let targetSuiteName = "";
+ for (let key in suiteStack) {
+ targetSuiteName = targetSuiteName + "." + suiteStack[key].description;
+ }
+ targetSuiteName = targetSuiteName.substring(2);
+ const targetSpecName = targetSuiteName + "#" + desc;
+ let isFilter = true;
+ if (targetSpecArray.includes(targetSpecName)) {
+ return false;
+ }
+ for (let index in targetSuiteArray) {
+ if (targetSuiteName.startsWith(targetSuiteArray[index])) {
+ return false;
+ }
+ }
+ return isFilter;
+ }
+
+ filterNotClass(notClass, suiteStack, desc) {
+ let isFilterNotClass = false;
+ if (notClass != null) {
+ let notClassArray = notClass.split(",");
+ let targetSuiteName = "";
+ for (let key in suiteStack) {
+ targetSuiteName = targetSuiteName + "." + suiteStack[key].description;
+ }
+ targetSuiteName = targetSuiteName.substring(2);
+ const targetSpecName = targetSuiteName + "#" + desc;
+ if (notClassArray.includes(targetSpecName) || notClassArray.some(key => targetSpecName.startsWith(key))) {
+ isFilterNotClass = true;
+ }
+ }
+ return isFilterNotClass;
+ }
+
+ filterLevelOrSizeOrTestType(level, size, testType, filter) {
+ let result = false;
+ if (filter === 0 || filter === '0') {
+ return result;
+ }
+ if (level == null && size == null && testType == null) {
+ return result;
+ }
+ if (level != null) {
+ let levelFilter = LEVEL[`${level}`];
+ result = result || filter === levelFilter;
+ }
+ if (size != null) {
+ let sizeFilter = SIZE[`${size}`];
+ result = result || filter === sizeFilter;
+ }
+ if (testType != null) {
+ let testTypeFilter = TESTTYPE[`${testType}`];
+ result = result || filter === testTypeFilter;
+ }
+ return !result;
+ }
+}
+export { ClassFilter, NotClassFilter, SuiteAndItNameFilter, TestTypesFilter, NestFilter };
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/config/configService.js b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/config/configService.js
new file mode 100644
index 0000000000000000000000000000000000000000..8639877e3d114d54a1e3430ea41ffaa51cba5a59
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/config/configService.js
@@ -0,0 +1,299 @@
+/*
+ * Copyright (c) 2021-2024 Huawei Device 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 { ClassFilter, NotClassFilter, SuiteAndItNameFilter, TestTypesFilter, NestFilter } from './Filter';
+import { TAG, TESTTYPE, LEVEL, SIZE, KEYSET } from '../../Constant';
+const STRESS_RULE = /^[1-9]\d*$/;
+
+class ConfigService {
+ constructor(attr) {
+ this.id = attr.id;
+ this.supportAsync = true; // 默认异步处理测试用例
+ this.random = false;
+ this.filterValid = [];
+ this.filter = 0;
+ this.flag = false;
+ this.suite = null;
+ this.itName = null;
+ this.testType = null;
+ this.level = null;
+ this.size = null;
+ this.class = null;
+ this.notClass = null;
+ this.timeout = null;
+ // 遇错即停模式配置
+ this.breakOnError = false;
+ // 压力测试配置
+ this.stress = null;
+ this.skipMessage = false;
+ this.runSkipped = '';
+ this.filterXdescribe = [];
+ }
+
+ init(coreContext) {
+ this.coreContext = coreContext;
+ }
+
+ isNormalInteger(str) {
+ const n = Math.floor(Number(str));
+ return n !== Infinity && String(n) === String(str) && n >= 0;
+ }
+
+
+ getStress() {
+ if (this.stress === undefined || this.stress === '' || this.stress === null) {
+ return 1;
+ }
+ return !this.stress.match(STRESS_RULE) ? 1 : Number.parseInt(this.stress);
+ }
+
+ basicParamValidCheck(params) {
+ let size = params.size;
+ if (size !== undefined && size !== '' && size !== null) {
+ let sizeArray = ['small', 'medium', 'large'];
+ if (sizeArray.indexOf(size) === -1) {
+ this.filterValid.push('size:' + size);
+ }
+ }
+ let level = params.level;
+ if (level !== undefined && level !== '' && level !== null) {
+ let levelArray = ['0', '1', '2', '3', '4'];
+ if (levelArray.indexOf(level) === -1) {
+ this.filterValid.push('level:' + level);
+ }
+ }
+ let testType = params.testType;
+ if (testType !== undefined && testType !== '' && testType !== null) {
+ let testTypeArray = ['function', 'performance', 'power', 'reliability', 'security',
+ 'global', 'compatibility', 'user', 'standard', 'safety', 'resilience'];
+ if (testTypeArray.indexOf(testType) === -1) {
+ this.filterValid.push('testType:' + testType);
+ }
+ }
+ }
+
+ filterParamValidCheck(params) {
+ let timeout = params.timeout;
+ if (timeout !== undefined && timeout !== '' && timeout !== null) {
+ if (!this.isNormalInteger(timeout)) {
+ this.filterValid.push('timeout:' + timeout);
+ }
+ }
+
+ let paramKeys = ['dryRun', 'random', 'breakOnError', 'coverage', 'skipMessage'];
+ for (const key of paramKeys) {
+ if (params[key] !== undefined && params[key] !== 'true' && params[key] !== 'false') {
+ this.filterValid.push(`${key}:${params[key]}`);
+ }
+ }
+
+ // 压力测试参数验证,正整数
+ if (params.stress !== undefined && params.stress !== '' && params.stress !== null) {
+ if (!params.stress.match(STRESS_RULE)) {
+ this.filterValid.push('stress:' + params.stress);
+ }
+ }
+
+ let nameRule = /^[A-Za-z]{1}[\w#,.]*$/;
+ let paramClassKeys = ['class', 'notClass'];
+ for (const key of paramClassKeys) {
+ if (params[key] !== undefined && params[key] !== '' && params[key] !== null) {
+ let classArray = params[key].split(',');
+ classArray.forEach(item => !item.match(nameRule) ? this.filterValid.push(`${key}:${params[key]}`) : null);
+ }
+ }
+ }
+
+ setConfig(params) {
+ this.basicParamValidCheck(params);
+ this.filterParamValidCheck(params);
+ try {
+ this.class = params.class;
+ this.notClass = params.notClass;
+ this.flag = params.flag || { flag: false };
+ this.suite = params.suite;
+ this.itName = params.itName;
+ this.filter = params.filter;
+ this.testType = params.testType;
+ this.level = params.level;
+ this.size = params.size;
+ this.timeout = params.timeout;
+ this.dryRun = params.dryRun;
+ this.breakOnError = params.breakOnError;
+ this.random = params.random === 'true' ? true : false;
+ this.stress = params.stress;
+ this.coverage = params.coverage;
+ this.skipMessage = params.skipMessage;
+ this.runSkipped = params.runSkipped;
+ this.filterParam = {
+ testType: TESTTYPE,
+ level: LEVEL,
+ size: SIZE
+ };
+ this.parseParams();
+ } catch (err) {
+ console.info(`${TAG}setConfig error: ${err.message}`);
+ }
+ }
+
+ parseParams() {
+ if (this.filter != null) {
+ return;
+ }
+ let testTypeFilter = 0;
+ let sizeFilter = 0;
+ let levelFilter = 0;
+ if (this.testType != null) {
+ testTypeFilter = this.testType.split(',')
+ .map(item => this.filterParam.testType[item] || 0)
+ .reduce((pre, cur) => pre | cur, 0);
+ }
+ if (this.level != null) {
+ levelFilter = this.level.split(',')
+ .map(item => this.filterParam.level[item] || 0)
+ .reduce((pre, cur) => pre | cur, 0);
+ }
+ if (this.size != null) {
+ sizeFilter = this.size.split(',')
+ .map(item => this.filterParam.size[item] || 0)
+ .reduce((pre, cur) => pre | cur, 0);
+ }
+ this.filter = testTypeFilter | sizeFilter | levelFilter;
+ console.info(`${TAG}filter params:${this.filter}`);
+ }
+
+ isCurrentSuite(description) {
+ if (this.suite !== undefined && this.suite !== '' && this.suite !== null) {
+ let suiteArray = this.suite.split(',');
+ return suiteArray.indexOf(description) !== -1;
+ }
+ return false;
+ }
+
+ filterSuite(currentSuiteName) {
+ let filterArray = [];
+ if (this.suite !== undefined && this.suite !== '' && this.suite !== null) {
+ filterArray.push(new SuiteAndItNameFilter(currentSuiteName, '', this.suite));
+ }
+ if (this.class !== undefined && this.class !== '' && this.class !== null) {
+ filterArray.push(new ClassFilter(currentSuiteName, '', this.class));
+ }
+ if (this.notClass !== undefined && this.notClass !== '' && this.notClass !== null) {
+ filterArray.push(new NotClassFilter(currentSuiteName, '', this.notClass));
+ }
+
+ let result = filterArray.map(item => item.filterSuite()).reduce((pre, cur) => pre || cur, false);
+ return result;
+ }
+
+ filterDesc(currentSuiteName, desc, fi, coreContext) {
+ let filterArray = [];
+ if (this.itName !== undefined && this.itName !== '' && this.itName !== null) {
+ filterArray.push(new SuiteAndItNameFilter(currentSuiteName, desc, this.itName));
+ }
+ if (this.class !== undefined && this.class !== '' && this.class !== null) {
+ filterArray.push(new ClassFilter(currentSuiteName, desc, this.class));
+ }
+ if (this.notClass !== undefined && this.notClass !== '' && this.notClass !== null) {
+ filterArray.push(new NotClassFilter(currentSuiteName, desc, this.notClass));
+ }
+ if (typeof (this.filter) !== 'undefined' && this.filter !== 0 && fi !== 0) {
+ filterArray.push(new TestTypesFilter('', '', fi, this.filter));
+ }
+ let result = filterArray.map(item => item.filterIt()).reduce((pre, cur) => pre || cur, false);
+ return result;
+ }
+
+ filterWithNest(desc, filter) {
+ let filterArray = [];
+ const nestFilter = new NestFilter();
+ const targetSuiteArray = this.coreContext.getDefaultService('suite').targetSuiteArray;
+ const targetSpecArray = this.coreContext.getDefaultService('suite').targetSpecArray;
+ const suiteStack = this.coreContext.getDefaultService('suite').suitesStack;
+ let isFilter = nestFilter.filterNestName(targetSuiteArray, targetSpecArray, suiteStack, desc);
+ const isFullRun = this.coreContext.getDefaultService('suite').fullRun;
+ if (typeof (this.filter) !== 'undefined' && this.filter !== 0 && filter !== 0) {
+ filterArray.push(new TestTypesFilter('', '', filter, this.filter));
+ return filterArray.map(item => item.filterIt()).reduce((pre, cur) => pre || cur, false);
+ }
+ if (isFilter && !isFullRun) {
+ return true;
+ }
+ return nestFilter.filterNotClass(this.notClass, suiteStack, desc);
+
+ }
+
+ isRandom() {
+ return this.random || false;
+ }
+
+ isBreakOnError() {
+ return this.breakOnError !== 'true' ? false : true;
+ }
+
+ setSupportAsync(value) {
+ this.supportAsync = value;
+ }
+
+ isSupportAsync() {
+ return this.supportAsync;
+ }
+
+ translateParams(parameters) {
+ const keySet = new Set(KEYSET);
+ let targetParams = {};
+ for (const key in parameters) {
+ if (keySet.has(key)) {
+ var newKey = key.replace("-s ", "");
+ targetParams[newKey] = parameters[key];
+ }
+ }
+ return targetParams;
+ }
+ translateParamsToString(parameters) {
+ const keySet = new Set(KEYSET);
+ let targetParams = '';
+ for (const key in parameters) {
+ if (keySet.has(key)) {
+ targetParams += ' ' + key + ' ' + parameters[key];
+ }
+ }
+ return targetParams.trim();
+ }
+
+ execute() {
+ }
+
+ checkIfSuiteInSkipRun(desc) {
+ return this.runSkipped.split(",").some(item => {
+ return item === desc || item.startsWith(desc + '.') || item.startsWith(desc + '#') || desc.startsWith(item + '.') || this.runSkipped === 'skipped';
+ });
+ }
+
+ checkIfSpecInSkipRun(desc) {
+ return this.runSkipped.split(",").some(item => {
+ if (item.includes("#")) {
+ return item === desc;
+ } else {
+ return desc.startsWith(item + ".") || desc.startsWith(item + "#") || this.runSkipped === 'skipped';
+ }
+ }
+ );
+ }
+}
+
+export {
+ ConfigService
+};
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/coverage/coverageCollect.js b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/coverage/coverageCollect.js
new file mode 100644
index 0000000000000000000000000000000000000000..466bbaa11ef258895ebd64929ac5c99f7a471051
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/coverage/coverageCollect.js
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2023 Huawei Device 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 SysTestKit from "../kit/SysTestKit";
+import fs from '@ohos.file.fs';
+import {TAG} from '../../Constant';
+
+const jsCoverageFileName = 'js_coverage.json';
+
+export async function collectCoverageData() {
+ if (globalThis.__coverage__ === undefined) {
+ console.info(`${TAG} globalThis not have coverage`);
+ return;
+ }
+ const strJson = JSON.stringify(globalThis.__coverage__);
+ let testMode = globalThis.__testMode__;
+ console.info(`${TAG} coverage data testMode: ${testMode}`)
+ let savePath = globalThis.__savePath__;
+ console.info(`${TAG} write coverage data to: ${savePath}`);
+ let readPath = globalThis.__readPath__;
+ console.info(`${TAG} read coverage data in: ${readPath}`);
+
+ // run callback mode if local test or (save path and read path ) is not defined
+ if (!testMode || !isCoveragePathValid(savePath)) {
+ console.info(`${TAG} run coverage data in call back mode`)
+ const strLen = strJson.length;
+ const maxLen = 500;
+ const maxCount = Math.floor(strLen / maxLen);
+ const OHOS_REPORT_COVERAGE_DATA = 'OHOS_REPORT_COVERAGE_DATA:';
+ for (let count = 0; count <= maxCount; count++) {
+ console.info(`${OHOS_REPORT_COVERAGE_DATA} ${strJson.substring(count * maxLen, (count + 1) * maxLen)}`);
+ await SysTestKit.print(`${OHOS_REPORT_COVERAGE_DATA} ${strJson.substring(count * maxLen, (count + 1) * maxLen)}`);
+ }
+ return;
+ }
+ console.info(`${TAG} run coverage data in save file mode`);
+ if(fs.accessSync(savePath)) {
+ fs.unlinkSync(savePath)
+ }
+
+ let inputPathDir = savePath.substring(0, savePath.length - jsCoverageFileName.length);
+ if (!fs.accessSync(inputPathDir)) {
+ console.info(`${TAG} coverage data create dir: ${inputPathDir}`);
+ fs.mkdirSync(inputPathDir)
+ }
+
+ let file = fs.openSync(savePath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
+ let writeLen = fs.writeSync(file.fd, strJson, {encoding:"utf-8"});
+ console.info(`${TAG} write coverage data success: ${writeLen}`);
+ fs.closeSync(file);
+ const OHOS_REPORT_COVERAGE_PATH = 'OHOS_REPORT_COVERAGE_PATH:';
+ await SysTestKit.print(`${OHOS_REPORT_COVERAGE_PATH} ${readPath}`);
+ console.info(`${OHOS_REPORT_COVERAGE_PATH} ${readPath}`);
+}
+
+function isCoveragePathValid(inputPath) {
+ if (!inputPath) {
+ return false;
+ }
+ if (inputPath.indexOf(jsCoverageFileName) === -1) {
+ return false;
+ }
+ return true;
+}
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/kit/SysTestKit.js b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/kit/SysTestKit.js
new file mode 100644
index 0000000000000000000000000000000000000000..86173be050350e7284d17842abb0d23d3c1d97bb
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/kit/SysTestKit.js
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2022-2023 Huawei Device 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 {TAG} from '../../Constant';
+import Core from '../../core.js';
+
+export default class SysTestKit {
+
+ static delegator = null;
+ static systemTime = null;
+
+ constructor() {
+ this.id = 'sysTestKit';
+ this.index = 0;
+ }
+
+ static getDescribeName() {
+ return Core.getInstance().getDefaultService('suite').getCurrentRunningSuite().description;
+ }
+
+ static getItName() {
+ return Core.getInstance().getDefaultService('spec').getCurrentRunningSpec().description;
+ }
+
+ static getItAttribute() {
+ return Core.getInstance().getDefaultService('spec').getCurrentRunningSpec().fi;
+ }
+
+ static actionStart(tag) {
+ console.info(`${TAG}${JSON.stringify(tag)}`);
+ var message = '\n' + 'OHOS_REPORT_ACTIONSTART: ' + JSON.stringify(tag) + '\n';
+ SysTestKit.print(message);
+ console.info(`${TAG}${JSON.stringify(tag)} actionStart print success`);
+ }
+
+ static actionEnd(tag) {
+ console.info(`${TAG}${JSON.stringify(tag)}`);
+ var message = '\n' + 'OHOS_REPORT_ACTIONEND: ' + JSON.stringify(tag) + '\n';
+ SysTestKit.print(message);
+ console.info(`${TAG}${JSON.stringify(tag)} actionEnd print success`);
+ }
+
+ static async existKeyword(keyword, timeout) {
+ let reg = new RegExp(/^[a-zA-Z0-9]{1,}$/);
+ if (!reg.test(keyword)) {
+ throw new Error('keyword must contain more than one string, and only letters and numbers are supported.');
+ }
+ timeout = timeout || 4;
+
+ let searchResult = false;
+ let cmd = 'hilog -x | grep -i \'' + keyword + '\' | wc -l';
+ await executePromise(cmd, timeout).then((data) => {
+ searchResult = data;
+ });
+ return searchResult;
+ }
+ static async print(message) {
+ if ('printSync' in SysTestKit.delegator) {
+ console.debug(`${TAG}printSync called ...`);
+ SysTestKit.delegator.printSync(message);
+ } else {
+ await SysTestKit.delegator.print(message);
+ }
+ }
+
+ static async getRealTime() {
+ let currentTime = new Date().getTime();
+ if (SysTestKit.systemTime !== null && SysTestKit.systemTime !== undefined) {
+ await SysTestKit.systemTime.getRealTime().then((time) => {
+ console.info(`${TAG}systemTime.getRealTime success data: ${JSON.stringify(time)}`);
+ currentTime = time;
+ }).catch((error) => {
+ console.error(`${TAG}failed to systemTime.getRealTime because ${JSON.stringify(error)}`);
+ });
+ }
+ return currentTime;
+ }
+}
+
+function executePromise(cmd, timeout) {
+ return new Promise((resolve, reject) => {
+ SysTestKit.delegator.executeShellCommand(cmd, timeout,
+ (error, data) => {
+ console.info(`${TAG}existKeyword CallBack: err : ${JSON.stringify(error)}`);
+ console.info(`${TAG}existKeyword CallBack: data : ${JSON.stringify(data)}`);
+ resolve(parseInt(data.stdResult) > 3 ? true : false);
+ });
+ });
+}
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/mock/ArgumentMatchers.js b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/mock/ArgumentMatchers.js
new file mode 100644
index 0000000000000000000000000000000000000000..6a9d7aac464e95383ea31385284b6603c34e084c
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/mock/ArgumentMatchers.js
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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.
+ */
+
+class ArgumentMatchers {
+ ANY = "";
+ ANY_STRING = "";
+ ANY_BOOLEAN = "";
+ ANY_NUMBER = "";
+ ANY_OBJECT = "";
+ ANY_FUNCTION = "";
+ MATCH_REGEXS = "";
+
+ static any() {
+ }
+
+ static anyString() {
+ }
+
+ static anyBoolean() {
+ }
+
+ static anyNumber() {
+ }
+
+ static anyObj() {
+ }
+
+ static anyFunction() {
+ }
+
+ static matchRegexs() {
+ let regex = arguments[0];
+ if (ArgumentMatchers.isRegExp(regex)) {
+ return regex;
+ }
+ throw Error("not a regex");
+ }
+
+ static isRegExp(value) {
+ return Object.prototype.toString.call(value) === "[object RegExp]";
+ }
+
+ matcheReturnKey() {
+ let arg = arguments[0];
+ let regex = arguments[1];
+ let stubSetKey = arguments[2];
+
+ if (stubSetKey && stubSetKey == this.ANY) {
+ return this.ANY;
+ }
+
+ if (typeof arg === "string" && !regex) {
+ return this.ANY_STRING;
+ }
+
+ if (typeof arg === "boolean" && !regex) {
+ return this.ANY_BOOLEAN;
+ }
+
+ if (typeof arg === "number" && !regex) {
+ return this.ANY_NUMBER;
+ }
+
+ if (typeof arg === "object" && !regex) {
+ return this.ANY_OBJECT;
+ }
+
+ if (typeof arg === "function" && !regex) {
+ return this.ANY_FUNCTION;
+ }
+
+ if (typeof arg === "string" && regex) {
+ return regex.test(arg);
+ }
+
+ return null;
+ }
+
+ matcheStubKey() {
+ let key = arguments[0];
+
+ if (key === ArgumentMatchers.any) {
+ return this.ANY;
+ }
+
+ if (key === ArgumentMatchers.anyString) {
+ return this.ANY_STRING;
+ }
+ if (key === ArgumentMatchers.anyBoolean) {
+ return this.ANY_BOOLEAN;
+ }
+ if (key === ArgumentMatchers.anyNumber) {
+ return this.ANY_NUMBER;
+ }
+ if (key === ArgumentMatchers.anyObj) {
+ return this.ANY_OBJECT;
+ }
+ if (key === ArgumentMatchers.anyFunction) {
+ return this.ANY_FUNCTION;
+ }
+
+ if (ArgumentMatchers.isRegExp(key)) {
+ return key;
+ }
+
+ return null;
+ }
+}
+
+export default ArgumentMatchers;
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/mock/ExtendInterface.js b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/mock/ExtendInterface.js
new file mode 100644
index 0000000000000000000000000000000000000000..c6a866a6df662ad10a7f6869dcbc2381fa47bcdc
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/mock/ExtendInterface.js
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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.
+ */
+
+class ExtendInterface {
+ constructor(mocker) {
+ this.mocker = mocker;
+ }
+
+ stub() {
+ this.params = arguments;
+ return this;
+ }
+
+ stubMockedCall(returnInfo) {
+ this.mocker.stubApply(this, this.params, returnInfo);
+ }
+
+ afterReturn(value) {
+ this.stubMockedCall(function () {
+ return value;
+ });
+ }
+
+ afterReturnNothing() {
+ this.stubMockedCall(function () {
+ return undefined;
+ });
+ }
+
+ afterAction(action) {
+ this.stubMockedCall(action);
+ }
+
+ afterThrow(msg) {
+ this.stubMockedCall(function () {
+ throw msg;
+ });
+ }
+
+ clear() {
+ this.mocker.clear();
+ }
+}
+
+export default ExtendInterface;
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/mock/MockKit.js b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/mock/MockKit.js
new file mode 100644
index 0000000000000000000000000000000000000000..6e9e19ab7baa7fe024496e28f4f97abd9a7db9b4
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/mock/MockKit.js
@@ -0,0 +1,256 @@
+/*
+ * Copyright (c) 2022-2023 Huawei Device 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 ExtendInterface from "./ExtendInterface";
+import VerificationMode from "./VerificationMode";
+import ArgumentMatchers from "./ArgumentMatchers";
+
+class MockKit {
+
+ constructor() {
+ this.mFunctions = [];
+ this.stubs = new Map();
+ this.recordCalls = new Map();
+ this.currentSetKey = new Map();
+ this.mockObj = null;
+ this.recordMockedMethod = new Map();
+ }
+
+ init() {
+ this.reset();
+ }
+
+ reset() {
+ this.mFunctions = [];
+ this.stubs = {};
+ this.recordCalls = {};
+ this.currentSetKey = new Map();
+ this.mockObj = null;
+ this.recordMockedMethod = new Map();
+ }
+
+ clearAll() {
+ this.reset();
+ var props = Object.keys(this);
+ for (var i = 0; i < props.length; i++) {
+ delete this[props[i]];
+ }
+
+ var props = Object.getOwnPropertyNames(this);
+ for (var i = 0; i < props.length; i++) {
+ delete this[props[i]];
+ }
+ for (var key in this) {
+ delete this[key];
+ }
+ }
+
+ clear(obj) {
+ if (!obj) throw Error("Please enter an object to be cleaned");
+ if (typeof (obj) !== 'object' && typeof (obj) !== 'function') throw new Error('Not a object or static class');
+ this.recordMockedMethod.forEach(function (value, key, map) {
+ if (key) {
+ obj[key] = value;
+ }
+ });
+ }
+
+ ignoreMock(obj, method) {
+ if (typeof (obj) !== 'object' && typeof (obj) !== 'function') throw new Error('Not a object or static class');
+ if (typeof (method) !== 'function') throw new Error('Not a function');
+ let og = this.recordMockedMethod.get(method.propName);
+ if (og) {
+ obj[method.propName] = og;
+ this.recordMockedMethod.set(method.propName, undefined);
+ }
+ }
+
+ extend(dest, source) {
+ dest["stub"] = source["stub"];
+ dest["afterReturn"] = source["afterReturn"];
+ dest["afterReturnNothing"] = source["afterReturnNothing"];
+ dest["afterAction"] = source["afterAction"];
+ dest["afterThrow"] = source["afterThrow"];
+ dest["stubMockedCall"] = source["stubMockedCall"];
+ dest["clear"] = source["clear"];
+ return dest;
+ }
+
+ stubApply(f, params, returnInfo) {
+ let values = this.stubs.get(f);
+ if (!values) {
+ values = new Map();
+ }
+ let key = params[0];
+ if (typeof key == "undefined") {
+ key = "anonymous-mock-" + f.propName;
+ }
+ let matcher = new ArgumentMatchers();
+ if (matcher.matcheStubKey(key)) {
+ key = matcher.matcheStubKey(key);
+ if (key) {
+ this.currentSetKey.set(f, key);
+ }
+ }
+ values.set(key, returnInfo);
+ this.stubs.set(f, values);
+ }
+
+ getReturnInfo(f, params) {
+ let values = this.stubs.get(f);
+ if (!values) {
+ return undefined;
+ }
+ let retrunKet = params[0];
+ if (typeof retrunKet == "undefined") {
+ retrunKet = "anonymous-mock-" + f.propName;
+ }
+ let stubSetKey = this.currentSetKey.get(f);
+
+ if (stubSetKey && (typeof (retrunKet) !== "undefined")) {
+ retrunKet = stubSetKey;
+ }
+ let matcher = new ArgumentMatchers();
+ if (matcher.matcheReturnKey(params[0], undefined, stubSetKey) && matcher.matcheReturnKey(params[0], undefined, stubSetKey) !== stubSetKey) {
+ retrunKet = params[0];
+ }
+
+ values.forEach(function (value, key, map) {
+ if (ArgumentMatchers.isRegExp(key) && matcher.matcheReturnKey(params[0], key)) {
+ retrunKet = key;
+ }
+ });
+
+ return values.get(retrunKet);
+ }
+
+ findName(obj, value) {
+ let properties = this.findProperties(obj);
+ let name = null;
+ properties.filter(item => (item !== 'caller' && item !== 'arguments')).forEach(
+ function (va1, idx, array) {
+ if (obj[va1] === value) {
+ name = va1;
+ }
+ }
+ );
+ return name;
+ }
+
+ isFunctionFromPrototype(f, container, propName) {
+ if (container.constructor !== Object && container.constructor.prototype !== container) {
+ return container.constructor.prototype[propName] === f;
+ }
+ return false;
+ }
+
+ findProperties(obj, ...arg) {
+ function getProperty(new_obj) {
+ if (new_obj.__proto__ === null) {
+ return [];
+ }
+ let properties = Object.getOwnPropertyNames(new_obj);
+ return [...properties, ...getProperty(new_obj.__proto__)];
+ }
+ return getProperty(obj);
+ }
+
+ recordMethodCall(originalMethod, args) {
+ Function.prototype.getName = function () {
+ return this.name || this.toString().match(/function\s*([^(]*)\(/)[1];
+ };
+ let name = originalMethod.getName();
+ let arglistString = name + '(' + Array.from(args).toString() + ')';
+ let records = this.recordCalls.get(arglistString);
+ if (!records) {
+ records = 0;
+ }
+ records++;
+ this.recordCalls.set(arglistString, records);
+ }
+
+ mockFunc(originalObject, originalMethod) {
+ let tmp = this;
+ this.originalMethod = originalMethod;
+ let f = function () {
+ let args = arguments;
+ let action = tmp.getReturnInfo(f, args);
+ if (originalMethod) {
+ tmp.recordMethodCall(originalMethod, args);
+ }
+ if (action) {
+ return action.apply(this, args);
+ }
+ };
+
+ f.container = null || originalObject;
+ f.original = originalMethod || null;
+
+ if (originalObject && originalMethod) {
+ if (typeof (originalMethod) !== 'function') throw new Error('Not a function');
+ var name = this.findName(originalObject, originalMethod);
+ originalObject[name] = f;
+ this.recordMockedMethod.set(name, originalMethod);
+ f.propName = name;
+ f.originalFromPrototype = this.isFunctionFromPrototype(f.original, originalObject, f.propName);
+ }
+ f.mocker = this;
+ this.mFunctions.push(f);
+ this.extend(f, new ExtendInterface(this));
+ return f;
+ }
+
+ verify(methodName, argsArray) {
+ if (!methodName) {
+ throw Error("not a function name");
+ }
+ let a = this.recordCalls.get(methodName + '(' + argsArray.toString() + ')');
+ return new VerificationMode(a ? a : 0);
+ }
+
+ mockObject(object) {
+ if (!object || typeof object === "string") {
+ throw Error(`this ${object} cannot be mocked`);
+ }
+ const _this = this;
+ let mockedObject = {};
+ let keys = Reflect.ownKeys(object);
+ keys.filter(key => (typeof Reflect.get(object, key)) === 'function')
+ .forEach(key => {
+ mockedObject[key] = object[key];
+ mockedObject[key] = _this.mockFunc(mockedObject, mockedObject[key]);
+ });
+ return mockedObject;
+ }
+}
+
+function ifMockedFunction(f) {
+ if (Object.prototype.toString.call(f) !== "[object Function]" &&
+ Object.prototype.toString.call(f) !== "[object AsyncFunction]") {
+ throw Error("not a function");
+ }
+ if (!f.stub) {
+ throw Error("not a mock function");
+ }
+ return true;
+}
+
+function when(f) {
+ if (ifMockedFunction(f)) {
+ return f.stub.bind(f);
+ }
+}
+
+export {MockKit, when};
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/mock/VerificationMode.js b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/mock/VerificationMode.js
new file mode 100644
index 0000000000000000000000000000000000000000..28eda2b05fa5ec9f78f9b20d1be1b6c87ffaf33b
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/mock/VerificationMode.js
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2022-2023 Huawei Device 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 {expect} from '../../interface';
+
+class VerificationMode {
+ constructor(times) {
+ this.doTimes = times;
+ }
+
+ times(count) {
+ expect(count).assertEqual(this.doTimes);
+ }
+
+ never() {
+ console.log(this.doTimes);
+ expect(0).assertEqual(this.doTimes);
+ }
+
+ once() {
+ expect(1).assertEqual(this.doTimes);
+ }
+
+ atLeast(count) {
+ if (count > this.doTimes) {
+ throw Error('failed ' + count + ' greater than the actual execution times of method');
+ }
+ }
+
+ atMost(count) {
+ if (count < this.doTimes) {
+ throw Error('failed ' + count + ' less than the actual execution times of method');
+ }
+ }
+}
+
+export default VerificationMode;
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/report/LogExpectError.js b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/report/LogExpectError.js
new file mode 100644
index 0000000000000000000000000000000000000000..f2aede62f86d762524a59fba0eeacf959f1a846c
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/report/LogExpectError.js
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2024 Huawei Device 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.
+ */
+
+class LogExpectError {
+ static getErrorMsg(matcherName, actualValue, expect, originMsg) {
+ if (matcherName === "assertNull") {
+ return "expect not null, actualValue is " + (actualValue)
+ }
+ if (matcherName === "assertTrue") {
+ return "expect not true, actualValue is " + (actualValue)
+ }
+ if (matcherName === "assertFalse") {
+ return "expect not false, actualValue is " + (actualValue)
+ }
+ if (matcherName === "assertEqual") {
+ return "expect not Equal, actualValue is "
+ + actualValue + ' equals ' + expect;
+ }
+ if (matcherName === "assertContain") {
+ return "expect not have, " + actualValue + " have " + expect;
+ }
+ if (matcherName === "assertInstanceOf") {
+ return "expect not InstanceOf, "
+ + actualValue + ' is '
+ + Object.prototype.toString.call(actualValue) + expect;
+ }
+ if (matcherName === "assertLarger") {
+ return "expect not Larger, "
+ + (actualValue) + ' is larger than ' + expect;
+ }
+ if (matcherName === "assertLargerOrEqual") {
+ return "expect not LargerOrEqual, "
+ + (actualValue) + ' larger than ' + expect;
+ }
+ if (matcherName === "assertLess") {
+ return "expect not Less, "
+ + (actualValue) + ' less than ' + expect;
+ }
+ if (matcherName === "assertLessOrEqual") {
+ return "expect not LessOrEqual, "
+ + (actualValue) + ' is less than ' + expect;
+ }
+ if (matcherName === "assertNaN") {
+ return "expect not NaN, actualValue is " + (actualValue)
+ }
+ if (matcherName === "assertNegUnlimited") {
+ return "expect not NegUnlimited, actualValue is " + (actualValue)
+ }
+ if (matcherName === "assertPosUnlimited") {
+ return "expect not PosUnlimited, actualValue is " + (actualValue)
+ }
+ if (matcherName === "assertUndefined") {
+ return "expect not Undefined, actualValue is " + (actualValue)
+ }
+ return originMsg;
+ }
+}
+export default LogExpectError
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/report/OhReport.js b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/report/OhReport.js
new file mode 100644
index 0000000000000000000000000000000000000000..529c003cfb8a11f2ddaf24f8884301d4e8e39dd0
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/report/OhReport.js
@@ -0,0 +1,186 @@
+/*
+ * Copyright (c) 2021-2024 Huawei Device 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 SysTestKit from "../kit/SysTestKit";
+import { collectCoverageData } from '../coverage/coverageCollect';
+import { TAG } from '../../Constant';
+
+class OhReport {
+ constructor(attr) {
+ this.delegator = attr.delegator;
+ this.abilityDelegatorArguments = attr.abilityDelegatorArguments;
+ this.id = 'report';
+ this.index = 0;
+ this.duration = 0;
+ }
+
+ init(coreContext) {
+ this.coreContext = coreContext;
+ this.suiteService = this.coreContext.getDefaultService('suite');
+ this.specService = this.coreContext.getDefaultService('spec');
+ }
+
+ taskStart() {
+ }
+
+ async taskDone() {
+ if (this.abilityDelegatorArguments !== null) {
+ this.taskDoneTime = new Date().getTime();
+ let summary = this.suiteService.getSummary();
+ const configService = this.coreContext.getDefaultService('config');
+ const suiteService = this.coreContext.getDefaultService('suite');
+ const specService = this.coreContext.getDefaultService('spec');
+ if (configService['coverage'] === 'true') {
+ await collectCoverageData();
+ }
+ let message = '\n' + 'OHOS_REPORT_RESULT: stream=Tests run: ' + summary.total + ', Failure: ' + summary.failure;
+ message += ', Error: ' + summary.error;
+ message += ', Pass: ' + summary.pass;
+ message += ', Ignore: ' + summary.ignore;
+ if (specService.skipSpecNum > 0) {
+ message += ', SkipSpec: ' + specService.skipSpecNum;
+ }
+ message += '\n' + 'OHOS_REPORT_CODE: ' + (summary.failure > 0 ? -1 : 0) + '\n';
+ let isHasError = summary.failure > 0 || summary.error > 0;
+ let config = this.coreContext.getDefaultService('config');
+ if (config.isBreakOnError() && isHasError) {
+ // 未执行全部说明
+ message += '\n' + 'OHOS_REPORT_RESULT: breakOnError model, Stopping whole test suite if one specific test case failed or error' + '\n';
+ }
+ message += 'OHOS_REPORT_STATUS: taskconsuming=' + summary.duration + '\n';
+ console.info(`${message}`);
+ await SysTestKit.print(message);
+ }
+ console.info(`${TAG}report print success`);
+ this.delegator.finishTest('your test finished!!!', 0, () => { });
+ }
+
+ incorrectFormat() {
+ if (this.coreContext.getDefaultService('config').filterValid.length !== 0) {
+ var value = this.coreContext.getDefaultService('config').filterValid;
+ var message = 'this param ' + value.join(',') + ' is invalid' + '\n';
+ this.delegator.finishTest(message, 0, () => {
+ });
+ }
+ }
+
+ incorrectTestSuiteFormat() {
+ if (this.coreContext.getDefaultService('config').filterXdescribe.length !== 0) {
+ let value = this.coreContext.getDefaultService('config').filterXdescribe;
+ let message = 'xdescribe ' + value.join(',') + ' should not contain it' + '\n';
+ this.delegator.finishTest(message, 0, () => {
+ });
+ }
+ }
+ async suiteStart() {
+ if (this.abilityDelegatorArguments !== null) {
+ let specArr = [];
+ this.suiteService.getAllChildSuiteNum(this.suiteService.getCurrentRunningSuite(), specArr);
+ let message = '\n' + 'OHOS_REPORT_SUM: ' + specArr.length;
+ this.suiteService.setCurrentRunningSuiteDesc(this.suiteService.getRootSuite(), this.suiteService.getCurrentRunningSuite(), '');
+ message += '\n' + 'OHOS_REPORT_STATUS: class=' + this.suiteService.getCurrentRunningSuiteDesc() + '\n';
+ if (this.suiteService.currentRunningSuite.isSkip) {
+ message += 'OHOS_REPORT_STATUS: skipReason=' + this.suiteService.currentRunningSuite.skipReason + '\n';
+ }
+ console.info(`${message}`);
+ await SysTestKit.print(message);
+ console.info(`${TAG}${this.suiteService.getCurrentRunningSuite().description} suiteStart print success`);
+ }
+ }
+
+ async suiteDone() {
+ if (this.abilityDelegatorArguments !== null) {
+ const currentRunningSuite = this.suiteService.getCurrentRunningSuite();
+ this.suiteService.setCurrentRunningSuiteDesc(this.suiteService.getRootSuite(), this.suiteService.getCurrentRunningSuite(), '');
+ let message = '\n' + 'OHOS_REPORT_STATUS: class=' + this.suiteService.getCurrentRunningSuiteDesc();
+ if (this.suiteService.currentRunningSuite.isSkip && this.suiteService.currentRunningSuite.skipReason !== '') {
+ message += '\n' + 'OHOS_REPORT_STATUS: skipReason=' + this.suiteService.currentRunningSuite.skipReason;
+ }
+ message += '\n' + 'OHOS_REPORT_STATUS: suiteconsuming=' + this.suiteService.getCurrentRunningSuite().duration;
+ if (currentRunningSuite.hookError) {
+ message += '\n' + `OHOS_REPORT_STATUS: ${currentRunningSuite.hookError.message}`;
+ }
+ message += '\n';
+ console.info(`${message}`);
+ await SysTestKit.print(message);
+ console.info(`${TAG}${this.suiteService.getCurrentRunningSuite().description} suiteDone print success`);
+ }
+ }
+
+ async specStart() {
+ if (this.abilityDelegatorArguments !== null) {
+ let message = '\n' + 'OHOS_REPORT_STATUS: class=' + this.suiteService.getCurrentRunningSuiteDesc();
+ message += '\n' + 'OHOS_REPORT_STATUS: current=' + (++this.index);
+ message += '\n' + 'OHOS_REPORT_STATUS: id=JS';
+ message += '\n' + 'OHOS_REPORT_STATUS: numtests=' + this.specService.getTestTotal();
+ message += '\n' + 'OHOS_REPORT_STATUS: stream=';
+ message += '\n' + 'OHOS_REPORT_STATUS: test=' + this.specService.currentRunningSpec.description;
+ message += '\n' + 'OHOS_REPORT_STATUS_CODE: 1' + '\n';
+ if (this.specService.currentRunningSpec.isSkip) {
+ message += 'OHOS_REPORT_STATUS: skipReason=' + this.specService.currentRunningSpec.skipReason + '\n';
+ }
+ console.info(`${message}`);
+ await SysTestKit.print(message);
+ console.info(`${TAG}${this.specService.currentRunningSpec.description} specStart start print success`);
+ }
+ }
+
+ async specDone() {
+ if (this.abilityDelegatorArguments !== null) {
+ let message = '\n' + 'OHOS_REPORT_STATUS: class=' + this.suiteService.getCurrentRunningSuiteDesc();
+ message += '\n' + 'OHOS_REPORT_STATUS: current=' + (this.index);
+ message += '\n' + 'OHOS_REPORT_STATUS: id=JS';
+ message += '\n' + 'OHOS_REPORT_STATUS: numtests=' + this.specService.getTestTotal();
+ let messageStack = '';
+ let messageCode = '';
+ if (this.specService.currentRunningSpec.error) {
+ messageStack = 'OHOS_REPORT_STATUS: stack=' + this.specService.currentRunningSpec.error?.stack?.slice(0, -1);
+ messageCode += 'OHOS_REPORT_STATUS: stream=';
+ messageCode += this.specService.currentRunningSpec.expectMsg !== '' ?
+ `message: ${this.specService.currentRunningSpec.expectMsg}, Error in ${this.specService.currentRunningSpec.description}, ${this.specService.currentRunningSpec.error?.message}` :
+ `Error in ${this.specService.currentRunningSpec.description}, ${this.specService.currentRunningSpec.error?.message}`;
+ messageCode += '\n' + 'OHOS_REPORT_STATUS: test=' + this.specService.currentRunningSpec.description;
+ messageCode += '\n' + 'OHOS_REPORT_STATUS_CODE: -1' + '\n';
+ } else if (this.specService.currentRunningSpec) {
+ if (this.specService.currentRunningSpec.fail) {
+ messageStack += 'OHOS_REPORT_STATUS: stack=' + this.specService.currentRunningSpec.fail?.stack?.slice(0, -1);
+ messageCode += 'OHOS_REPORT_STATUS: stream=';
+ messageCode += this.specService.currentRunningSpec.expectMsg !== '' ?
+ `message: ${this.specService.currentRunningSpec.expectMsg}, Error in ${this.specService.currentRunningSpec.description}, ${this.specService.currentRunningSpec.fail?.message}` :
+ `Error in ${this.specService.currentRunningSpec.description}, ${this.specService.currentRunningSpec.fail?.message}`;
+ messageCode += '\n' + 'OHOS_REPORT_STATUS: test=' + this.specService.currentRunningSpec.description;
+ messageCode += '\n' + 'OHOS_REPORT_STATUS_CODE: -2' + '\n';
+ } else {
+ messageStack += 'OHOS_REPORT_STATUS: stream=';
+ messageCode += 'OHOS_REPORT_STATUS: test=' + this.specService.currentRunningSpec.description;
+ messageCode += '\n' + 'OHOS_REPORT_STATUS_CODE: 0' + '\n';
+ messageCode += this.specService.currentRunningSpec.isSkip ? ('OHOS_REPORT_STATUS: skipReason=' + this.specService.currentRunningSpec.skipReason + '\n') : '';
+ }
+ } else {
+ messageCode += '\n';
+ }
+ messageCode += 'OHOS_REPORT_STATUS: consuming=' + this.specService.currentRunningSpec.duration + '\n';
+ console.info(`${message}`);
+ console.info(`\n${messageStack}`);
+ console.info(`\n${messageCode}`);
+ await SysTestKit.print(message);
+ await SysTestKit.print(messageStack);
+ await SysTestKit.print(messageCode);
+ console.info(`${TAG}${this.specService.currentRunningSpec.description} specDone end print success`);
+ }
+ }
+}
+
+export default OhReport;
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/report/ReportExtend.js b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/report/ReportExtend.js
new file mode 100644
index 0000000000000000000000000000000000000000..852fbcd5cbf97e776ebe5177a029df0f516594a5
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/module/report/ReportExtend.js
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+class ReportExtend {
+ constructor(fileModule) {
+ this.id = 'extend';
+ this.fileModule = fileModule;
+ }
+
+ init(coreContext) {
+ this.coreContext = coreContext;
+ this.suiteService = this.coreContext.getDefaultService('suite');
+ }
+
+ taskStart() {
+
+ }
+
+ taskDone() {
+ const report = {
+ tag: 'testsuites',
+ name: 'summary_report',
+ timestamp: new Date().toDateString(),
+ time: '1',
+ errors: 0,
+ failures: 0,
+ tests: 0,
+ children: []
+ };
+ const rootSuite = this.suiteService.rootSuite;
+ if (rootSuite && rootSuite.childSuites) {
+ for (let testsuite of rootSuite.childSuites) {
+ let suiteReport = {
+ tag: 'testsuite',
+ name: testsuite['description'],
+ errors: 0,
+ tests: 0,
+ failures: 0,
+ time: '0.1',
+ children: []
+ };
+ let specs = testsuite['specs'];
+ for (let testcase of specs) {
+ report.tests++;
+ suiteReport.tests++;
+ let caseReport = {
+ tag: 'testcase',
+ name: testcase['description'],
+ status: 'run',
+ time: '0.0',
+ classname: testsuite['description']
+ };
+ if (testcase.error) {
+ caseReport['result'] = false;
+ caseReport['children'] = [{
+ tag: 'error',
+ type: '',
+ message: testcase.error.message
+ }];
+ report.errors++;
+ suiteReport.errors++;
+ } else if (testcase.result.failExpects.length > 0) {
+ caseReport['result'] = false;
+ let message = '';
+ testcase.result.failExpects.forEach(failExpect => {
+ message += failExpect.message || ('expect ' + failExpect.actualValue + ' ' + failExpect.checkFunc + ' ' + (failExpect.expectValue || '')) + ';';
+ });
+ caseReport['children'] = [{
+ tag: 'failure',
+ type: '',
+ message: message
+ }];
+ report.failures++;
+ suiteReport.failures++;
+ } else {
+ caseReport['result'] = true;
+ }
+ suiteReport.children.push(caseReport);
+ }
+ report.children.push(suiteReport);
+ }
+ }
+
+ let reportXml = '\n' + json2xml(report);
+ this.fileModule.writeText({
+ uri: 'internal://app/report.xml',
+ text: reportXml,
+ success: function () {
+ console.info('call success callback success');
+ },
+ fail: function (data, code) {
+ console.info('call fail callback success:');
+ },
+ complete: function () {
+ console.info('call complete callback success');
+ }
+ });
+ }
+}
+
+function json2xml(json) {
+ let tagName;
+ let hasChildren = false;
+ let childrenStr = '';
+ let attrStr = '';
+ for (let key in json) {
+ if (key === 'tag') {
+ tagName = json[key];
+ } else if (key === 'children') {
+ if (json[key].length > 0) {
+ hasChildren = true;
+ for (let child of json[key]) {
+ childrenStr += json2xml(child);
+ }
+ }
+ } else {
+ attrStr += ` ${key}="${json[key]}"`;
+ }
+ }
+ let xml = `<${tagName}${attrStr}`;
+ xml += hasChildren ? `>${childrenStr}${tagName}>` : '/>';
+ return xml;
+}
+
+export default ReportExtend;
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/service.js b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/service.js
new file mode 100644
index 0000000000000000000000000000000000000000..c9ea9b3218ee85d859aec61105bd67487d422a9b
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/service.js
@@ -0,0 +1,1217 @@
+/*
+ * Copyright (c) 2021-2024 Huawei Device 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 SysTestKit from "./module/kit/SysTestKit";
+import { TAG } from './Constant';
+import LogExpectError from './module/report/LogExpectError'
+import { NestFilter } from "./module/config/Filter";
+
+class AssertException extends Error {
+ constructor(message) {
+ super();
+ this.name = "AssertException";
+ this.message = message;
+ }
+}
+
+function getFuncWithArgsZero(func, timeout, isStressTest) {
+ return new Promise(async (resolve, reject) => {
+ let timer = null;
+ if (!isStressTest) {
+ timer = setTimeout(() => {
+ reject(new Error('execute timeout ' + timeout + 'ms'));
+ }, timeout);
+ }
+ try {
+ await func();
+ } catch (err) {
+ reject(err);
+ }
+ timer !== null ? clearTimeout(timer) : null;
+ resolve();
+ });
+}
+
+function getFuncWithArgsOne(func, timeout, isStressTest) {
+ return new Promise(async (resolve, reject) => {
+ let timer = null;
+ if (!isStressTest) {
+ timer = setTimeout(() => {
+ reject(new Error('execute timeout ' + timeout + 'ms'));
+ }, timeout);;
+ }
+
+ function done() {
+ timer !== null ? clearTimeout(timer) : null;
+ resolve();
+ }
+
+ try {
+ await func(done);
+ } catch (err) {
+ timer !== null ? clearTimeout(timer) : null;
+ reject(err);
+ }
+ });
+}
+
+function getFuncWithArgsTwo(func, timeout, paramItem, isStressTest) {
+ return new Promise(async (resolve, reject) => {
+ let timer = null;
+ if (!isStressTest) {
+ timer = setTimeout(() => {
+ reject(new Error('execute timeout ' + timeout + 'ms'));
+ }, timeout);
+ }
+
+ function done() {
+ timer !== null ? clearTimeout(timer) : null;
+ resolve();
+ }
+
+ try {
+ await func(done, paramItem);
+ } catch (err) {
+ timer !== null ? clearTimeout(timer) : null;
+ reject(err);
+ }
+ });
+}
+
+function processFunc(coreContext, func) {
+ let argNames = ((func || '').toString()
+ .replace(/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg, '')
+ .match(/^(function)?\s*[^\(]*\(\s*([^\)]*)\)/m) || ['', '', ''])[2]
+ .split(',') // split parameters
+ .map(item => item.replace(/^\s*(_?)(.+?)\1\s*$/, name => name.split('=')[0].trim()))
+ .filter(String);
+ let funcLen = func.length;
+ let processedFunc;
+ const config = coreContext.getDefaultService('config');
+ config.setSupportAsync(true);
+ const timeout = + (config.timeout === undefined ? 5000 : config.timeout);
+ const isStressTest = (coreContext.getServices('dataDriver') !== undefined || config.getStress() > 1);
+ switch (funcLen) {
+ case 0: {
+ processedFunc = function () {
+ return getFuncWithArgsZero(func, timeout, isStressTest);
+ };
+ break;
+ }
+ case 1: {
+ if (argNames[0] === 'data') {
+ processedFunc = function (paramItem) {
+ func(paramItem);
+ };
+ } else {
+ processedFunc = function () {
+ return getFuncWithArgsOne(func, timeout, isStressTest);
+ };
+ }
+ break;
+ }
+ default: {
+ processedFunc = function (paramItem) {
+ return getFuncWithArgsTwo(func, timeout, paramItem, isStressTest);
+ };
+ break;
+ }
+ }
+ return processedFunc;
+}
+
+function secureRandomNumber() {
+ return crypto.randomBytes(8).readUInt32LE() / 0xffffffff;
+}
+
+class SuiteService {
+ constructor(attr) {
+ this.id = attr.id;
+ this.rootSuite = new SuiteService.Suite({});
+ this.currentRunningSuite = this.rootSuite;
+ this.suitesStack = [this.rootSuite];
+ this.targetSuiteArray = [];
+ this.targetSpecArray = [];
+ this.currentRunningSuiteDesc = null;
+ this.fullRun = false;
+ this.isSkipSuite = false;
+ this.suiteSkipReason = null;
+ }
+
+ describe(desc, func) {
+ const configService = this.coreContext.getDefaultService('config');
+ if (this.suitesStack.some(suite => { return suite.description === desc })) {
+ console.error(`${TAG} Loop nesting occurs : ${desc}`);
+ this.suiteSkipReason = '';
+ this.isSkipSuite = false;
+ return;
+ }
+ let isFilter = this.analyzeConfigServiceClass(configService.class, desc);
+ if (configService.filterSuite(desc) && isFilter) {
+ if (this.currentRunningSuite.description === '' || this.currentRunningSuite.description == null) {
+ console.info(`${TAG}filter suite : ${desc}`);
+ this.suiteSkipReason = '';
+ this.isSkipSuite = false;
+ return;
+ }
+ }
+ const suite = new SuiteService.Suite({ description: desc });
+ if (this.isSkipSuite) {
+ suite.isSkip = true;
+ suite.skipReason = this.suiteSkipReason;
+ }
+ this.suiteSkipReason = '';
+ this.isSkipSuite = false;
+ if (typeof this.coreContext.getServices('dataDriver') !== 'undefined' && configService['dryRun'] !== 'true') {
+ let suiteStress = this.coreContext.getServices('dataDriver').dataDriver.getSuiteStress(desc);
+ for (let i = 1; i < suiteStress; i++) {
+ this.currentRunningSuite.childSuites.push(suite);
+ }
+ }
+ this.currentRunningSuite.childSuites.push(suite);
+ this.currentRunningSuite = suite;
+ this.suitesStack.push(suite);
+ func.call();
+ this.suitesStack.pop();
+ this.currentRunningSuite = this.suitesStack.pop();
+ this.suitesStack.push(this.currentRunningSuite);
+ }
+ xdescribe(desc, func, reason) {
+ const configService = this.coreContext.getDefaultService('config');
+ if (!configService.skipMessage && configService.runSkipped !== 'all') {
+ if (configService.runSkipped != null && configService.runSkipped !== '') {
+ let finalDesc = '';
+ this.suitesStack.map(suite => {
+ finalDesc = finalDesc + '.' + suite.description;
+ })
+ finalDesc = (finalDesc + '.' + desc).substring(2);
+ console.info(`${TAG} finalDesc ${finalDesc}`);
+ if (configService.checkIfSuiteInSkipRun(finalDesc)) {
+ console.log(`${TAG} runSkipped suite: ${desc}`);
+ } else {
+ console.log(reason == null ? `${TAG} skip suite: ${desc}` : `${TAG} skip suite: ${desc}, and the reason is ${reason}`);
+ return;
+ }
+ } else {
+ console.log(reason == null ? `${TAG} skip suite: ${desc}` : `${TAG} skip suite: ${desc}, and the reason is ${reason}`);
+ return;
+ }
+ }
+ this.isSkipSuite = true;
+ this.suiteSkipReason = reason;
+ this.describe(desc, func);
+ }
+
+ beforeAll(func) {
+ this.currentRunningSuite.beforeAll.push(processFunc(this.coreContext, func));
+ }
+
+ beforeEach(func) {
+ this.currentRunningSuite.beforeEach.push(processFunc(this.coreContext, func));
+ }
+
+ beforeItSpecified(itDescs, func) {
+ this.currentRunningSuite.beforeItSpecified.set(itDescs, processFunc(this.coreContext, func));
+ }
+
+ afterItSpecified(itDescs, func) {
+ this.currentRunningSuite.afterItSpecified.set(itDescs, processFunc(this.coreContext, func));
+ }
+
+ afterAll(func) {
+ this.currentRunningSuite.afterAll.push(processFunc(this.coreContext, func));
+ }
+
+ afterEach(func) {
+ this.currentRunningSuite.afterEach.push(processFunc(this.coreContext, func));
+ }
+
+ getCurrentRunningSuite() {
+ return this.currentRunningSuite;
+ }
+
+ setCurrentRunningSuite(suite) {
+ this.currentRunningSuite = suite;
+ }
+
+ getRootSuite() {
+ return this.rootSuite;
+ }
+
+ getCurrentRunningSuiteDesc() {
+ return this.currentRunningSuiteDesc;
+ }
+
+
+ setCurrentRunningSuiteDesc(suite, currentSuite, prefix) {
+ if (suite != null && suite === currentSuite) {
+ this.currentRunningSuiteDesc = prefix;
+ } else if (suite != null && suite !== currentSuite) {
+ suite.childSuites.forEach(it => {
+ let temp = prefix;
+ if (it.description != null || it.description !== '') {
+ temp = prefix === '' ? it.description : prefix + "." + it.description;
+ }
+ this.setCurrentRunningSuiteDesc(it, currentSuite, temp);
+ }
+ )
+ }
+ }
+ analyzeConfigServiceClass(configServiceClass, desc) {
+ if (configServiceClass == null || configServiceClass === '') {
+ this.fullRun = true
+ return false;
+ }
+ if (this.targetSuiteArray.length === 0) {
+ const targetArray = configServiceClass.split(",")
+ for (let index in targetArray) {
+ if (targetArray[index].includes("#")) {
+ this.targetSpecArray.push(targetArray[index])
+ } else {
+ this.targetSuiteArray.push(targetArray[index])
+ }
+ }
+
+ }
+ return !configServiceClass.includes(desc);
+
+ }
+ traversalResults(suite, obj, breakOnError) {
+ if (suite.childSuites.length === 0 && suite.specs.length === 0) {
+ return obj;
+ }
+ if (suite.specs.length > 0) {
+ for (const itItem of suite.specs) {
+ obj.total++;
+ if (breakOnError && (obj.error > 0 || obj.failure > 0)) { // breakOnError模式
+ continue;
+ }
+ if (itItem.error) {
+ obj.error++;
+ } else if (itItem.fail) {
+ obj.failure++;
+ } else if (itItem.pass === true) {
+ obj.pass++;
+ }
+ }
+ }
+
+ obj.duration += suite.duration;
+
+ if (suite.childSuites.length > 0) {
+ for (const suiteItem of suite.childSuites) {
+ this.traversalResults(suiteItem, obj, breakOnError);
+ }
+ }
+ }
+
+ async setSuiteResults(suite, error, coreContext) {
+ if (suite.childSuites.length === 0 && suite.specs.length === 0) {
+ return obj;
+ }
+ if (suite.specs.length > 0) {
+ const specService = coreContext.getDefaultService('spec');
+ for (const specItem of suite.specs) {
+ specService.setCurrentRunningSpec(specItem);
+ if (error instanceof AssertException) {
+ specItem.fail = error;
+ } else {
+ specItem.error = error;
+ }
+ await coreContext.fireEvents('spec', 'specStart', specItem);
+ await coreContext.fireEvents('spec', 'specDone', specItem);
+ }
+ }
+ if (suite.childSuites.length > 0) {
+ for (const suiteItem of suite.childSuites) {
+ await this.setSuiteResults(suiteItem, error, coreContext);
+ }
+ }
+ }
+
+ getSummary() {
+ let suiteService = this.coreContext.getDefaultService('suite');
+ let rootSuite = suiteService.rootSuite;
+ const specService = this.coreContext.getDefaultService('spec');
+ const configService = this.coreContext.getDefaultService('config');
+ let breakOnError = configService.isBreakOnError();
+ let isError = specService.getStatus();
+ let isBreaKOnError = breakOnError && isError;
+ let obj = { total: 0, failure: 0, error: 0, pass: 0, ignore: 0, duration: 0 };
+ for (const suiteItem of rootSuite.childSuites) {
+ this.traversalResults(suiteItem, obj, isBreaKOnError);
+ }
+ obj.ignore = obj.total - obj.pass - obj.failure - obj.error;
+ return obj;
+ }
+
+ init(coreContext) {
+ this.coreContext = coreContext;
+ }
+
+ traversalSuites(suite, obj, configService) {
+ if (suite.childSuites.length === 0 && suite.specs.length === 0) {
+ return [];
+ }
+ if (suite.specs.length > 0) {
+ let itArray = [];
+ for (const itItem of suite['specs']) {
+ if (!configService.filterDesc(suite.description, itItem.description, itItem.fi, null)) {
+ itArray.push({ 'itName': itItem.description });
+ }
+ }
+ obj[suite.description] = itArray;
+ }
+ if (suite.childSuites.length > 0) {
+ let suiteArray = [];
+ for (const suiteItem of suite.childSuites) {
+ let suiteObj = {};
+ this.traversalSuites(suiteItem, suiteObj, configService);
+ if (!configService.filterSuite(suiteItem.description)) {
+ suiteArray.push(suiteObj);
+ }
+ }
+ obj.suites = suiteArray;
+ }
+ }
+
+ async dryRun(abilityDelegator) {
+ console.log(`${TAG} rootSuite : ` + JSON.stringify(this.rootSuite));
+ let obj = this.rootSuite;
+ let prefixStack = [];
+ let suiteArray = [];
+ let skipSuiteArray = [];
+ this.analyzeSuitesArray(prefixStack, suiteArray, skipSuiteArray, obj);
+ const configService = this.coreContext.getDefaultService('config');
+ let result;
+ if (configService.skipMessage) {
+ result = { "suites": suiteArray, "skipSuites": skipSuiteArray };
+ } else {
+ result = { "suites": suiteArray };
+ }
+ let strJson = JSON.stringify(result);
+ let strLen = strJson.length;
+ let maxLen = 500;
+ let maxCount = Math.floor(strLen / maxLen);
+ for (let count = 0; count <= maxCount; count++) {
+ await SysTestKit.print(strJson.substring(count * maxLen, (count + 1) * maxLen));
+ }
+ console.info(`${TAG}dryRun print success`);
+ abilityDelegator.finishTest('dry run finished!!!', 0, () => { });
+ }
+
+ //将suitesArray的嵌套结构展开成三层结构
+ analyzeSuitesArray(prefixStack, suiteArray, skipSuiteArray, obj) {
+ obj.childSuites.map(suite => {
+ if (suite.description != null && suite.description !== '') {
+ let prefix = '';
+ if (prefixStack.length > 0) {
+ prefix = prefixStack.join('.') + '.' + suite.description;
+ } else {
+ prefix = suite.description;
+ }
+ prefixStack.push(suite.description);
+ let temp = {};
+ temp[prefix] = [];
+ let skipTemp = {};
+ skipTemp[prefix] = [];
+ suite.specs.map(spec => {
+ let it = { 'itName': spec.description }
+ spec.isSkip ? skipTemp[prefix].push(it) : temp[prefix].push(it);
+ })
+ suiteArray.push(temp);
+ skipSuiteArray.push(skipTemp);
+ }
+ this.analyzeSuitesArray(prefixStack, suiteArray, skipSuiteArray, suite);
+ prefixStack.pop();
+ });
+ }
+ //获取当前测试套下的所有测试用例数量
+ getAllChildSuiteNum(suite, specArray) {
+ if (suite.specs != null) {
+ suite.specs.forEach(spec => specArray.push(spec));
+ }
+ if (suite.childSuites != null) {
+ suite.childSuites.forEach(it => this.getAllChildSuiteNum(it, specArray))
+ }
+ }
+
+ execute() {
+ const configService = this.coreContext.getDefaultService('config');
+ if (configService.filterValid.length !== 0) {
+ this.coreContext.fireEvents('task', 'incorrectFormat');
+ return;
+ }
+ if (configService.filterXdescribe.length !== 0) {
+ this.coreContext.fireEvents('task', 'incorrectTestSuiteFormat');
+ return;
+ }
+ if (configService.isRandom() && this.rootSuite.childSuites.length > 0) {
+ this.rootSuite.childSuites.sort(function () {
+ return Math.random().toFixed(1) > 0.5 ? -1 : 1;
+ });
+ this.currentRunningSuite = this.rootSuite.childSuites[0];
+ }
+ if (configService.isSupportAsync()) {
+ console.info(`${TAG} rootSuite:` + JSON.stringify(this.rootSuite));
+ let asyncExecute = async () => {
+ await this.coreContext.fireEvents('task', 'taskStart');
+ await this.rootSuite.asyncRun(this.coreContext);
+ };
+ asyncExecute().then(async () => {
+ await this.coreContext.fireEvents('task', 'taskDone');
+ });
+ } else {
+ console.info('${TAG} rootSuite:' + JSON.stringify(this.rootSuite));
+ this.coreContext.fireEvents('task', 'taskStart');
+ this.rootSuite.run(this.coreContext);
+ this.coreContext.fireEvents('task', 'taskDone');
+ }
+ }
+
+ apis() {
+ const _this = this;
+ return {
+ describe: function (desc, func) {
+ return _this.describe(desc, func);
+ },
+ xdescribe: function (desc, func, reason) {
+ return _this.xdescribe(desc, func, reason);
+ },
+ beforeItSpecified: function (itDescs, func) {
+ return _this.beforeItSpecified(itDescs, func);
+ },
+ afterItSpecified: function (itDescs, func) {
+ return _this.afterItSpecified(itDescs, func);
+ },
+ beforeAll: function (func) {
+ return _this.beforeAll(func);
+ },
+ beforeEach: function (func) {
+ return _this.beforeEach(func);
+ },
+ afterAll: function (func) {
+ return _this.afterAll(func);
+ },
+ afterEach: function (func) {
+ return _this.afterEach(func);
+ }
+ };
+ }
+}
+
+SuiteService.Suite = class {
+ constructor(attrs) {
+ this.description = attrs.description || '';
+ this.childSuites = [];
+ this.specs = [];
+ this.beforeAll = [];
+ this.afterAll = [];
+ this.beforeItSpecified = new Map();
+ this.afterItSpecified = new Map();
+ this.beforeEach = [];
+ this.afterEach = [];
+ this.duration = 0;
+ this.hookError = null;
+ this.isSkip = false;
+ this.skipReason = '';
+ }
+
+ pushSpec(spec) {
+ this.specs.push(spec);
+ }
+
+ removeSpec(desc) {
+ this.specs = this.specs.filter((item, index) => {
+ return item.description !== desc;
+ });
+ }
+
+ getSpecsNum() {
+ return this.specs.length;
+ }
+
+ isRun(coreContext) {
+ const configService = coreContext.getDefaultService('config');
+ const suiteService = coreContext.getDefaultService('suite');
+ const specService = coreContext.getDefaultService('spec');
+ let breakOnError = configService.isBreakOnError();
+ let isError = specService.getStatus();
+ return breakOnError && isError;
+ }
+
+ run(coreContext) {
+ const suiteService = coreContext.getDefaultService('suite');
+ suiteService.setCurrentRunningSuite(this);
+ if (this.description !== '') {
+ coreContext.fireEvents('suite', 'suiteStart', this);
+ }
+ this.runHookFunc('beforeAll');
+ if (this.specs.length > 0) {
+ const configService = coreContext.getDefaultService('config');
+ if (configService.isRandom()) {
+ this.specs.sort(function () {
+ return Math.random().toFixed(1) > 0.5 ? -1 : 1;
+ });
+ }
+ for (let spec in this.specs) {
+ let isBreakOnError = this.isRun(coreContext);
+ if (isBreakOnError) {
+ break;
+ }
+ this.runHookFunc('beforeEach');
+ spec.run(coreContext);
+ this.runHookFunc('afterEach');
+ }
+ }
+ if (this.childSuites.length > 0) {
+ for (let suite in this.childSuites) {
+ let isBreakOnError = this.isRun(coreContext);
+ if (isBreakOnError) {
+ break;
+ }
+ suite.run(coreContext);
+ suiteService.setCurrentRunningSuite(suite);
+ }
+ }
+ this.runHookFunc('afterAll');
+ if (this.description !== '') {
+ coreContext.fireEvents('suite', 'suiteDone');
+ }
+ }
+
+ async asyncRunSpecs(coreContext) {
+ const configService = coreContext.getDefaultService('config');
+ if (configService.isRandom()) {
+ this.specs.sort(function () {
+ return Math.random().toFixed(1) > 0.5 ? -1 : 1;
+ });
+ }
+ const specService = coreContext.getDefaultService('spec');
+ for (let specItem of this.specs) {
+ specService.setCurrentRunningSpec(specItem);
+ // 遇错即停模式,发现用例有问题,直接返回,不在执行后面的it
+ let isBreakOnError = this.isRun(coreContext);
+ if (isBreakOnError) {
+ console.log("break description :" + this.description);
+ break;
+ }
+ await coreContext.fireEvents('spec', 'specStart', specItem);
+ try {
+ for (const [itNames, hookFunc] of this.beforeItSpecified) {
+ if ((Object.prototype.toString.call(itNames) === '[object Array]' && itNames.includes(specItem.description)) ||
+ (Object.prototype.toString.call(itNames) === '[object String]' && itNames === specItem.description)) {
+ await Reflect.apply(hookFunc, null, []);
+ }
+ break;
+ }
+ await this.runAsyncHookFunc('beforeEach');
+ await specItem.asyncRun(coreContext);
+ for (const [itNames, hookFunc] of this.afterItSpecified) {
+ if ((Object.prototype.toString.call(itNames) === '[object Array]' && itNames.includes(specItem.description)) ||
+ (Object.prototype.toString.call(itNames) === '[object String]' && itNames === specItem.description)) {
+ await Reflect.apply(hookFunc, null, []);
+ }
+ break;
+ }
+ await this.runAsyncHookFunc('afterEach');
+ } catch (e) {
+ console.error(`${TAG}stack:${e?.stack}`);
+ console.error(`${TAG}stack end`);
+ if (e instanceof AssertException) {
+ specItem.fail = e;
+ } else {
+ specItem.error = e;
+ }
+ specService.setStatus(true);
+ }
+ specItem.setResult();
+ await coreContext.fireEvents('spec', 'specDone', specItem);
+ specService.setCurrentRunningSpec(null);
+ }
+ }
+
+ async asyncRunChildSuites(coreContext) {
+ for (let i = 0; i < this.childSuites.length; i++) {
+ // 遇错即停模式, 发现用例有问题,直接返回,不在执行后面的description
+ let isBreakOnError = this.isRun(coreContext);
+ if (isBreakOnError) {
+ console.log(`${TAG}break description : ${this.description}`);
+ break;
+ }
+ await this.childSuites[i].asyncRun(coreContext);
+ }
+ }
+
+ async asyncRun(coreContext) {
+ const suiteService = coreContext.getDefaultService('suite');
+ const specService = coreContext.getDefaultService('spec');
+
+ suiteService.setCurrentRunningSuite(this);
+ suiteService.suitesStack.push(this);
+ if (this.description !== '') {
+ await coreContext.fireEvents('suite', 'suiteStart', this);
+ }
+
+ try {
+ await this.runAsyncHookFunc('beforeAll');
+ } catch (error) {
+ console.error(`${TAG}${error?.stack}`);
+ this.hookError = error;
+ }
+
+ if (this.hookError !== null) {
+ specService.setStatus(true);
+ await suiteService.setSuiteResults(this, this.hookError, coreContext);
+ }
+
+ if (this.specs.length > 0 && this.hookError === null) {
+ await this.asyncRunSpecs(coreContext);
+ }
+
+ if (this.childSuites.length > 0 && this.hookError === null) {
+ await this.asyncRunChildSuites(coreContext);
+ }
+
+ try {
+ await this.runAsyncHookFunc('afterAll');
+ } catch (error) {
+ console.error(`${TAG}${error?.stack}`);
+ this.hookError = error;
+ specService.setStatus(true);
+ }
+
+ if (this.description !== '') {
+ await coreContext.fireEvents('suite', 'suiteDone');
+ let childSuite = suiteService.suitesStack.pop();
+ let currentRunningSuite = suiteService.suitesStack.pop();
+ suiteService.setCurrentRunningSuite(currentRunningSuite);
+ suiteService.suitesStack.push(currentRunningSuite);
+ }
+ }
+
+ runHookFunc(hookName) {
+ if (this[hookName] && this[hookName].length > 0) {
+ this[hookName].forEach(func => {
+ try {
+ func();
+ } catch (e) {
+ console.error(`${TAG}${e.stack}`);
+ }
+ });
+ }
+ }
+
+ async runAsyncHookFunc(hookName) {
+ for (const hookItem of this[hookName]) {
+ try {
+ await hookItem();
+ } catch (error) {
+ error['message'] += `, error in ${hookName} function`;
+ throw error;
+ }
+
+ }
+ }
+};
+
+class SpecService {
+ constructor(attr) {
+ this.id = attr.id;
+ this.totalTest = 0;
+ this.hasError = false;
+ this.skipSpecNum = 0;
+ this.isSkipSpec = false;
+ this.specSkipReason = '';
+ }
+
+ init(coreContext) {
+ this.coreContext = coreContext;
+ }
+
+ setCurrentRunningSpec(spec) {
+ this.currentRunningSpec = spec;
+ }
+
+ setStatus(obj) {
+ this.hasError = obj;
+ }
+
+ getStatus() {
+ return this.hasError;
+ }
+
+ getTestTotal() {
+ return this.totalTest;
+ }
+
+ getCurrentRunningSpec() {
+ return this.currentRunningSpec;
+ }
+
+
+ getSkipSpecNum() {
+ return this.skipSpecNum;
+ }
+
+ initSpecService() {
+ this.isSkipSpec = false;
+ this.specSkipReason = '';
+ }
+
+ it(desc, filter, func) {
+ const suiteService = this.coreContext.getDefaultService('suite');
+ const configService = this.coreContext.getDefaultService('config');
+ let isFilter = new NestFilter().filterNestName(suiteService.targetSuiteArray, suiteService.targetSpecArray, suiteService.suitesStack, desc);
+ if (configService.filterWithNest(desc, filter)) {
+ console.info(`${TAG}filter it :${desc}`);
+ this.initSpecService();
+ return;
+ }
+ if (configService.filterDesc(suiteService.currentRunningSuite.description, desc, filter, this.coreContext) && isFilter && !suiteService.fullRun) {
+ console.info(`${TAG}filter it :${desc}`);
+ this.initSpecService();
+ } else {
+ let processedFunc = processFunc(this.coreContext, func);
+ const spec = new SpecService.Spec({ description: desc, fi: filter, fn: processedFunc });
+ if (this.isSkipSpec) {
+ spec.isSkip = true;
+ spec.skipReason = this.specSkipReason;
+ }
+ this.initSpecService();
+ if (configService.runSkipped === 'skipped' && !spec.isSkip) {
+ console.info(`${TAG} runSkipped is skipped , just run xit, don't run it: ${spec.description}`);
+ return;
+ }
+ if (suiteService.getCurrentRunningSuite().isSkip && !spec.isSkip) {
+ configService.filterXdescribe.push(suiteService.getCurrentRunningSuite().description);
+ }
+ if (typeof this.coreContext.getServices('dataDriver') !== 'undefined' && configService['dryRun'] !== 'true') {
+ let specStress = this.coreContext.getServices('dataDriver').dataDriver.getSpecStress(desc);
+ for (let i = 1; i < specStress; i++) {
+ this.totalTest++;
+ suiteService.getCurrentRunningSuite().pushSpec(spec);
+ }
+ }
+ // dryRun 状态下不统计压力测试重复数据
+ if (configService['dryRun'] !== 'true') {
+ let stress = configService.getStress(); // 命令配置压力测试
+ console.info(`${TAG}stress length : ${stress}`);
+ for (let i = 1; i < stress; i++) {
+ this.totalTest++;
+ suiteService.getCurrentRunningSuite().pushSpec(spec);
+ }
+ }
+ this.totalTest++;
+ suiteService.getCurrentRunningSuite().pushSpec(spec);
+ }
+ }
+
+ xit(desc, filter, func, reason) {
+ const configService = this.coreContext.getDefaultService('config');
+ const suiteService = this.coreContext.getDefaultService('suite');
+ if (!configService.skipMessage && configService.runSkipped !== 'all') {
+ if (configService.runSkipped != null && configService.runSkipped !== '') {
+ let finalDesc = '';
+ suiteService.suitesStack.map(suite => {
+ finalDesc = finalDesc + '.' + suite.description;
+ })
+ finalDesc = (finalDesc + "#" + desc).substring(2);
+ if (configService.checkIfSpecInSkipRun(finalDesc)) {
+ console.log(`${TAG} runSkipped spec: ${desc}`);
+ } else {
+ console.log(reason == null ? `${TAG} skip spec: ${desc}` : `${TAG} skip spec: ${desc}, and the reason is ${reason}`);
+ return;
+ }
+ } else {
+ console.log(reason == null ? `${TAG} skip spec: ${desc}` : `${TAG} skip spec: ${desc}, and the reason is ${reason}`);
+ return;
+ }
+ }
+ this.skipSpecNum++;
+ this.isSkipSpec = true;
+ this.specSkipReason = reason;
+ this.it(desc, filter, func);
+ }
+
+ apis() {
+ const _this = this;
+ return {
+ it: function (desc, filter, func) {
+ return _this.it(desc, filter, func);
+ },
+ xit: function (desc, filter, func, reason) {
+ return _this.xit(desc, filter, func, reason);
+ }
+ };
+ }
+}
+
+SpecService.Spec = class {
+ constructor(attrs) {
+ this.description = attrs.description || '';
+ this.fi = attrs.fi;
+ this.fn = attrs.fn || function () {
+ };
+ this.fail = undefined;
+ this.error = undefined;
+ this.duration = 0;
+ this.startTime = 0;
+ this.isExecuted = false; // 当前用例是否执行
+ this.isSkip = false;
+ this.skipReason = '';
+ this.expectMsg = '';
+ }
+
+ setResult() {
+ if (this.fail) {
+ this.pass = false;
+ } else {
+ this.pass = true;
+ }
+ }
+
+ run(coreContext) {
+ const specService = coreContext.getDefaultService('spec');
+ specService.setCurrentRunningSpec(this);
+ coreContext.fireEvents('spec', 'specStart', this);
+ this.isExecuted = true;
+ try {
+ let dataDriver = coreContext.getServices('dataDriver');
+ if (typeof dataDriver === 'undefined') {
+ this.fn();
+ } else {
+ let suiteParams = dataDriver.dataDriver.getSuiteParams();
+ let specParams = dataDriver.dataDriver.getSpecParams();
+ console.info(`${TAG}[suite params] ${JSON.stringify(suiteParams)}`);
+ console.info(`${TAG}[spec params] ${JSON.stringify(specParams)}`);
+ if (this.fn.length === 0) {
+ this.fn();
+ } else if (specParams.length === 0) {
+ this.fn(suiteParams);
+ } else {
+ specParams.forEach(paramItem => this.fn(Object.assign({}, paramItem, suiteParams)));
+ }
+ }
+ this.setResult();
+ } catch (e) {
+ this.error = e;
+ specService.setStatus(true);
+ }
+ coreContext.fireEvents('spec', 'specDone', this);
+ }
+
+ async asyncRun(coreContext) {
+ const dataDriver = coreContext.getServices('dataDriver');
+ if (typeof dataDriver === 'undefined') {
+ await this.fn();
+ } else {
+ const suiteParams = dataDriver.dataDriver.getSuiteParams();
+ const specParams = dataDriver.dataDriver.getSpecParams();
+ console.info(`[suite params] ${JSON.stringify(suiteParams)}`);
+ console.info(`[spec params] ${JSON.stringify(specParams)}`);
+ if (this.fn.length === 0) {
+ await this.fn();
+ } else if (specParams.length === 0) {
+ await this.fn(suiteParams);
+ } else {
+ for (const paramItem of specParams) {
+ await this.fn(Object.assign({}, paramItem, suiteParams));
+ }
+ }
+ }
+
+ this.isExecuted = true;
+ }
+
+ filterCheck(coreContext) {
+ const specService = coreContext.getDefaultService('spec');
+ specService.setCurrentRunningSpec(this);
+ return true;
+ }
+};
+
+class ExpectService {
+ constructor(attr) {
+ this.id = attr.id;
+ this.matchers = {};
+ this.customMatchers = [];
+ }
+
+ expect(actualValue) {
+ return this.wrapMatchers(actualValue);
+ }
+
+ init(coreContext) {
+ this.coreContext = coreContext;
+ this.addMatchers(this.basicMatchers());
+ }
+
+ addMatchers(matchers) {
+ for (const matcherName in matchers) {
+ if (Object.prototype.hasOwnProperty.call(matchers, matcherName)) {
+ this.matchers[matcherName] = matchers[matcherName];
+ }
+ }
+ }
+
+ removeMatchers(customAssertionName) {
+ if (customAssertionName === 'all') {
+ for (const matcherName in this.matchers) {
+ this.matchers[matcherName] = this.customMatchers.includes(matcherName) ? (() => {throw new Error(`${matcherName} is unregistered`)}) : undefined;
+ }
+ }else {
+ this.matchers[customAssertionName] = () => {
+ throw new Error(`${customAssertionName} is unregistered`)
+ };
+ }
+ }
+
+ basicMatchers() {
+ return {
+ assertTrue: function (actualValue) {
+ return {
+ pass: (actualValue) === true,
+ message: 'expect true, actualValue is ' + actualValue
+ };
+ },
+ assertEqual: function (actualValue, args) {
+ let msg = 'expect ' + actualValue + ' equals ' + args[0];
+ if (actualValue == args[0]) { // 数值相同,提示数据类型
+ const aClassName = Object.prototype.toString.call(actualValue);
+ const bClassName = Object.prototype.toString.call(args[0]);
+ msg = 'expect ' + actualValue + aClassName + ' equals ' + args[0] + bClassName + "strict mode inspect type";
+ }
+ return {
+ pass: (actualValue) === args[0],
+ expectValue: args[0],
+ message: msg
+ };
+ },
+ assertThrow: function (actual, args) {
+ const result = {
+ pass: false
+ };
+ if (typeof actual !== 'function') {
+ result.message = 'toThrow\'s Actual should be a Function';
+ } else {
+ let hasThrow = false;
+ let throwError;
+ try {
+ actual();
+ } catch (e) {
+ hasThrow = true;
+ throwError = e;
+ }
+ if (!hasThrow) {
+ result.message = 'function did not throw an exception';
+ } else if (throwError && throwError.message === args[0]) {
+ result.pass = true;
+ } else {
+ result.message = `expect to throw ${args[0]} , actual throw ${throwError.message}`;
+ }
+ }
+ return result;
+ }
+ };
+ }
+
+ initWrapMatchers(currentRunningSpec) {
+ return {
+ // 翻转标识
+ isNot: false,
+ // 翻转方法
+ not: function () {
+ this.isNot = true;
+ return this;
+ },
+ message: function (msg) {
+ currentRunningSpec.expectMsg = msg;
+ console.info(`${TAG} msg: ${msg}`);
+ return this;
+ }
+ };
+
+ }
+ wrapMatchers(actualValue) {
+ const _this = this;
+ const specService = _this.coreContext.getDefaultService('spec');
+ const currentRunningSpec = specService.getCurrentRunningSpec();
+ const wrappedMatchers = this.initWrapMatchers(currentRunningSpec);
+ const currentRunningSuite = _this.coreContext.getDefaultService('suite').getCurrentRunningSuite();
+ for (const matcherName in this.matchers) {
+ let result = Object.prototype.hasOwnProperty.call(this.matchers, matcherName);
+ if (!result) {
+ continue;
+ }
+ if (matcherName.search('assertPromise') == 0) {
+ wrappedMatchers[matcherName] = async function () {
+ await _this.matchers[matcherName](actualValue, arguments).then(function (result) {
+ if (wrappedMatchers.isNot) {
+ result.pass = !result.pass;
+ }
+ result.actualValue = actualValue;
+ result.checkFunc = matcherName;
+ if (!result.pass) {
+ const assertError = new AssertException(result.message);
+ currentRunningSpec ? currentRunningSpec.fail = assertError : currentRunningSuite.hookError = assertError;
+ throw assertError;
+ }
+ });
+ };
+ } else {
+ wrappedMatchers[matcherName] = function () {
+ const result = _this.customMatchers.includes(matcherName) ? _this.matchers[matcherName](actualValue, arguments[0]) : _this.matchers[matcherName](actualValue, arguments);
+ if (wrappedMatchers.isNot) {
+ result.pass = !result.pass;
+ result.message = LogExpectError.getErrorMsg(matcherName, actualValue, arguments[0], result.message);
+ }
+ result.actualValue = actualValue;
+ result.checkFunc = matcherName;
+ if (!result.pass) {
+ const assertError = new AssertException(result.message);
+ currentRunningSpec ? currentRunningSpec.fail = assertError : currentRunningSuite.hookError = assertError;
+ throw assertError;
+ }
+ };
+ }
+ }
+ return wrappedMatchers;
+ }
+
+ apis() {
+ const _this = this;
+ return {
+ expect: function (actualValue) {
+ return _this.expect(actualValue);
+ }
+ };
+ }
+}
+
+class ReportService {
+ constructor(attr) {
+ this.id = attr.id;
+ }
+
+ init(coreContext) {
+ this.coreContext = coreContext;
+ this.specService = this.coreContext.getDefaultService('spec');
+ this.suiteService = this.coreContext.getDefaultService('suite');
+ this.duration = 0;
+ }
+
+ taskStart() {
+ console.info(`${TAG}[start] start run suites`);
+ }
+
+ async suiteStart() {
+ console.info(`${TAG}[suite start]${this.suiteService.getCurrentRunningSuite().description}`);
+ }
+
+ async specStart() {
+ console.info(`${TAG}start running case '${this.specService.currentRunningSpec.description}'`);
+ this.index = this.index + 1;
+ let spec = this.specService.currentRunningSpec;
+ spec.startTime = await SysTestKit.getRealTime();
+ }
+
+ async specDone() {
+ let msg = '';
+ let spec = this.specService.currentRunningSpec;
+ let suite = this.suiteService.currentRunningSuite;
+ spec.duration = await SysTestKit.getRealTime() - spec.startTime;
+ suite.duration += spec.duration;
+ if (spec.error) {
+ this.formatPrint('error', spec.description + ' ; consuming ' + spec.duration + 'ms');
+ this.formatPrint('errorDetail', spec.error);
+ } else if (spec.fail) {
+ this.formatPrint('fail', spec.description + ' ; consuming ' + spec.duration + 'ms');
+ this.formatPrint('failDetail', spec.fail?.message);
+ } else {
+ this.formatPrint('pass', spec.description + ' ; consuming ' + spec.duration + 'ms');
+ }
+ this.formatPrint(this.specService.currentRunningSpec.error, msg);
+ }
+
+ suiteDone() {
+ let suite = this.suiteService.currentRunningSuite;
+ let message = suite.hookError ? `, ${suite.hookError?.message}` : '';
+ console.info(`[suite end] ${suite.description} consuming ${suite.duration} ms${message}`);
+ }
+
+ taskDone() {
+ let msg = '';
+ let summary = this.suiteService.getSummary();
+ msg = 'total cases:' + summary.total + ';failure ' + summary.failure + ',' + 'error ' + summary.error;
+ msg += ',pass ' + summary.pass + '; consuming ' + summary.duration + 'ms';
+ console.info(`${TAG}${msg}`);
+ console.info(`${TAG}[end] run suites end`);
+ }
+
+ incorrectFormat() {
+ if (this.coreContext.getDefaultService('config').filterValid.length !== 0) {
+ this.coreContext.getDefaultService('config').filterValid.forEach(function (item) {
+ console.info(`${TAG}this param ${item} is invalid`);
+ });
+ }
+ }
+
+ incorrectTestSuiteFormat() {
+ if (this.coreContext.getDefaultService('config').filterXdescribe.length !== 0) {
+ this.coreContext.getDefaultService('config').filterXdescribe.forEach(function (item) {
+ console.info(`${TAG}xdescribe: ${item} should not contain it`);
+ })
+ }
+ }
+
+ formatPrint(type, msg) {
+ switch (type) {
+ case 'pass':
+ console.info(`${TAG}[pass]${msg}`);
+ break;
+ case 'fail':
+ console.info(`${TAG}[fail]${msg}`);
+ break;
+ case 'failDetail':
+ console.info(`${TAG}[failDetail]${msg}`);
+ break;
+ case 'error':
+ console.info(`${TAG}[error]${msg}`);
+ break;
+ case 'errorDetail':
+ console.info(`${TAG}[errorDetail]${msg}`);
+ break;
+ }
+ }
+
+ sleep(numberMillis) {
+ var now = new Date();
+ var exitTime = now.getTime() + numberMillis;
+ while (true) {
+ now = new Date();
+ if (now.getTime() > exitTime) {
+ return;
+ }
+ }
+ }
+}
+
+export {
+ SuiteService,
+ SpecService,
+ ExpectService,
+ ReportService
+};
diff --git a/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/testrunner/OpenHarmonyTestRunner.ts b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/testrunner/OpenHarmonyTestRunner.ts
new file mode 100644
index 0000000000000000000000000000000000000000..e6f4c1b12dd69714ed5a4524671abca1fbcaa58c
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/@ohos+hypium@1.0.18/oh_modules/@ohos/hypium/src/main/testrunner/OpenHarmonyTestRunner.ts
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2023-2024 Huawei Device 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 { abilityDelegatorRegistry, TestRunner } from '@kit.TestKit';
+import { BusinessError } from '@kit.BasicServicesKit';
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { resourceManager } from '@kit.LocalizationKit';
+import { util } from '@kit.ArkTS';
+import { Hypium } from '@ohos/hypium';
+import testsuite from '../test/List.test';
+
+let abilityDelegator: abilityDelegatorRegistry.AbilityDelegator;
+let abilityDelegatorArguments: abilityDelegatorRegistry.AbilityDelegatorArgs;
+let jsonPath: string = 'mock/mock-config.json';
+let domain: number = 0x0000; //日志标识,0x0000作为测试框架的业务标识
+let tag: string = 'testTag'; //日志标识字符串,作为tag标识当前runner类下的测试行为
+
+export default class OpenHarmonyTestRunner implements TestRunner {
+ constructor() {
+ }
+
+ onPrepare() {
+ hilog.info(domain, tag, '%{public}s', 'OpenHarmonyTestRunner OnPrepare');
+ }
+
+ async onRun() {
+ hilog.info(domain, tag, '%{public}s', 'OpenHarmonyTestRunner onRun run');
+ abilityDelegatorArguments = abilityDelegatorRegistry.getArguments();
+ abilityDelegator = abilityDelegatorRegistry.getAbilityDelegator();
+ let moduleName = abilityDelegatorArguments.parameters['-m'];
+ let context = abilityDelegator.getAppContext().getApplicationContext().createModuleContext(moduleName);
+ let mResourceManager = context.resourceManager;
+ await checkMock(abilityDelegator, mResourceManager);
+ hilog.info(domain, tag, '%{public}s', 'start run testcase!!!');
+ Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite);
+ hilog.info(domain, tag, '%{public}s', 'OpenHarmonyTestRunner onRun end');
+ }
+}
+
+async function checkMock(abilityDelegator: abilityDelegatorRegistry.AbilityDelegator, resourceManager: resourceManager.ResourceManager) {
+ let rawFile: Uint8Array;
+ try {
+ rawFile = resourceManager.getRawFileContentSync(jsonPath);
+ hilog.info(domain, tag, 'MockList file exists');
+ let mockStr: string = util.TextDecoder.create("utf-8", { ignoreBOM: true }).decodeWithStream(rawFile);
+ let mockMap: Record = getMockList(mockStr);
+ try {
+ abilityDelegator.setMockList(mockMap);
+ } catch (error) {
+ let code = (error as BusinessError).code;
+ let message = (error as BusinessError).message;
+ hilog.error(domain, tag, `abilityDelegator.setMockList failed, error code: ${code}, message: ${message}.`);
+ }
+ } catch (error) {
+ let code = (error as BusinessError).code;
+ let message = (error as BusinessError).message;
+ hilog.error(domain, tag, `ResourceManager:callback getRawFileContent failed, error code: ${code}, message: ${message}.`);
+ }
+}
+
+function getMockList(jsonStr: string) {
+ let jsonObj: Record = JSON.parse(jsonStr);
+ let map: Map = new Map(Object.entries(jsonObj));
+ let mockList: Record = {};
+ map.forEach((value: object, key: string) => {
+ let realValue: string = value['source'].toString();
+ mockList[key] = realValue;
+ });
+ hilog.info(domain, tag, '%{public}s', 'mock-json value:' + JSON.stringify(mockList) ?? '');
+ return mockList;
+}
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/lock.json5 b/MultipleImage/oh_modules/.ohpm/lock.json5
new file mode 100644
index 0000000000000000000000000000000000000000..9ce079377ac8069187d7f097f340eca5b0344a4c
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/lock.json5
@@ -0,0 +1,55 @@
+{
+ "lockVersion": "1.0",
+ "settings": {
+ "resolveConflict": true,
+ "resolveConflictStrict": false,
+ "installAll": true
+ },
+ "overrides": {},
+ "overrideDependencyMap": {},
+ "modules": {
+ ".": {
+ "name": "",
+ "dependencies": {},
+ "devDependencies": {
+ "@ohos/hypium": {
+ "specifier": "1.0.18",
+ "version": "1.0.18"
+ },
+ "@ohos/hamock": {
+ "specifier": "1.0.0",
+ "version": "1.0.0"
+ }
+ },
+ "dynamicDependencies": {},
+ "maskedByOverrideDependencyMap": false
+ },
+ "entry": {
+ "name": "entry",
+ "dependencies": {},
+ "devDependencies": {},
+ "dynamicDependencies": {},
+ "maskedByOverrideDependencyMap": false
+ }
+ },
+ "packages": {
+ "@ohos/hypium@1.0.18": {
+ "integrity": "sha512-RGe/iLGdeywdQilMWZsHKUoiE9OJ+9QxQsorF92R2ImLNVHVhbpSePNITGpW7TnvLgOIP/jscOqfIOhk6X7XRQ==",
+ "storePath": "oh_modules/.ohpm/@ohos+hypium@1.0.18",
+ "dependencies": {},
+ "dynamicDependencies": {},
+ "dev": true,
+ "dynamic": false,
+ "maskedByOverrideDependencyMap": false
+ },
+ "@ohos/hamock@1.0.0": {
+ "integrity": "sha512-K6lDPYc6VkKe6ZBNQa9aoG+ZZMiwqfcR/7yAVFSUGIuOAhPvCJAo9+t1fZnpe0dBRBPxj2bxPPbKh69VuyAtDg==",
+ "storePath": "oh_modules/.ohpm/@ohos+hamock@1.0.0",
+ "dependencies": {},
+ "dynamicDependencies": {},
+ "dev": true,
+ "dynamic": false,
+ "maskedByOverrideDependencyMap": false
+ }
+ }
+}
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/CHANGELOG.md b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/CHANGELOG.md
new file mode 100644
index 0000000000000000000000000000000000000000..22a35bda8a1fab36dd81c1c7ae86addcc1f111cc
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/CHANGELOG.md
@@ -0,0 +1,4 @@
+## 1.0.0
+- 修复once断言问题
+## 1.0.0-rc
+- 提供DevEco Studio预览器场景使能的MockSetup装饰器
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/LICENSE b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..4947287f7b5ccb5d1e8b7b2d3aa5d89f322c160d
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/README.md b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..c46981eb6b9163cb82723dd4c410b69b5e6a66cd
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/README.md
@@ -0,0 +1,82 @@
+# Hamock
+
+## 简介
+
+Hamock 是 OpenHarmony 上的模拟框架,提供预览场景的模拟功能。
+
+## 下载安装
+
+```bash
+ohpm install @ohos/hamock
+```
+
+OpenHarmony ohpm 环境配置等更多内容,请参考[如何安装 OpenHarmony ohpm 包](https://gitee.com/openharmony-tpc/docs/blob/master/OpenHarmony_har_usage.md)
+
+## 使用示例
+
+Hamock 提供了 @MockSetup 用于修饰 Mock 方法,仅支持声明式范式的组件。当开发者预览该组件时,预览运行时将在组件初始化时执行被 @MockSetup 修饰的方法。因此,开发者可以在这个被修饰的方法内重定义组件的方法或重赋值组件的属性,其将在预览时生效。
+
+> 说明:
+> @MockSetup 修饰的方法仅在预览场景会自动触发,并先于组件的 aboutToAppear 执行。
+
+### UI组件的方法
+
+在 ArkTS 页面代码中引入 Hamock。在目标组件中定义一个方法,并用 @MockSetup 修饰该方法。在这个方法中,使用 MockKit 模拟目标方法。
+
+```typescript
+import { MockKit, when, MockSetup } from '@ohos/hamock';
+
+@Entry
+@Component
+struct Index {
+ ...
+ @MockSetup
+ randomName() {
+ let mocker: MockKit = new MockKit();
+ let mockfunc: Object = mocker.mockFunc(this, this.method1);
+ // mock 指定的方法在指定入参的返回值
+ when(mockfunc)('test').afterReturn(1);
+ }
+ ...
+ // 业务场景调用方法
+ const result: number = this.method1('test'); // in previewer, result = 1
+}
+```
+
+### UI组件的属性
+
+在 ArkTS 页面代码中引入 Hamock。在目标组件中定义一个方法,并用 @MockSetup 修饰该方法。在这个方法中,对于需要 Mock 的属性,可以重新赋值。
+
+```typescript
+import { MockSetup } from '@ohos/hamock';
+
+@Component
+struct Person {
+ @Prop species: string;
+ ...
+ // 在 @MockSetup 片段中,定义对象属性
+ @MockSetup
+ randomName() {
+ this.species = 'primates';
+ }
+ ...
+ // 业务场景调用属性(如果从初始化到调用期间,该属性无变化)
+ const result: string = this.species; // in previewer, result = primates
+}
+```
+
+## 约束与限制
+
+在下述版本验证通过:
+
+DevEco Studio: 4.1 (4.1.3.400), SDK: API11 (4.1.0.36)
+
+MockSetup 仅在 API11 支持。
+
+## 贡献代码
+
+使用过程中发现任何问题都可以提[Issue](https://gitee.com/openharmony/testfwk_arkxtest/issues) 给我们,当然,我们也非常欢迎你给我们提[PR](https://gitee.com/openharmony/testfwk_arkxtest/pulls) 。
+
+## 开源协议
+
+本项目基于 [Apache License 2.0](https://gitee.com/openharmony/testfwk_arkxtest/blob/master/hamock/LICENSE) ,请自由地享受和参与开源。
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/build-profile.json5 b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..12fe2d844bdb69584fd05ebaa3e1cb197a25c3f1
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/build-profile.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2023 Huawei Device 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.
+ */
+
+{
+ "apiType": "stageMode",
+ "buildOption": {
+ },
+ "targets": [
+ {
+ "name": "default"
+ }
+ ]
+}
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/hvigorfile.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/hvigorfile.js
new file mode 100644
index 0000000000000000000000000000000000000000..d7bda561c9bf09b92a7fac485141cc8648907388
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/hvigorfile.js
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2023 Huawei Device 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.
+ */
+
+// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
+export { harTasks } from '@ohos/hvigor-ohos-plugin';
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/hvigorfile.ts b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..960be7d7df0790853d6bdab1f52a3ec8c8e4a1ca
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/hvigorfile.ts
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2023 Huawei Device 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.
+ */
+
+// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
+export { harTasks } from '@ohos/hvigor-ohos-plugin';
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/index.d.ts b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/index.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..6bc7929ba5718da0e459721be04e903ec59289c0
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/index.d.ts
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2023 Huawei Device 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.
+ */
+
+export class ArgumentMatchers {
+ static any;
+ static anyString;
+ static anyBoolean;
+ static anyNumber;
+ static anyObj;
+ static anyFunction;
+ static matchRegexs(Regex: RegExp): void
+}
+
+declare interface when {
+ afterReturn(value: any): any
+ afterReturnNothing(): undefined
+ afterAction(action: any): any
+ afterThrow(e_msg: string): string
+ (argMatchers?: any): when;
+}
+
+export const when: when;
+
+export interface VerificationMode {
+ times(count: Number): void
+ never(): void
+ once(): void
+ atLeast(count: Number): void
+ atMost(count: Number): void
+}
+
+export class MockKit {
+ constructor()
+ mockFunc(obj: Object, func: Function): Function
+ mockObject(obj: Object): Object
+ verify(methodName: String, argsArray: Array): VerificationMode
+ ignoreMock(obj: Object, func: Function): void
+ clear(obj: Object): void
+ clearAll(): void
+}
+
+export declare function MockSetup(
+ target: Object,
+ propertyName: string | Symbol,
+ descriptor: TypedPropertyDescriptor<() => void>
+): void;
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/index.ets b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..c3a47320c2b674216cccde0fe217dbb8423625cc
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/index.ets
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2023 Huawei Device 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.
+ */
+
+export { MockSetup, MockKit, when } from './src/main/mock/MockKit';
+export { ArgumentMatchers } from './src/main/mock/ArgumentMatchers';
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/index.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..1cb2b5e0256e00aa9276867f0753a89a7ac5e16f
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/index.js
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2021-2023 Huawei Device 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.
+ */
+export { MockSetup, MockKit, when } from './src/main/mock/MockKit.js';
+export { ArgumentMatchers } from './src/main/mock/ArgumentMatchers.js';
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/index.ts b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/index.ts
new file mode 100644
index 0000000000000000000000000000000000000000..608eb4fe72aaf0f6cca0ccb3baad94e9b6101de0
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/index.ts
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2021-2023 Huawei Device 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.
+ */
+
+export { MockSetup, MockKit, when } from './src/main/mock/MockKit.js';
+export { ArgumentMatchers } from './src/main/mock/ArgumentMatchers.js';
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/oh-package.json5 b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..0ef4eeed251a93463c2abf85b262c3e1fb6733bc
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/oh-package.json5
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2023 Huawei Device 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.
+ */
+
+{
+ name: '@ohos/hamock',
+ version: '1.0.0',
+ description: 'A mock framework for OpenHarmony application.',
+ main: 'index.ets',
+ author: 'huawei',
+ license: 'Apache-2.0',
+ dependencies: {},
+ ohos: {
+ org: 'ohos',
+ },
+ types: 'index.d.ts'
+}
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/src/main/mock/ArgumentMatchers.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/src/main/mock/ArgumentMatchers.js
new file mode 100644
index 0000000000000000000000000000000000000000..f06bbca0b287aac612f42f9263c064c0157ae03a
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/src/main/mock/ArgumentMatchers.js
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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.
+ */
+export class ArgumentMatchers {
+ constructor() {
+ this.ANY = "";
+ this.ANY_STRING = "";
+ this.ANY_BOOLEAN = "";
+ this.ANY_NUMBER = "";
+ this.ANY_OBJECT = "";
+ this.ANY_FUNCTION = "";
+ this.MATCH_REGEXS = "";
+ }
+ static any() {
+ }
+ static anyString() {
+ }
+ static anyBoolean() {
+ }
+ static anyNumber() {
+ }
+ static anyObj() {
+ }
+ static anyFunction() {
+ }
+ static matchRegexs(regex) {
+ if (ArgumentMatchers.isRegExp(regex)) {
+ return regex;
+ }
+ throw Error("not a regex");
+ }
+ static isRegExp(value) {
+ return Object.prototype.toString.call(value) === "[object RegExp]";
+ }
+ matcheReturnKey(...args) {
+ let arg = args[0];
+ let regex = args[1];
+ let stubSetKey = args[2];
+ if (stubSetKey && stubSetKey == this.ANY) {
+ return this.ANY;
+ }
+ if (typeof arg === "string" && !regex) {
+ return this.ANY_STRING;
+ }
+ if (typeof arg === "boolean" && !regex) {
+ return this.ANY_BOOLEAN;
+ }
+ if (typeof arg === "number" && !regex) {
+ return this.ANY_NUMBER;
+ }
+ if (typeof arg === "object" && !regex) {
+ return this.ANY_OBJECT;
+ }
+ if (typeof arg === "function" && !regex) {
+ return this.ANY_FUNCTION;
+ }
+ if (typeof arg === "string" && regex) {
+ return regex.test(arg);
+ }
+ return null;
+ }
+ matcheStubKey(key) {
+ if (key === ArgumentMatchers.any) {
+ return this.ANY;
+ }
+ if (key === ArgumentMatchers.anyString) {
+ return this.ANY_STRING;
+ }
+ if (key === ArgumentMatchers.anyBoolean) {
+ return this.ANY_BOOLEAN;
+ }
+ if (key === ArgumentMatchers.anyNumber) {
+ return this.ANY_NUMBER;
+ }
+ if (key === ArgumentMatchers.anyObj) {
+ return this.ANY_OBJECT;
+ }
+ if (key === ArgumentMatchers.anyFunction) {
+ return this.ANY_FUNCTION;
+ }
+ if (ArgumentMatchers.isRegExp(key)) {
+ return key;
+ }
+ return null;
+ }
+}
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/src/main/mock/ArgumentMatchers.ts b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/src/main/mock/ArgumentMatchers.ts
new file mode 100644
index 0000000000000000000000000000000000000000..262bea1afbeb611029db0cfaeb65767b92f97b91
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/src/main/mock/ArgumentMatchers.ts
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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.
+ */
+
+export class ArgumentMatchers {
+ ANY = "";
+ ANY_STRING = "";
+ ANY_BOOLEAN = "";
+ ANY_NUMBER = "";
+ ANY_OBJECT = "";
+ ANY_FUNCTION = "";
+ MATCH_REGEXS = "";
+
+ static any() {
+ }
+
+ static anyString() {
+ }
+
+ static anyBoolean() {
+ }
+
+ static anyNumber() {
+ }
+
+ static anyObj() {
+ }
+
+ static anyFunction() {
+ }
+
+ static matchRegexs(regex: any) {
+ if (ArgumentMatchers.isRegExp(regex)) {
+ return regex;
+ }
+ throw Error("not a regex");
+ }
+
+ static isRegExp(value: string) {
+ return Object.prototype.toString.call(value) === "[object RegExp]";
+ }
+
+ matcheReturnKey(...args: Array) {
+ let arg = args[0];
+ let regex = args[1];
+ let stubSetKey = args[2];
+
+ if (stubSetKey && stubSetKey == this.ANY) {
+ return this.ANY;
+ }
+
+ if (typeof arg === "string" && !regex) {
+ return this.ANY_STRING;
+ }
+
+ if (typeof arg === "boolean" && !regex) {
+ return this.ANY_BOOLEAN;
+ }
+
+ if (typeof arg === "number" && !regex) {
+ return this.ANY_NUMBER;
+ }
+
+ if (typeof arg === "object" && !regex) {
+ return this.ANY_OBJECT;
+ }
+
+ if (typeof arg === "function" && !regex) {
+ return this.ANY_FUNCTION;
+ }
+
+ if (typeof arg === "string" && regex) {
+ return regex.test(arg);
+ }
+
+ return null;
+ }
+
+ matcheStubKey(key: any) {
+
+ if (key === ArgumentMatchers.any) {
+ return this.ANY;
+ }
+
+ if (key === ArgumentMatchers.anyString) {
+ return this.ANY_STRING;
+ }
+ if (key === ArgumentMatchers.anyBoolean) {
+ return this.ANY_BOOLEAN;
+ }
+ if (key === ArgumentMatchers.anyNumber) {
+ return this.ANY_NUMBER;
+ }
+ if (key === ArgumentMatchers.anyObj) {
+ return this.ANY_OBJECT;
+ }
+ if (key === ArgumentMatchers.anyFunction) {
+ return this.ANY_FUNCTION;
+ }
+
+ if (ArgumentMatchers.isRegExp(key)) {
+ return key;
+ }
+
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/src/main/mock/ExtendInterface.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/src/main/mock/ExtendInterface.js
new file mode 100644
index 0000000000000000000000000000000000000000..52f9dff07f7b719900ca47d56c3020586db31d5b
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/src/main/mock/ExtendInterface.js
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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.
+ */
+class ExtendInterface {
+ constructor(mocker) {
+ this.mocker = mocker;
+ }
+ stub() {
+ this.params = arguments;
+ return this;
+ }
+ stubMockedCall(returnInfo) {
+ this.mocker.stubApply(this, this.params, returnInfo);
+ }
+ afterReturn(value) {
+ this.stubMockedCall(function () {
+ return value;
+ });
+ }
+ afterReturnNothing() {
+ this.stubMockedCall(function () {
+ return undefined;
+ });
+ }
+ afterAction(action) {
+ this.stubMockedCall(action);
+ }
+ afterThrow(msg) {
+ this.stubMockedCall(function () {
+ throw msg;
+ });
+ }
+ clear(obj) {
+ this.mocker.clear(obj);
+ }
+}
+export default ExtendInterface;
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/src/main/mock/ExtendInterface.ts b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/src/main/mock/ExtendInterface.ts
new file mode 100644
index 0000000000000000000000000000000000000000..55f7a0b36bc2895e17a2e6b32a6c1980853cbce9
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/src/main/mock/ExtendInterface.ts
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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 { MockKit } from "./MockKit.js";
+
+class ExtendInterface {
+
+ private mocker: MockKit
+ private params: any
+
+ constructor(mocker: MockKit) {
+ this.mocker = mocker;
+ }
+
+ stub() {
+ this.params = arguments;
+ return this;
+ }
+
+ stubMockedCall(returnInfo: any) {
+ this.mocker.stubApply(this, this.params, returnInfo);
+ }
+
+ afterReturn(value: any) {
+ this.stubMockedCall(function () {
+ return value;
+ });
+ }
+
+ afterReturnNothing() {
+ this.stubMockedCall(function () {
+ return undefined;
+ });
+ }
+
+ afterAction(action: Function) {
+ this.stubMockedCall(action);
+ }
+
+ afterThrow(msg: string) {
+ this.stubMockedCall(function () {
+ throw msg;
+ });
+ }
+
+ clear(obj?: any) {
+ this.mocker.clear(obj);
+ }
+}
+
+export default ExtendInterface;
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/src/main/mock/MockKit.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/src/main/mock/MockKit.js
new file mode 100644
index 0000000000000000000000000000000000000000..c1ca51614abe9f9c149094f5186eeb750b00a074
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/src/main/mock/MockKit.js
@@ -0,0 +1,253 @@
+/*
+ * Copyright (c) 2022-2023 Huawei Device 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 ExtendInterface from "./ExtendInterface.js";
+import VerificationMode from "./VerificationMode.js";
+import { ArgumentMatchers } from "./ArgumentMatchers.js";
+class MockKit {
+ constructor() {
+ this.mFunctions = [];
+ this.stubs = new Map();
+ this.recordCalls = new Map();
+ this.currentSetKey = new Map();
+ this.mockObj = null;
+ this.recordMockedMethod = new Map();
+ this.mFunctions = [];
+ this.stubs = new Map();
+ this.recordCalls = new Map();
+ this.currentSetKey = new Map();
+ this.mockObj = null;
+ this.recordMockedMethod = new Map();
+ }
+ init() {
+ this.reset();
+ }
+ reset() {
+ this.mFunctions = [];
+ this.stubs = new Map();
+ this.recordCalls = new Map();
+ this.currentSetKey = new Map();
+ this.mockObj = null;
+ this.recordMockedMethod = new Map();
+ }
+ clearAll() {
+ this.reset();
+ }
+ clear(obj) {
+ if (!obj) throw Error("Please enter an object to be cleaned");
+ if (typeof (obj) !== 'object' && typeof (obj) !== 'function') throw new Error('Not a object or static class');
+ this.recordMockedMethod.forEach(function (value, key, map) {
+ if (key) {
+ obj[key] = value;
+ }
+ });
+ }
+ ignoreMock(obj, method) {
+ if (typeof (obj) !== 'object' && typeof (obj) !== 'function') throw new Error('Not a object or static class');
+ if (typeof (method) !== 'function') throw new Error('Not a function');
+ let og = this.recordMockedMethod.get(method.propName);
+ if (og) {
+ obj[method.propName] = og;
+ this.recordMockedMethod.set(method.propName, undefined);
+ }
+ }
+ extend(dest, source) {
+ dest["stub"] = source["stub"];
+ dest["afterReturn"] = source["afterReturn"];
+ dest["afterReturnNothing"] = source["afterReturnNothing"];
+ dest["afterAction"] = source["afterAction"];
+ dest["afterThrow"] = source["afterThrow"];
+ dest["stubMockedCall"] = source["stubMockedCall"];
+ dest["clear"] = source["clear"];
+ return dest;
+ }
+ stubApply(f, params, returnInfo) {
+ let values = this.stubs.get(f);
+ if (!values) {
+ values = new Map();
+ }
+ let key = params[0];
+ if (typeof key === "undefined") {
+ key = "anonymous-mock-" + f.propName;
+ }
+ let matcher = new ArgumentMatchers();
+ if (matcher.matcheStubKey(key)) {
+ key = matcher.matcheStubKey(key);
+ if (key) {
+ this.currentSetKey.set(f, key);
+ }
+ }
+ values.set(key, returnInfo);
+ this.stubs.set(f, values);
+ }
+ getReturnInfo(f, params) {
+ let values = this.stubs.get(f);
+ if (!values) {
+ return undefined;
+ }
+ let retrunKet = params[0];
+ if (typeof retrunKet === "undefined") {
+ retrunKet = "anonymous-mock-" + f.propName;
+ }
+ let stubSetKey = this.currentSetKey.get(f);
+
+ if (stubSetKey && (typeof (retrunKet) !== "undefined")) {
+ retrunKet = stubSetKey;
+ }
+ let matcher = new ArgumentMatchers();
+ if (matcher.matcheReturnKey(params[0], undefined, stubSetKey) && matcher.matcheReturnKey(params[0], undefined, stubSetKey) !== stubSetKey) {
+ retrunKet = params[0];
+ }
+ values.forEach(function (value, key, map) {
+ if (ArgumentMatchers.isRegExp(key) && matcher.matcheReturnKey(params[0], key)) {
+ retrunKet = key;
+ }
+ });
+ return values.get(retrunKet);
+ }
+ findName(obj, value) {
+ let properties = this.findProperties(obj);
+ let name = '';
+ properties.filter((item) => (item !== 'caller' && item !== 'arguments')).forEach(function (va1, idx, array) {
+ if (obj[va1] === value) {
+ name = va1;
+ }
+ });
+ return name;
+ }
+ isFunctionFromPrototype(f, container, propName) {
+ if (container.constructor !== Object && container.constructor.prototype !== container) {
+ return container.constructor.prototype[propName] === f;
+ }
+ return false;
+ }
+ findProperties(obj, ...arg) {
+ function getProperty(new_obj) {
+ if (new_obj.__proto__ === null) {
+ return [];
+ }
+ let properties = Object.getOwnPropertyNames(new_obj);
+ return [...properties, ...getProperty(new_obj.__proto__)];
+ }
+ return getProperty(obj);
+ }
+ recordMethodCall(originalMethod, args) {
+ originalMethod['getName'] = function () {
+ return this.name || this.toString().match(/function\s*([^(]*)\(/)[1];
+ };
+ let name = originalMethod.getName();
+ let arglistString = name + '(' + Array.from(args).toString() + ')';
+ let records = this.recordCalls.get(arglistString);
+ if (!records) {
+ records = 0;
+ }
+ records++;
+ this.recordCalls.set(arglistString, records);
+ }
+ mockFunc(originalObject, originalMethod) {
+ let tmp = this;
+ this.originalMethod = originalMethod;
+ const _this = this;
+ let f = function () {
+ let args = arguments;
+ let action = tmp.getReturnInfo(f, args);
+ if (originalMethod) {
+ tmp.recordMethodCall(originalMethod, args);
+ }
+ if (action) {
+ return action.apply(_this, args);
+ }
+ };
+ f.container = null || originalObject;
+ f.original = originalMethod || null;
+ if (originalObject && originalMethod) {
+ if (typeof (originalMethod) != 'function')
+ throw new Error('Not a function');
+ var name = this.findName(originalObject, originalMethod);
+ originalObject[name] = f;
+ this.recordMockedMethod.set(name, originalMethod);
+ f.propName = name;
+ f.originalFromPrototype = this.isFunctionFromPrototype(f.original, originalObject, f.propName);
+ }
+ f.mocker = this;
+ this.mFunctions.push(f);
+ this.extend(f, new ExtendInterface(this));
+ return f;
+ }
+ verify(methodName, argsArray) {
+ if (!methodName) {
+ throw Error("not a function name");
+ }
+ let a = this.recordCalls.get(methodName + '(' + argsArray.toString() + ')');
+ return new VerificationMode(a ? a : 0);
+ }
+ mockObject(object) {
+ if (!object || typeof object === "string") {
+ throw Error(`this ${object} cannot be mocked`);
+ }
+ const _this = this;
+ let mockedObject = {};
+ let keys = Reflect.ownKeys(object);
+ keys.filter(key => (typeof Reflect.get(object, key)) === 'function')
+ .forEach((key) => {
+ mockedObject[key] = object[key];
+ mockedObject[key] = _this.mockFunc(mockedObject, mockedObject[key]);
+ });
+ return mockedObject;
+ }
+}
+function ifMockedFunction(f) {
+ if (Object.prototype.toString.call(f) != "[object Function]" &&
+ Object.prototype.toString.call(f) != "[object AsyncFunction]") {
+ throw Error("not a function");
+ }
+ if (!f.stub) {
+ throw Error("not a mock function");
+ }
+ return true;
+}
+function when(f) {
+ if (ifMockedFunction(f)) {
+ return f.stub.bind(f);
+ }
+}
+function MockSetup(target, propertyName, descriptor) {
+ const aboutToAppearOrigin = target.aboutToAppear;
+ const setup = descriptor.value;
+ target.aboutToAppear = function (...args) {
+ if (target.__Param) { // copy attributes and params of the original context
+ try {
+ const map = target.__Param;
+ for (const [key, val] of map) {
+ this[key] = val; // 'this' refers to context of current function
+ }
+ }
+ catch (e) {
+ throw new Error(`Mock setup param error: ${e}`);
+ }
+ }
+ if (setup) { // apply the mock content
+ try {
+ setup.apply(this);
+ }
+ catch (e) {
+ throw new Error(`Mock setup apply error: ${e}`);
+ }
+ }
+ if (aboutToAppearOrigin) { // append to aboutToAppear function of the original context
+ aboutToAppearOrigin.apply(this, args);
+ }
+ };
+}
+export { MockSetup, MockKit, when };
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/src/main/mock/MockKit.ts b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/src/main/mock/MockKit.ts
new file mode 100644
index 0000000000000000000000000000000000000000..2807643e29d6da16ee7061ce5674b696a4fc3ca6
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/src/main/mock/MockKit.ts
@@ -0,0 +1,294 @@
+/*
+ * Copyright (c) 2023 Huawei Device 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 ExtendInterface from "./ExtendInterface.js";
+import VerificationMode from "./VerificationMode.js";
+import { ArgumentMatchers } from "./ArgumentMatchers.js";
+
+interface IFunction extends Function {
+ container: any;
+ original: any;
+ propName: string;
+ originalFromPrototype: boolean
+ mocker: MockKit
+}
+
+class MockKit {
+
+ private mFunctions:Array = [];
+ private stubs = new Map();
+ private recordCalls = new Map();
+ private currentSetKey = new Map();
+ private mockObj = null;
+ private recordMockedMethod = new Map();
+ private originalMethod: any;
+
+ constructor() {
+ this.mFunctions = [];
+ this.stubs = new Map();
+ this.recordCalls = new Map();
+ this.currentSetKey = new Map();
+ this.mockObj = null;
+ this.recordMockedMethod = new Map();
+ }
+
+ init() {
+ this.reset();
+ }
+
+ reset() {
+ this.mFunctions = [];
+ this.stubs = new Map()
+ this.recordCalls = new Map();
+ this.currentSetKey = new Map();
+ this.mockObj = null;
+ this.recordMockedMethod = new Map();
+ }
+
+ clearAll() {
+ this.reset();
+ }
+
+ clear(obj: any) {
+ if (!obj) throw Error("Please enter an object to be cleaned");
+ if (typeof (obj) != 'object') throw new Error('Not a object');
+ this.recordMockedMethod.forEach(function (value, key, map) {
+ if (key) {
+ obj[key] = value;
+ }
+ });
+ }
+
+ ignoreMock(obj:any, method: any) {
+ if (typeof (obj) != 'object') throw new Error('Not a object');
+ if (typeof (method) != 'function') throw new Error('Not a function');
+ let og = this.recordMockedMethod.get(method.propName);
+ if (og) {
+ obj[method.propName] = og;
+ this.recordMockedMethod.set(method.propName, undefined);
+ }
+ }
+
+ extend(dest: any, source:any) {
+ dest["stub"] = source["stub"];
+ dest["afterReturn"] = source["afterReturn"];
+ dest["afterReturnNothing"] = source["afterReturnNothing"];
+ dest["afterAction"] = source["afterAction"];
+ dest["afterThrow"] = source["afterThrow"];
+ dest["stubMockedCall"] = source["stubMockedCall"];
+ dest["clear"] = source["clear"];
+ return dest;
+ }
+
+ stubApply(f: any, params:any, returnInfo:any) {
+ let values = this.stubs.get(f);
+ if (!values) {
+ values = new Map();
+ }
+ let key = params[0];
+ if (typeof key == "undefined") {
+ key = "anonymous-mock-" + f.propName;
+ }
+ let matcher = new ArgumentMatchers();
+ if (matcher.matcheStubKey(key)) {
+ key = matcher.matcheStubKey(key);
+ if (key) {
+ this.currentSetKey.set(f, key);
+ }
+ }
+ values.set(key, returnInfo);
+ this.stubs.set(f, values);
+ }
+
+ getReturnInfo(f: any, params:any) {
+ let values = this.stubs.get(f);
+ if (!values) {
+ return undefined;
+ }
+ let retrunKet = params[0];
+ if (typeof retrunKet == "undefined") {
+ retrunKet = "anonymous-mock-" + f.propName;
+ }
+ let stubSetKey = this.currentSetKey.get(f);
+
+ if (stubSetKey && (typeof (retrunKet) != "undefined")) {
+ retrunKet = stubSetKey;
+ }
+ let matcher = new ArgumentMatchers();
+ if (matcher.matcheReturnKey(params[0], undefined, stubSetKey) && matcher.matcheReturnKey(params[0], undefined, stubSetKey) != stubSetKey) {
+ retrunKet = params[0];
+ }
+
+ values.forEach(function (value: any, key: any, map: any) {
+ if (ArgumentMatchers.isRegExp(key) && matcher.matcheReturnKey(params[0], key)) {
+ retrunKet = key;
+ }
+ });
+
+ return values.get(retrunKet);
+ }
+
+ findName(obj: any, value: any) {
+ let properties = this.findProperties(obj);
+ let name = '';
+ properties.filter((item:any) => (item !== 'caller' && item !== 'arguments')).forEach(
+ function (va1:any, idx:any, array:any) {
+ if (obj[va1] === value) {
+ name = va1;
+ }
+ }
+ );
+ return name;
+ }
+
+ isFunctionFromPrototype(f: Function, container:Function, propName: string) {
+ if (container.constructor != Object && container.constructor.prototype !== container) {
+ return container.constructor.prototype[propName] === f;
+ }
+ return false;
+ }
+
+ findProperties(obj: any, ...arg: Array) {
+ function getProperty(new_obj:any): Array {
+ if (new_obj.__proto__ === null) {
+ return [];
+ }
+ let properties = Object.getOwnPropertyNames(new_obj);
+ return [...properties, ...getProperty(new_obj.__proto__)];
+ }
+ return getProperty(obj);
+ }
+
+ recordMethodCall(originalMethod: any, args: any) {
+ originalMethod['getName'] = function () {
+ return this.name || this.toString().match(/function\s*([^(]*)\(/)[1];
+ }
+ let name = originalMethod.getName();
+ let arglistString = name + '(' + Array.from(args).toString() + ')';
+ let records = this.recordCalls.get(arglistString);
+ if (!records) {
+ records = 0;
+ }
+ records++;
+ this.recordCalls.set(arglistString, records);
+ }
+
+ mockFunc(originalObject:any, originalMethod:any) {
+ let tmp = this;
+ this.originalMethod = originalMethod;
+ const _this = this;
+ let f:any = function () {
+ let args = arguments;
+ let action = tmp.getReturnInfo(f, args);
+ if (originalMethod) {
+ tmp.recordMethodCall(originalMethod, args);
+ }
+ if (action) {
+ return action.apply(_this, args);
+ }
+ };
+
+ f.container = null || originalObject;
+ f.original = originalMethod || null;
+
+ if (originalObject && originalMethod) {
+ if (typeof (originalMethod) != 'function') throw new Error('Not a function');
+ var name = this.findName(originalObject, originalMethod);
+ originalObject[name] = f;
+ this.recordMockedMethod.set(name, originalMethod);
+ f.propName = name;
+ f.originalFromPrototype = this.isFunctionFromPrototype(f.original, originalObject, f.propName);
+ }
+ f.mocker = this;
+ this.mFunctions.push(f);
+ this.extend(f, new ExtendInterface(this));
+ return f;
+ }
+
+ verify(methodName:any, argsArray:any) {
+ if (!methodName) {
+ throw Error("not a function name");
+ }
+ let a = this.recordCalls.get(methodName + '(' + argsArray.toString() + ')');
+ return new VerificationMode(a ? a : 0);
+ }
+
+ mockObject(object: any) {
+ if (!object || typeof object === "string") {
+ throw Error(`this ${object} cannot be mocked`);
+ }
+ const _this = this;
+ let mockedObject:any = {};
+ let keys = Reflect.ownKeys(object);
+ keys.filter(key => (typeof Reflect.get(object, key)) === 'function')
+ .forEach((key:any) => {
+ mockedObject[key] = object[key];
+ mockedObject[key] = _this.mockFunc(mockedObject, mockedObject[key]);
+ });
+ return mockedObject;
+ }
+}
+
+function ifMockedFunction(f: any) {
+ if (Object.prototype.toString.call(f) != "[object Function]" &&
+ Object.prototype.toString.call(f) != "[object AsyncFunction]") {
+ throw Error("not a function");
+ }
+ if (!f.stub) {
+ throw Error("not a mock function");
+ }
+ return true;
+}
+
+function when(f: any) {
+ if (ifMockedFunction(f)) {
+ return f.stub.bind(f);
+ }
+}
+
+function MockSetup(target: Object, propertyName: string | Symbol, descriptor: TypedPropertyDescriptor<() => void>): void {
+ const aboutToAppearOrigin = target.aboutToAppear;
+ const setup = descriptor.value;
+ target.aboutToAppear = function (...args: any[]) {
+ if (target.__Param) { // copy attributes and params of the original context
+ try {
+ const map = target.__Param as Map;
+ for (const [key, val] of map) {
+ this[key] = val; // 'this' refers to context of current function
+ }
+ } catch (e) {
+ throw new Error(`Mock setup param error: ${e}`);
+ }
+ }
+
+ if (setup) { // apply the mock content
+ try {
+ setup.apply(this);
+ } catch (e) {
+ throw new Error(`Mock setup apply error: ${e}`);
+ }
+ }
+
+ if (aboutToAppearOrigin) { // append to aboutToAppear function of the original context
+ aboutToAppearOrigin.apply(this, args);
+ }
+ }
+}
+
+export {
+ MockSetup,
+ MockKit,
+ when
+};
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/src/main/mock/VerificationMode.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/src/main/mock/VerificationMode.js
new file mode 100644
index 0000000000000000000000000000000000000000..21e10fb8037f59475510b2821fcf7432c9459a4a
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/src/main/mock/VerificationMode.js
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2022-2023 Huawei Device 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.
+ */
+class VerificationMode {
+ constructor(times) {
+ this.doTimes = times;
+ }
+ times(count) {
+ if (count !== this.doTimes) {
+ throw Error(`expect ${count} actual ${this.doTimes}`);
+ }
+ }
+ never() {
+ if (this.doTimes !== 0) {
+ throw Error(`expect 0 actual ${this.doTimes}`);
+ }
+ }
+ once() {
+ if (this.doTimes !== 1) {
+ throw Error(`expect 1 actual ${this.doTimes}`);
+ }
+ }
+ atLeast(count) {
+ if (count > this.doTimes) {
+ throw Error('failed ' + count + ' greater than the actual execution times of method');
+ }
+ }
+ atMost(count) {
+ if (count < this.doTimes) {
+ throw Error('failed ' + count + ' less than the actual execution times of method');
+ }
+ }
+}
+export default VerificationMode;
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/src/main/mock/VerificationMode.ts b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/src/main/mock/VerificationMode.ts
new file mode 100644
index 0000000000000000000000000000000000000000..93d976ce73b2fbde199d31b3efd30eb3544179d8
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/src/main/mock/VerificationMode.ts
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2022-2023 Huawei Device 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.
+ */
+
+
+class VerificationMode {
+
+ private doTimes: number
+
+ constructor(times: number) {
+ this.doTimes = times;
+ }
+
+ times(count: number) {
+ if(count !== this.doTimes) {
+ throw Error(`expect ${count} actual ${this.doTimes}`);
+ }
+ }
+
+ never() {
+ if (this.doTimes !== 0) {
+ throw Error(`expect 0 actual ${this.doTimes}`);
+ }
+ }
+
+ once() {
+ if (this.doTimes !== 1) {
+ throw Error(`expect 1 actual ${this.doTimes}`);
+ }
+ }
+
+ atLeast(count: number) {
+ if (count > this.doTimes) {
+ throw Error('failed ' + count + ' greater than the actual execution times of method');
+ }
+ }
+
+ atMost(count: number) {
+ if (count < this.doTimes) {
+ throw Error('failed ' + count + ' less than the actual execution times of method');
+ }
+ }
+}
+
+export default VerificationMode;
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/src/main/module.json b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/src/main/module.json
new file mode 100644
index 0000000000000000000000000000000000000000..384ae72f9bd2353fea8a5c9c5d6696ab5e67cb21
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/src/main/module.json
@@ -0,0 +1,22 @@
+{
+ "app": {
+ "bundleName": "com.example.hamock",
+ "debug": true,
+ "versionCode": 1000000,
+ "versionName": "1.0.0",
+ "minAPIVersion": 9,
+ "targetAPIVersion": 9,
+ "apiReleaseType": "Release"
+ },
+ "module": {
+ "name": "hamock",
+ "type": "har",
+ "deviceTypes": [
+ "default",
+ "tablet",
+ "tv",
+ "wearable",
+ "car"
+ ]
+ }
+}
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/src/res/schemas/mock-config-json5-schema.json b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/src/res/schemas/mock-config-json5-schema.json
new file mode 100644
index 0000000000000000000000000000000000000000..96036325a316d827cb9fcb6908b3de23c53b4b79
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hamock/src/res/schemas/mock-config-json5-schema.json
@@ -0,0 +1,25 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "title": "JSON schema for mock-config.json5 file",
+ "definitions": {
+ "sourceRedirection": {
+ "description": "A source redirection for mocked module.",
+ "type": "object",
+ "required": [
+ "source"
+ ],
+ "properties": {
+ "source": {
+ "type": "string",
+ "maxLength": 128,
+ "minLength": 1
+ }
+ }
+ }
+ },
+ "patternProperties": {
+ ".+": {
+ "$ref": "#/definitions/sourceRedirection"
+ }
+ }
+}
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/BuildProfile.ets b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/BuildProfile.ets
new file mode 100644
index 0000000000000000000000000000000000000000..e84ee338f70bbfe5512c648fc7cc88b019557243
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/BuildProfile.ets
@@ -0,0 +1,5 @@
+export default class BuildProfile {
+ static readonly HAR_VERSION = '1.0.18';
+ static readonly BUILD_MODE_NAME = 'debug';
+ static readonly DEBUG = true;
+}
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/CHANGELOG.md b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/CHANGELOG.md
new file mode 100644
index 0000000000000000000000000000000000000000..b7e0113af1ceafe3ba8abc35ecf69aa9746088be
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/CHANGELOG.md
@@ -0,0 +1,18 @@
+## 1.0.14
+- 堆栈信息打印到cmd
+## 1.0.15
+- 支持获取测试代码的失败堆栈信息
+- mock代码迁移至harmock包
+- 适配arkts语法
+- 修复覆盖率数据容易截断的bug
+## 1.0.16
+- 修改覆盖率文件生成功能
+- 修改静态方法无法ignoreMock函数
+- ## 1.0.17
+- 修改not断言失败提示日志
+- 自定义错误message信息
+- 添加xdescribe, xit API功能
+- ## 1.0.18
+- 添加全局变量存储API get set
+- 自定义断言功能
+
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/LICENSE b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..4947287f7b5ccb5d1e8b7b2d3aa5d89f322c160d
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/README.md b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..50cdf9dc5e11bba059f2147354273225bd3781b0
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/README.md
@@ -0,0 +1,220 @@
+
Hypium
+
A unit test framework for OpenHarmonyOS application
+
+## Hypium是什么?
+***
+- Hypium是OpenHarmony上的测试框架,提供测试用例编写、执行、结果显示能力,用于OpenHarmony系统应用接口以及应用界面测试。
+- Hypium结构化模型:hypium工程主要由List.test.js与TestCase.test.js组成。
+```
+rootProject // Hypium工程根目录
+├── moduleA
+│ ├── src
+│ ├── main // 被测试应用目录
+│ ├── ohosTest // 测试用例目录
+│ ├── js/ets
+│ └── test
+│ └── List.test.js // 测试用例加载脚本,ets目录下为.ets后缀
+│ └── TestCase.test.js // 测试用例脚本,ets目录下为.ets后缀
+└── moduleB
+ ...
+│ └── List.test.js // 测试用例加载脚本,ets目录下为.ets后缀
+│ └── TestCase.test.js // 测试用例脚本,ets目录下为.ets后缀
+```
+
+## 安装使用
+***
+- 在DevEco Studio内使用Hypium
+- 工程级package.json内配置:
+```json
+"dependencies": {
+ "@ohos/hypium": "1.0.18"
+}
+```
+注:
+hypium服务于OpenHarmonyOS应用对外接口测试、系统对外接口测试(SDK中接口),完成HAP自动化测试。详细指导:
+[Deveco Studio](https://developer.harmonyos.com/cn/develop/deveco-studio)
+
+#### 通用语法
+
+- 测试用例采用业内通用语法,describe代表一个测试套, it代表一条用例。
+
+| No. | API | 功能说明 |
+|-----| ---------- | ---------------------------------------------------------------------------------------------------------------------- |
+| 1 | describe | 定义一个测试套,支持两个参数:测试套名称和测试套函数 |
+| 2 | beforeAll | 在测试套内定义一个预置条件,在所有测试用例开始前执行且仅执行一次,支持一个参数:预置动作函数 |
+| 3 | beforeEach | 在测试套内定义一个单元预置条件,在每条测试用例开始前执行,执行次数与it定义的测试用例数一致,支持一个参数:预置动作函数 |
+| 4 | afterEach | 在测试套内定义一个单元清理条件,在每条测试用例结束后执行,执行次数与it定义的测试用例数一致,支持一个参数:清理动作函数 |
+| 5 | afterAll | 在测试套内定义一个清理条件,在所有测试用例结束后执行且仅执行一次,支持一个参数:清理动作函数 |
+| 6 | it | 定义一条测试用例,支持三个参数:用例名称,过滤参数和用例函数 |
+| 7 | expect | 支持bool类型判断等多种断言方法 |
+| 8 | xdescribe | @since1.0.17定义一个跳过的测试套,支持两个参数:测试套名称和测试套函数。 |
+| 9 | xit | @since1.0.17定义一条跳过的测试用例,支持三个参数:用例名称,过滤参数和用例函数。 |
+#### 断言库
+
+- 示例代码:
+
+```javascript
+ expect(${actualvalue}).assertX(${expectvalue})
+```
+
+- 断言功能列表:
+
+| No. | API | 功能说明 |
+| :--- | :------------------------------- | ---------------------------------------------------------------------------------------------- |
+| 1 | assertClose | 检验actualvalue和expectvalue(0)的接近程度是否是expectValue(1) |
+| 2 | assertContain | 检验actualvalue中是否包含expectvalue |
+| 3 | assertDeepEquals | @since1.0.4 检验actualvalue和expectvalue(0)是否是同一个对象 |
+| 4 | assertEqual | 检验actualvalue是否等于expectvalue[0] |
+| 5 | assertFail | 抛出一个错误 |
+| 6 | assertFalse | 检验actualvalue是否是false |
+| 7 | assertTrue | 检验actualvalue是否是true |
+| 8 | assertInstanceOf | 检验actualvalue是否是expectvalue类型 |
+| 9 | assertLarger | 检验actualvalue是否大于expectvalue |
+| 10 | assertLess | 检验actualvalue是否小于expectvalue |
+| 11 | assertNaN | @since1.0.4 检验actualvalue是否是NaN |
+| 12 | assertNegUnlimited | @since1.0.4 检验actualvalue是否等于Number.NEGATIVE_INFINITY |
+| 13 | assertNull | 检验actualvalue是否是null |
+| 14 | assertPosUnlimited | @since1.0.4 检验actualvalue是否等于Number.POSITIVE_INFINITY |
+| 15 | assertPromiseIsPending | @since1.0.4 检验actualvalue是否处于Pending状态【actualvalue为promse对象】 |
+| 16 | assertPromiseIsRejected | @since1.0.4 检验actualvalue是否处于Rejected状态【同15】 |
+| 17 | assertPromiseIsRejectedWith | @since1.0.4 检验actualvalue是否处于Rejected状态,并且比较执行的结果值【同15】 |
+| 18 | assertPromiseIsRejectedWithError | @since1.0.4 检验actualvalue是否处于Rejected状态并有异常,同时比较异常的类型和message值【同15】 |
+| 19 | assertPromiseIsResolved | @since1.0.4 检验actualvalue是否处于Resolved状态【同15】 |
+| 20 | assertPromiseIsResolvedWith | @since1.0.4 检验actualvalue是否处于Resolved状态,并且比较执行的结果值【同15】 |
+| 21 | assertThrowError | 检验actualvalue抛出Error内容是否是expectValue |
+| 22 | assertUndefined | 检验actualvalue是否是undefined |
+| 23 | not | @since1.0.4 断言结果取反 |
+| 24 | message | @since1.0.17自定义断言异常信息 |
+
+示例代码:
+
+```javascript
+ import { describe, it, expect } from '@ohos/hypium';
+
+ export default async function assertCloseTest() {
+ describe('assertClose', function () {
+ it('assertClose_success', 0, function () {
+ let a = 100;
+ let b = 0.1;
+ expect(a).assertClose(99, b);
+ })
+ })
+ }
+```
+
+#### 公共系统能力
+
+| No. | API | 功能描述 |
+| ---- | ------------------------------------------------------- | ------------------------------------------------------------ |
+| 1 | existKeyword(keyword: string, timeout: number): boolean | @since1.0.3 hilog日志中查找指定字段是否存在,keyword是待查找关键字,timeout为设置的查找时间 |
+| 2 | actionStart(tag: string): void | @since1.0.3 cmd窗口输出开始tag |
+| 3 | actionEnd(tag: string): void | @since1.0.3 cmd窗口输出结束tag |
+
+示例代码:
+
+```javascript
+import { describe, it, expect, SysTestKit} from '@ohos/hypium';
+
+export default function existKeywordTest() {
+ describe('existKeywordTest', function () {
+ it('existKeyword',DEFAULT, async function () {
+ console.info("HelloTest");
+ let isExist = await SysTestKit.existKeyword('HelloTest');
+ console.info('isExist ------>' + isExist);
+ })
+ })
+}
+```
+```javascript
+import { describe, it, expect, SysTestKit} from '@ohos/hypium';
+
+export default function actionTest() {
+ describe('actionTest', function () {
+ it('existKeyword',DEFAULT, async function () {
+ let tag = '[MyTest]';
+ SysTestKit.actionStart(tag);
+ //do something
+ SysTestKit.actionEnd(tag);
+ })
+ })
+}
+```
+
+#### 专项能力
+
+- 测试用例属性筛选能力:hypium支持根据用例属性筛选执行指定测试用例,使用方式是先在测试用例上标记用例属性后,再在测试应用的启动shell命令后新增" -s ${Key} ${Value}"。
+
+| Key | 含义说明 | Value取值范围 |
+| -------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
+| level | 用例级别 | "0","1","2","3","4", 例如:-s level 1 |
+| size | 用例粒度 | "small","medium","large", 例如:-s size small |
+| testType | 用例测试类型 | "function","performance","power","reliability","security","global","compatibility","user","standard","safety","resilience", 例如:-s testType function |
+
+示例代码
+
+```javascript
+import { describe, it, expect, TestType, Size, Level } from '@ohos/hypium';
+
+export default function attributeTest() {
+ describe('attributeTest', function () {
+ it("testAttributeIt", TestType.FUNCTION | Size.SMALLTEST | Level.LEVEL0, function () {
+ console.info('Hello Test');
+ })
+ })
+}
+```
+
+示例命令
+```shell
+XX -s level 1 -s size small -s testType function
+```
+该命令的作用是:筛选测试应用中同时满足a)用例级别是1 b)用例粒度是small c)用例测试类型是function 三个条件的用例执行。
+
+- 测试套/测试用例名称筛选能力(测试套与用例名称用“#”号连接,多个用“,”英文逗号分隔)
+
+| Key | 含义说明 | Value取值范围 |
+| -------- | ----------------------- | -------------------------------------------------------------------------------------------- |
+| class | 指定要执行的测试套&用例 | ${describeName}#${itName},${describeName} , 例如:-s class attributeTest#testAttributeIt |
+| notClass | 指定不执行的测试套&用例 | ${describeName}#${itName},${describeName} , 例如:-s notClass attributeTest#testAttributeIt |
+
+示例命令
+```shell
+XX -s class attributeTest#testAttributeIt,abilityTest#testAbilityIt
+```
+该命令的作用是:筛选测试应用中attributeTest测试套下的testAttributeIt测试用例,abilityTest测试套下的testAbilityIt测试用例,只执行这两条用例。
+
+- 其他能力
+
+| 能力项 | Key | 含义说明 | Value取值范围 |
+| ------------ | ------- | ---------------------------- | ---------------------------------------------- |
+| 随机执行能力 | random | 测试套&测试用例随机执行 | true, 不传参默认为false, 例如:-s random true |
+| 空跑能力 | dryRun | 显示要执行的测试用例信息全集 | true , 不传参默认为false,例如:-s dryRun true |
+| 异步超时能力 | timeout | 异步用例执行的超时时间 | 正整数 , 单位ms,例如:-s timeout 5000 |
+
+##### 约束限制
+随机执行能力和空跑能力从npm包1.0.3版本开始支持
+
+#### Mock能力
+
+##### 约束限制
+
+单元测试框架Mock能力从npm包[1.0.1版本](https://repo.harmonyos.com/#/cn/application/atomService/@ohos%2Fhypium/v/1.0.1)开始支持
+
+## 约束
+
+***
+ 本模块首批接口从OpenHarmony SDK API version 8开始支持。
+
+## Hypium开放能力隐私声明
+
+- 我们如何收集和使用您的个人信息
+ 您在使用集成了Hypium开放能力的测试应用时,Hypium不会处理您的个人信息。
+- SDK处理的个人信息
+ 不涉及。
+- SDK集成第三方服务声明
+ 不涉及。
+- SDK数据安全保护
+ 不涉及。
+- SDK版本更新声明
+ 为了向您提供最新的服务,我们会不时更新Hypium版本。我们强烈建议开发者集成使用最新版本的Hypium。
+
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/build-profile.json5 b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..312d38eb08629793b3484c7373213f22840c8d82
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/build-profile.json5
@@ -0,0 +1,28 @@
+{
+ "apiType": "stageMode",
+ "buildOption": {
+ },
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": true,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ },
+ "consumerFiles": [
+ "./consumer-rules.txt"
+ ]
+ }
+ },
+ },
+ ],
+ "targets": [
+ {
+ "name": "default"
+ }
+ ]
+}
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/hvigorfile.ts b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..42187071482d292588ad40babeda74f7b8d97a23
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/hvigorfile.ts
@@ -0,0 +1,6 @@
+import { harTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/index.d.ts b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/index.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..54fc0420f7b872b8ffd6f9e6c3623e32be6ff606
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/index.d.ts
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2021-2024 Huawei Device 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.
+ */
+
+export const DEFAULT = 0B0000
+
+export const when: when;
+
+export enum TestType {
+ FUNCTION = 0B1,
+ PERFORMANCE = 0B1 << 1,
+ POWER = 0B1 << 2,
+ RELIABILITY = 0B1 << 3,
+ SECURITY = 0B1 << 4,
+ GLOBAL = 0B1 << 5,
+ COMPATIBILITY = 0B1 << 6,
+ USER = 0B1 << 7,
+ STANDARD = 0B1 << 8,
+ SAFETY = 0B1 << 9,
+ RESILIENCE = 0B1 << 10
+}
+
+export enum Size {
+ SMALLTEST = 0B1 << 16,
+ MEDIUMTEST = 0B1 << 17,
+ LARGETEST = 0B1 << 18
+}
+
+export enum Level {
+ LEVEL0 = 0B1 << 24,
+ LEVEL1 = 0B1 << 25,
+ LEVEL2 = 0B1 << 26,
+ LEVEL3 = 0B1 << 27,
+ LEVEL4 = 0B1 << 28
+}
+export { xdescribe, xit, describe, it } from './index';
+
+
+
+export function beforeItSpecified(testCaseNames: Array | string, callback: Function): void
+
+export function afterItSpecified(testCaseNames: Array | string, callback: Function): void
+
+export function beforeEach(callback: Function): void
+
+export function afterEach(callback: Function): void
+
+export function beforeAll(callback: Function): void
+
+export function afterAll(callback: Function): void
+
+
+export interface Assert {
+ assertClose(expectValue: number, precision: number): void
+ assertContain(expectValue: any): void
+ assertEqual(expectValue: any): void
+ assertFail(): void
+ assertFalse(): void
+ assertTrue(): void
+ assertInstanceOf(expectValue: string): void
+ assertLarger(expectValue: number): void
+ assertLess(expectValue: number): void
+ assertNull(): void
+ assertThrowError(expectValue: string): void
+ assertUndefined(): void
+ assertLargerOrEqual(expectValue: number): void
+ assertLessOrEqual(expectValue: number): void
+ assertNaN(): void
+ assertNegUnlimited(): void
+ assertPosUnlimited(): void
+ not(): Assert;
+ assertDeepEquals(expectValue: any): void
+ assertPromiseIsPending(): void
+ assertPromiseIsRejected(): void
+ assertPromiseIsRejectedWith(expectValue?: any): void
+ assertPromiseIsRejectedWithError(...expectValue): void
+ assertPromiseIsResolved(): void
+ assertPromiseIsResolvedWith(expectValue?: any): void
+ message(msg: string): Assert
+}
+
+export function expect(actualValue?: any): Assert
+
+export class ArgumentMatchers {
+ static any;
+ static anyString;
+ static anyBoolean;
+ static anyNumber;
+ static anyObj;
+ static anyFunction;
+ static matchRegexs(Regex: RegExp): void
+}
+
+declare interface when {
+ afterReturn(value: any): any
+ afterReturnNothing(): undefined
+ afterAction(action: any): any
+ afterThrow(e_msg: string): string
+ (argMatchers?: any): when;
+}
+
+export interface VerificationMode {
+ times(count: Number): void
+ never(): void
+ once(): void
+ atLeast(count: Number): void
+ atMost(count: Number): void
+}
+
+export class MockKit {
+ constructor()
+ mockFunc(obj: Object, func: Function): Function
+ mockObject(obj: Object): Object
+ verify(methodName: String, argsArray: Array): VerificationMode
+ ignoreMock(obj: Object, func: Function): void
+ clear(obj: Object): void
+ clearAll(): void
+}
+
+export class SysTestKit {
+ static getDescribeName(): string;
+ static getItName(): string;
+ static getItAttribute(): TestType | Size | Level
+ static actionStart(tag: string): void
+ static actionEnd(tag: string): void
+ static existKeyword(keyword: string, timeout?: number): boolean
+}
+
+export class Hypium {
+ static setData(data: { [key: string]: any }): void
+ static setTimeConfig(systemTime: any)
+ static hypiumTest(abilityDelegator: any, abilityDelegatorArguments: any, testsuite: Function): void
+ static set(key: string, value: any): void
+ static get(key: string): any
+ static registerAssert(customAssertion: Function): void
+ static unregisterAssert(customAssertion: string | Function): void
+}
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/index.ets b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..1a9b707e35e58e5819594321bac6e36997a90713
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/index.ets
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2021-2024 Huawei Device 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 Core from './src/main/core';
+import {TestType, Size, Level, DEFAULT} from './src/main/Constant';
+import DataDriver from './src/main/module/config/DataDriver';
+import ExpectExtend from './src/main/module/assert/ExpectExtend';
+import OhReport from './src/main/module/report/OhReport';
+export { xdescribe, xit, describe, it } from './index.ts';
+
+export declare class Hypium {
+ static setData(data: Object): void
+ static setTimeConfig(systemTime: Object): void
+ static hypiumTest(abilityDelegator: Object, abilityDelegatorArguments: Object, testsuite: Function): void
+ static set(key: string, value: Object): void
+ static get(key: string): Object
+ static registerAssert(customAssertion: Function): void
+ static unregisterAssert(customAssertion: string | Function): void
+}
+
+export {
+ Core,
+ DataDriver,
+ ExpectExtend,
+ OhReport,
+ TestType,
+ Size,
+ Level,
+ DEFAULT
+};
+
+type allExpectType = Object | undefined | null
+
+export declare function beforeItSpecified(testCaseNames: Array | string, callback: Function): void
+
+export declare function afterItSpecified(testCaseNames: Array | string, callback: Function): void
+
+export declare function beforeEach(callback: Function): void
+
+export declare function afterEach(callback: Function): void
+
+export declare function beforeAll(callback: Function): void
+
+export declare function afterAll(callback: Function): void
+
+export declare interface Assert {
+ assertClose(expectValue: number, precision: number): void
+ assertContain(expectValue: allExpectType): void
+ assertEqual(expectValue: allExpectType): void
+ assertFail(): void
+ assertFalse(): void
+ assertTrue(): void
+ assertInstanceOf(expectValue: string): void
+ assertLarger(expectValue: number): void
+ assertLess(expectValue: number): void
+ assertNull(): void
+ assertThrowError(expectValue: string): void
+ assertUndefined(): void
+ assertLargerOrEqual(expectValue: number):void
+ assertLessOrEqual(expectValue: number):void
+ assertNaN():void
+ assertNegUnlimited(): void
+ assertPosUnlimited(): void
+ not(): Assert;
+ assertDeepEquals(expectValue: allExpectType):void
+ assertPromiseIsPending(): void
+ assertPromiseIsRejected(): void
+ assertPromiseIsRejectedWith(expectValue?: allExpectType): void
+ assertPromiseIsRejectedWithError(...expectValue: allExpectType[]): void
+ assertPromiseIsResolved(): void
+ assertPromiseIsResolvedWith(expectValue?: allExpectType): void
+ message(msg: string): Assert
+}
+
+export declare function expect(actualValue?: allExpectType): Assert
+
+export declare class ArgumentMatchers {
+ static any: allExpectType;
+ static anyString: string;
+ static anyBoolean: Boolean;
+ static anyNumber: Number;
+ static anyObj: Object;
+ static anyFunction: Function;
+ static matchRegexs(Regex: RegExp): void
+}
+
+declare interface whenResult {
+ afterReturn: (value: allExpectType) => allExpectType
+ afterReturnNothing: () => undefined
+ afterAction: (action: allExpectType) => allExpectType
+ afterThrow: (e_msg: string) => string
+}
+
+export declare function when(f:Function): (f?: allExpectType | void) => whenResult
+
+export declare interface VerificationMode {
+ times(count: Number): void
+ never(): void
+ once(): void
+ atLeast(count: Number): void
+ atMost(count: Number): void
+}
+
+export declare class MockKit {
+ constructor()
+ mockFunc(obj: Object, func: Function): Function
+ mockObject(obj: Object): Object
+ verify(methodName: String, argsArray: Array): VerificationMode
+ ignoreMock(obj: Object, func: Function): void
+ clear(obj: Object): void
+ clearAll(): void
+}
+
+export declare class SysTestKit {
+ static actionStart(tag: string): void
+ static actionEnd(tag: string): void
+ static existKeyword(keyword: string, timeout?: number): boolean
+}
+
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/index.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..320cff5bd99bfe6c13665e558f0845b98b2c8619
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/index.js
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2021-2024 Huawei Device 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 Core from './src/main/core';
+import { DEFAULT, TestType, Size, Level, TAG } from './src/main/Constant';
+import DataDriver from './src/main/module/config/DataDriver';
+import ExpectExtend from './src/main/module/assert/ExpectExtend';
+import OhReport from './src/main/module/report/OhReport';
+import SysTestKit from './src/main/module/kit/SysTestKit';
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, beforeItSpecified, afterItSpecified, xdescribe, xit } from './src/main/interface';
+import { MockKit, when } from './src/main/module/mock/MockKit';
+import ArgumentMatchers from './src/main/module/mock/ArgumentMatchers';
+
+class Hypium {
+ static context = new Map();
+ static setData(data) {
+ const core = Core.getInstance();
+ const dataDriver = new DataDriver({ data });
+ core.addService('dataDriver', dataDriver);
+ }
+
+ static setTimeConfig(systemTime) {
+ SysTestKit.systemTime = systemTime;
+ }
+
+ static set(key, value) {
+ Hypium.context.set(key, value);
+ }
+
+ static get(key) {
+ return Hypium.context.get(key);
+ }
+
+ static hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) {
+ const core = Core.getInstance();
+ const expectExtend = new ExpectExtend({
+ 'id': 'extend'
+ });
+ core.addService('expect', expectExtend);
+ const ohReport = new OhReport({
+ 'delegator': abilityDelegator,
+ 'abilityDelegatorArguments': abilityDelegatorArguments
+ });
+ SysTestKit.delegator = abilityDelegator;
+ core.addService('report', ohReport);
+ core.init();
+ core.subscribeEvent('spec', ohReport);
+ core.subscribeEvent('suite', ohReport);
+ core.subscribeEvent('task', ohReport);
+ const configService = core.getDefaultService('config');
+ if (abilityDelegatorArguments !== null) {
+ let testParameters = configService.translateParams(abilityDelegatorArguments.parameters);
+ console.info(`${TAG}parameters:${JSON.stringify(testParameters)}`);
+ configService.setConfig(testParameters);
+ }
+ testsuite();
+ core.execute(abilityDelegator);
+ }
+
+ static registerAssert(customAssertion) {
+ const core = Core.getInstance();
+ const expectService = core.getDefaultService('expect');
+ let matchers = {};
+ matchers[customAssertion.name] = customAssertion;
+ expectService.addMatchers(matchers);
+ expectService.customMatchers.push(customAssertion.name);
+ console.log(`${TAG}success to register the ${customAssertion.name}`);
+ }
+
+ static unregisterAssert(customAssertion) {
+ const core = Core.getInstance();
+ const expectService = core.getDefaultService('expect');
+ let customAssertionName = typeof customAssertion === 'function' ? customAssertion.name : customAssertion;
+ expectService.removeMatchers(customAssertionName);
+ console.log(`${TAG}success to unregister the ${customAssertionName}`);
+ }
+
+}
+
+export {
+ Hypium,
+ Core,
+ DEFAULT,
+ TestType,
+ Size,
+ Level,
+ DataDriver,
+ ExpectExtend,
+ OhReport,
+ SysTestKit,
+ describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, beforeItSpecified, afterItSpecified, xdescribe, xit,
+ MockKit, when,
+ ArgumentMatchers
+};
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/index.ts b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/index.ts
new file mode 100644
index 0000000000000000000000000000000000000000..b7082ebc98214b58d41e8681791809f1aee48f12
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/index.ts
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2024 Huawei Device 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 { TestType, Size, Level } from "./src/main/Constant";
+
+export declare function xdescribe(testSuiteName: string, func: Function): void;
+
+export declare namespace xdescribe {
+ function reason(reason: string): any;
+};
+
+export declare function describe(testSuiteName: string, func: Function): void;
+
+export declare function xit(testCaseName: string, attribute: TestType | Size | Level, func: Function): void;
+
+export declare namespace xit {
+ function reason(reason: string): any;
+};
+
+export declare function it(testCaseName: string, attribute: TestType | Size | Level, func: Function): void;
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/oh-package.json5 b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..9cd9da2c41f9f31a6c14b8fe792c87bcf4183554
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/oh-package.json5
@@ -0,0 +1 @@
+{"name":"@ohos/hypium","version":"1.0.18","description":"A unit test framework for OpenHarmony application","main":"index.js","keywords":["测试框架","except","mock"],"author":"huawei","license":"Apache-2.0","repository":"https://gitee.com/openharmony/testfwk_arkxtest","homepage":"https://gitee.com/openharmony/testfwk_arkxtest","dependencies":{}}
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/Constant.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/Constant.js
new file mode 100644
index 0000000000000000000000000000000000000000..7a24b2130e3c6e3f2f7bc75d425247e9b355c6b6
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/Constant.js
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2021-2024 Huawei Device 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.
+ */
+
+/**
+ * define the testcase type : TestType, Size , Level
+ */
+export const TAG = '[Hypium]';
+
+export const DEFAULT = 0B0000;
+
+export class TestType {
+ static FUNCTION = 0B1;
+ static PERFORMANCE = 0B1 << 1;
+ static POWER = 0B1 << 2;
+ static RELIABILITY = 0B1 << 3;
+ static SECURITY = 0B1 << 4;
+ static GLOBAL = 0B1 << 5;
+ static COMPATIBILITY = 0B1 << 6;
+ static USER = 0B1 << 7;
+ static STANDARD = 0B1 << 8;
+ static SAFETY = 0B1 << 9;
+ static RESILIENCE = 0B1 << 10;
+}
+
+export class Size {
+ static SMALLTEST = 0B1 << 16;
+ static MEDIUMTEST = 0B1 << 17;
+ static LARGETEST = 0B1 << 18;
+}
+
+export class Level {
+ static LEVEL0 = 0B1 << 24;
+ static LEVEL1 = 0B1 << 25;
+ static LEVEL2 = 0B1 << 26;
+ static LEVEL3 = 0B1 << 27;
+ static LEVEL4 = 0B1 << 28;
+}
+
+export const TESTTYPE = {
+ 'function': 1,
+ 'performance': 1 << 1,
+ 'power': 1 << 2,
+ 'reliability': 1 << 3,
+ 'security': 1 << 4,
+ 'global': 1 << 5,
+ 'compatibility': 1 << 6,
+ 'user': 1 << 7,
+ 'standard': 1 << 8,
+ 'safety': 1 << 9,
+ 'resilience': 1 << 10,
+}
+
+export const LEVEL = {
+ '0': 1 << 24,
+ '1': 1 << 25,
+ '2': 1 << 26,
+ '3': 1 << 27,
+ '4': 1 << 28,
+}
+
+export const SIZE = {
+ 'small': 1 << 16,
+ 'medium': 1 << 17,
+ 'large': 1 << 18,
+}
+
+export const KEYSET = [
+ '-s class', '-s notClass', '-s suite', '-s itName',
+ '-s level', '-s testType', '-s size', '-s timeout',
+ '-s dryRun', '-s random', '-s breakOnError', '-s stress',
+ '-s coverage', '-s skipMessage', '-s runSkipped',
+ 'class', 'notClass', 'suite', 'itName',
+ 'level', 'testType', 'size', 'timeout', 'dryRun', 'random',
+ 'breakOnError', 'stress', 'coverage', 'skipMessage', 'runSkipped'
+]
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/core.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/core.js
new file mode 100644
index 0000000000000000000000000000000000000000..cfcb5f17287208f5e6869b4248faf6c9093002d9
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/core.js
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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 {SuiteService, SpecService, ExpectService, ReportService} from './service';
+import {ConfigService} from './module/config/configService';
+import {SpecEvent, TaskEvent, SuiteEvent} from './event';
+
+/**
+ * core service for execute testcase.
+ */
+class Core {
+ static getInstance() {
+ if (!this.instance) {
+ this.instance = new Core();
+ }
+ return this.instance;
+ }
+
+ constructor() {
+ this.instance = null;
+ this.services = {
+ suite: {},
+ spec: {},
+ config: {},
+ expect: {},
+ log: {},
+ report: {}
+
+ };
+ this.events = {
+ suite: {},
+ spec: {},
+ task: {}
+ };
+ }
+
+ addService(name, service) {
+ let serviceObj = {};
+ if (!this.services[name]) {
+ this.services[name] = serviceObj;
+ } else {
+ serviceObj = this.services[name];
+ }
+ serviceObj[service.id] = service;
+ }
+
+ getDefaultService(name) {
+ return this.services[name].default;
+ }
+
+ getServices(name) {
+ return this.services[name];
+ }
+
+ registerEvent(serviceName, event) {
+ let eventObj = {};
+ if (!this.events[serviceName]) {
+ this.events[serviceName] = eventObj;
+ } else {
+ eventObj = this.events[serviceName];
+ }
+ eventObj[event.id] = event;
+ }
+
+ unRegisterEvent(serviceName, eventID) {
+ const eventObj = this.events[serviceName];
+ if (eventObj) {
+ delete eventObj[eventID];
+ }
+ }
+
+ subscribeEvent(serviceName, serviceObj) {
+ const eventObj = this.events[serviceName];
+ if (eventObj) {
+ for (const attr in eventObj) {
+ eventObj[attr]['subscribeEvent'](serviceObj);
+ }
+ }
+ }
+
+ async fireEvents(serviceName, eventName) {
+ const eventObj = this.events[serviceName];
+ if (!eventObj) {
+ return;
+ }
+ for (const attr in eventObj) {
+ await eventObj[attr][eventName]();
+ }
+ }
+
+ addToGlobal(apis) {
+ if (typeof globalThis !== 'undefined') {
+ for (let api in apis) {
+ globalThis[api] = apis[api];
+ }
+ }
+ for (const api in apis) {
+ this[api] = apis[api];
+ }
+ }
+
+ init() {
+ this.addService('suite', new SuiteService({id: 'default'}));
+ this.addService('spec', new SpecService({id: 'default'}));
+ this.addService('expect', new ExpectService({id: 'default'}));
+ this.addService('report', new ReportService({id: 'default'}));
+ this.addService('config', new ConfigService({id: 'default'}));
+ this.registerEvent('task', new TaskEvent({id: 'default', coreContext: this}));
+ this.registerEvent('suite', new SuiteEvent({id: 'default', coreContext: this}));
+ this.registerEvent('spec', new SpecEvent({id: 'default', coreContext: this}));
+ this.subscribeEvent('spec', this.getDefaultService('report'));
+ this.subscribeEvent('suite', this.getDefaultService('report'));
+ this.subscribeEvent('task', this.getDefaultService('report'));
+ const context = this;
+ for (const key in this.services) {
+ const serviceObj = this.services[key];
+ for (const serviceID in serviceObj) {
+ const service = serviceObj[serviceID];
+ service.init(context);
+
+ if (typeof service.apis !== 'function') {
+ continue;
+ }
+ const apis = service.apis();
+ if (apis) {
+ this.addToGlobal(apis);
+ }
+ }
+ }
+ }
+
+ execute(abilityDelegator) {
+ const suiteService = this.getDefaultService('suite');
+ const configService = this.getDefaultService('config');
+ if (configService['dryRun'] === 'true') {
+ (async function () {
+ await suiteService.dryRun(abilityDelegator);
+ })();
+ return;
+ }
+ setTimeout(() => {
+ suiteService.execute();
+ }, 10);
+ }
+}
+
+export default Core;
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/event.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/event.js
new file mode 100644
index 0000000000000000000000000000000000000000..3be0211f01646c9c269c2425cbee82c87ac6d9ea
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/event.js
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2021-2024 Huawei Device 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.
+ */
+
+class SpecEvent {
+ constructor(attr) {
+ this.id = attr.id;
+ this.coreContext = attr.context;
+ this.eventMonitors = [];
+ }
+
+ subscribeEvent(service) {
+ this.eventMonitors.push(service);
+ }
+
+ async specStart() {
+ for (const monitor of this.eventMonitors) {
+ await monitor['specStart']();
+ }
+ }
+
+ async specDone() {
+ for (const monitor of this.eventMonitors) {
+ await monitor['specDone']();
+ }
+ }
+}
+
+class SuiteEvent {
+ constructor(attr) {
+ this.id = attr.id;
+ this.suiteContext = attr.coreContext;
+ this.eventMonitors = [];
+ }
+
+ subscribeEvent(service) {
+ this.eventMonitors.push(service);
+ }
+
+ async suiteStart() {
+ for (const monitor of this.eventMonitors) {
+ await monitor['suiteStart']();
+ }
+ }
+
+ async suiteDone() {
+ for (const monitor of this.eventMonitors) {
+ await monitor['suiteDone']();
+ }
+ }
+}
+
+class TaskEvent {
+ constructor(attr) {
+ this.id = attr.id;
+ this.coreContext = attr.coreContext;
+ this.eventMonitors = [];
+ }
+
+ subscribeEvent(service) {
+ this.eventMonitors.push(service);
+ }
+
+ async taskStart() {
+ for (const monitor of this.eventMonitors) {
+ await monitor['taskStart']();
+ }
+ }
+
+ async taskDone() {
+ for (const monitor of this.eventMonitors) {
+ await monitor['taskDone']();
+ }
+ }
+
+ incorrectFormat() {
+ for (const monitor of this.eventMonitors) {
+ monitor['incorrectFormat']();
+ }
+ }
+
+ incorrectTestSuiteFormat() {
+ for (const monitor of this.eventMonitors) {
+ monitor.incorrectTestSuiteFormat();
+ }
+ }
+}
+
+export { SpecEvent, TaskEvent, SuiteEvent };
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/interface.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/interface.js
new file mode 100644
index 0000000000000000000000000000000000000000..44c345543313b6bad3108a8fa8824dfd92c39c79
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/interface.js
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2021-2024 Huawei Device 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 Core from './core';
+
+const core = Core.getInstance();
+
+const describe = function (desc, func) {
+ return Reflect.has(core, 'describe') ? core.describe(desc, func) : (desc, func) => { };
+};
+const it = function (desc, filter, func) {
+ return Reflect.has(core, 'it') ? core.it(desc, filter, func) : (desc, filter, func) => { };
+};
+const beforeItSpecified = function (itDescs, func) {
+ return Reflect.has(core, 'beforeItSpecified') ? core.beforeItSpecified(itDescs, func) : (itDescs, func) => { };
+};
+
+const afterItSpecified = function (itDescs, func) {
+ return Reflect.has(core, 'afterItSpecified') ? core.afterItSpecified(itDescs, func) : (itDescs, func) => { };
+};
+const beforeEach = function (func) {
+ return Reflect.has(core, 'beforeEach') ? core.beforeEach(func) : (func) => { };
+};
+const afterEach = function (func) {
+ return Reflect.has(core, 'afterEach') ? core.afterEach(func) : (func) => { };
+};
+const beforeAll = function (func) {
+ return Reflect.has(core, 'beforeAll') ? core.beforeAll(func) : (func) => { };
+};
+const afterAll = function (func) {
+ return Reflect.has(core, 'afterAll') ? core.afterAll(func) : (func) => { };
+};
+const expect = function (actualValue) {
+ return Reflect.has(core, 'expect') ? core.expect(actualValue) : (actualValue) => { };
+};
+
+const xdescribe = function (desc, func) {
+ return Reflect.has(core, 'xdescribe') ? core.xdescribe(desc, func, null) : (desc, func, reason) => { };
+};
+xdescribe.reason = (reason) => {
+ return (desc, func) => {
+ return Reflect.has(core, 'xdescribe') ? core.xdescribe(desc, func, reason) : (desc, func, reason) => { };
+ }
+}
+const xit = function (desc, filter, func) {
+ return Reflect.has(core, 'xit') ? core.xit(desc, filter, func, null) : (desc, filter, func, reason) => { };
+};
+xit.reason = (reason) => {
+ return (desc, filter, func) => {
+ return Reflect.has(core, 'xit') ? core.xit(desc, filter, func, reason) : (desc, filter, func, reason) => { };
+ }
+}
+
+export {
+ describe, it, beforeAll, beforeEach, afterEach, afterAll, expect, beforeItSpecified, afterItSpecified, xdescribe, xit
+};
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module.json b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module.json
new file mode 100644
index 0000000000000000000000000000000000000000..1fd46ff69422297a5b9139cf75e4a5ab55e38c19
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module.json
@@ -0,0 +1,26 @@
+{
+ "app": {
+ "bundleName": "com.ohos.hypium",
+ "debug": true,
+ "versionCode": 1000000,
+ "versionName": "1.0.0",
+ "minAPIVersion": 40100011,
+ "targetAPIVersion": 40100011,
+ "apiReleaseType": "Beta1",
+ "compileSdkVersion": "4.1.0.55",
+ "compileSdkType": "HarmonyOS",
+ "bundleType": "app"
+ },
+ "module": {
+ "name": "hypium",
+ "type": "har",
+ "deviceTypes": [
+ "default",
+ "tablet",
+ "tv",
+ "wearable",
+ "car"
+ ],
+ "installationFree": false
+ }
+}
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/ExpectExtend.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/ExpectExtend.js
new file mode 100644
index 0000000000000000000000000000000000000000..d10d15e6f9955c6d04610101f8766c951ee1a35d
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/ExpectExtend.js
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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 assertNull from './assertNull';
+import assertClose from './assertClose';
+import assertContain from './assertContain';
+import assertLess from './assertLess';
+import assertLarger from './assertLarger';
+import assertFail from './assertFail';
+import assertUndefined from './assertUndefined';
+import assertFalse from './assertFalse';
+import assertInstanceOf from './assertInstanceOf';
+import assertThrowError from './assertThrowError';
+import assertLargerOrEqual from './assertLargerOrEqual'
+import assertLessOrEqual from './assertLessOrEqual'
+import assertNaN from './assertNaN'
+import assertNegUnlimited from './assertNegUnlimited'
+import assertPosUnlimited from './assertPosUnlimited'
+import assertDeepEquals from './deepEquals/assertDeepEquals'
+import assertPromiseIsPending from './assertPromiseIsPending';
+import assertPromiseIsRejected from './assertPromiseIsRejected';
+import assertPromiseIsRejectedWith from './assertPromiseIsRejectedWith';
+import assertPromiseIsRejectedWithError from './assertPromiseIsRejectedWithError';
+import assertPromiseIsResolved from './assertPromiseIsResolved';
+import assertPromiseIsResolvedWith from './assertPromiseIsResolvedWith';
+class ExpectExtend {
+ constructor(attr) {
+ this.id = attr.id;
+ this.matchers = {};
+ }
+
+ extendsMatchers() {
+ this.matchers.assertNull = assertNull;
+ this.matchers.assertClose = assertClose;
+ this.matchers.assertContain = assertContain;
+ this.matchers.assertLess = assertLess;
+ this.matchers.assertLarger = assertLarger;
+ this.matchers.assertFail = assertFail;
+ this.matchers.assertUndefined = assertUndefined;
+ this.matchers.assertFalse = assertFalse;
+ this.matchers.assertInstanceOf = assertInstanceOf;
+ this.matchers.assertThrowError = assertThrowError;
+ this.matchers.assertLargerOrEqual = assertLargerOrEqual;
+ this.matchers.assertLessOrEqual = assertLessOrEqual;
+ this.matchers.assertNaN = assertNaN;
+ this.matchers.assertNegUnlimited = assertNegUnlimited;
+ this.matchers.assertPosUnlimited = assertPosUnlimited;
+ this.matchers.assertDeepEquals = assertDeepEquals;
+ this.matchers.assertPromiseIsPending = assertPromiseIsPending;
+ this.matchers.assertPromiseIsRejected = assertPromiseIsRejected;
+ this.matchers.assertPromiseIsRejectedWith = assertPromiseIsRejectedWith;
+ this.matchers.assertPromiseIsRejectedWithError = assertPromiseIsRejectedWithError;
+ this.matchers.assertPromiseIsResolved = assertPromiseIsResolved;
+ this.matchers.assertPromiseIsResolvedWith = assertPromiseIsResolvedWith;
+ }
+
+ init(coreContext) {
+ this.coreContext = coreContext;
+ this.extendsMatchers();
+ const expectService = this.coreContext.getDefaultService('expect');
+ expectService.addMatchers(this.matchers);
+ }
+
+ apis() {
+ return {
+ 'expect': function (actualValue) {
+ return this.coreContext.getDefaultService('expect').expect(actualValue);
+ }
+ };
+ }
+}
+
+export default ExpectExtend;
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertClose.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertClose.js
new file mode 100644
index 0000000000000000000000000000000000000000..63635bea5bf1298776de565260e0e0babae56857
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertClose.js
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+function assertClose(actualValue, expected) {
+ console.log('expected:' + expected[0] + ',precision:' + expected[1]);
+ if (actualValue === null && expected[0] === null) {
+ throw new Error('actualValue and expected can not be both null!!!');
+ }
+ let result;
+ let diff = Math.abs(expected[0] - actualValue);
+ let actualAbs = Math.abs(actualValue);
+ if ((actualAbs - 0) === 0) {
+ if ((diff - 0) === 0) {
+ result = true;
+ } else {
+ result = false;
+ }
+ } else if (diff / actualAbs < expected[1]) {
+ result = true;
+ } else {
+ result = false;
+ }
+ return {
+ pass: result,
+ message: '|' + actualValue + ' - ' + expected[0] + '|/' + actualValue + ' is not less than ' + expected[1]
+ };
+}
+
+export default assertClose;
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertContain.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertContain.js
new file mode 100644
index 0000000000000000000000000000000000000000..7fba0d9755503e5e926f6c1a4e425e0d1cf47570
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertContain.js
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+function assertContain(actualValue, expect) {
+ let result = false;
+ if (Object.prototype.toString.call(actualValue).indexOf('Array')) {
+ for (let i in actualValue) {
+ if (actualValue[i] == expect[0]) {
+ result = true;
+ }
+ }
+ }
+ let type = Object.prototype.toString.call(actualValue);
+ if (type === '[object String]') {
+ result = actualValue.indexOf(expect[0]) >= 0;
+ }
+ return {
+ pass: result,
+ message: 'expect false, ' + actualValue + ' do not have ' + expect[0]
+ };
+}
+
+export default assertContain;
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertFail.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertFail.js
new file mode 100644
index 0000000000000000000000000000000000000000..8ab4ac5caef712c75c4eac49dfbbb91d33669d9a
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertFail.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+function assertFail() {
+ return {
+ pass: false,
+ message: 'fail '
+ };
+}
+
+export default assertFail;
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertFalse.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertFalse.js
new file mode 100644
index 0000000000000000000000000000000000000000..c5008e94f4b2ce13ed35b604811793c76b542347
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertFalse.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+function assertFalse(actualValue) {
+ return {
+ pass: (actualValue) === false,
+ message: 'expect false, actualValue is ' + actualValue
+ };
+}
+
+export default assertFalse;
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertInstanceOf.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertInstanceOf.js
new file mode 100644
index 0000000000000000000000000000000000000000..1e11b93f7251c67f5455c5007cd7be268aa53b32
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertInstanceOf.js
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+function assertInstanceOf(actualValue, expected) {
+ if (Object.prototype.toString.call(actualValue) == '[object ' + expected[0] + ']') {
+ return {
+ pass: true
+ };
+ } else {
+ return {
+ pass: false,
+ message: actualValue + ' is ' + Object.prototype.toString.call(actualValue) + 'not ' + expected[0]
+ };
+ }
+}
+
+export default assertInstanceOf;
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertLarger.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertLarger.js
new file mode 100644
index 0000000000000000000000000000000000000000..a74f4a8cedaf3add9c2dc2d3799081a83198732f
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertLarger.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+function assertLarger(actualValue, expected) {
+ return {
+ pass: (actualValue) > expected[0],
+ message: (actualValue) + ' is not larger than ' + expected[0]
+ };
+}
+
+export default assertLarger;
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertLargerOrEqual.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertLargerOrEqual.js
new file mode 100644
index 0000000000000000000000000000000000000000..e847e6c217364b7f69c173c66fb98d10efc45ef1
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertLargerOrEqual.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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.
+ */
+
+function assertLargerOrEqual(actualValue, expected) {
+ return {
+ pass: (actualValue) >= expected[0],
+ message: (actualValue) + ' is not larger than ' + expected[0]
+ };
+}
+
+export default assertLargerOrEqual;
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertLess.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertLess.js
new file mode 100644
index 0000000000000000000000000000000000000000..17e84b0abaeb20804048a5a15c19e0603634846d
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertLess.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+function assertLess(actualValue, expected) {
+ return {
+ pass: (actualValue) < expected[0],
+ message: (actualValue) + ' is not less than ' + expected[0]
+ };
+}
+
+export default assertLess;
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertLessOrEqual.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertLessOrEqual.js
new file mode 100644
index 0000000000000000000000000000000000000000..f754f97ffa9d24e7852efe2423a1dd35d448af82
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertLessOrEqual.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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.
+ */
+
+function assertLessOrEqual(actualValue, expected) {
+ return {
+ pass: (actualValue) <= expected[0],
+ message: (actualValue) + ' is not less than ' + expected[0]
+ };
+}
+
+export default assertLessOrEqual;
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertNaN.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertNaN.js
new file mode 100644
index 0000000000000000000000000000000000000000..8d45d6a93b86c5ed325a68b32ff014835993a58e
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertNaN.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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.
+ */
+
+function assertNaN(actualValue) {
+ return {
+ pass: actualValue !== actualValue,
+ message: 'expect NaN, actualValue is ' + actualValue
+ };
+}
+
+export default assertNaN;
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertNegUnlimited.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertNegUnlimited.js
new file mode 100644
index 0000000000000000000000000000000000000000..ceac555afc826e057970e6cfe9c73b322c672aa2
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertNegUnlimited.js
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2022 Huawei Device 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.
+*/
+
+function assertNegUnlimited(actualValue) {
+ return {
+ pass: actualValue === Number.NEGATIVE_INFINITY,
+ message: 'Expected actualValue not to be -Infinity. actualValue is,' + actualValue
+ };
+}
+
+export default assertNegUnlimited;
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertNull.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertNull.js
new file mode 100644
index 0000000000000000000000000000000000000000..53a7bad827323a98d3302a4e7eea679551b459c5
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertNull.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+function assertNull(actualValue) {
+ return {
+ pass: (actualValue) === null,
+ message: 'expect null, actualValue is ' + (actualValue)
+ };
+}
+
+export default assertNull;
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertPosUnlimited.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertPosUnlimited.js
new file mode 100644
index 0000000000000000000000000000000000000000..6e68c0e2b6c499f4dc3dd56c13e9ea1073a3c54c
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertPosUnlimited.js
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2022 Huawei Device 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.
+*/
+
+function assertPosUnlimited(actualValue) {
+ return {
+ pass: actualValue === Number.POSITIVE_INFINITY,
+ message: 'Expected actualValue is POSITIVE_INFINITY. actualValue is,' + actualValue
+ };
+}
+
+export default assertPosUnlimited;
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsPending.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsPending.js
new file mode 100644
index 0000000000000000000000000000000000000000..7e2ca2ce14d50c39554fc1157d6d4eb9329d5c39
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsPending.js
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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 isPromiseLike from './isPromiseLike';
+
+function assertPromiseIsPending(actualPromise) {
+ if (!isPromiseLike(actualPromise)) {
+ return Promise.reject().then(function () {
+ }, function () {
+ return {pass: false, message: 'Expected not be called on a promise.'};
+ });
+ }
+ const helper = {};
+ return Promise.race([actualPromise, Promise.resolve(helper)]).then(
+ function (got) {
+ return helper === got ? {pass: true, message: 'actualValue is isPending'}
+ : {
+ pass: false,
+ message: 'expect isPending, actualValue is resolve'
+ };
+ },
+ function () {
+ return {
+ pass: false
+ , message: 'expect isPending, actualValue is reject'
+ };
+ });
+}
+
+export default assertPromiseIsPending;
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsRejected.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsRejected.js
new file mode 100644
index 0000000000000000000000000000000000000000..eb8e65c7d70d5750a9ccebb55c2cf5049cf144fc
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsRejected.js
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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 isPromiseLike from './isPromiseLike';
+
+function assertPromiseIsRejected(actualPromise) {
+ if (!isPromiseLike(actualPromise)) {
+ return Promise.reject().then(function () {
+ }, function () {
+ return {pass: false, message: 'Expected not be called on a promise.'};
+ });
+ }
+ const helper = {};
+ return Promise.race([actualPromise, Promise.resolve(helper)]).then(
+ function (got) {
+ return {
+ pass: false,
+ message: 'expect isRejected, but actualValue is '
+ + (helper === got ? 'isPending' : 'resolve')
+ };
+ },
+ function () {
+ return {pass: true, message: 'actualValue is isRejected'};
+ }
+ );
+}
+
+export default assertPromiseIsRejected;
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsRejectedWith.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsRejectedWith.js
new file mode 100644
index 0000000000000000000000000000000000000000..48eaf7859279a70ea2ad85509296b5da1c7b69f9
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsRejectedWith.js
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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 isPromiseLike from './isPromiseLike';
+
+function assertPromiseIsRejectedWith(actualPromise, expectedValue) {
+
+ if (!isPromiseLike(actualPromise)) {
+ return Promise.reject().then(function () {
+ }, function () {
+ return {pass: false, message: 'Expected not be called on a promise.'};
+ });
+ }
+
+ function tips(passed) {
+ return ('Expected a promise ' + (passed ? 'not ' : '') +
+ 'to be rejected with ' + JSON.stringify(expectedValue[0]));
+ }
+
+ const helper = {};
+ return Promise.race([actualPromise, Promise.resolve(helper)]).then(
+ function (got) {
+ return {
+ pass: false,
+ message: tips(false) + ' but actualValue is '
+ + (helper === got ? 'isPending' : 'resolve')
+ };
+ },
+ function (actualValue) {
+ if (JSON.stringify(actualValue) == JSON.stringify(expectedValue[0])) {
+ return {
+ pass: true,
+ message: 'actualValue was rejected with ' + JSON.stringify(actualValue) + '.'
+ };
+ } else {
+ return {
+ pass: false,
+ message: tips(false) + ' but it was rejected with ' + JSON.stringify(actualValue) + '.'
+ };
+ }
+ }
+ );
+}
+
+export default assertPromiseIsRejectedWith;
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsRejectedWithError.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsRejectedWithError.js
new file mode 100644
index 0000000000000000000000000000000000000000..20f236fc11dd66f270322efa12a1b3f6b543407c
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsRejectedWithError.js
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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 isPromiseLike from './isPromiseLike';
+
+function assertPromiseIsRejectedWithError(actualPromise, expectedValue) {
+ if (!isPromiseLike(actualPromise)) {
+ return Promise.reject().then(function () {
+ }, function () {
+ return {pass: false, message: 'Expected not be called on a promise.'};
+ });
+ }
+ const helper = {};
+ return Promise.race([actualPromise, Promise.resolve(helper)]).then(
+ function (got) {
+ return {
+ pass: false,
+ message: 'Expected a promise to be rejected but actualValue is '
+ + (helper === got ? 'isPending' : 'resolve')
+ };
+ },
+ function (actualValue) {
+ return matchError(actualValue, expectedValue);
+ }
+ );
+
+}
+
+function matchError(actualValue, expectedValue) {
+ if (expectedValue.length == 1 && typeof expectedValue[0] === 'function') {
+ if (expectedValue[0].name === actualValue.__proto__.name) {
+ return {pass: true, message: 'actual error type is ' + actualValue.name + '.'};
+ }
+ return {pass: false, message: `except error type is ${expectedValue[0].name},but actual is ${actualValue.name}.`};
+ }
+
+ if (expectedValue.length == 1 && typeof expectedValue[0] === 'string') {
+ if (expectedValue[0] === actualValue.message) {
+ return {pass: true, message: `actual error message is ${actualValue.message}.`};
+ }
+ return {pass: false, message: `except error message ${expectedValue[0]},but actual is ${actualValue.message}.`};
+ }
+
+ if (expectedValue.length == 1) {
+ return {pass: false, message: 'When only one parameter, it should be error type or error message.'};
+ }
+
+ if (expectedValue.length == 2 && typeof expectedValue[0] === 'function' && expectedValue[0].name === actualValue.name) {
+ if (typeof expectedValue[1] === 'string' && actualValue.message === expectedValue[1]) {
+ return {pass: true, message: 'actual error message is ' + actualValue.message + '.'};
+ }
+ return {pass: false, message: `except error message is ${expectedValue[1]},but actual is ${actualValue.message}.`};
+ }
+
+ if (expectedValue.length == 2 && typeof expectedValue[0] === 'function' && expectedValue[0].name !== actualValue.name) {
+ if (typeof expectedValue[1] === 'string' && actualValue.message === expectedValue[1]) {
+ return {pass: false, message: `except error type is ${expectedValue[0].name},but actual is ${actualValue.name}.`};
+ }
+ return {pass: false, message: 'except error type and message are incorrect.'};
+ }
+ if (expectedValue.length > 2) {
+ return {pass: false, message: 'Up to two parameters are supported.'};
+ }
+}
+
+export default assertPromiseIsRejectedWithError;
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsResolved.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsResolved.js
new file mode 100644
index 0000000000000000000000000000000000000000..855426ca79e5002428e53d4fcb5f843cdf7119f7
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsResolved.js
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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 isPromiseLike from './isPromiseLike';
+
+function assertPromiseIsResolved(actualPromise) {
+ if (!isPromiseLike(actualPromise)) {
+ return Promise.reject().then(function () {
+ }, function () {
+ return {pass: false, message: 'Expected not be called on a promise.'};
+ });
+ }
+
+ const helper = {};
+ return Promise.race([actualPromise, Promise.resolve(helper)]).then(
+ function (got) {
+ return helper === got ? {
+ pass: false,
+ message: 'expect resolve, actualValue is isPending'
+ }
+ : {pass: true, message: 'actualValue is isResolved'};
+ },
+ function (rej) {
+ return {
+ pass: false,
+ message: 'Expected a promise to be resolved but it was ' +
+ 'rejected with ' + JSON.stringify(rej) + '.'
+ };
+ }
+ );
+}
+
+export default assertPromiseIsResolved;
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsResolvedWith.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsResolvedWith.js
new file mode 100644
index 0000000000000000000000000000000000000000..d5eb01e32491b281a1e1d650a307723253a61e39
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertPromiseIsResolvedWith.js
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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 isPromiseLike from './isPromiseLike';
+
+function assertPromiseIsResolvedWith(actualPromise, expectedValue) {
+ if (!isPromiseLike(actualPromise)) {
+ return Promise.reject().then(function () {
+ }, function () {
+ return {pass: false, message: 'Expected not be called on a promise.'};
+ });
+ }
+
+ function tips(passed) {
+ return (
+ 'Expected a promise ' + (passed ? 'not ' : '') +
+ 'to be resolved with ' + JSON.stringify(expectedValue[0]));
+ }
+
+ const helper = {};
+ return Promise.race([actualPromise, Promise.resolve(helper)]).then(
+ function (got) {
+ if (helper === got) {
+ return {pass: false, message: 'expect resolve, actualValue is isPending'};
+ }
+ if (JSON.stringify(got) == JSON.stringify(expectedValue[0])) {
+ return {
+ pass: true,
+ message: 'actualValue was resolved with ' + JSON.stringify(got) + '.'
+ };
+ }
+ return {
+ pass: false,
+ message: tips(false) + ' but it was resolved with ' +
+ JSON.stringify(got) + '.'
+ };
+ },
+ function (rej) {
+ return {
+ pass: false,
+ message: tips(false) + ' but it was rejected with ' + JSON.stringify(rej) + '.'
+ };
+ }
+ );
+}
+
+export default assertPromiseIsResolvedWith;
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertThrowError.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertThrowError.js
new file mode 100644
index 0000000000000000000000000000000000000000..749cab0daee3f156909f60c9375146c23d7aa322
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertThrowError.js
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+function assertThrowError(actualValue, expected) {
+ let result = false;
+ let err;
+ if (typeof actualValue !== 'function') {
+ throw new Error('actualValue is not a function');
+ }
+ try {
+ actualValue();
+ return {
+ pass: result,
+ message: ' An error is not thrown while it is expected!'
+ };
+ } catch (e) {
+ err = e;
+ }
+
+ if (err instanceof Error) {
+ console.log(err.message);
+ if (err.message == expected[0]) {
+ result = true;
+ }
+ }
+ return {
+ pass: result,
+ message: 'expected throw failed , ' + err.message + ' is not ' + expected[0]
+ };
+}
+
+export default assertThrowError;
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertUndefined.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertUndefined.js
new file mode 100644
index 0000000000000000000000000000000000000000..61f092d715dd1630297518b59ff13ef0940991e1
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/assertUndefined.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+function assertUndefined(actualValue) {
+ return {
+ pass: undefined === (actualValue),
+ message: 'expect Undefined, actualValue is ' + (actualValue)
+ };
+}
+
+export default assertUndefined;
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/deepEquals/DeepTypeUtils.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/deepEquals/DeepTypeUtils.js
new file mode 100644
index 0000000000000000000000000000000000000000..627fb3b3ae7e315808b5ee2927d4bfbf17cc64b2
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/deepEquals/DeepTypeUtils.js
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2022-2023 Huawei Device 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.
+ */
+
+class DeepTypeUtils {
+ static getType_(value) {
+ return Object.prototype.toString.apply(value);
+ }
+ static isA_(typeName, value) {
+ return this.getType_(value) === '[object ' + typeName + ']';
+ }
+ static isAsymmetricEqualityTester_(obj) {
+ return obj ? this.isA_('Function', obj.asymmetricMatch) : false;
+ }
+
+ /**
+ * 是否是function
+ * @param value
+ */
+ static isFunction_(value) {
+ return this.isA_('Function', value);
+ }
+
+ /**
+ * 是否是undefined
+ * @param obj
+ */
+ static isUndefined(obj) {
+ return obj === void 0;
+ }
+
+ /**
+ * 是否是Node
+ * @param obj
+ */
+ static isDomNode(obj) {
+ return obj !== null &&
+ typeof obj === 'object' &&
+ typeof obj.nodeType === 'number' &&
+ typeof obj.nodeName === 'string';
+ }
+
+ /**
+ * 是否是promise对象
+ * @param obj
+ */
+ static isPromise (obj) {
+ return !!obj && obj.constructor === Promise;
+ };
+ /**
+ * 是否是map对象
+ * @param obj
+ */
+ static isMap(obj) {
+ return (
+ obj !== null &&
+ typeof obj !== 'undefined' &&
+ obj.constructor === Map
+ );
+ }
+
+ /**
+ * 是否是set对象
+ * @param obj 对象
+ */
+ static isSet(obj) {
+ return (
+ obj !== null &&
+ typeof obj !== 'undefined' &&
+ obj.constructor === Set
+ );
+ }
+
+ /**
+ * 对象是否有key属性
+ * @param obj 对象
+ * @param key 对象属性名称
+ */
+ static has(obj, key) {
+ return Object.prototype.hasOwnProperty.call(obj, key);
+ }
+
+ /**
+ * 获取对象的自有属性
+ * @param obj 对象
+ * @param isArray 是否是数组,[object Array]
+ */
+ static keys(obj, isArray) {
+ const extraKeys = [];
+ // 获取对象所有属性
+ const allKeys = this.getAllKeys(obj);
+ if (!isArray) {
+ return allKeys;
+ }
+ if (allKeys.length === 0) {
+ return allKeys;
+ }
+ for (const k of allKeys) {
+ if (typeof k === 'symbol' || !/^[0-9]+$/.test(k)) {
+ extraKeys.push(k);
+ }
+ }
+ return extraKeys;
+ }
+
+ /**
+ * 获取obj对象的所有属性
+ * @param obj obj对象
+ */
+ static getAllKeys(obj) {
+ const keys = [];
+ for (let key in obj) {
+ if(this.has(obj, key)) {
+ keys.push(key);
+ }
+ }
+ const symbols = Object.getOwnPropertySymbols(obj);
+ for (const sym of symbols) {
+ if (obj.propertyIsEnumerable(sym)) {
+ keys.push(sym);
+ }
+ }
+ return keys;
+ }
+
+}
+export default DeepTypeUtils;
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/deepEquals/assertDeepEquals.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/deepEquals/assertDeepEquals.js
new file mode 100644
index 0000000000000000000000000000000000000000..482e28e6af45482f8c2d9d0f61130730b07eba70
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/deepEquals/assertDeepEquals.js
@@ -0,0 +1,315 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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 DeepTypeUtils from './DeepTypeUtils'
+function assertDeepEquals(actualValue, expected) {
+ console.log('actualValue:' + actualValue + ',expected:' + expected[0]);
+ let result = eq(actualValue, expected[0],[], [])
+ let msg = logMsg(actualValue, expected[0]);
+ return {
+ pass: result,
+ message: msg
+ };
+}
+
+/**
+ * 获取失败显示日志
+ * @param actualValue 实际对象
+ * @param expected 期待比较对象
+ */
+function logMsg(actualValue, expected) {
+ // 获取a的对象名称
+ const aClassName = Object.prototype.toString.call(actualValue);
+ const bClassName = Object.prototype.toString.call(expected);
+ let actualMsg;
+ let expectMsg;
+ if(aClassName == "[object Function]") {
+ actualMsg = "actualValue Function"
+ }else if(aClassName == "[object Promise]") {
+ actualMsg = "actualValue Promise"
+ }else if(aClassName == "[object Set]" || aClassName == "[object Map]") {
+ actualMsg = JSON.stringify(Array.from(actualValue));;
+ }else if(aClassName == "[object RegExp]") {
+ actualMsg = JSON.stringify(actualValue.source.replace("\\",""));;
+ }else if(aClassName == "[object BigInt]") {
+ actualMsg = actualValue;
+ }
+ else{
+ actualMsg = JSON.stringify(actualValue);
+ }
+ if(bClassName == "[object Function]") {
+ expectMsg = "expected Function"
+ }else if(bClassName == "[object Promise]") {
+ expectMsg = "expected Promise"
+ }else if(bClassName == "[object Set]" || bClassName == "[object Map]") {
+ expectMsg = JSON.stringify(Array.from(expected));
+ }else if(bClassName == "[object RegExp]") {
+ expectMsg = JSON.stringify(expected.source.replace("\\",""));;
+ }else if(bClassName == "[object BigInt]") {
+ expectMsg = expected;
+ }
+ else{
+ expectMsg = JSON.stringify(expected);
+ }
+ return actualMsg + " is not deep equal " + expectMsg;
+}
+
+function eq(a, b, aStack, bStack) {
+ let result = true;
+ console.log('a is:' + a + ',b is:' + b);
+ const asymmetricResult = asymmetricMatch_(a,b);
+ if (!DeepTypeUtils.isUndefined(asymmetricResult)) {
+ return asymmetricResult;
+ }
+
+ if (a instanceof Error && b instanceof Error) {
+ result = a.message == b.message;
+ return result;
+ }
+
+ if (a === b) {
+ result = a !== 0 || 1 / a == 1 / b;
+ return result;
+ }
+
+ if (a === null || b === null) {
+ result = a === b;
+ return result;
+ }
+ // 获取a的对象名称
+ const aClassName = Object.prototype.toString.call(a);
+ const bClassName = Object.prototype.toString.call(b);
+ console.log('aClassName is:' + aClassName);
+ console.log('bClassName is:' + bClassName);
+ // 不同类型不同对象
+ if (aClassName != bClassName) {
+ return false;
+ }
+ // 俩个string对象
+ if(aClassName === '[object String]') {
+ result = a == String(b);
+ return result;
+ }
+ // 俩个Number对象
+ if(aClassName === '[object Number]') {
+ result = a != +a ? b != +b : a === 0 && b === 0 ? 1 / a == 1 / b : a == +b;
+ return result;
+ }
+
+ if(aClassName === '[object Date]' || aClassName === '[object Boolean]') {
+ result = +a == +b;
+ return result;
+ }
+
+ // 数组
+ if(aClassName === '[object ArrayBuffer]') {
+ return eq(new Uint8Array(a), new Uint8Array(b), aStack, bStack);
+ }
+
+ // 正则表达式
+ if(aClassName === '[object RegExp]') {
+ return (
+ a.source == b.source &&
+ a.global == b.global &&
+ a.multiline == b.multiline &&
+ a.ignoreCase == b.ignoreCase
+ );
+ }
+
+ if (typeof a != 'object' || typeof b != 'object') {
+ return false;
+ }
+
+ const aIsDomNode = DeepTypeUtils.isDomNode(a);
+ const bIsDomNode = DeepTypeUtils.isDomNode(b);
+ if (aIsDomNode && bIsDomNode) {
+ // At first try to use DOM3 method isEqualNode
+ result = a.isEqualNode(b);
+ return result;
+ }
+ if (aIsDomNode || bIsDomNode) {
+ return false;
+ }
+ const aIsPromise = DeepTypeUtils.isPromise(a);
+ const bIsPromise = DeepTypeUtils.isPromise(b);
+ if (aIsPromise && bIsPromise) {
+ return a === b;
+ }
+ let length = aStack.length;
+ while (length--) {
+ if (aStack[length] == a) {
+ return bStack[length] == b;
+ }
+ }
+ aStack.push(a);
+ bStack.push(b);
+ let size = 0;
+
+ // 都是数组
+ if(aClassName == '[object Array]') {
+ const aLength = a.length;
+ const bLength = b.length;
+ if (aLength !== bLength) {
+ // 数组长度不同,不是同一个对象
+ return false;
+ }
+ for (let i = 0; i < aLength || i < bLength; i++) {
+ // 递归每一个元素是否相同
+ result = eq(i < aLength ? a[i] : void 0, i < bLength ? b[i] : void 0, aStack, bStack) && result;
+ }
+ if (!result) {
+ return false;
+ }
+ } else if(DeepTypeUtils.isMap(a) && DeepTypeUtils.isMap(b)) {
+ if (a.size != b.size) {
+ return false;
+ }
+ const keysA = [];
+ const keysB = [];
+ a.forEach(function(valueA, keyA) {
+ keysA.push(keyA);
+ });
+ b.forEach(function(valueB, keyB) {
+ keysB.push(keyB);
+ });
+ const mapKeys = [keysA, keysB];
+ const cmpKeys = [keysB, keysA];
+ for (let i = 0; result && i < mapKeys.length; i++) {
+ const mapIter = mapKeys[i];
+ const cmpIter = cmpKeys[i];
+
+ for (let j = 0; result && j < mapIter.length; j++) {
+ const mapKey = mapIter[j];
+ const cmpKey = cmpIter[j];
+ const mapValueA = a.get(mapKey);
+ let mapValueB;
+ if (
+ DeepTypeUtils.isAsymmetricEqualityTester_(mapKey) ||
+ (DeepTypeUtils.isAsymmetricEqualityTester_(cmpKey) &&
+ eq(mapKey, cmpKey))
+ ) {
+ mapValueB = b.get(cmpKey);
+ } else {
+ mapValueB = b.get(mapKey);
+ }
+ result = eq(mapValueA, mapValueB, aStack, bStack);
+ }
+ }
+ if (!result) {
+ return false;
+ }
+ } else if(DeepTypeUtils.isSet(a) && DeepTypeUtils.isSet(b)) {
+ if (a.size != b.size) {
+ return false;
+ }
+ const valuesA = [];
+ a.forEach(function(valueA) {
+ valuesA.push(valueA);
+ });
+ const valuesB = [];
+ b.forEach(function(valueB) {
+ valuesB.push(valueB);
+ });
+ const setPairs = [[valuesA, valuesB], [valuesB, valuesA]];
+ const stackPairs = [[aStack, bStack], [bStack, aStack]];
+ for (let i = 0; result && i < setPairs.length; i++) {
+ const baseValues = setPairs[i][0];
+ const otherValues = setPairs[i][1];
+ const baseStack = stackPairs[i][0];
+ const otherStack = stackPairs[i][1];
+ for (const baseValue of baseValues) {
+ let found = false;
+ for (let j = 0; !found && j < otherValues.length; j++) {
+ const otherValue = otherValues[j];
+ const prevStackSize = baseStack.length;
+ // 深度比较对象
+ found = eq(baseValue, otherValue, baseStack, otherStack);
+ if (!found && prevStackSize !== baseStack.length) {
+ baseStack.splice(prevStackSize);
+ otherStack.splice(prevStackSize);
+ }
+ }
+ result = result && found;
+ }
+ }
+ if (!result) {
+ return false;
+ }
+ } else {
+ const aCtor = a.constructor,
+ bCtor = b.constructor;
+ if (
+ aCtor !== bCtor &&
+ DeepTypeUtils.isFunction_(aCtor) &&
+ DeepTypeUtils.isFunction_(bCtor) &&
+ a instanceof aCtor &&
+ b instanceof bCtor &&
+ !(aCtor instanceof aCtor && bCtor instanceof bCtor)
+ ) {
+ return false;
+ }
+ }
+
+ // 获取对象所有的属性集合
+ const aKeys = DeepTypeUtils.keys(a, aClassName == '[object Array]');
+ size = aKeys.length;
+
+ // 俩个对象属性长度不一致, 俩对象不相同
+ if (DeepTypeUtils.keys(b, bClassName == '[object Array]').length !== size) {
+ return false;
+ }
+
+ // 俩对象属性数量相同, 递归比较每个属性值得值
+ for (const key of aKeys) {
+ console.log('key is:' + key);
+ // b 没有 key 属性
+ if(!DeepTypeUtils.has(b, key)) {
+ result = false;
+ continue;
+ }
+ if (!eq(a[key], b[key], aStack, bStack)) {
+ result = false;
+ }
+ }
+ if (!result) {
+ return false;
+ }
+ aStack.pop();
+ bStack.pop();
+ return result;
+}
+
+function asymmetricMatch_(a, b) {
+ const asymmetricA = DeepTypeUtils.isAsymmetricEqualityTester_(a);
+ const asymmetricB = DeepTypeUtils.isAsymmetricEqualityTester_(b);
+
+ if (asymmetricA === asymmetricB) {
+ return undefined;
+ }
+
+}
+
+/**
+ * 获取对象的自有属性
+ *
+ * @param obj 对象
+ * @param isArray 是否是一个数组
+ */
+function keys(obj, isArray) {
+ const keys = [];
+
+}
+
+export default assertDeepEquals;
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/isPromiseLike.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/isPromiseLike.js
new file mode 100644
index 0000000000000000000000000000000000000000..015ab19a2a0c4872d7cb490b61f8e1dd6a8ac90b
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/assert/isPromiseLike.js
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+function isPromiseLike(obj) {
+ return !!obj && isFunction_(obj.then);
+}
+
+function isFunction_(value) {
+ return isA_('Function', value);
+}
+
+function isA_(typeName, value) {
+ return getType_(value) === '[object ' + typeName + ']';
+}
+
+function getType_(value) {
+ return Object.prototype.toString.apply(value);
+}
+
+export default isPromiseLike;
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/config/DataDriver.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/config/DataDriver.js
new file mode 100644
index 0000000000000000000000000000000000000000..639dffc9cdb912f1f33a6ccb61868c9ed7c695bf
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/config/DataDriver.js
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+const SUITES_KEY = 'suites';
+const SPECS_KEY = 'items';
+const DESCRIBE_KEY = 'describe';
+const IT_KEY = 'it';
+const PARAMS_KEY = 'params';
+const STRESS_KEY = 'stress';
+
+class ObjectUtils {
+ static get(object, name, defaultValue) {
+ let result = defaultValue;
+ for (const key in object) {
+ if (key === name) {
+ return object[key];
+ }
+ }
+ return result;
+ }
+
+ static has(object, key) {
+ return Object.prototype.hasOwnProperty.call(object, key);
+ }
+}
+
+class DataDriver {
+ constructor(attr) {
+ this.id = 'dataDriver';
+ this.data = attr.data || {};
+ }
+
+ init(coreContext) {
+ this.coreContext = coreContext;
+ this.suiteService = this.coreContext.getDefaultService('suite');
+ this.specService = this.coreContext.getDefaultService('spec');
+ }
+
+ getSpecParams() {
+ let specParams = [];
+ let suiteDesc = this.suiteService.getCurrentRunningSuite().description;
+ let specDesc = this.specService.getCurrentRunningSpec().description;
+ let suites = ObjectUtils.get(this.data, SUITES_KEY, []);
+ for (const suiteItem of suites) {
+ let describeValue = ObjectUtils.get(suiteItem, DESCRIBE_KEY, '');
+ if (ObjectUtils.has(suiteItem, DESCRIBE_KEY) && (typeof describeValue === 'object') && describeValue.constructor === Array && describeValue.includes(suiteDesc)) {
+ let specs = ObjectUtils.get(suiteItem, SPECS_KEY, []);
+ for (const specItem of specs) {
+ if (ObjectUtils.has(specItem, IT_KEY) && ObjectUtils.get(specItem, IT_KEY) === specDesc) {
+ return ObjectUtils.get(specItem, PARAMS_KEY, specParams);
+ }
+ }
+ }
+ }
+ return specParams;
+ }
+
+ getSuiteParams() {
+ let suiteParams = {};
+ let suiteDesc = this.suiteService.getCurrentRunningSuite().description;
+ let suites = ObjectUtils.get(this.data, SUITES_KEY, []);
+ for (const suiteItem of suites) {
+ let describeValue = ObjectUtils.get(suiteItem, DESCRIBE_KEY, []);
+ if (ObjectUtils.has(suiteItem, DESCRIBE_KEY) && (typeof describeValue === 'object') && describeValue.constructor === Array && describeValue.includes(suiteDesc)) {
+ suiteParams = Object.assign({}, suiteParams, ObjectUtils.get(suiteItem, PARAMS_KEY, suiteParams));
+ }
+ }
+ return suiteParams;
+ }
+
+ getSpecStress(specDesc) {
+ let stress = 1;
+ let suiteDesc = this.suiteService.getCurrentRunningSuite().description;
+ let suites = ObjectUtils.get(this.data, SUITES_KEY, []);
+ for (const suiteItem of suites) {
+ let describeValue = ObjectUtils.get(suiteItem, DESCRIBE_KEY, '');
+ if (ObjectUtils.has(suiteItem, DESCRIBE_KEY) && (typeof describeValue === 'object') && describeValue.constructor === Array && describeValue.includes(suiteDesc)) {
+ let specs = ObjectUtils.get(suiteItem, SPECS_KEY, []);
+ for (const specItem of specs) {
+ if (ObjectUtils.has(specItem, IT_KEY) && ObjectUtils.get(specItem, IT_KEY) === specDesc) {
+ let tempStress = ObjectUtils.get(specItem, STRESS_KEY, stress);
+ return (Number.isInteger(tempStress) && tempStress >= 1) ? tempStress : stress;
+ }
+ }
+ }
+ }
+ return stress;
+ }
+
+ getSuiteStress(suiteDesc) {
+ let stress = 1;
+ let suites = ObjectUtils.get(this.data, SUITES_KEY, []);
+ for (const suiteItem of suites) {
+ let describeValue = ObjectUtils.get(suiteItem, DESCRIBE_KEY, []);
+ if (ObjectUtils.has(suiteItem, DESCRIBE_KEY) && (typeof describeValue === 'object') && describeValue.constructor === Array && describeValue.includes(suiteDesc)) {
+ let tempStress = ObjectUtils.get(suiteItem, STRESS_KEY, stress);
+ return (Number.isInteger(tempStress) && tempStress >= 1) ? tempStress : stress;
+ }
+ }
+ return stress;
+ }
+}
+
+export default DataDriver;
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/config/Filter.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/config/Filter.js
new file mode 100644
index 0000000000000000000000000000000000000000..2720b73ea2cebd148ee8d2a337b8fe9529912a0d
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/config/Filter.js
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2021-2024 Huawei Device 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 { LEVEL, SIZE, TESTTYPE } from "../../Constant";
+
+class ClassFilter {
+ constructor(suiteName, itName, params) {
+ this.suiteName = suiteName;
+ this.itName = itName;
+ this.params = params;
+ }
+
+ filterSuite() {
+ return !this.params.split(',').map(item => item.split('#')[0]).map(item => item == this.suiteName).reduce((pre, cur) => pre || cur, false);
+ }
+
+ filterIt() {
+ let classArray = this.params.split(',') || [];
+ let suiteFilterResult = classArray.filter(item => !item.includes('#')).map(item => item == this.suiteName).reduce((pre, cur) => pre || cur, false);
+ let itFilterResult = classArray.filter(item => item.includes('#')).map(item => item == (this.suiteName + '#' + this.itName)).reduce((pre, cur) => pre || cur, false);
+ return !(suiteFilterResult || itFilterResult);
+ }
+}
+
+class NotClassFilter {
+ constructor(suiteName, itName, params) {
+ this.suiteName = suiteName;
+ this.itName = itName;
+ this.params = params;
+ }
+
+ filterSuite() {
+ return this.params.split(',').map(item => item == this.suiteName).reduce((pre, cur) => pre || cur, false);
+ }
+
+ filterIt() {
+ return this.params.split(',').some(item => item == (this.suiteName + '#' + this.itName));
+ }
+}
+
+class SuiteAndItNameFilter {
+ constructor(suiteName, itName, params) {
+ this.suiteName = suiteName;
+ this.itName = itName;
+ this.params = params;
+ }
+
+ filterSuite() {
+ return !this.params.split(',').map(item => item == this.suiteName).reduce((pre, cur) => pre || cur, false);
+ }
+
+ filterIt() {
+ return !this.params.split(',').map(item => item == this.itName).reduce((pre, cur) => pre || cur, false);
+ }
+}
+
+
+class TestTypesFilter {
+ constructor(suiteName, itName, fi, params) {
+ this.suiteName = suiteName;
+ this.itName = itName;
+ this.params = params;
+ this.fi = fi;
+ }
+
+ filterIt() {
+ return !((this.params === (this.fi & this.params)) || this.fi === 0);
+ }
+}
+
+class NestFilter {
+ filterNestName(targetSuiteArray, targetSpecArray, suiteStack, desc) {
+ let targetSuiteName = "";
+ for (let key in suiteStack) {
+ targetSuiteName = targetSuiteName + "." + suiteStack[key].description;
+ }
+ targetSuiteName = targetSuiteName.substring(2);
+ const targetSpecName = targetSuiteName + "#" + desc;
+ let isFilter = true;
+ if (targetSpecArray.includes(targetSpecName)) {
+ return false;
+ }
+ for (let index in targetSuiteArray) {
+ if (targetSuiteName.startsWith(targetSuiteArray[index])) {
+ return false;
+ }
+ }
+ return isFilter;
+ }
+
+ filterNotClass(notClass, suiteStack, desc) {
+ let isFilterNotClass = false;
+ if (notClass != null) {
+ let notClassArray = notClass.split(",");
+ let targetSuiteName = "";
+ for (let key in suiteStack) {
+ targetSuiteName = targetSuiteName + "." + suiteStack[key].description;
+ }
+ targetSuiteName = targetSuiteName.substring(2);
+ const targetSpecName = targetSuiteName + "#" + desc;
+ if (notClassArray.includes(targetSpecName) || notClassArray.some(key => targetSpecName.startsWith(key))) {
+ isFilterNotClass = true;
+ }
+ }
+ return isFilterNotClass;
+ }
+
+ filterLevelOrSizeOrTestType(level, size, testType, filter) {
+ let result = false;
+ if (filter === 0 || filter === '0') {
+ return result;
+ }
+ if (level == null && size == null && testType == null) {
+ return result;
+ }
+ if (level != null) {
+ let levelFilter = LEVEL[`${level}`];
+ result = result || filter === levelFilter;
+ }
+ if (size != null) {
+ let sizeFilter = SIZE[`${size}`];
+ result = result || filter === sizeFilter;
+ }
+ if (testType != null) {
+ let testTypeFilter = TESTTYPE[`${testType}`];
+ result = result || filter === testTypeFilter;
+ }
+ return !result;
+ }
+}
+export { ClassFilter, NotClassFilter, SuiteAndItNameFilter, TestTypesFilter, NestFilter };
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/config/configService.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/config/configService.js
new file mode 100644
index 0000000000000000000000000000000000000000..8639877e3d114d54a1e3430ea41ffaa51cba5a59
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/config/configService.js
@@ -0,0 +1,299 @@
+/*
+ * Copyright (c) 2021-2024 Huawei Device 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 { ClassFilter, NotClassFilter, SuiteAndItNameFilter, TestTypesFilter, NestFilter } from './Filter';
+import { TAG, TESTTYPE, LEVEL, SIZE, KEYSET } from '../../Constant';
+const STRESS_RULE = /^[1-9]\d*$/;
+
+class ConfigService {
+ constructor(attr) {
+ this.id = attr.id;
+ this.supportAsync = true; // 默认异步处理测试用例
+ this.random = false;
+ this.filterValid = [];
+ this.filter = 0;
+ this.flag = false;
+ this.suite = null;
+ this.itName = null;
+ this.testType = null;
+ this.level = null;
+ this.size = null;
+ this.class = null;
+ this.notClass = null;
+ this.timeout = null;
+ // 遇错即停模式配置
+ this.breakOnError = false;
+ // 压力测试配置
+ this.stress = null;
+ this.skipMessage = false;
+ this.runSkipped = '';
+ this.filterXdescribe = [];
+ }
+
+ init(coreContext) {
+ this.coreContext = coreContext;
+ }
+
+ isNormalInteger(str) {
+ const n = Math.floor(Number(str));
+ return n !== Infinity && String(n) === String(str) && n >= 0;
+ }
+
+
+ getStress() {
+ if (this.stress === undefined || this.stress === '' || this.stress === null) {
+ return 1;
+ }
+ return !this.stress.match(STRESS_RULE) ? 1 : Number.parseInt(this.stress);
+ }
+
+ basicParamValidCheck(params) {
+ let size = params.size;
+ if (size !== undefined && size !== '' && size !== null) {
+ let sizeArray = ['small', 'medium', 'large'];
+ if (sizeArray.indexOf(size) === -1) {
+ this.filterValid.push('size:' + size);
+ }
+ }
+ let level = params.level;
+ if (level !== undefined && level !== '' && level !== null) {
+ let levelArray = ['0', '1', '2', '3', '4'];
+ if (levelArray.indexOf(level) === -1) {
+ this.filterValid.push('level:' + level);
+ }
+ }
+ let testType = params.testType;
+ if (testType !== undefined && testType !== '' && testType !== null) {
+ let testTypeArray = ['function', 'performance', 'power', 'reliability', 'security',
+ 'global', 'compatibility', 'user', 'standard', 'safety', 'resilience'];
+ if (testTypeArray.indexOf(testType) === -1) {
+ this.filterValid.push('testType:' + testType);
+ }
+ }
+ }
+
+ filterParamValidCheck(params) {
+ let timeout = params.timeout;
+ if (timeout !== undefined && timeout !== '' && timeout !== null) {
+ if (!this.isNormalInteger(timeout)) {
+ this.filterValid.push('timeout:' + timeout);
+ }
+ }
+
+ let paramKeys = ['dryRun', 'random', 'breakOnError', 'coverage', 'skipMessage'];
+ for (const key of paramKeys) {
+ if (params[key] !== undefined && params[key] !== 'true' && params[key] !== 'false') {
+ this.filterValid.push(`${key}:${params[key]}`);
+ }
+ }
+
+ // 压力测试参数验证,正整数
+ if (params.stress !== undefined && params.stress !== '' && params.stress !== null) {
+ if (!params.stress.match(STRESS_RULE)) {
+ this.filterValid.push('stress:' + params.stress);
+ }
+ }
+
+ let nameRule = /^[A-Za-z]{1}[\w#,.]*$/;
+ let paramClassKeys = ['class', 'notClass'];
+ for (const key of paramClassKeys) {
+ if (params[key] !== undefined && params[key] !== '' && params[key] !== null) {
+ let classArray = params[key].split(',');
+ classArray.forEach(item => !item.match(nameRule) ? this.filterValid.push(`${key}:${params[key]}`) : null);
+ }
+ }
+ }
+
+ setConfig(params) {
+ this.basicParamValidCheck(params);
+ this.filterParamValidCheck(params);
+ try {
+ this.class = params.class;
+ this.notClass = params.notClass;
+ this.flag = params.flag || { flag: false };
+ this.suite = params.suite;
+ this.itName = params.itName;
+ this.filter = params.filter;
+ this.testType = params.testType;
+ this.level = params.level;
+ this.size = params.size;
+ this.timeout = params.timeout;
+ this.dryRun = params.dryRun;
+ this.breakOnError = params.breakOnError;
+ this.random = params.random === 'true' ? true : false;
+ this.stress = params.stress;
+ this.coverage = params.coverage;
+ this.skipMessage = params.skipMessage;
+ this.runSkipped = params.runSkipped;
+ this.filterParam = {
+ testType: TESTTYPE,
+ level: LEVEL,
+ size: SIZE
+ };
+ this.parseParams();
+ } catch (err) {
+ console.info(`${TAG}setConfig error: ${err.message}`);
+ }
+ }
+
+ parseParams() {
+ if (this.filter != null) {
+ return;
+ }
+ let testTypeFilter = 0;
+ let sizeFilter = 0;
+ let levelFilter = 0;
+ if (this.testType != null) {
+ testTypeFilter = this.testType.split(',')
+ .map(item => this.filterParam.testType[item] || 0)
+ .reduce((pre, cur) => pre | cur, 0);
+ }
+ if (this.level != null) {
+ levelFilter = this.level.split(',')
+ .map(item => this.filterParam.level[item] || 0)
+ .reduce((pre, cur) => pre | cur, 0);
+ }
+ if (this.size != null) {
+ sizeFilter = this.size.split(',')
+ .map(item => this.filterParam.size[item] || 0)
+ .reduce((pre, cur) => pre | cur, 0);
+ }
+ this.filter = testTypeFilter | sizeFilter | levelFilter;
+ console.info(`${TAG}filter params:${this.filter}`);
+ }
+
+ isCurrentSuite(description) {
+ if (this.suite !== undefined && this.suite !== '' && this.suite !== null) {
+ let suiteArray = this.suite.split(',');
+ return suiteArray.indexOf(description) !== -1;
+ }
+ return false;
+ }
+
+ filterSuite(currentSuiteName) {
+ let filterArray = [];
+ if (this.suite !== undefined && this.suite !== '' && this.suite !== null) {
+ filterArray.push(new SuiteAndItNameFilter(currentSuiteName, '', this.suite));
+ }
+ if (this.class !== undefined && this.class !== '' && this.class !== null) {
+ filterArray.push(new ClassFilter(currentSuiteName, '', this.class));
+ }
+ if (this.notClass !== undefined && this.notClass !== '' && this.notClass !== null) {
+ filterArray.push(new NotClassFilter(currentSuiteName, '', this.notClass));
+ }
+
+ let result = filterArray.map(item => item.filterSuite()).reduce((pre, cur) => pre || cur, false);
+ return result;
+ }
+
+ filterDesc(currentSuiteName, desc, fi, coreContext) {
+ let filterArray = [];
+ if (this.itName !== undefined && this.itName !== '' && this.itName !== null) {
+ filterArray.push(new SuiteAndItNameFilter(currentSuiteName, desc, this.itName));
+ }
+ if (this.class !== undefined && this.class !== '' && this.class !== null) {
+ filterArray.push(new ClassFilter(currentSuiteName, desc, this.class));
+ }
+ if (this.notClass !== undefined && this.notClass !== '' && this.notClass !== null) {
+ filterArray.push(new NotClassFilter(currentSuiteName, desc, this.notClass));
+ }
+ if (typeof (this.filter) !== 'undefined' && this.filter !== 0 && fi !== 0) {
+ filterArray.push(new TestTypesFilter('', '', fi, this.filter));
+ }
+ let result = filterArray.map(item => item.filterIt()).reduce((pre, cur) => pre || cur, false);
+ return result;
+ }
+
+ filterWithNest(desc, filter) {
+ let filterArray = [];
+ const nestFilter = new NestFilter();
+ const targetSuiteArray = this.coreContext.getDefaultService('suite').targetSuiteArray;
+ const targetSpecArray = this.coreContext.getDefaultService('suite').targetSpecArray;
+ const suiteStack = this.coreContext.getDefaultService('suite').suitesStack;
+ let isFilter = nestFilter.filterNestName(targetSuiteArray, targetSpecArray, suiteStack, desc);
+ const isFullRun = this.coreContext.getDefaultService('suite').fullRun;
+ if (typeof (this.filter) !== 'undefined' && this.filter !== 0 && filter !== 0) {
+ filterArray.push(new TestTypesFilter('', '', filter, this.filter));
+ return filterArray.map(item => item.filterIt()).reduce((pre, cur) => pre || cur, false);
+ }
+ if (isFilter && !isFullRun) {
+ return true;
+ }
+ return nestFilter.filterNotClass(this.notClass, suiteStack, desc);
+
+ }
+
+ isRandom() {
+ return this.random || false;
+ }
+
+ isBreakOnError() {
+ return this.breakOnError !== 'true' ? false : true;
+ }
+
+ setSupportAsync(value) {
+ this.supportAsync = value;
+ }
+
+ isSupportAsync() {
+ return this.supportAsync;
+ }
+
+ translateParams(parameters) {
+ const keySet = new Set(KEYSET);
+ let targetParams = {};
+ for (const key in parameters) {
+ if (keySet.has(key)) {
+ var newKey = key.replace("-s ", "");
+ targetParams[newKey] = parameters[key];
+ }
+ }
+ return targetParams;
+ }
+ translateParamsToString(parameters) {
+ const keySet = new Set(KEYSET);
+ let targetParams = '';
+ for (const key in parameters) {
+ if (keySet.has(key)) {
+ targetParams += ' ' + key + ' ' + parameters[key];
+ }
+ }
+ return targetParams.trim();
+ }
+
+ execute() {
+ }
+
+ checkIfSuiteInSkipRun(desc) {
+ return this.runSkipped.split(",").some(item => {
+ return item === desc || item.startsWith(desc + '.') || item.startsWith(desc + '#') || desc.startsWith(item + '.') || this.runSkipped === 'skipped';
+ });
+ }
+
+ checkIfSpecInSkipRun(desc) {
+ return this.runSkipped.split(",").some(item => {
+ if (item.includes("#")) {
+ return item === desc;
+ } else {
+ return desc.startsWith(item + ".") || desc.startsWith(item + "#") || this.runSkipped === 'skipped';
+ }
+ }
+ );
+ }
+}
+
+export {
+ ConfigService
+};
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/coverage/coverageCollect.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/coverage/coverageCollect.js
new file mode 100644
index 0000000000000000000000000000000000000000..466bbaa11ef258895ebd64929ac5c99f7a471051
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/coverage/coverageCollect.js
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2023 Huawei Device 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 SysTestKit from "../kit/SysTestKit";
+import fs from '@ohos.file.fs';
+import {TAG} from '../../Constant';
+
+const jsCoverageFileName = 'js_coverage.json';
+
+export async function collectCoverageData() {
+ if (globalThis.__coverage__ === undefined) {
+ console.info(`${TAG} globalThis not have coverage`);
+ return;
+ }
+ const strJson = JSON.stringify(globalThis.__coverage__);
+ let testMode = globalThis.__testMode__;
+ console.info(`${TAG} coverage data testMode: ${testMode}`)
+ let savePath = globalThis.__savePath__;
+ console.info(`${TAG} write coverage data to: ${savePath}`);
+ let readPath = globalThis.__readPath__;
+ console.info(`${TAG} read coverage data in: ${readPath}`);
+
+ // run callback mode if local test or (save path and read path ) is not defined
+ if (!testMode || !isCoveragePathValid(savePath)) {
+ console.info(`${TAG} run coverage data in call back mode`)
+ const strLen = strJson.length;
+ const maxLen = 500;
+ const maxCount = Math.floor(strLen / maxLen);
+ const OHOS_REPORT_COVERAGE_DATA = 'OHOS_REPORT_COVERAGE_DATA:';
+ for (let count = 0; count <= maxCount; count++) {
+ console.info(`${OHOS_REPORT_COVERAGE_DATA} ${strJson.substring(count * maxLen, (count + 1) * maxLen)}`);
+ await SysTestKit.print(`${OHOS_REPORT_COVERAGE_DATA} ${strJson.substring(count * maxLen, (count + 1) * maxLen)}`);
+ }
+ return;
+ }
+ console.info(`${TAG} run coverage data in save file mode`);
+ if(fs.accessSync(savePath)) {
+ fs.unlinkSync(savePath)
+ }
+
+ let inputPathDir = savePath.substring(0, savePath.length - jsCoverageFileName.length);
+ if (!fs.accessSync(inputPathDir)) {
+ console.info(`${TAG} coverage data create dir: ${inputPathDir}`);
+ fs.mkdirSync(inputPathDir)
+ }
+
+ let file = fs.openSync(savePath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
+ let writeLen = fs.writeSync(file.fd, strJson, {encoding:"utf-8"});
+ console.info(`${TAG} write coverage data success: ${writeLen}`);
+ fs.closeSync(file);
+ const OHOS_REPORT_COVERAGE_PATH = 'OHOS_REPORT_COVERAGE_PATH:';
+ await SysTestKit.print(`${OHOS_REPORT_COVERAGE_PATH} ${readPath}`);
+ console.info(`${OHOS_REPORT_COVERAGE_PATH} ${readPath}`);
+}
+
+function isCoveragePathValid(inputPath) {
+ if (!inputPath) {
+ return false;
+ }
+ if (inputPath.indexOf(jsCoverageFileName) === -1) {
+ return false;
+ }
+ return true;
+}
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/kit/SysTestKit.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/kit/SysTestKit.js
new file mode 100644
index 0000000000000000000000000000000000000000..86173be050350e7284d17842abb0d23d3c1d97bb
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/kit/SysTestKit.js
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2022-2023 Huawei Device 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 {TAG} from '../../Constant';
+import Core from '../../core.js';
+
+export default class SysTestKit {
+
+ static delegator = null;
+ static systemTime = null;
+
+ constructor() {
+ this.id = 'sysTestKit';
+ this.index = 0;
+ }
+
+ static getDescribeName() {
+ return Core.getInstance().getDefaultService('suite').getCurrentRunningSuite().description;
+ }
+
+ static getItName() {
+ return Core.getInstance().getDefaultService('spec').getCurrentRunningSpec().description;
+ }
+
+ static getItAttribute() {
+ return Core.getInstance().getDefaultService('spec').getCurrentRunningSpec().fi;
+ }
+
+ static actionStart(tag) {
+ console.info(`${TAG}${JSON.stringify(tag)}`);
+ var message = '\n' + 'OHOS_REPORT_ACTIONSTART: ' + JSON.stringify(tag) + '\n';
+ SysTestKit.print(message);
+ console.info(`${TAG}${JSON.stringify(tag)} actionStart print success`);
+ }
+
+ static actionEnd(tag) {
+ console.info(`${TAG}${JSON.stringify(tag)}`);
+ var message = '\n' + 'OHOS_REPORT_ACTIONEND: ' + JSON.stringify(tag) + '\n';
+ SysTestKit.print(message);
+ console.info(`${TAG}${JSON.stringify(tag)} actionEnd print success`);
+ }
+
+ static async existKeyword(keyword, timeout) {
+ let reg = new RegExp(/^[a-zA-Z0-9]{1,}$/);
+ if (!reg.test(keyword)) {
+ throw new Error('keyword must contain more than one string, and only letters and numbers are supported.');
+ }
+ timeout = timeout || 4;
+
+ let searchResult = false;
+ let cmd = 'hilog -x | grep -i \'' + keyword + '\' | wc -l';
+ await executePromise(cmd, timeout).then((data) => {
+ searchResult = data;
+ });
+ return searchResult;
+ }
+ static async print(message) {
+ if ('printSync' in SysTestKit.delegator) {
+ console.debug(`${TAG}printSync called ...`);
+ SysTestKit.delegator.printSync(message);
+ } else {
+ await SysTestKit.delegator.print(message);
+ }
+ }
+
+ static async getRealTime() {
+ let currentTime = new Date().getTime();
+ if (SysTestKit.systemTime !== null && SysTestKit.systemTime !== undefined) {
+ await SysTestKit.systemTime.getRealTime().then((time) => {
+ console.info(`${TAG}systemTime.getRealTime success data: ${JSON.stringify(time)}`);
+ currentTime = time;
+ }).catch((error) => {
+ console.error(`${TAG}failed to systemTime.getRealTime because ${JSON.stringify(error)}`);
+ });
+ }
+ return currentTime;
+ }
+}
+
+function executePromise(cmd, timeout) {
+ return new Promise((resolve, reject) => {
+ SysTestKit.delegator.executeShellCommand(cmd, timeout,
+ (error, data) => {
+ console.info(`${TAG}existKeyword CallBack: err : ${JSON.stringify(error)}`);
+ console.info(`${TAG}existKeyword CallBack: data : ${JSON.stringify(data)}`);
+ resolve(parseInt(data.stdResult) > 3 ? true : false);
+ });
+ });
+}
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/mock/ArgumentMatchers.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/mock/ArgumentMatchers.js
new file mode 100644
index 0000000000000000000000000000000000000000..6a9d7aac464e95383ea31385284b6603c34e084c
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/mock/ArgumentMatchers.js
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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.
+ */
+
+class ArgumentMatchers {
+ ANY = "";
+ ANY_STRING = "";
+ ANY_BOOLEAN = "";
+ ANY_NUMBER = "";
+ ANY_OBJECT = "";
+ ANY_FUNCTION = "";
+ MATCH_REGEXS = "";
+
+ static any() {
+ }
+
+ static anyString() {
+ }
+
+ static anyBoolean() {
+ }
+
+ static anyNumber() {
+ }
+
+ static anyObj() {
+ }
+
+ static anyFunction() {
+ }
+
+ static matchRegexs() {
+ let regex = arguments[0];
+ if (ArgumentMatchers.isRegExp(regex)) {
+ return regex;
+ }
+ throw Error("not a regex");
+ }
+
+ static isRegExp(value) {
+ return Object.prototype.toString.call(value) === "[object RegExp]";
+ }
+
+ matcheReturnKey() {
+ let arg = arguments[0];
+ let regex = arguments[1];
+ let stubSetKey = arguments[2];
+
+ if (stubSetKey && stubSetKey == this.ANY) {
+ return this.ANY;
+ }
+
+ if (typeof arg === "string" && !regex) {
+ return this.ANY_STRING;
+ }
+
+ if (typeof arg === "boolean" && !regex) {
+ return this.ANY_BOOLEAN;
+ }
+
+ if (typeof arg === "number" && !regex) {
+ return this.ANY_NUMBER;
+ }
+
+ if (typeof arg === "object" && !regex) {
+ return this.ANY_OBJECT;
+ }
+
+ if (typeof arg === "function" && !regex) {
+ return this.ANY_FUNCTION;
+ }
+
+ if (typeof arg === "string" && regex) {
+ return regex.test(arg);
+ }
+
+ return null;
+ }
+
+ matcheStubKey() {
+ let key = arguments[0];
+
+ if (key === ArgumentMatchers.any) {
+ return this.ANY;
+ }
+
+ if (key === ArgumentMatchers.anyString) {
+ return this.ANY_STRING;
+ }
+ if (key === ArgumentMatchers.anyBoolean) {
+ return this.ANY_BOOLEAN;
+ }
+ if (key === ArgumentMatchers.anyNumber) {
+ return this.ANY_NUMBER;
+ }
+ if (key === ArgumentMatchers.anyObj) {
+ return this.ANY_OBJECT;
+ }
+ if (key === ArgumentMatchers.anyFunction) {
+ return this.ANY_FUNCTION;
+ }
+
+ if (ArgumentMatchers.isRegExp(key)) {
+ return key;
+ }
+
+ return null;
+ }
+}
+
+export default ArgumentMatchers;
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/mock/ExtendInterface.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/mock/ExtendInterface.js
new file mode 100644
index 0000000000000000000000000000000000000000..c6a866a6df662ad10a7f6869dcbc2381fa47bcdc
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/mock/ExtendInterface.js
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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.
+ */
+
+class ExtendInterface {
+ constructor(mocker) {
+ this.mocker = mocker;
+ }
+
+ stub() {
+ this.params = arguments;
+ return this;
+ }
+
+ stubMockedCall(returnInfo) {
+ this.mocker.stubApply(this, this.params, returnInfo);
+ }
+
+ afterReturn(value) {
+ this.stubMockedCall(function () {
+ return value;
+ });
+ }
+
+ afterReturnNothing() {
+ this.stubMockedCall(function () {
+ return undefined;
+ });
+ }
+
+ afterAction(action) {
+ this.stubMockedCall(action);
+ }
+
+ afterThrow(msg) {
+ this.stubMockedCall(function () {
+ throw msg;
+ });
+ }
+
+ clear() {
+ this.mocker.clear();
+ }
+}
+
+export default ExtendInterface;
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/mock/MockKit.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/mock/MockKit.js
new file mode 100644
index 0000000000000000000000000000000000000000..6e9e19ab7baa7fe024496e28f4f97abd9a7db9b4
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/mock/MockKit.js
@@ -0,0 +1,256 @@
+/*
+ * Copyright (c) 2022-2023 Huawei Device 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 ExtendInterface from "./ExtendInterface";
+import VerificationMode from "./VerificationMode";
+import ArgumentMatchers from "./ArgumentMatchers";
+
+class MockKit {
+
+ constructor() {
+ this.mFunctions = [];
+ this.stubs = new Map();
+ this.recordCalls = new Map();
+ this.currentSetKey = new Map();
+ this.mockObj = null;
+ this.recordMockedMethod = new Map();
+ }
+
+ init() {
+ this.reset();
+ }
+
+ reset() {
+ this.mFunctions = [];
+ this.stubs = {};
+ this.recordCalls = {};
+ this.currentSetKey = new Map();
+ this.mockObj = null;
+ this.recordMockedMethod = new Map();
+ }
+
+ clearAll() {
+ this.reset();
+ var props = Object.keys(this);
+ for (var i = 0; i < props.length; i++) {
+ delete this[props[i]];
+ }
+
+ var props = Object.getOwnPropertyNames(this);
+ for (var i = 0; i < props.length; i++) {
+ delete this[props[i]];
+ }
+ for (var key in this) {
+ delete this[key];
+ }
+ }
+
+ clear(obj) {
+ if (!obj) throw Error("Please enter an object to be cleaned");
+ if (typeof (obj) !== 'object' && typeof (obj) !== 'function') throw new Error('Not a object or static class');
+ this.recordMockedMethod.forEach(function (value, key, map) {
+ if (key) {
+ obj[key] = value;
+ }
+ });
+ }
+
+ ignoreMock(obj, method) {
+ if (typeof (obj) !== 'object' && typeof (obj) !== 'function') throw new Error('Not a object or static class');
+ if (typeof (method) !== 'function') throw new Error('Not a function');
+ let og = this.recordMockedMethod.get(method.propName);
+ if (og) {
+ obj[method.propName] = og;
+ this.recordMockedMethod.set(method.propName, undefined);
+ }
+ }
+
+ extend(dest, source) {
+ dest["stub"] = source["stub"];
+ dest["afterReturn"] = source["afterReturn"];
+ dest["afterReturnNothing"] = source["afterReturnNothing"];
+ dest["afterAction"] = source["afterAction"];
+ dest["afterThrow"] = source["afterThrow"];
+ dest["stubMockedCall"] = source["stubMockedCall"];
+ dest["clear"] = source["clear"];
+ return dest;
+ }
+
+ stubApply(f, params, returnInfo) {
+ let values = this.stubs.get(f);
+ if (!values) {
+ values = new Map();
+ }
+ let key = params[0];
+ if (typeof key == "undefined") {
+ key = "anonymous-mock-" + f.propName;
+ }
+ let matcher = new ArgumentMatchers();
+ if (matcher.matcheStubKey(key)) {
+ key = matcher.matcheStubKey(key);
+ if (key) {
+ this.currentSetKey.set(f, key);
+ }
+ }
+ values.set(key, returnInfo);
+ this.stubs.set(f, values);
+ }
+
+ getReturnInfo(f, params) {
+ let values = this.stubs.get(f);
+ if (!values) {
+ return undefined;
+ }
+ let retrunKet = params[0];
+ if (typeof retrunKet == "undefined") {
+ retrunKet = "anonymous-mock-" + f.propName;
+ }
+ let stubSetKey = this.currentSetKey.get(f);
+
+ if (stubSetKey && (typeof (retrunKet) !== "undefined")) {
+ retrunKet = stubSetKey;
+ }
+ let matcher = new ArgumentMatchers();
+ if (matcher.matcheReturnKey(params[0], undefined, stubSetKey) && matcher.matcheReturnKey(params[0], undefined, stubSetKey) !== stubSetKey) {
+ retrunKet = params[0];
+ }
+
+ values.forEach(function (value, key, map) {
+ if (ArgumentMatchers.isRegExp(key) && matcher.matcheReturnKey(params[0], key)) {
+ retrunKet = key;
+ }
+ });
+
+ return values.get(retrunKet);
+ }
+
+ findName(obj, value) {
+ let properties = this.findProperties(obj);
+ let name = null;
+ properties.filter(item => (item !== 'caller' && item !== 'arguments')).forEach(
+ function (va1, idx, array) {
+ if (obj[va1] === value) {
+ name = va1;
+ }
+ }
+ );
+ return name;
+ }
+
+ isFunctionFromPrototype(f, container, propName) {
+ if (container.constructor !== Object && container.constructor.prototype !== container) {
+ return container.constructor.prototype[propName] === f;
+ }
+ return false;
+ }
+
+ findProperties(obj, ...arg) {
+ function getProperty(new_obj) {
+ if (new_obj.__proto__ === null) {
+ return [];
+ }
+ let properties = Object.getOwnPropertyNames(new_obj);
+ return [...properties, ...getProperty(new_obj.__proto__)];
+ }
+ return getProperty(obj);
+ }
+
+ recordMethodCall(originalMethod, args) {
+ Function.prototype.getName = function () {
+ return this.name || this.toString().match(/function\s*([^(]*)\(/)[1];
+ };
+ let name = originalMethod.getName();
+ let arglistString = name + '(' + Array.from(args).toString() + ')';
+ let records = this.recordCalls.get(arglistString);
+ if (!records) {
+ records = 0;
+ }
+ records++;
+ this.recordCalls.set(arglistString, records);
+ }
+
+ mockFunc(originalObject, originalMethod) {
+ let tmp = this;
+ this.originalMethod = originalMethod;
+ let f = function () {
+ let args = arguments;
+ let action = tmp.getReturnInfo(f, args);
+ if (originalMethod) {
+ tmp.recordMethodCall(originalMethod, args);
+ }
+ if (action) {
+ return action.apply(this, args);
+ }
+ };
+
+ f.container = null || originalObject;
+ f.original = originalMethod || null;
+
+ if (originalObject && originalMethod) {
+ if (typeof (originalMethod) !== 'function') throw new Error('Not a function');
+ var name = this.findName(originalObject, originalMethod);
+ originalObject[name] = f;
+ this.recordMockedMethod.set(name, originalMethod);
+ f.propName = name;
+ f.originalFromPrototype = this.isFunctionFromPrototype(f.original, originalObject, f.propName);
+ }
+ f.mocker = this;
+ this.mFunctions.push(f);
+ this.extend(f, new ExtendInterface(this));
+ return f;
+ }
+
+ verify(methodName, argsArray) {
+ if (!methodName) {
+ throw Error("not a function name");
+ }
+ let a = this.recordCalls.get(methodName + '(' + argsArray.toString() + ')');
+ return new VerificationMode(a ? a : 0);
+ }
+
+ mockObject(object) {
+ if (!object || typeof object === "string") {
+ throw Error(`this ${object} cannot be mocked`);
+ }
+ const _this = this;
+ let mockedObject = {};
+ let keys = Reflect.ownKeys(object);
+ keys.filter(key => (typeof Reflect.get(object, key)) === 'function')
+ .forEach(key => {
+ mockedObject[key] = object[key];
+ mockedObject[key] = _this.mockFunc(mockedObject, mockedObject[key]);
+ });
+ return mockedObject;
+ }
+}
+
+function ifMockedFunction(f) {
+ if (Object.prototype.toString.call(f) !== "[object Function]" &&
+ Object.prototype.toString.call(f) !== "[object AsyncFunction]") {
+ throw Error("not a function");
+ }
+ if (!f.stub) {
+ throw Error("not a mock function");
+ }
+ return true;
+}
+
+function when(f) {
+ if (ifMockedFunction(f)) {
+ return f.stub.bind(f);
+ }
+}
+
+export {MockKit, when};
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/mock/VerificationMode.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/mock/VerificationMode.js
new file mode 100644
index 0000000000000000000000000000000000000000..28eda2b05fa5ec9f78f9b20d1be1b6c87ffaf33b
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/mock/VerificationMode.js
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2022-2023 Huawei Device 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 {expect} from '../../interface';
+
+class VerificationMode {
+ constructor(times) {
+ this.doTimes = times;
+ }
+
+ times(count) {
+ expect(count).assertEqual(this.doTimes);
+ }
+
+ never() {
+ console.log(this.doTimes);
+ expect(0).assertEqual(this.doTimes);
+ }
+
+ once() {
+ expect(1).assertEqual(this.doTimes);
+ }
+
+ atLeast(count) {
+ if (count > this.doTimes) {
+ throw Error('failed ' + count + ' greater than the actual execution times of method');
+ }
+ }
+
+ atMost(count) {
+ if (count < this.doTimes) {
+ throw Error('failed ' + count + ' less than the actual execution times of method');
+ }
+ }
+}
+
+export default VerificationMode;
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/report/LogExpectError.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/report/LogExpectError.js
new file mode 100644
index 0000000000000000000000000000000000000000..f2aede62f86d762524a59fba0eeacf959f1a846c
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/report/LogExpectError.js
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2024 Huawei Device 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.
+ */
+
+class LogExpectError {
+ static getErrorMsg(matcherName, actualValue, expect, originMsg) {
+ if (matcherName === "assertNull") {
+ return "expect not null, actualValue is " + (actualValue)
+ }
+ if (matcherName === "assertTrue") {
+ return "expect not true, actualValue is " + (actualValue)
+ }
+ if (matcherName === "assertFalse") {
+ return "expect not false, actualValue is " + (actualValue)
+ }
+ if (matcherName === "assertEqual") {
+ return "expect not Equal, actualValue is "
+ + actualValue + ' equals ' + expect;
+ }
+ if (matcherName === "assertContain") {
+ return "expect not have, " + actualValue + " have " + expect;
+ }
+ if (matcherName === "assertInstanceOf") {
+ return "expect not InstanceOf, "
+ + actualValue + ' is '
+ + Object.prototype.toString.call(actualValue) + expect;
+ }
+ if (matcherName === "assertLarger") {
+ return "expect not Larger, "
+ + (actualValue) + ' is larger than ' + expect;
+ }
+ if (matcherName === "assertLargerOrEqual") {
+ return "expect not LargerOrEqual, "
+ + (actualValue) + ' larger than ' + expect;
+ }
+ if (matcherName === "assertLess") {
+ return "expect not Less, "
+ + (actualValue) + ' less than ' + expect;
+ }
+ if (matcherName === "assertLessOrEqual") {
+ return "expect not LessOrEqual, "
+ + (actualValue) + ' is less than ' + expect;
+ }
+ if (matcherName === "assertNaN") {
+ return "expect not NaN, actualValue is " + (actualValue)
+ }
+ if (matcherName === "assertNegUnlimited") {
+ return "expect not NegUnlimited, actualValue is " + (actualValue)
+ }
+ if (matcherName === "assertPosUnlimited") {
+ return "expect not PosUnlimited, actualValue is " + (actualValue)
+ }
+ if (matcherName === "assertUndefined") {
+ return "expect not Undefined, actualValue is " + (actualValue)
+ }
+ return originMsg;
+ }
+}
+export default LogExpectError
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/report/OhReport.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/report/OhReport.js
new file mode 100644
index 0000000000000000000000000000000000000000..529c003cfb8a11f2ddaf24f8884301d4e8e39dd0
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/report/OhReport.js
@@ -0,0 +1,186 @@
+/*
+ * Copyright (c) 2021-2024 Huawei Device 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 SysTestKit from "../kit/SysTestKit";
+import { collectCoverageData } from '../coverage/coverageCollect';
+import { TAG } from '../../Constant';
+
+class OhReport {
+ constructor(attr) {
+ this.delegator = attr.delegator;
+ this.abilityDelegatorArguments = attr.abilityDelegatorArguments;
+ this.id = 'report';
+ this.index = 0;
+ this.duration = 0;
+ }
+
+ init(coreContext) {
+ this.coreContext = coreContext;
+ this.suiteService = this.coreContext.getDefaultService('suite');
+ this.specService = this.coreContext.getDefaultService('spec');
+ }
+
+ taskStart() {
+ }
+
+ async taskDone() {
+ if (this.abilityDelegatorArguments !== null) {
+ this.taskDoneTime = new Date().getTime();
+ let summary = this.suiteService.getSummary();
+ const configService = this.coreContext.getDefaultService('config');
+ const suiteService = this.coreContext.getDefaultService('suite');
+ const specService = this.coreContext.getDefaultService('spec');
+ if (configService['coverage'] === 'true') {
+ await collectCoverageData();
+ }
+ let message = '\n' + 'OHOS_REPORT_RESULT: stream=Tests run: ' + summary.total + ', Failure: ' + summary.failure;
+ message += ', Error: ' + summary.error;
+ message += ', Pass: ' + summary.pass;
+ message += ', Ignore: ' + summary.ignore;
+ if (specService.skipSpecNum > 0) {
+ message += ', SkipSpec: ' + specService.skipSpecNum;
+ }
+ message += '\n' + 'OHOS_REPORT_CODE: ' + (summary.failure > 0 ? -1 : 0) + '\n';
+ let isHasError = summary.failure > 0 || summary.error > 0;
+ let config = this.coreContext.getDefaultService('config');
+ if (config.isBreakOnError() && isHasError) {
+ // 未执行全部说明
+ message += '\n' + 'OHOS_REPORT_RESULT: breakOnError model, Stopping whole test suite if one specific test case failed or error' + '\n';
+ }
+ message += 'OHOS_REPORT_STATUS: taskconsuming=' + summary.duration + '\n';
+ console.info(`${message}`);
+ await SysTestKit.print(message);
+ }
+ console.info(`${TAG}report print success`);
+ this.delegator.finishTest('your test finished!!!', 0, () => { });
+ }
+
+ incorrectFormat() {
+ if (this.coreContext.getDefaultService('config').filterValid.length !== 0) {
+ var value = this.coreContext.getDefaultService('config').filterValid;
+ var message = 'this param ' + value.join(',') + ' is invalid' + '\n';
+ this.delegator.finishTest(message, 0, () => {
+ });
+ }
+ }
+
+ incorrectTestSuiteFormat() {
+ if (this.coreContext.getDefaultService('config').filterXdescribe.length !== 0) {
+ let value = this.coreContext.getDefaultService('config').filterXdescribe;
+ let message = 'xdescribe ' + value.join(',') + ' should not contain it' + '\n';
+ this.delegator.finishTest(message, 0, () => {
+ });
+ }
+ }
+ async suiteStart() {
+ if (this.abilityDelegatorArguments !== null) {
+ let specArr = [];
+ this.suiteService.getAllChildSuiteNum(this.suiteService.getCurrentRunningSuite(), specArr);
+ let message = '\n' + 'OHOS_REPORT_SUM: ' + specArr.length;
+ this.suiteService.setCurrentRunningSuiteDesc(this.suiteService.getRootSuite(), this.suiteService.getCurrentRunningSuite(), '');
+ message += '\n' + 'OHOS_REPORT_STATUS: class=' + this.suiteService.getCurrentRunningSuiteDesc() + '\n';
+ if (this.suiteService.currentRunningSuite.isSkip) {
+ message += 'OHOS_REPORT_STATUS: skipReason=' + this.suiteService.currentRunningSuite.skipReason + '\n';
+ }
+ console.info(`${message}`);
+ await SysTestKit.print(message);
+ console.info(`${TAG}${this.suiteService.getCurrentRunningSuite().description} suiteStart print success`);
+ }
+ }
+
+ async suiteDone() {
+ if (this.abilityDelegatorArguments !== null) {
+ const currentRunningSuite = this.suiteService.getCurrentRunningSuite();
+ this.suiteService.setCurrentRunningSuiteDesc(this.suiteService.getRootSuite(), this.suiteService.getCurrentRunningSuite(), '');
+ let message = '\n' + 'OHOS_REPORT_STATUS: class=' + this.suiteService.getCurrentRunningSuiteDesc();
+ if (this.suiteService.currentRunningSuite.isSkip && this.suiteService.currentRunningSuite.skipReason !== '') {
+ message += '\n' + 'OHOS_REPORT_STATUS: skipReason=' + this.suiteService.currentRunningSuite.skipReason;
+ }
+ message += '\n' + 'OHOS_REPORT_STATUS: suiteconsuming=' + this.suiteService.getCurrentRunningSuite().duration;
+ if (currentRunningSuite.hookError) {
+ message += '\n' + `OHOS_REPORT_STATUS: ${currentRunningSuite.hookError.message}`;
+ }
+ message += '\n';
+ console.info(`${message}`);
+ await SysTestKit.print(message);
+ console.info(`${TAG}${this.suiteService.getCurrentRunningSuite().description} suiteDone print success`);
+ }
+ }
+
+ async specStart() {
+ if (this.abilityDelegatorArguments !== null) {
+ let message = '\n' + 'OHOS_REPORT_STATUS: class=' + this.suiteService.getCurrentRunningSuiteDesc();
+ message += '\n' + 'OHOS_REPORT_STATUS: current=' + (++this.index);
+ message += '\n' + 'OHOS_REPORT_STATUS: id=JS';
+ message += '\n' + 'OHOS_REPORT_STATUS: numtests=' + this.specService.getTestTotal();
+ message += '\n' + 'OHOS_REPORT_STATUS: stream=';
+ message += '\n' + 'OHOS_REPORT_STATUS: test=' + this.specService.currentRunningSpec.description;
+ message += '\n' + 'OHOS_REPORT_STATUS_CODE: 1' + '\n';
+ if (this.specService.currentRunningSpec.isSkip) {
+ message += 'OHOS_REPORT_STATUS: skipReason=' + this.specService.currentRunningSpec.skipReason + '\n';
+ }
+ console.info(`${message}`);
+ await SysTestKit.print(message);
+ console.info(`${TAG}${this.specService.currentRunningSpec.description} specStart start print success`);
+ }
+ }
+
+ async specDone() {
+ if (this.abilityDelegatorArguments !== null) {
+ let message = '\n' + 'OHOS_REPORT_STATUS: class=' + this.suiteService.getCurrentRunningSuiteDesc();
+ message += '\n' + 'OHOS_REPORT_STATUS: current=' + (this.index);
+ message += '\n' + 'OHOS_REPORT_STATUS: id=JS';
+ message += '\n' + 'OHOS_REPORT_STATUS: numtests=' + this.specService.getTestTotal();
+ let messageStack = '';
+ let messageCode = '';
+ if (this.specService.currentRunningSpec.error) {
+ messageStack = 'OHOS_REPORT_STATUS: stack=' + this.specService.currentRunningSpec.error?.stack?.slice(0, -1);
+ messageCode += 'OHOS_REPORT_STATUS: stream=';
+ messageCode += this.specService.currentRunningSpec.expectMsg !== '' ?
+ `message: ${this.specService.currentRunningSpec.expectMsg}, Error in ${this.specService.currentRunningSpec.description}, ${this.specService.currentRunningSpec.error?.message}` :
+ `Error in ${this.specService.currentRunningSpec.description}, ${this.specService.currentRunningSpec.error?.message}`;
+ messageCode += '\n' + 'OHOS_REPORT_STATUS: test=' + this.specService.currentRunningSpec.description;
+ messageCode += '\n' + 'OHOS_REPORT_STATUS_CODE: -1' + '\n';
+ } else if (this.specService.currentRunningSpec) {
+ if (this.specService.currentRunningSpec.fail) {
+ messageStack += 'OHOS_REPORT_STATUS: stack=' + this.specService.currentRunningSpec.fail?.stack?.slice(0, -1);
+ messageCode += 'OHOS_REPORT_STATUS: stream=';
+ messageCode += this.specService.currentRunningSpec.expectMsg !== '' ?
+ `message: ${this.specService.currentRunningSpec.expectMsg}, Error in ${this.specService.currentRunningSpec.description}, ${this.specService.currentRunningSpec.fail?.message}` :
+ `Error in ${this.specService.currentRunningSpec.description}, ${this.specService.currentRunningSpec.fail?.message}`;
+ messageCode += '\n' + 'OHOS_REPORT_STATUS: test=' + this.specService.currentRunningSpec.description;
+ messageCode += '\n' + 'OHOS_REPORT_STATUS_CODE: -2' + '\n';
+ } else {
+ messageStack += 'OHOS_REPORT_STATUS: stream=';
+ messageCode += 'OHOS_REPORT_STATUS: test=' + this.specService.currentRunningSpec.description;
+ messageCode += '\n' + 'OHOS_REPORT_STATUS_CODE: 0' + '\n';
+ messageCode += this.specService.currentRunningSpec.isSkip ? ('OHOS_REPORT_STATUS: skipReason=' + this.specService.currentRunningSpec.skipReason + '\n') : '';
+ }
+ } else {
+ messageCode += '\n';
+ }
+ messageCode += 'OHOS_REPORT_STATUS: consuming=' + this.specService.currentRunningSpec.duration + '\n';
+ console.info(`${message}`);
+ console.info(`\n${messageStack}`);
+ console.info(`\n${messageCode}`);
+ await SysTestKit.print(message);
+ await SysTestKit.print(messageStack);
+ await SysTestKit.print(messageCode);
+ console.info(`${TAG}${this.specService.currentRunningSpec.description} specDone end print success`);
+ }
+ }
+}
+
+export default OhReport;
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/report/ReportExtend.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/report/ReportExtend.js
new file mode 100644
index 0000000000000000000000000000000000000000..852fbcd5cbf97e776ebe5177a029df0f516594a5
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/module/report/ReportExtend.js
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2021-2022 Huawei Device 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.
+ */
+
+class ReportExtend {
+ constructor(fileModule) {
+ this.id = 'extend';
+ this.fileModule = fileModule;
+ }
+
+ init(coreContext) {
+ this.coreContext = coreContext;
+ this.suiteService = this.coreContext.getDefaultService('suite');
+ }
+
+ taskStart() {
+
+ }
+
+ taskDone() {
+ const report = {
+ tag: 'testsuites',
+ name: 'summary_report',
+ timestamp: new Date().toDateString(),
+ time: '1',
+ errors: 0,
+ failures: 0,
+ tests: 0,
+ children: []
+ };
+ const rootSuite = this.suiteService.rootSuite;
+ if (rootSuite && rootSuite.childSuites) {
+ for (let testsuite of rootSuite.childSuites) {
+ let suiteReport = {
+ tag: 'testsuite',
+ name: testsuite['description'],
+ errors: 0,
+ tests: 0,
+ failures: 0,
+ time: '0.1',
+ children: []
+ };
+ let specs = testsuite['specs'];
+ for (let testcase of specs) {
+ report.tests++;
+ suiteReport.tests++;
+ let caseReport = {
+ tag: 'testcase',
+ name: testcase['description'],
+ status: 'run',
+ time: '0.0',
+ classname: testsuite['description']
+ };
+ if (testcase.error) {
+ caseReport['result'] = false;
+ caseReport['children'] = [{
+ tag: 'error',
+ type: '',
+ message: testcase.error.message
+ }];
+ report.errors++;
+ suiteReport.errors++;
+ } else if (testcase.result.failExpects.length > 0) {
+ caseReport['result'] = false;
+ let message = '';
+ testcase.result.failExpects.forEach(failExpect => {
+ message += failExpect.message || ('expect ' + failExpect.actualValue + ' ' + failExpect.checkFunc + ' ' + (failExpect.expectValue || '')) + ';';
+ });
+ caseReport['children'] = [{
+ tag: 'failure',
+ type: '',
+ message: message
+ }];
+ report.failures++;
+ suiteReport.failures++;
+ } else {
+ caseReport['result'] = true;
+ }
+ suiteReport.children.push(caseReport);
+ }
+ report.children.push(suiteReport);
+ }
+ }
+
+ let reportXml = '\n' + json2xml(report);
+ this.fileModule.writeText({
+ uri: 'internal://app/report.xml',
+ text: reportXml,
+ success: function () {
+ console.info('call success callback success');
+ },
+ fail: function (data, code) {
+ console.info('call fail callback success:');
+ },
+ complete: function () {
+ console.info('call complete callback success');
+ }
+ });
+ }
+}
+
+function json2xml(json) {
+ let tagName;
+ let hasChildren = false;
+ let childrenStr = '';
+ let attrStr = '';
+ for (let key in json) {
+ if (key === 'tag') {
+ tagName = json[key];
+ } else if (key === 'children') {
+ if (json[key].length > 0) {
+ hasChildren = true;
+ for (let child of json[key]) {
+ childrenStr += json2xml(child);
+ }
+ }
+ } else {
+ attrStr += ` ${key}="${json[key]}"`;
+ }
+ }
+ let xml = `<${tagName}${attrStr}`;
+ xml += hasChildren ? `>${childrenStr}${tagName}>` : '/>';
+ return xml;
+}
+
+export default ReportExtend;
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/service.js b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/service.js
new file mode 100644
index 0000000000000000000000000000000000000000..c9ea9b3218ee85d859aec61105bd67487d422a9b
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/service.js
@@ -0,0 +1,1217 @@
+/*
+ * Copyright (c) 2021-2024 Huawei Device 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 SysTestKit from "./module/kit/SysTestKit";
+import { TAG } from './Constant';
+import LogExpectError from './module/report/LogExpectError'
+import { NestFilter } from "./module/config/Filter";
+
+class AssertException extends Error {
+ constructor(message) {
+ super();
+ this.name = "AssertException";
+ this.message = message;
+ }
+}
+
+function getFuncWithArgsZero(func, timeout, isStressTest) {
+ return new Promise(async (resolve, reject) => {
+ let timer = null;
+ if (!isStressTest) {
+ timer = setTimeout(() => {
+ reject(new Error('execute timeout ' + timeout + 'ms'));
+ }, timeout);
+ }
+ try {
+ await func();
+ } catch (err) {
+ reject(err);
+ }
+ timer !== null ? clearTimeout(timer) : null;
+ resolve();
+ });
+}
+
+function getFuncWithArgsOne(func, timeout, isStressTest) {
+ return new Promise(async (resolve, reject) => {
+ let timer = null;
+ if (!isStressTest) {
+ timer = setTimeout(() => {
+ reject(new Error('execute timeout ' + timeout + 'ms'));
+ }, timeout);;
+ }
+
+ function done() {
+ timer !== null ? clearTimeout(timer) : null;
+ resolve();
+ }
+
+ try {
+ await func(done);
+ } catch (err) {
+ timer !== null ? clearTimeout(timer) : null;
+ reject(err);
+ }
+ });
+}
+
+function getFuncWithArgsTwo(func, timeout, paramItem, isStressTest) {
+ return new Promise(async (resolve, reject) => {
+ let timer = null;
+ if (!isStressTest) {
+ timer = setTimeout(() => {
+ reject(new Error('execute timeout ' + timeout + 'ms'));
+ }, timeout);
+ }
+
+ function done() {
+ timer !== null ? clearTimeout(timer) : null;
+ resolve();
+ }
+
+ try {
+ await func(done, paramItem);
+ } catch (err) {
+ timer !== null ? clearTimeout(timer) : null;
+ reject(err);
+ }
+ });
+}
+
+function processFunc(coreContext, func) {
+ let argNames = ((func || '').toString()
+ .replace(/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg, '')
+ .match(/^(function)?\s*[^\(]*\(\s*([^\)]*)\)/m) || ['', '', ''])[2]
+ .split(',') // split parameters
+ .map(item => item.replace(/^\s*(_?)(.+?)\1\s*$/, name => name.split('=')[0].trim()))
+ .filter(String);
+ let funcLen = func.length;
+ let processedFunc;
+ const config = coreContext.getDefaultService('config');
+ config.setSupportAsync(true);
+ const timeout = + (config.timeout === undefined ? 5000 : config.timeout);
+ const isStressTest = (coreContext.getServices('dataDriver') !== undefined || config.getStress() > 1);
+ switch (funcLen) {
+ case 0: {
+ processedFunc = function () {
+ return getFuncWithArgsZero(func, timeout, isStressTest);
+ };
+ break;
+ }
+ case 1: {
+ if (argNames[0] === 'data') {
+ processedFunc = function (paramItem) {
+ func(paramItem);
+ };
+ } else {
+ processedFunc = function () {
+ return getFuncWithArgsOne(func, timeout, isStressTest);
+ };
+ }
+ break;
+ }
+ default: {
+ processedFunc = function (paramItem) {
+ return getFuncWithArgsTwo(func, timeout, paramItem, isStressTest);
+ };
+ break;
+ }
+ }
+ return processedFunc;
+}
+
+function secureRandomNumber() {
+ return crypto.randomBytes(8).readUInt32LE() / 0xffffffff;
+}
+
+class SuiteService {
+ constructor(attr) {
+ this.id = attr.id;
+ this.rootSuite = new SuiteService.Suite({});
+ this.currentRunningSuite = this.rootSuite;
+ this.suitesStack = [this.rootSuite];
+ this.targetSuiteArray = [];
+ this.targetSpecArray = [];
+ this.currentRunningSuiteDesc = null;
+ this.fullRun = false;
+ this.isSkipSuite = false;
+ this.suiteSkipReason = null;
+ }
+
+ describe(desc, func) {
+ const configService = this.coreContext.getDefaultService('config');
+ if (this.suitesStack.some(suite => { return suite.description === desc })) {
+ console.error(`${TAG} Loop nesting occurs : ${desc}`);
+ this.suiteSkipReason = '';
+ this.isSkipSuite = false;
+ return;
+ }
+ let isFilter = this.analyzeConfigServiceClass(configService.class, desc);
+ if (configService.filterSuite(desc) && isFilter) {
+ if (this.currentRunningSuite.description === '' || this.currentRunningSuite.description == null) {
+ console.info(`${TAG}filter suite : ${desc}`);
+ this.suiteSkipReason = '';
+ this.isSkipSuite = false;
+ return;
+ }
+ }
+ const suite = new SuiteService.Suite({ description: desc });
+ if (this.isSkipSuite) {
+ suite.isSkip = true;
+ suite.skipReason = this.suiteSkipReason;
+ }
+ this.suiteSkipReason = '';
+ this.isSkipSuite = false;
+ if (typeof this.coreContext.getServices('dataDriver') !== 'undefined' && configService['dryRun'] !== 'true') {
+ let suiteStress = this.coreContext.getServices('dataDriver').dataDriver.getSuiteStress(desc);
+ for (let i = 1; i < suiteStress; i++) {
+ this.currentRunningSuite.childSuites.push(suite);
+ }
+ }
+ this.currentRunningSuite.childSuites.push(suite);
+ this.currentRunningSuite = suite;
+ this.suitesStack.push(suite);
+ func.call();
+ this.suitesStack.pop();
+ this.currentRunningSuite = this.suitesStack.pop();
+ this.suitesStack.push(this.currentRunningSuite);
+ }
+ xdescribe(desc, func, reason) {
+ const configService = this.coreContext.getDefaultService('config');
+ if (!configService.skipMessage && configService.runSkipped !== 'all') {
+ if (configService.runSkipped != null && configService.runSkipped !== '') {
+ let finalDesc = '';
+ this.suitesStack.map(suite => {
+ finalDesc = finalDesc + '.' + suite.description;
+ })
+ finalDesc = (finalDesc + '.' + desc).substring(2);
+ console.info(`${TAG} finalDesc ${finalDesc}`);
+ if (configService.checkIfSuiteInSkipRun(finalDesc)) {
+ console.log(`${TAG} runSkipped suite: ${desc}`);
+ } else {
+ console.log(reason == null ? `${TAG} skip suite: ${desc}` : `${TAG} skip suite: ${desc}, and the reason is ${reason}`);
+ return;
+ }
+ } else {
+ console.log(reason == null ? `${TAG} skip suite: ${desc}` : `${TAG} skip suite: ${desc}, and the reason is ${reason}`);
+ return;
+ }
+ }
+ this.isSkipSuite = true;
+ this.suiteSkipReason = reason;
+ this.describe(desc, func);
+ }
+
+ beforeAll(func) {
+ this.currentRunningSuite.beforeAll.push(processFunc(this.coreContext, func));
+ }
+
+ beforeEach(func) {
+ this.currentRunningSuite.beforeEach.push(processFunc(this.coreContext, func));
+ }
+
+ beforeItSpecified(itDescs, func) {
+ this.currentRunningSuite.beforeItSpecified.set(itDescs, processFunc(this.coreContext, func));
+ }
+
+ afterItSpecified(itDescs, func) {
+ this.currentRunningSuite.afterItSpecified.set(itDescs, processFunc(this.coreContext, func));
+ }
+
+ afterAll(func) {
+ this.currentRunningSuite.afterAll.push(processFunc(this.coreContext, func));
+ }
+
+ afterEach(func) {
+ this.currentRunningSuite.afterEach.push(processFunc(this.coreContext, func));
+ }
+
+ getCurrentRunningSuite() {
+ return this.currentRunningSuite;
+ }
+
+ setCurrentRunningSuite(suite) {
+ this.currentRunningSuite = suite;
+ }
+
+ getRootSuite() {
+ return this.rootSuite;
+ }
+
+ getCurrentRunningSuiteDesc() {
+ return this.currentRunningSuiteDesc;
+ }
+
+
+ setCurrentRunningSuiteDesc(suite, currentSuite, prefix) {
+ if (suite != null && suite === currentSuite) {
+ this.currentRunningSuiteDesc = prefix;
+ } else if (suite != null && suite !== currentSuite) {
+ suite.childSuites.forEach(it => {
+ let temp = prefix;
+ if (it.description != null || it.description !== '') {
+ temp = prefix === '' ? it.description : prefix + "." + it.description;
+ }
+ this.setCurrentRunningSuiteDesc(it, currentSuite, temp);
+ }
+ )
+ }
+ }
+ analyzeConfigServiceClass(configServiceClass, desc) {
+ if (configServiceClass == null || configServiceClass === '') {
+ this.fullRun = true
+ return false;
+ }
+ if (this.targetSuiteArray.length === 0) {
+ const targetArray = configServiceClass.split(",")
+ for (let index in targetArray) {
+ if (targetArray[index].includes("#")) {
+ this.targetSpecArray.push(targetArray[index])
+ } else {
+ this.targetSuiteArray.push(targetArray[index])
+ }
+ }
+
+ }
+ return !configServiceClass.includes(desc);
+
+ }
+ traversalResults(suite, obj, breakOnError) {
+ if (suite.childSuites.length === 0 && suite.specs.length === 0) {
+ return obj;
+ }
+ if (suite.specs.length > 0) {
+ for (const itItem of suite.specs) {
+ obj.total++;
+ if (breakOnError && (obj.error > 0 || obj.failure > 0)) { // breakOnError模式
+ continue;
+ }
+ if (itItem.error) {
+ obj.error++;
+ } else if (itItem.fail) {
+ obj.failure++;
+ } else if (itItem.pass === true) {
+ obj.pass++;
+ }
+ }
+ }
+
+ obj.duration += suite.duration;
+
+ if (suite.childSuites.length > 0) {
+ for (const suiteItem of suite.childSuites) {
+ this.traversalResults(suiteItem, obj, breakOnError);
+ }
+ }
+ }
+
+ async setSuiteResults(suite, error, coreContext) {
+ if (suite.childSuites.length === 0 && suite.specs.length === 0) {
+ return obj;
+ }
+ if (suite.specs.length > 0) {
+ const specService = coreContext.getDefaultService('spec');
+ for (const specItem of suite.specs) {
+ specService.setCurrentRunningSpec(specItem);
+ if (error instanceof AssertException) {
+ specItem.fail = error;
+ } else {
+ specItem.error = error;
+ }
+ await coreContext.fireEvents('spec', 'specStart', specItem);
+ await coreContext.fireEvents('spec', 'specDone', specItem);
+ }
+ }
+ if (suite.childSuites.length > 0) {
+ for (const suiteItem of suite.childSuites) {
+ await this.setSuiteResults(suiteItem, error, coreContext);
+ }
+ }
+ }
+
+ getSummary() {
+ let suiteService = this.coreContext.getDefaultService('suite');
+ let rootSuite = suiteService.rootSuite;
+ const specService = this.coreContext.getDefaultService('spec');
+ const configService = this.coreContext.getDefaultService('config');
+ let breakOnError = configService.isBreakOnError();
+ let isError = specService.getStatus();
+ let isBreaKOnError = breakOnError && isError;
+ let obj = { total: 0, failure: 0, error: 0, pass: 0, ignore: 0, duration: 0 };
+ for (const suiteItem of rootSuite.childSuites) {
+ this.traversalResults(suiteItem, obj, isBreaKOnError);
+ }
+ obj.ignore = obj.total - obj.pass - obj.failure - obj.error;
+ return obj;
+ }
+
+ init(coreContext) {
+ this.coreContext = coreContext;
+ }
+
+ traversalSuites(suite, obj, configService) {
+ if (suite.childSuites.length === 0 && suite.specs.length === 0) {
+ return [];
+ }
+ if (suite.specs.length > 0) {
+ let itArray = [];
+ for (const itItem of suite['specs']) {
+ if (!configService.filterDesc(suite.description, itItem.description, itItem.fi, null)) {
+ itArray.push({ 'itName': itItem.description });
+ }
+ }
+ obj[suite.description] = itArray;
+ }
+ if (suite.childSuites.length > 0) {
+ let suiteArray = [];
+ for (const suiteItem of suite.childSuites) {
+ let suiteObj = {};
+ this.traversalSuites(suiteItem, suiteObj, configService);
+ if (!configService.filterSuite(suiteItem.description)) {
+ suiteArray.push(suiteObj);
+ }
+ }
+ obj.suites = suiteArray;
+ }
+ }
+
+ async dryRun(abilityDelegator) {
+ console.log(`${TAG} rootSuite : ` + JSON.stringify(this.rootSuite));
+ let obj = this.rootSuite;
+ let prefixStack = [];
+ let suiteArray = [];
+ let skipSuiteArray = [];
+ this.analyzeSuitesArray(prefixStack, suiteArray, skipSuiteArray, obj);
+ const configService = this.coreContext.getDefaultService('config');
+ let result;
+ if (configService.skipMessage) {
+ result = { "suites": suiteArray, "skipSuites": skipSuiteArray };
+ } else {
+ result = { "suites": suiteArray };
+ }
+ let strJson = JSON.stringify(result);
+ let strLen = strJson.length;
+ let maxLen = 500;
+ let maxCount = Math.floor(strLen / maxLen);
+ for (let count = 0; count <= maxCount; count++) {
+ await SysTestKit.print(strJson.substring(count * maxLen, (count + 1) * maxLen));
+ }
+ console.info(`${TAG}dryRun print success`);
+ abilityDelegator.finishTest('dry run finished!!!', 0, () => { });
+ }
+
+ //将suitesArray的嵌套结构展开成三层结构
+ analyzeSuitesArray(prefixStack, suiteArray, skipSuiteArray, obj) {
+ obj.childSuites.map(suite => {
+ if (suite.description != null && suite.description !== '') {
+ let prefix = '';
+ if (prefixStack.length > 0) {
+ prefix = prefixStack.join('.') + '.' + suite.description;
+ } else {
+ prefix = suite.description;
+ }
+ prefixStack.push(suite.description);
+ let temp = {};
+ temp[prefix] = [];
+ let skipTemp = {};
+ skipTemp[prefix] = [];
+ suite.specs.map(spec => {
+ let it = { 'itName': spec.description }
+ spec.isSkip ? skipTemp[prefix].push(it) : temp[prefix].push(it);
+ })
+ suiteArray.push(temp);
+ skipSuiteArray.push(skipTemp);
+ }
+ this.analyzeSuitesArray(prefixStack, suiteArray, skipSuiteArray, suite);
+ prefixStack.pop();
+ });
+ }
+ //获取当前测试套下的所有测试用例数量
+ getAllChildSuiteNum(suite, specArray) {
+ if (suite.specs != null) {
+ suite.specs.forEach(spec => specArray.push(spec));
+ }
+ if (suite.childSuites != null) {
+ suite.childSuites.forEach(it => this.getAllChildSuiteNum(it, specArray))
+ }
+ }
+
+ execute() {
+ const configService = this.coreContext.getDefaultService('config');
+ if (configService.filterValid.length !== 0) {
+ this.coreContext.fireEvents('task', 'incorrectFormat');
+ return;
+ }
+ if (configService.filterXdescribe.length !== 0) {
+ this.coreContext.fireEvents('task', 'incorrectTestSuiteFormat');
+ return;
+ }
+ if (configService.isRandom() && this.rootSuite.childSuites.length > 0) {
+ this.rootSuite.childSuites.sort(function () {
+ return Math.random().toFixed(1) > 0.5 ? -1 : 1;
+ });
+ this.currentRunningSuite = this.rootSuite.childSuites[0];
+ }
+ if (configService.isSupportAsync()) {
+ console.info(`${TAG} rootSuite:` + JSON.stringify(this.rootSuite));
+ let asyncExecute = async () => {
+ await this.coreContext.fireEvents('task', 'taskStart');
+ await this.rootSuite.asyncRun(this.coreContext);
+ };
+ asyncExecute().then(async () => {
+ await this.coreContext.fireEvents('task', 'taskDone');
+ });
+ } else {
+ console.info('${TAG} rootSuite:' + JSON.stringify(this.rootSuite));
+ this.coreContext.fireEvents('task', 'taskStart');
+ this.rootSuite.run(this.coreContext);
+ this.coreContext.fireEvents('task', 'taskDone');
+ }
+ }
+
+ apis() {
+ const _this = this;
+ return {
+ describe: function (desc, func) {
+ return _this.describe(desc, func);
+ },
+ xdescribe: function (desc, func, reason) {
+ return _this.xdescribe(desc, func, reason);
+ },
+ beforeItSpecified: function (itDescs, func) {
+ return _this.beforeItSpecified(itDescs, func);
+ },
+ afterItSpecified: function (itDescs, func) {
+ return _this.afterItSpecified(itDescs, func);
+ },
+ beforeAll: function (func) {
+ return _this.beforeAll(func);
+ },
+ beforeEach: function (func) {
+ return _this.beforeEach(func);
+ },
+ afterAll: function (func) {
+ return _this.afterAll(func);
+ },
+ afterEach: function (func) {
+ return _this.afterEach(func);
+ }
+ };
+ }
+}
+
+SuiteService.Suite = class {
+ constructor(attrs) {
+ this.description = attrs.description || '';
+ this.childSuites = [];
+ this.specs = [];
+ this.beforeAll = [];
+ this.afterAll = [];
+ this.beforeItSpecified = new Map();
+ this.afterItSpecified = new Map();
+ this.beforeEach = [];
+ this.afterEach = [];
+ this.duration = 0;
+ this.hookError = null;
+ this.isSkip = false;
+ this.skipReason = '';
+ }
+
+ pushSpec(spec) {
+ this.specs.push(spec);
+ }
+
+ removeSpec(desc) {
+ this.specs = this.specs.filter((item, index) => {
+ return item.description !== desc;
+ });
+ }
+
+ getSpecsNum() {
+ return this.specs.length;
+ }
+
+ isRun(coreContext) {
+ const configService = coreContext.getDefaultService('config');
+ const suiteService = coreContext.getDefaultService('suite');
+ const specService = coreContext.getDefaultService('spec');
+ let breakOnError = configService.isBreakOnError();
+ let isError = specService.getStatus();
+ return breakOnError && isError;
+ }
+
+ run(coreContext) {
+ const suiteService = coreContext.getDefaultService('suite');
+ suiteService.setCurrentRunningSuite(this);
+ if (this.description !== '') {
+ coreContext.fireEvents('suite', 'suiteStart', this);
+ }
+ this.runHookFunc('beforeAll');
+ if (this.specs.length > 0) {
+ const configService = coreContext.getDefaultService('config');
+ if (configService.isRandom()) {
+ this.specs.sort(function () {
+ return Math.random().toFixed(1) > 0.5 ? -1 : 1;
+ });
+ }
+ for (let spec in this.specs) {
+ let isBreakOnError = this.isRun(coreContext);
+ if (isBreakOnError) {
+ break;
+ }
+ this.runHookFunc('beforeEach');
+ spec.run(coreContext);
+ this.runHookFunc('afterEach');
+ }
+ }
+ if (this.childSuites.length > 0) {
+ for (let suite in this.childSuites) {
+ let isBreakOnError = this.isRun(coreContext);
+ if (isBreakOnError) {
+ break;
+ }
+ suite.run(coreContext);
+ suiteService.setCurrentRunningSuite(suite);
+ }
+ }
+ this.runHookFunc('afterAll');
+ if (this.description !== '') {
+ coreContext.fireEvents('suite', 'suiteDone');
+ }
+ }
+
+ async asyncRunSpecs(coreContext) {
+ const configService = coreContext.getDefaultService('config');
+ if (configService.isRandom()) {
+ this.specs.sort(function () {
+ return Math.random().toFixed(1) > 0.5 ? -1 : 1;
+ });
+ }
+ const specService = coreContext.getDefaultService('spec');
+ for (let specItem of this.specs) {
+ specService.setCurrentRunningSpec(specItem);
+ // 遇错即停模式,发现用例有问题,直接返回,不在执行后面的it
+ let isBreakOnError = this.isRun(coreContext);
+ if (isBreakOnError) {
+ console.log("break description :" + this.description);
+ break;
+ }
+ await coreContext.fireEvents('spec', 'specStart', specItem);
+ try {
+ for (const [itNames, hookFunc] of this.beforeItSpecified) {
+ if ((Object.prototype.toString.call(itNames) === '[object Array]' && itNames.includes(specItem.description)) ||
+ (Object.prototype.toString.call(itNames) === '[object String]' && itNames === specItem.description)) {
+ await Reflect.apply(hookFunc, null, []);
+ }
+ break;
+ }
+ await this.runAsyncHookFunc('beforeEach');
+ await specItem.asyncRun(coreContext);
+ for (const [itNames, hookFunc] of this.afterItSpecified) {
+ if ((Object.prototype.toString.call(itNames) === '[object Array]' && itNames.includes(specItem.description)) ||
+ (Object.prototype.toString.call(itNames) === '[object String]' && itNames === specItem.description)) {
+ await Reflect.apply(hookFunc, null, []);
+ }
+ break;
+ }
+ await this.runAsyncHookFunc('afterEach');
+ } catch (e) {
+ console.error(`${TAG}stack:${e?.stack}`);
+ console.error(`${TAG}stack end`);
+ if (e instanceof AssertException) {
+ specItem.fail = e;
+ } else {
+ specItem.error = e;
+ }
+ specService.setStatus(true);
+ }
+ specItem.setResult();
+ await coreContext.fireEvents('spec', 'specDone', specItem);
+ specService.setCurrentRunningSpec(null);
+ }
+ }
+
+ async asyncRunChildSuites(coreContext) {
+ for (let i = 0; i < this.childSuites.length; i++) {
+ // 遇错即停模式, 发现用例有问题,直接返回,不在执行后面的description
+ let isBreakOnError = this.isRun(coreContext);
+ if (isBreakOnError) {
+ console.log(`${TAG}break description : ${this.description}`);
+ break;
+ }
+ await this.childSuites[i].asyncRun(coreContext);
+ }
+ }
+
+ async asyncRun(coreContext) {
+ const suiteService = coreContext.getDefaultService('suite');
+ const specService = coreContext.getDefaultService('spec');
+
+ suiteService.setCurrentRunningSuite(this);
+ suiteService.suitesStack.push(this);
+ if (this.description !== '') {
+ await coreContext.fireEvents('suite', 'suiteStart', this);
+ }
+
+ try {
+ await this.runAsyncHookFunc('beforeAll');
+ } catch (error) {
+ console.error(`${TAG}${error?.stack}`);
+ this.hookError = error;
+ }
+
+ if (this.hookError !== null) {
+ specService.setStatus(true);
+ await suiteService.setSuiteResults(this, this.hookError, coreContext);
+ }
+
+ if (this.specs.length > 0 && this.hookError === null) {
+ await this.asyncRunSpecs(coreContext);
+ }
+
+ if (this.childSuites.length > 0 && this.hookError === null) {
+ await this.asyncRunChildSuites(coreContext);
+ }
+
+ try {
+ await this.runAsyncHookFunc('afterAll');
+ } catch (error) {
+ console.error(`${TAG}${error?.stack}`);
+ this.hookError = error;
+ specService.setStatus(true);
+ }
+
+ if (this.description !== '') {
+ await coreContext.fireEvents('suite', 'suiteDone');
+ let childSuite = suiteService.suitesStack.pop();
+ let currentRunningSuite = suiteService.suitesStack.pop();
+ suiteService.setCurrentRunningSuite(currentRunningSuite);
+ suiteService.suitesStack.push(currentRunningSuite);
+ }
+ }
+
+ runHookFunc(hookName) {
+ if (this[hookName] && this[hookName].length > 0) {
+ this[hookName].forEach(func => {
+ try {
+ func();
+ } catch (e) {
+ console.error(`${TAG}${e.stack}`);
+ }
+ });
+ }
+ }
+
+ async runAsyncHookFunc(hookName) {
+ for (const hookItem of this[hookName]) {
+ try {
+ await hookItem();
+ } catch (error) {
+ error['message'] += `, error in ${hookName} function`;
+ throw error;
+ }
+
+ }
+ }
+};
+
+class SpecService {
+ constructor(attr) {
+ this.id = attr.id;
+ this.totalTest = 0;
+ this.hasError = false;
+ this.skipSpecNum = 0;
+ this.isSkipSpec = false;
+ this.specSkipReason = '';
+ }
+
+ init(coreContext) {
+ this.coreContext = coreContext;
+ }
+
+ setCurrentRunningSpec(spec) {
+ this.currentRunningSpec = spec;
+ }
+
+ setStatus(obj) {
+ this.hasError = obj;
+ }
+
+ getStatus() {
+ return this.hasError;
+ }
+
+ getTestTotal() {
+ return this.totalTest;
+ }
+
+ getCurrentRunningSpec() {
+ return this.currentRunningSpec;
+ }
+
+
+ getSkipSpecNum() {
+ return this.skipSpecNum;
+ }
+
+ initSpecService() {
+ this.isSkipSpec = false;
+ this.specSkipReason = '';
+ }
+
+ it(desc, filter, func) {
+ const suiteService = this.coreContext.getDefaultService('suite');
+ const configService = this.coreContext.getDefaultService('config');
+ let isFilter = new NestFilter().filterNestName(suiteService.targetSuiteArray, suiteService.targetSpecArray, suiteService.suitesStack, desc);
+ if (configService.filterWithNest(desc, filter)) {
+ console.info(`${TAG}filter it :${desc}`);
+ this.initSpecService();
+ return;
+ }
+ if (configService.filterDesc(suiteService.currentRunningSuite.description, desc, filter, this.coreContext) && isFilter && !suiteService.fullRun) {
+ console.info(`${TAG}filter it :${desc}`);
+ this.initSpecService();
+ } else {
+ let processedFunc = processFunc(this.coreContext, func);
+ const spec = new SpecService.Spec({ description: desc, fi: filter, fn: processedFunc });
+ if (this.isSkipSpec) {
+ spec.isSkip = true;
+ spec.skipReason = this.specSkipReason;
+ }
+ this.initSpecService();
+ if (configService.runSkipped === 'skipped' && !spec.isSkip) {
+ console.info(`${TAG} runSkipped is skipped , just run xit, don't run it: ${spec.description}`);
+ return;
+ }
+ if (suiteService.getCurrentRunningSuite().isSkip && !spec.isSkip) {
+ configService.filterXdescribe.push(suiteService.getCurrentRunningSuite().description);
+ }
+ if (typeof this.coreContext.getServices('dataDriver') !== 'undefined' && configService['dryRun'] !== 'true') {
+ let specStress = this.coreContext.getServices('dataDriver').dataDriver.getSpecStress(desc);
+ for (let i = 1; i < specStress; i++) {
+ this.totalTest++;
+ suiteService.getCurrentRunningSuite().pushSpec(spec);
+ }
+ }
+ // dryRun 状态下不统计压力测试重复数据
+ if (configService['dryRun'] !== 'true') {
+ let stress = configService.getStress(); // 命令配置压力测试
+ console.info(`${TAG}stress length : ${stress}`);
+ for (let i = 1; i < stress; i++) {
+ this.totalTest++;
+ suiteService.getCurrentRunningSuite().pushSpec(spec);
+ }
+ }
+ this.totalTest++;
+ suiteService.getCurrentRunningSuite().pushSpec(spec);
+ }
+ }
+
+ xit(desc, filter, func, reason) {
+ const configService = this.coreContext.getDefaultService('config');
+ const suiteService = this.coreContext.getDefaultService('suite');
+ if (!configService.skipMessage && configService.runSkipped !== 'all') {
+ if (configService.runSkipped != null && configService.runSkipped !== '') {
+ let finalDesc = '';
+ suiteService.suitesStack.map(suite => {
+ finalDesc = finalDesc + '.' + suite.description;
+ })
+ finalDesc = (finalDesc + "#" + desc).substring(2);
+ if (configService.checkIfSpecInSkipRun(finalDesc)) {
+ console.log(`${TAG} runSkipped spec: ${desc}`);
+ } else {
+ console.log(reason == null ? `${TAG} skip spec: ${desc}` : `${TAG} skip spec: ${desc}, and the reason is ${reason}`);
+ return;
+ }
+ } else {
+ console.log(reason == null ? `${TAG} skip spec: ${desc}` : `${TAG} skip spec: ${desc}, and the reason is ${reason}`);
+ return;
+ }
+ }
+ this.skipSpecNum++;
+ this.isSkipSpec = true;
+ this.specSkipReason = reason;
+ this.it(desc, filter, func);
+ }
+
+ apis() {
+ const _this = this;
+ return {
+ it: function (desc, filter, func) {
+ return _this.it(desc, filter, func);
+ },
+ xit: function (desc, filter, func, reason) {
+ return _this.xit(desc, filter, func, reason);
+ }
+ };
+ }
+}
+
+SpecService.Spec = class {
+ constructor(attrs) {
+ this.description = attrs.description || '';
+ this.fi = attrs.fi;
+ this.fn = attrs.fn || function () {
+ };
+ this.fail = undefined;
+ this.error = undefined;
+ this.duration = 0;
+ this.startTime = 0;
+ this.isExecuted = false; // 当前用例是否执行
+ this.isSkip = false;
+ this.skipReason = '';
+ this.expectMsg = '';
+ }
+
+ setResult() {
+ if (this.fail) {
+ this.pass = false;
+ } else {
+ this.pass = true;
+ }
+ }
+
+ run(coreContext) {
+ const specService = coreContext.getDefaultService('spec');
+ specService.setCurrentRunningSpec(this);
+ coreContext.fireEvents('spec', 'specStart', this);
+ this.isExecuted = true;
+ try {
+ let dataDriver = coreContext.getServices('dataDriver');
+ if (typeof dataDriver === 'undefined') {
+ this.fn();
+ } else {
+ let suiteParams = dataDriver.dataDriver.getSuiteParams();
+ let specParams = dataDriver.dataDriver.getSpecParams();
+ console.info(`${TAG}[suite params] ${JSON.stringify(suiteParams)}`);
+ console.info(`${TAG}[spec params] ${JSON.stringify(specParams)}`);
+ if (this.fn.length === 0) {
+ this.fn();
+ } else if (specParams.length === 0) {
+ this.fn(suiteParams);
+ } else {
+ specParams.forEach(paramItem => this.fn(Object.assign({}, paramItem, suiteParams)));
+ }
+ }
+ this.setResult();
+ } catch (e) {
+ this.error = e;
+ specService.setStatus(true);
+ }
+ coreContext.fireEvents('spec', 'specDone', this);
+ }
+
+ async asyncRun(coreContext) {
+ const dataDriver = coreContext.getServices('dataDriver');
+ if (typeof dataDriver === 'undefined') {
+ await this.fn();
+ } else {
+ const suiteParams = dataDriver.dataDriver.getSuiteParams();
+ const specParams = dataDriver.dataDriver.getSpecParams();
+ console.info(`[suite params] ${JSON.stringify(suiteParams)}`);
+ console.info(`[spec params] ${JSON.stringify(specParams)}`);
+ if (this.fn.length === 0) {
+ await this.fn();
+ } else if (specParams.length === 0) {
+ await this.fn(suiteParams);
+ } else {
+ for (const paramItem of specParams) {
+ await this.fn(Object.assign({}, paramItem, suiteParams));
+ }
+ }
+ }
+
+ this.isExecuted = true;
+ }
+
+ filterCheck(coreContext) {
+ const specService = coreContext.getDefaultService('spec');
+ specService.setCurrentRunningSpec(this);
+ return true;
+ }
+};
+
+class ExpectService {
+ constructor(attr) {
+ this.id = attr.id;
+ this.matchers = {};
+ this.customMatchers = [];
+ }
+
+ expect(actualValue) {
+ return this.wrapMatchers(actualValue);
+ }
+
+ init(coreContext) {
+ this.coreContext = coreContext;
+ this.addMatchers(this.basicMatchers());
+ }
+
+ addMatchers(matchers) {
+ for (const matcherName in matchers) {
+ if (Object.prototype.hasOwnProperty.call(matchers, matcherName)) {
+ this.matchers[matcherName] = matchers[matcherName];
+ }
+ }
+ }
+
+ removeMatchers(customAssertionName) {
+ if (customAssertionName === 'all') {
+ for (const matcherName in this.matchers) {
+ this.matchers[matcherName] = this.customMatchers.includes(matcherName) ? (() => {throw new Error(`${matcherName} is unregistered`)}) : undefined;
+ }
+ }else {
+ this.matchers[customAssertionName] = () => {
+ throw new Error(`${customAssertionName} is unregistered`)
+ };
+ }
+ }
+
+ basicMatchers() {
+ return {
+ assertTrue: function (actualValue) {
+ return {
+ pass: (actualValue) === true,
+ message: 'expect true, actualValue is ' + actualValue
+ };
+ },
+ assertEqual: function (actualValue, args) {
+ let msg = 'expect ' + actualValue + ' equals ' + args[0];
+ if (actualValue == args[0]) { // 数值相同,提示数据类型
+ const aClassName = Object.prototype.toString.call(actualValue);
+ const bClassName = Object.prototype.toString.call(args[0]);
+ msg = 'expect ' + actualValue + aClassName + ' equals ' + args[0] + bClassName + "strict mode inspect type";
+ }
+ return {
+ pass: (actualValue) === args[0],
+ expectValue: args[0],
+ message: msg
+ };
+ },
+ assertThrow: function (actual, args) {
+ const result = {
+ pass: false
+ };
+ if (typeof actual !== 'function') {
+ result.message = 'toThrow\'s Actual should be a Function';
+ } else {
+ let hasThrow = false;
+ let throwError;
+ try {
+ actual();
+ } catch (e) {
+ hasThrow = true;
+ throwError = e;
+ }
+ if (!hasThrow) {
+ result.message = 'function did not throw an exception';
+ } else if (throwError && throwError.message === args[0]) {
+ result.pass = true;
+ } else {
+ result.message = `expect to throw ${args[0]} , actual throw ${throwError.message}`;
+ }
+ }
+ return result;
+ }
+ };
+ }
+
+ initWrapMatchers(currentRunningSpec) {
+ return {
+ // 翻转标识
+ isNot: false,
+ // 翻转方法
+ not: function () {
+ this.isNot = true;
+ return this;
+ },
+ message: function (msg) {
+ currentRunningSpec.expectMsg = msg;
+ console.info(`${TAG} msg: ${msg}`);
+ return this;
+ }
+ };
+
+ }
+ wrapMatchers(actualValue) {
+ const _this = this;
+ const specService = _this.coreContext.getDefaultService('spec');
+ const currentRunningSpec = specService.getCurrentRunningSpec();
+ const wrappedMatchers = this.initWrapMatchers(currentRunningSpec);
+ const currentRunningSuite = _this.coreContext.getDefaultService('suite').getCurrentRunningSuite();
+ for (const matcherName in this.matchers) {
+ let result = Object.prototype.hasOwnProperty.call(this.matchers, matcherName);
+ if (!result) {
+ continue;
+ }
+ if (matcherName.search('assertPromise') == 0) {
+ wrappedMatchers[matcherName] = async function () {
+ await _this.matchers[matcherName](actualValue, arguments).then(function (result) {
+ if (wrappedMatchers.isNot) {
+ result.pass = !result.pass;
+ }
+ result.actualValue = actualValue;
+ result.checkFunc = matcherName;
+ if (!result.pass) {
+ const assertError = new AssertException(result.message);
+ currentRunningSpec ? currentRunningSpec.fail = assertError : currentRunningSuite.hookError = assertError;
+ throw assertError;
+ }
+ });
+ };
+ } else {
+ wrappedMatchers[matcherName] = function () {
+ const result = _this.customMatchers.includes(matcherName) ? _this.matchers[matcherName](actualValue, arguments[0]) : _this.matchers[matcherName](actualValue, arguments);
+ if (wrappedMatchers.isNot) {
+ result.pass = !result.pass;
+ result.message = LogExpectError.getErrorMsg(matcherName, actualValue, arguments[0], result.message);
+ }
+ result.actualValue = actualValue;
+ result.checkFunc = matcherName;
+ if (!result.pass) {
+ const assertError = new AssertException(result.message);
+ currentRunningSpec ? currentRunningSpec.fail = assertError : currentRunningSuite.hookError = assertError;
+ throw assertError;
+ }
+ };
+ }
+ }
+ return wrappedMatchers;
+ }
+
+ apis() {
+ const _this = this;
+ return {
+ expect: function (actualValue) {
+ return _this.expect(actualValue);
+ }
+ };
+ }
+}
+
+class ReportService {
+ constructor(attr) {
+ this.id = attr.id;
+ }
+
+ init(coreContext) {
+ this.coreContext = coreContext;
+ this.specService = this.coreContext.getDefaultService('spec');
+ this.suiteService = this.coreContext.getDefaultService('suite');
+ this.duration = 0;
+ }
+
+ taskStart() {
+ console.info(`${TAG}[start] start run suites`);
+ }
+
+ async suiteStart() {
+ console.info(`${TAG}[suite start]${this.suiteService.getCurrentRunningSuite().description}`);
+ }
+
+ async specStart() {
+ console.info(`${TAG}start running case '${this.specService.currentRunningSpec.description}'`);
+ this.index = this.index + 1;
+ let spec = this.specService.currentRunningSpec;
+ spec.startTime = await SysTestKit.getRealTime();
+ }
+
+ async specDone() {
+ let msg = '';
+ let spec = this.specService.currentRunningSpec;
+ let suite = this.suiteService.currentRunningSuite;
+ spec.duration = await SysTestKit.getRealTime() - spec.startTime;
+ suite.duration += spec.duration;
+ if (spec.error) {
+ this.formatPrint('error', spec.description + ' ; consuming ' + spec.duration + 'ms');
+ this.formatPrint('errorDetail', spec.error);
+ } else if (spec.fail) {
+ this.formatPrint('fail', spec.description + ' ; consuming ' + spec.duration + 'ms');
+ this.formatPrint('failDetail', spec.fail?.message);
+ } else {
+ this.formatPrint('pass', spec.description + ' ; consuming ' + spec.duration + 'ms');
+ }
+ this.formatPrint(this.specService.currentRunningSpec.error, msg);
+ }
+
+ suiteDone() {
+ let suite = this.suiteService.currentRunningSuite;
+ let message = suite.hookError ? `, ${suite.hookError?.message}` : '';
+ console.info(`[suite end] ${suite.description} consuming ${suite.duration} ms${message}`);
+ }
+
+ taskDone() {
+ let msg = '';
+ let summary = this.suiteService.getSummary();
+ msg = 'total cases:' + summary.total + ';failure ' + summary.failure + ',' + 'error ' + summary.error;
+ msg += ',pass ' + summary.pass + '; consuming ' + summary.duration + 'ms';
+ console.info(`${TAG}${msg}`);
+ console.info(`${TAG}[end] run suites end`);
+ }
+
+ incorrectFormat() {
+ if (this.coreContext.getDefaultService('config').filterValid.length !== 0) {
+ this.coreContext.getDefaultService('config').filterValid.forEach(function (item) {
+ console.info(`${TAG}this param ${item} is invalid`);
+ });
+ }
+ }
+
+ incorrectTestSuiteFormat() {
+ if (this.coreContext.getDefaultService('config').filterXdescribe.length !== 0) {
+ this.coreContext.getDefaultService('config').filterXdescribe.forEach(function (item) {
+ console.info(`${TAG}xdescribe: ${item} should not contain it`);
+ })
+ }
+ }
+
+ formatPrint(type, msg) {
+ switch (type) {
+ case 'pass':
+ console.info(`${TAG}[pass]${msg}`);
+ break;
+ case 'fail':
+ console.info(`${TAG}[fail]${msg}`);
+ break;
+ case 'failDetail':
+ console.info(`${TAG}[failDetail]${msg}`);
+ break;
+ case 'error':
+ console.info(`${TAG}[error]${msg}`);
+ break;
+ case 'errorDetail':
+ console.info(`${TAG}[errorDetail]${msg}`);
+ break;
+ }
+ }
+
+ sleep(numberMillis) {
+ var now = new Date();
+ var exitTime = now.getTime() + numberMillis;
+ while (true) {
+ now = new Date();
+ if (now.getTime() > exitTime) {
+ return;
+ }
+ }
+ }
+}
+
+export {
+ SuiteService,
+ SpecService,
+ ExpectService,
+ ReportService
+};
diff --git a/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/testrunner/OpenHarmonyTestRunner.ts b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/testrunner/OpenHarmonyTestRunner.ts
new file mode 100644
index 0000000000000000000000000000000000000000..e6f4c1b12dd69714ed5a4524671abca1fbcaa58c
--- /dev/null
+++ b/MultipleImage/oh_modules/.ohpm/oh_modules/@ohos/hypium/src/main/testrunner/OpenHarmonyTestRunner.ts
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2023-2024 Huawei Device 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 { abilityDelegatorRegistry, TestRunner } from '@kit.TestKit';
+import { BusinessError } from '@kit.BasicServicesKit';
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { resourceManager } from '@kit.LocalizationKit';
+import { util } from '@kit.ArkTS';
+import { Hypium } from '@ohos/hypium';
+import testsuite from '../test/List.test';
+
+let abilityDelegator: abilityDelegatorRegistry.AbilityDelegator;
+let abilityDelegatorArguments: abilityDelegatorRegistry.AbilityDelegatorArgs;
+let jsonPath: string = 'mock/mock-config.json';
+let domain: number = 0x0000; //日志标识,0x0000作为测试框架的业务标识
+let tag: string = 'testTag'; //日志标识字符串,作为tag标识当前runner类下的测试行为
+
+export default class OpenHarmonyTestRunner implements TestRunner {
+ constructor() {
+ }
+
+ onPrepare() {
+ hilog.info(domain, tag, '%{public}s', 'OpenHarmonyTestRunner OnPrepare');
+ }
+
+ async onRun() {
+ hilog.info(domain, tag, '%{public}s', 'OpenHarmonyTestRunner onRun run');
+ abilityDelegatorArguments = abilityDelegatorRegistry.getArguments();
+ abilityDelegator = abilityDelegatorRegistry.getAbilityDelegator();
+ let moduleName = abilityDelegatorArguments.parameters['-m'];
+ let context = abilityDelegator.getAppContext().getApplicationContext().createModuleContext(moduleName);
+ let mResourceManager = context.resourceManager;
+ await checkMock(abilityDelegator, mResourceManager);
+ hilog.info(domain, tag, '%{public}s', 'start run testcase!!!');
+ Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite);
+ hilog.info(domain, tag, '%{public}s', 'OpenHarmonyTestRunner onRun end');
+ }
+}
+
+async function checkMock(abilityDelegator: abilityDelegatorRegistry.AbilityDelegator, resourceManager: resourceManager.ResourceManager) {
+ let rawFile: Uint8Array;
+ try {
+ rawFile = resourceManager.getRawFileContentSync(jsonPath);
+ hilog.info(domain, tag, 'MockList file exists');
+ let mockStr: string = util.TextDecoder.create("utf-8", { ignoreBOM: true }).decodeWithStream(rawFile);
+ let mockMap: Record = getMockList(mockStr);
+ try {
+ abilityDelegator.setMockList(mockMap);
+ } catch (error) {
+ let code = (error as BusinessError).code;
+ let message = (error as BusinessError).message;
+ hilog.error(domain, tag, `abilityDelegator.setMockList failed, error code: ${code}, message: ${message}.`);
+ }
+ } catch (error) {
+ let code = (error as BusinessError).code;
+ let message = (error as BusinessError).message;
+ hilog.error(domain, tag, `ResourceManager:callback getRawFileContent failed, error code: ${code}, message: ${message}.`);
+ }
+}
+
+function getMockList(jsonStr: string) {
+ let jsonObj: Record = JSON.parse(jsonStr);
+ let map: Map = new Map(Object.entries(jsonObj));
+ let mockList: Record = {};
+ map.forEach((value: object, key: string) => {
+ let realValue: string = value['source'].toString();
+ mockList[key] = realValue;
+ });
+ hilog.info(domain, tag, '%{public}s', 'mock-json value:' + JSON.stringify(mockList) ?? '');
+ return mockList;
+}
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/@ohos/hamock/CHANGELOG.md b/MultipleImage/oh_modules/@ohos/hamock/CHANGELOG.md
new file mode 100644
index 0000000000000000000000000000000000000000..22a35bda8a1fab36dd81c1c7ae86addcc1f111cc
--- /dev/null
+++ b/MultipleImage/oh_modules/@ohos/hamock/CHANGELOG.md
@@ -0,0 +1,4 @@
+## 1.0.0
+- 修复once断言问题
+## 1.0.0-rc
+- 提供DevEco Studio预览器场景使能的MockSetup装饰器
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/@ohos/hamock/LICENSE b/MultipleImage/oh_modules/@ohos/hamock/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..4947287f7b5ccb5d1e8b7b2d3aa5d89f322c160d
--- /dev/null
+++ b/MultipleImage/oh_modules/@ohos/hamock/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/@ohos/hamock/README.md b/MultipleImage/oh_modules/@ohos/hamock/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..c46981eb6b9163cb82723dd4c410b69b5e6a66cd
--- /dev/null
+++ b/MultipleImage/oh_modules/@ohos/hamock/README.md
@@ -0,0 +1,82 @@
+# Hamock
+
+## 简介
+
+Hamock 是 OpenHarmony 上的模拟框架,提供预览场景的模拟功能。
+
+## 下载安装
+
+```bash
+ohpm install @ohos/hamock
+```
+
+OpenHarmony ohpm 环境配置等更多内容,请参考[如何安装 OpenHarmony ohpm 包](https://gitee.com/openharmony-tpc/docs/blob/master/OpenHarmony_har_usage.md)
+
+## 使用示例
+
+Hamock 提供了 @MockSetup 用于修饰 Mock 方法,仅支持声明式范式的组件。当开发者预览该组件时,预览运行时将在组件初始化时执行被 @MockSetup 修饰的方法。因此,开发者可以在这个被修饰的方法内重定义组件的方法或重赋值组件的属性,其将在预览时生效。
+
+> 说明:
+> @MockSetup 修饰的方法仅在预览场景会自动触发,并先于组件的 aboutToAppear 执行。
+
+### UI组件的方法
+
+在 ArkTS 页面代码中引入 Hamock。在目标组件中定义一个方法,并用 @MockSetup 修饰该方法。在这个方法中,使用 MockKit 模拟目标方法。
+
+```typescript
+import { MockKit, when, MockSetup } from '@ohos/hamock';
+
+@Entry
+@Component
+struct Index {
+ ...
+ @MockSetup
+ randomName() {
+ let mocker: MockKit = new MockKit();
+ let mockfunc: Object = mocker.mockFunc(this, this.method1);
+ // mock 指定的方法在指定入参的返回值
+ when(mockfunc)('test').afterReturn(1);
+ }
+ ...
+ // 业务场景调用方法
+ const result: number = this.method1('test'); // in previewer, result = 1
+}
+```
+
+### UI组件的属性
+
+在 ArkTS 页面代码中引入 Hamock。在目标组件中定义一个方法,并用 @MockSetup 修饰该方法。在这个方法中,对于需要 Mock 的属性,可以重新赋值。
+
+```typescript
+import { MockSetup } from '@ohos/hamock';
+
+@Component
+struct Person {
+ @Prop species: string;
+ ...
+ // 在 @MockSetup 片段中,定义对象属性
+ @MockSetup
+ randomName() {
+ this.species = 'primates';
+ }
+ ...
+ // 业务场景调用属性(如果从初始化到调用期间,该属性无变化)
+ const result: string = this.species; // in previewer, result = primates
+}
+```
+
+## 约束与限制
+
+在下述版本验证通过:
+
+DevEco Studio: 4.1 (4.1.3.400), SDK: API11 (4.1.0.36)
+
+MockSetup 仅在 API11 支持。
+
+## 贡献代码
+
+使用过程中发现任何问题都可以提[Issue](https://gitee.com/openharmony/testfwk_arkxtest/issues) 给我们,当然,我们也非常欢迎你给我们提[PR](https://gitee.com/openharmony/testfwk_arkxtest/pulls) 。
+
+## 开源协议
+
+本项目基于 [Apache License 2.0](https://gitee.com/openharmony/testfwk_arkxtest/blob/master/hamock/LICENSE) ,请自由地享受和参与开源。
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/@ohos/hamock/build-profile.json5 b/MultipleImage/oh_modules/@ohos/hamock/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..12fe2d844bdb69584fd05ebaa3e1cb197a25c3f1
--- /dev/null
+++ b/MultipleImage/oh_modules/@ohos/hamock/build-profile.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2023 Huawei Device 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.
+ */
+
+{
+ "apiType": "stageMode",
+ "buildOption": {
+ },
+ "targets": [
+ {
+ "name": "default"
+ }
+ ]
+}
diff --git a/MultipleImage/oh_modules/@ohos/hamock/hvigorfile.js b/MultipleImage/oh_modules/@ohos/hamock/hvigorfile.js
new file mode 100644
index 0000000000000000000000000000000000000000..d7bda561c9bf09b92a7fac485141cc8648907388
--- /dev/null
+++ b/MultipleImage/oh_modules/@ohos/hamock/hvigorfile.js
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2023 Huawei Device 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.
+ */
+
+// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
+export { harTasks } from '@ohos/hvigor-ohos-plugin';
diff --git a/MultipleImage/oh_modules/@ohos/hamock/hvigorfile.ts b/MultipleImage/oh_modules/@ohos/hamock/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..960be7d7df0790853d6bdab1f52a3ec8c8e4a1ca
--- /dev/null
+++ b/MultipleImage/oh_modules/@ohos/hamock/hvigorfile.ts
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2023 Huawei Device 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.
+ */
+
+// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
+export { harTasks } from '@ohos/hvigor-ohos-plugin';
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/@ohos/hamock/index.d.ts b/MultipleImage/oh_modules/@ohos/hamock/index.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..6bc7929ba5718da0e459721be04e903ec59289c0
--- /dev/null
+++ b/MultipleImage/oh_modules/@ohos/hamock/index.d.ts
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2023 Huawei Device 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.
+ */
+
+export class ArgumentMatchers {
+ static any;
+ static anyString;
+ static anyBoolean;
+ static anyNumber;
+ static anyObj;
+ static anyFunction;
+ static matchRegexs(Regex: RegExp): void
+}
+
+declare interface when {
+ afterReturn(value: any): any
+ afterReturnNothing(): undefined
+ afterAction(action: any): any
+ afterThrow(e_msg: string): string
+ (argMatchers?: any): when;
+}
+
+export const when: when;
+
+export interface VerificationMode {
+ times(count: Number): void
+ never(): void
+ once(): void
+ atLeast(count: Number): void
+ atMost(count: Number): void
+}
+
+export class MockKit {
+ constructor()
+ mockFunc(obj: Object, func: Function): Function
+ mockObject(obj: Object): Object
+ verify(methodName: String, argsArray: Array): VerificationMode
+ ignoreMock(obj: Object, func: Function): void
+ clear(obj: Object): void
+ clearAll(): void
+}
+
+export declare function MockSetup(
+ target: Object,
+ propertyName: string | Symbol,
+ descriptor: TypedPropertyDescriptor<() => void>
+): void;
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/@ohos/hamock/index.ets b/MultipleImage/oh_modules/@ohos/hamock/index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..c3a47320c2b674216cccde0fe217dbb8423625cc
--- /dev/null
+++ b/MultipleImage/oh_modules/@ohos/hamock/index.ets
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2023 Huawei Device 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.
+ */
+
+export { MockSetup, MockKit, when } from './src/main/mock/MockKit';
+export { ArgumentMatchers } from './src/main/mock/ArgumentMatchers';
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/@ohos/hamock/index.js b/MultipleImage/oh_modules/@ohos/hamock/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..1cb2b5e0256e00aa9276867f0753a89a7ac5e16f
--- /dev/null
+++ b/MultipleImage/oh_modules/@ohos/hamock/index.js
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2021-2023 Huawei Device 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.
+ */
+export { MockSetup, MockKit, when } from './src/main/mock/MockKit.js';
+export { ArgumentMatchers } from './src/main/mock/ArgumentMatchers.js';
diff --git a/MultipleImage/oh_modules/@ohos/hamock/index.ts b/MultipleImage/oh_modules/@ohos/hamock/index.ts
new file mode 100644
index 0000000000000000000000000000000000000000..608eb4fe72aaf0f6cca0ccb3baad94e9b6101de0
--- /dev/null
+++ b/MultipleImage/oh_modules/@ohos/hamock/index.ts
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2021-2023 Huawei Device 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.
+ */
+
+export { MockSetup, MockKit, when } from './src/main/mock/MockKit.js';
+export { ArgumentMatchers } from './src/main/mock/ArgumentMatchers.js';
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/@ohos/hamock/oh-package.json5 b/MultipleImage/oh_modules/@ohos/hamock/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..0ef4eeed251a93463c2abf85b262c3e1fb6733bc
--- /dev/null
+++ b/MultipleImage/oh_modules/@ohos/hamock/oh-package.json5
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2023 Huawei Device 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.
+ */
+
+{
+ name: '@ohos/hamock',
+ version: '1.0.0',
+ description: 'A mock framework for OpenHarmony application.',
+ main: 'index.ets',
+ author: 'huawei',
+ license: 'Apache-2.0',
+ dependencies: {},
+ ohos: {
+ org: 'ohos',
+ },
+ types: 'index.d.ts'
+}
diff --git a/MultipleImage/oh_modules/@ohos/hamock/src/main/mock/ArgumentMatchers.js b/MultipleImage/oh_modules/@ohos/hamock/src/main/mock/ArgumentMatchers.js
new file mode 100644
index 0000000000000000000000000000000000000000..f06bbca0b287aac612f42f9263c064c0157ae03a
--- /dev/null
+++ b/MultipleImage/oh_modules/@ohos/hamock/src/main/mock/ArgumentMatchers.js
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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.
+ */
+export class ArgumentMatchers {
+ constructor() {
+ this.ANY = "";
+ this.ANY_STRING = "";
+ this.ANY_BOOLEAN = "";
+ this.ANY_NUMBER = "";
+ this.ANY_OBJECT = "";
+ this.ANY_FUNCTION = "";
+ this.MATCH_REGEXS = "";
+ }
+ static any() {
+ }
+ static anyString() {
+ }
+ static anyBoolean() {
+ }
+ static anyNumber() {
+ }
+ static anyObj() {
+ }
+ static anyFunction() {
+ }
+ static matchRegexs(regex) {
+ if (ArgumentMatchers.isRegExp(regex)) {
+ return regex;
+ }
+ throw Error("not a regex");
+ }
+ static isRegExp(value) {
+ return Object.prototype.toString.call(value) === "[object RegExp]";
+ }
+ matcheReturnKey(...args) {
+ let arg = args[0];
+ let regex = args[1];
+ let stubSetKey = args[2];
+ if (stubSetKey && stubSetKey == this.ANY) {
+ return this.ANY;
+ }
+ if (typeof arg === "string" && !regex) {
+ return this.ANY_STRING;
+ }
+ if (typeof arg === "boolean" && !regex) {
+ return this.ANY_BOOLEAN;
+ }
+ if (typeof arg === "number" && !regex) {
+ return this.ANY_NUMBER;
+ }
+ if (typeof arg === "object" && !regex) {
+ return this.ANY_OBJECT;
+ }
+ if (typeof arg === "function" && !regex) {
+ return this.ANY_FUNCTION;
+ }
+ if (typeof arg === "string" && regex) {
+ return regex.test(arg);
+ }
+ return null;
+ }
+ matcheStubKey(key) {
+ if (key === ArgumentMatchers.any) {
+ return this.ANY;
+ }
+ if (key === ArgumentMatchers.anyString) {
+ return this.ANY_STRING;
+ }
+ if (key === ArgumentMatchers.anyBoolean) {
+ return this.ANY_BOOLEAN;
+ }
+ if (key === ArgumentMatchers.anyNumber) {
+ return this.ANY_NUMBER;
+ }
+ if (key === ArgumentMatchers.anyObj) {
+ return this.ANY_OBJECT;
+ }
+ if (key === ArgumentMatchers.anyFunction) {
+ return this.ANY_FUNCTION;
+ }
+ if (ArgumentMatchers.isRegExp(key)) {
+ return key;
+ }
+ return null;
+ }
+}
diff --git a/MultipleImage/oh_modules/@ohos/hamock/src/main/mock/ArgumentMatchers.ts b/MultipleImage/oh_modules/@ohos/hamock/src/main/mock/ArgumentMatchers.ts
new file mode 100644
index 0000000000000000000000000000000000000000..262bea1afbeb611029db0cfaeb65767b92f97b91
--- /dev/null
+++ b/MultipleImage/oh_modules/@ohos/hamock/src/main/mock/ArgumentMatchers.ts
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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.
+ */
+
+export class ArgumentMatchers {
+ ANY = "";
+ ANY_STRING = "";
+ ANY_BOOLEAN = "";
+ ANY_NUMBER = "";
+ ANY_OBJECT = "";
+ ANY_FUNCTION = "";
+ MATCH_REGEXS = "";
+
+ static any() {
+ }
+
+ static anyString() {
+ }
+
+ static anyBoolean() {
+ }
+
+ static anyNumber() {
+ }
+
+ static anyObj() {
+ }
+
+ static anyFunction() {
+ }
+
+ static matchRegexs(regex: any) {
+ if (ArgumentMatchers.isRegExp(regex)) {
+ return regex;
+ }
+ throw Error("not a regex");
+ }
+
+ static isRegExp(value: string) {
+ return Object.prototype.toString.call(value) === "[object RegExp]";
+ }
+
+ matcheReturnKey(...args: Array) {
+ let arg = args[0];
+ let regex = args[1];
+ let stubSetKey = args[2];
+
+ if (stubSetKey && stubSetKey == this.ANY) {
+ return this.ANY;
+ }
+
+ if (typeof arg === "string" && !regex) {
+ return this.ANY_STRING;
+ }
+
+ if (typeof arg === "boolean" && !regex) {
+ return this.ANY_BOOLEAN;
+ }
+
+ if (typeof arg === "number" && !regex) {
+ return this.ANY_NUMBER;
+ }
+
+ if (typeof arg === "object" && !regex) {
+ return this.ANY_OBJECT;
+ }
+
+ if (typeof arg === "function" && !regex) {
+ return this.ANY_FUNCTION;
+ }
+
+ if (typeof arg === "string" && regex) {
+ return regex.test(arg);
+ }
+
+ return null;
+ }
+
+ matcheStubKey(key: any) {
+
+ if (key === ArgumentMatchers.any) {
+ return this.ANY;
+ }
+
+ if (key === ArgumentMatchers.anyString) {
+ return this.ANY_STRING;
+ }
+ if (key === ArgumentMatchers.anyBoolean) {
+ return this.ANY_BOOLEAN;
+ }
+ if (key === ArgumentMatchers.anyNumber) {
+ return this.ANY_NUMBER;
+ }
+ if (key === ArgumentMatchers.anyObj) {
+ return this.ANY_OBJECT;
+ }
+ if (key === ArgumentMatchers.anyFunction) {
+ return this.ANY_FUNCTION;
+ }
+
+ if (ArgumentMatchers.isRegExp(key)) {
+ return key;
+ }
+
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/@ohos/hamock/src/main/mock/ExtendInterface.js b/MultipleImage/oh_modules/@ohos/hamock/src/main/mock/ExtendInterface.js
new file mode 100644
index 0000000000000000000000000000000000000000..52f9dff07f7b719900ca47d56c3020586db31d5b
--- /dev/null
+++ b/MultipleImage/oh_modules/@ohos/hamock/src/main/mock/ExtendInterface.js
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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.
+ */
+class ExtendInterface {
+ constructor(mocker) {
+ this.mocker = mocker;
+ }
+ stub() {
+ this.params = arguments;
+ return this;
+ }
+ stubMockedCall(returnInfo) {
+ this.mocker.stubApply(this, this.params, returnInfo);
+ }
+ afterReturn(value) {
+ this.stubMockedCall(function () {
+ return value;
+ });
+ }
+ afterReturnNothing() {
+ this.stubMockedCall(function () {
+ return undefined;
+ });
+ }
+ afterAction(action) {
+ this.stubMockedCall(action);
+ }
+ afterThrow(msg) {
+ this.stubMockedCall(function () {
+ throw msg;
+ });
+ }
+ clear(obj) {
+ this.mocker.clear(obj);
+ }
+}
+export default ExtendInterface;
diff --git a/MultipleImage/oh_modules/@ohos/hamock/src/main/mock/ExtendInterface.ts b/MultipleImage/oh_modules/@ohos/hamock/src/main/mock/ExtendInterface.ts
new file mode 100644
index 0000000000000000000000000000000000000000..55f7a0b36bc2895e17a2e6b32a6c1980853cbce9
--- /dev/null
+++ b/MultipleImage/oh_modules/@ohos/hamock/src/main/mock/ExtendInterface.ts
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2022 Huawei Device 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 { MockKit } from "./MockKit.js";
+
+class ExtendInterface {
+
+ private mocker: MockKit
+ private params: any
+
+ constructor(mocker: MockKit) {
+ this.mocker = mocker;
+ }
+
+ stub() {
+ this.params = arguments;
+ return this;
+ }
+
+ stubMockedCall(returnInfo: any) {
+ this.mocker.stubApply(this, this.params, returnInfo);
+ }
+
+ afterReturn(value: any) {
+ this.stubMockedCall(function () {
+ return value;
+ });
+ }
+
+ afterReturnNothing() {
+ this.stubMockedCall(function () {
+ return undefined;
+ });
+ }
+
+ afterAction(action: Function) {
+ this.stubMockedCall(action);
+ }
+
+ afterThrow(msg: string) {
+ this.stubMockedCall(function () {
+ throw msg;
+ });
+ }
+
+ clear(obj?: any) {
+ this.mocker.clear(obj);
+ }
+}
+
+export default ExtendInterface;
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/@ohos/hamock/src/main/mock/MockKit.js b/MultipleImage/oh_modules/@ohos/hamock/src/main/mock/MockKit.js
new file mode 100644
index 0000000000000000000000000000000000000000..c1ca51614abe9f9c149094f5186eeb750b00a074
--- /dev/null
+++ b/MultipleImage/oh_modules/@ohos/hamock/src/main/mock/MockKit.js
@@ -0,0 +1,253 @@
+/*
+ * Copyright (c) 2022-2023 Huawei Device 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 ExtendInterface from "./ExtendInterface.js";
+import VerificationMode from "./VerificationMode.js";
+import { ArgumentMatchers } from "./ArgumentMatchers.js";
+class MockKit {
+ constructor() {
+ this.mFunctions = [];
+ this.stubs = new Map();
+ this.recordCalls = new Map();
+ this.currentSetKey = new Map();
+ this.mockObj = null;
+ this.recordMockedMethod = new Map();
+ this.mFunctions = [];
+ this.stubs = new Map();
+ this.recordCalls = new Map();
+ this.currentSetKey = new Map();
+ this.mockObj = null;
+ this.recordMockedMethod = new Map();
+ }
+ init() {
+ this.reset();
+ }
+ reset() {
+ this.mFunctions = [];
+ this.stubs = new Map();
+ this.recordCalls = new Map();
+ this.currentSetKey = new Map();
+ this.mockObj = null;
+ this.recordMockedMethod = new Map();
+ }
+ clearAll() {
+ this.reset();
+ }
+ clear(obj) {
+ if (!obj) throw Error("Please enter an object to be cleaned");
+ if (typeof (obj) !== 'object' && typeof (obj) !== 'function') throw new Error('Not a object or static class');
+ this.recordMockedMethod.forEach(function (value, key, map) {
+ if (key) {
+ obj[key] = value;
+ }
+ });
+ }
+ ignoreMock(obj, method) {
+ if (typeof (obj) !== 'object' && typeof (obj) !== 'function') throw new Error('Not a object or static class');
+ if (typeof (method) !== 'function') throw new Error('Not a function');
+ let og = this.recordMockedMethod.get(method.propName);
+ if (og) {
+ obj[method.propName] = og;
+ this.recordMockedMethod.set(method.propName, undefined);
+ }
+ }
+ extend(dest, source) {
+ dest["stub"] = source["stub"];
+ dest["afterReturn"] = source["afterReturn"];
+ dest["afterReturnNothing"] = source["afterReturnNothing"];
+ dest["afterAction"] = source["afterAction"];
+ dest["afterThrow"] = source["afterThrow"];
+ dest["stubMockedCall"] = source["stubMockedCall"];
+ dest["clear"] = source["clear"];
+ return dest;
+ }
+ stubApply(f, params, returnInfo) {
+ let values = this.stubs.get(f);
+ if (!values) {
+ values = new Map();
+ }
+ let key = params[0];
+ if (typeof key === "undefined") {
+ key = "anonymous-mock-" + f.propName;
+ }
+ let matcher = new ArgumentMatchers();
+ if (matcher.matcheStubKey(key)) {
+ key = matcher.matcheStubKey(key);
+ if (key) {
+ this.currentSetKey.set(f, key);
+ }
+ }
+ values.set(key, returnInfo);
+ this.stubs.set(f, values);
+ }
+ getReturnInfo(f, params) {
+ let values = this.stubs.get(f);
+ if (!values) {
+ return undefined;
+ }
+ let retrunKet = params[0];
+ if (typeof retrunKet === "undefined") {
+ retrunKet = "anonymous-mock-" + f.propName;
+ }
+ let stubSetKey = this.currentSetKey.get(f);
+
+ if (stubSetKey && (typeof (retrunKet) !== "undefined")) {
+ retrunKet = stubSetKey;
+ }
+ let matcher = new ArgumentMatchers();
+ if (matcher.matcheReturnKey(params[0], undefined, stubSetKey) && matcher.matcheReturnKey(params[0], undefined, stubSetKey) !== stubSetKey) {
+ retrunKet = params[0];
+ }
+ values.forEach(function (value, key, map) {
+ if (ArgumentMatchers.isRegExp(key) && matcher.matcheReturnKey(params[0], key)) {
+ retrunKet = key;
+ }
+ });
+ return values.get(retrunKet);
+ }
+ findName(obj, value) {
+ let properties = this.findProperties(obj);
+ let name = '';
+ properties.filter((item) => (item !== 'caller' && item !== 'arguments')).forEach(function (va1, idx, array) {
+ if (obj[va1] === value) {
+ name = va1;
+ }
+ });
+ return name;
+ }
+ isFunctionFromPrototype(f, container, propName) {
+ if (container.constructor !== Object && container.constructor.prototype !== container) {
+ return container.constructor.prototype[propName] === f;
+ }
+ return false;
+ }
+ findProperties(obj, ...arg) {
+ function getProperty(new_obj) {
+ if (new_obj.__proto__ === null) {
+ return [];
+ }
+ let properties = Object.getOwnPropertyNames(new_obj);
+ return [...properties, ...getProperty(new_obj.__proto__)];
+ }
+ return getProperty(obj);
+ }
+ recordMethodCall(originalMethod, args) {
+ originalMethod['getName'] = function () {
+ return this.name || this.toString().match(/function\s*([^(]*)\(/)[1];
+ };
+ let name = originalMethod.getName();
+ let arglistString = name + '(' + Array.from(args).toString() + ')';
+ let records = this.recordCalls.get(arglistString);
+ if (!records) {
+ records = 0;
+ }
+ records++;
+ this.recordCalls.set(arglistString, records);
+ }
+ mockFunc(originalObject, originalMethod) {
+ let tmp = this;
+ this.originalMethod = originalMethod;
+ const _this = this;
+ let f = function () {
+ let args = arguments;
+ let action = tmp.getReturnInfo(f, args);
+ if (originalMethod) {
+ tmp.recordMethodCall(originalMethod, args);
+ }
+ if (action) {
+ return action.apply(_this, args);
+ }
+ };
+ f.container = null || originalObject;
+ f.original = originalMethod || null;
+ if (originalObject && originalMethod) {
+ if (typeof (originalMethod) != 'function')
+ throw new Error('Not a function');
+ var name = this.findName(originalObject, originalMethod);
+ originalObject[name] = f;
+ this.recordMockedMethod.set(name, originalMethod);
+ f.propName = name;
+ f.originalFromPrototype = this.isFunctionFromPrototype(f.original, originalObject, f.propName);
+ }
+ f.mocker = this;
+ this.mFunctions.push(f);
+ this.extend(f, new ExtendInterface(this));
+ return f;
+ }
+ verify(methodName, argsArray) {
+ if (!methodName) {
+ throw Error("not a function name");
+ }
+ let a = this.recordCalls.get(methodName + '(' + argsArray.toString() + ')');
+ return new VerificationMode(a ? a : 0);
+ }
+ mockObject(object) {
+ if (!object || typeof object === "string") {
+ throw Error(`this ${object} cannot be mocked`);
+ }
+ const _this = this;
+ let mockedObject = {};
+ let keys = Reflect.ownKeys(object);
+ keys.filter(key => (typeof Reflect.get(object, key)) === 'function')
+ .forEach((key) => {
+ mockedObject[key] = object[key];
+ mockedObject[key] = _this.mockFunc(mockedObject, mockedObject[key]);
+ });
+ return mockedObject;
+ }
+}
+function ifMockedFunction(f) {
+ if (Object.prototype.toString.call(f) != "[object Function]" &&
+ Object.prototype.toString.call(f) != "[object AsyncFunction]") {
+ throw Error("not a function");
+ }
+ if (!f.stub) {
+ throw Error("not a mock function");
+ }
+ return true;
+}
+function when(f) {
+ if (ifMockedFunction(f)) {
+ return f.stub.bind(f);
+ }
+}
+function MockSetup(target, propertyName, descriptor) {
+ const aboutToAppearOrigin = target.aboutToAppear;
+ const setup = descriptor.value;
+ target.aboutToAppear = function (...args) {
+ if (target.__Param) { // copy attributes and params of the original context
+ try {
+ const map = target.__Param;
+ for (const [key, val] of map) {
+ this[key] = val; // 'this' refers to context of current function
+ }
+ }
+ catch (e) {
+ throw new Error(`Mock setup param error: ${e}`);
+ }
+ }
+ if (setup) { // apply the mock content
+ try {
+ setup.apply(this);
+ }
+ catch (e) {
+ throw new Error(`Mock setup apply error: ${e}`);
+ }
+ }
+ if (aboutToAppearOrigin) { // append to aboutToAppear function of the original context
+ aboutToAppearOrigin.apply(this, args);
+ }
+ };
+}
+export { MockSetup, MockKit, when };
diff --git a/MultipleImage/oh_modules/@ohos/hamock/src/main/mock/MockKit.ts b/MultipleImage/oh_modules/@ohos/hamock/src/main/mock/MockKit.ts
new file mode 100644
index 0000000000000000000000000000000000000000..2807643e29d6da16ee7061ce5674b696a4fc3ca6
--- /dev/null
+++ b/MultipleImage/oh_modules/@ohos/hamock/src/main/mock/MockKit.ts
@@ -0,0 +1,294 @@
+/*
+ * Copyright (c) 2023 Huawei Device 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 ExtendInterface from "./ExtendInterface.js";
+import VerificationMode from "./VerificationMode.js";
+import { ArgumentMatchers } from "./ArgumentMatchers.js";
+
+interface IFunction extends Function {
+ container: any;
+ original: any;
+ propName: string;
+ originalFromPrototype: boolean
+ mocker: MockKit
+}
+
+class MockKit {
+
+ private mFunctions:Array = [];
+ private stubs = new Map();
+ private recordCalls = new Map();
+ private currentSetKey = new Map();
+ private mockObj = null;
+ private recordMockedMethod = new Map();
+ private originalMethod: any;
+
+ constructor() {
+ this.mFunctions = [];
+ this.stubs = new Map();
+ this.recordCalls = new Map();
+ this.currentSetKey = new Map();
+ this.mockObj = null;
+ this.recordMockedMethod = new Map();
+ }
+
+ init() {
+ this.reset();
+ }
+
+ reset() {
+ this.mFunctions = [];
+ this.stubs = new Map()
+ this.recordCalls = new Map();
+ this.currentSetKey = new Map();
+ this.mockObj = null;
+ this.recordMockedMethod = new Map();
+ }
+
+ clearAll() {
+ this.reset();
+ }
+
+ clear(obj: any) {
+ if (!obj) throw Error("Please enter an object to be cleaned");
+ if (typeof (obj) != 'object') throw new Error('Not a object');
+ this.recordMockedMethod.forEach(function (value, key, map) {
+ if (key) {
+ obj[key] = value;
+ }
+ });
+ }
+
+ ignoreMock(obj:any, method: any) {
+ if (typeof (obj) != 'object') throw new Error('Not a object');
+ if (typeof (method) != 'function') throw new Error('Not a function');
+ let og = this.recordMockedMethod.get(method.propName);
+ if (og) {
+ obj[method.propName] = og;
+ this.recordMockedMethod.set(method.propName, undefined);
+ }
+ }
+
+ extend(dest: any, source:any) {
+ dest["stub"] = source["stub"];
+ dest["afterReturn"] = source["afterReturn"];
+ dest["afterReturnNothing"] = source["afterReturnNothing"];
+ dest["afterAction"] = source["afterAction"];
+ dest["afterThrow"] = source["afterThrow"];
+ dest["stubMockedCall"] = source["stubMockedCall"];
+ dest["clear"] = source["clear"];
+ return dest;
+ }
+
+ stubApply(f: any, params:any, returnInfo:any) {
+ let values = this.stubs.get(f);
+ if (!values) {
+ values = new Map();
+ }
+ let key = params[0];
+ if (typeof key == "undefined") {
+ key = "anonymous-mock-" + f.propName;
+ }
+ let matcher = new ArgumentMatchers();
+ if (matcher.matcheStubKey(key)) {
+ key = matcher.matcheStubKey(key);
+ if (key) {
+ this.currentSetKey.set(f, key);
+ }
+ }
+ values.set(key, returnInfo);
+ this.stubs.set(f, values);
+ }
+
+ getReturnInfo(f: any, params:any) {
+ let values = this.stubs.get(f);
+ if (!values) {
+ return undefined;
+ }
+ let retrunKet = params[0];
+ if (typeof retrunKet == "undefined") {
+ retrunKet = "anonymous-mock-" + f.propName;
+ }
+ let stubSetKey = this.currentSetKey.get(f);
+
+ if (stubSetKey && (typeof (retrunKet) != "undefined")) {
+ retrunKet = stubSetKey;
+ }
+ let matcher = new ArgumentMatchers();
+ if (matcher.matcheReturnKey(params[0], undefined, stubSetKey) && matcher.matcheReturnKey(params[0], undefined, stubSetKey) != stubSetKey) {
+ retrunKet = params[0];
+ }
+
+ values.forEach(function (value: any, key: any, map: any) {
+ if (ArgumentMatchers.isRegExp(key) && matcher.matcheReturnKey(params[0], key)) {
+ retrunKet = key;
+ }
+ });
+
+ return values.get(retrunKet);
+ }
+
+ findName(obj: any, value: any) {
+ let properties = this.findProperties(obj);
+ let name = '';
+ properties.filter((item:any) => (item !== 'caller' && item !== 'arguments')).forEach(
+ function (va1:any, idx:any, array:any) {
+ if (obj[va1] === value) {
+ name = va1;
+ }
+ }
+ );
+ return name;
+ }
+
+ isFunctionFromPrototype(f: Function, container:Function, propName: string) {
+ if (container.constructor != Object && container.constructor.prototype !== container) {
+ return container.constructor.prototype[propName] === f;
+ }
+ return false;
+ }
+
+ findProperties(obj: any, ...arg: Array) {
+ function getProperty(new_obj:any): Array {
+ if (new_obj.__proto__ === null) {
+ return [];
+ }
+ let properties = Object.getOwnPropertyNames(new_obj);
+ return [...properties, ...getProperty(new_obj.__proto__)];
+ }
+ return getProperty(obj);
+ }
+
+ recordMethodCall(originalMethod: any, args: any) {
+ originalMethod['getName'] = function () {
+ return this.name || this.toString().match(/function\s*([^(]*)\(/)[1];
+ }
+ let name = originalMethod.getName();
+ let arglistString = name + '(' + Array.from(args).toString() + ')';
+ let records = this.recordCalls.get(arglistString);
+ if (!records) {
+ records = 0;
+ }
+ records++;
+ this.recordCalls.set(arglistString, records);
+ }
+
+ mockFunc(originalObject:any, originalMethod:any) {
+ let tmp = this;
+ this.originalMethod = originalMethod;
+ const _this = this;
+ let f:any = function () {
+ let args = arguments;
+ let action = tmp.getReturnInfo(f, args);
+ if (originalMethod) {
+ tmp.recordMethodCall(originalMethod, args);
+ }
+ if (action) {
+ return action.apply(_this, args);
+ }
+ };
+
+ f.container = null || originalObject;
+ f.original = originalMethod || null;
+
+ if (originalObject && originalMethod) {
+ if (typeof (originalMethod) != 'function') throw new Error('Not a function');
+ var name = this.findName(originalObject, originalMethod);
+ originalObject[name] = f;
+ this.recordMockedMethod.set(name, originalMethod);
+ f.propName = name;
+ f.originalFromPrototype = this.isFunctionFromPrototype(f.original, originalObject, f.propName);
+ }
+ f.mocker = this;
+ this.mFunctions.push(f);
+ this.extend(f, new ExtendInterface(this));
+ return f;
+ }
+
+ verify(methodName:any, argsArray:any) {
+ if (!methodName) {
+ throw Error("not a function name");
+ }
+ let a = this.recordCalls.get(methodName + '(' + argsArray.toString() + ')');
+ return new VerificationMode(a ? a : 0);
+ }
+
+ mockObject(object: any) {
+ if (!object || typeof object === "string") {
+ throw Error(`this ${object} cannot be mocked`);
+ }
+ const _this = this;
+ let mockedObject:any = {};
+ let keys = Reflect.ownKeys(object);
+ keys.filter(key => (typeof Reflect.get(object, key)) === 'function')
+ .forEach((key:any) => {
+ mockedObject[key] = object[key];
+ mockedObject[key] = _this.mockFunc(mockedObject, mockedObject[key]);
+ });
+ return mockedObject;
+ }
+}
+
+function ifMockedFunction(f: any) {
+ if (Object.prototype.toString.call(f) != "[object Function]" &&
+ Object.prototype.toString.call(f) != "[object AsyncFunction]") {
+ throw Error("not a function");
+ }
+ if (!f.stub) {
+ throw Error("not a mock function");
+ }
+ return true;
+}
+
+function when(f: any) {
+ if (ifMockedFunction(f)) {
+ return f.stub.bind(f);
+ }
+}
+
+function MockSetup(target: Object, propertyName: string | Symbol, descriptor: TypedPropertyDescriptor<() => void>): void {
+ const aboutToAppearOrigin = target.aboutToAppear;
+ const setup = descriptor.value;
+ target.aboutToAppear = function (...args: any[]) {
+ if (target.__Param) { // copy attributes and params of the original context
+ try {
+ const map = target.__Param as Map;
+ for (const [key, val] of map) {
+ this[key] = val; // 'this' refers to context of current function
+ }
+ } catch (e) {
+ throw new Error(`Mock setup param error: ${e}`);
+ }
+ }
+
+ if (setup) { // apply the mock content
+ try {
+ setup.apply(this);
+ } catch (e) {
+ throw new Error(`Mock setup apply error: ${e}`);
+ }
+ }
+
+ if (aboutToAppearOrigin) { // append to aboutToAppear function of the original context
+ aboutToAppearOrigin.apply(this, args);
+ }
+ }
+}
+
+export {
+ MockSetup,
+ MockKit,
+ when
+};
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/@ohos/hamock/src/main/mock/VerificationMode.js b/MultipleImage/oh_modules/@ohos/hamock/src/main/mock/VerificationMode.js
new file mode 100644
index 0000000000000000000000000000000000000000..21e10fb8037f59475510b2821fcf7432c9459a4a
--- /dev/null
+++ b/MultipleImage/oh_modules/@ohos/hamock/src/main/mock/VerificationMode.js
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2022-2023 Huawei Device 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.
+ */
+class VerificationMode {
+ constructor(times) {
+ this.doTimes = times;
+ }
+ times(count) {
+ if (count !== this.doTimes) {
+ throw Error(`expect ${count} actual ${this.doTimes}`);
+ }
+ }
+ never() {
+ if (this.doTimes !== 0) {
+ throw Error(`expect 0 actual ${this.doTimes}`);
+ }
+ }
+ once() {
+ if (this.doTimes !== 1) {
+ throw Error(`expect 1 actual ${this.doTimes}`);
+ }
+ }
+ atLeast(count) {
+ if (count > this.doTimes) {
+ throw Error('failed ' + count + ' greater than the actual execution times of method');
+ }
+ }
+ atMost(count) {
+ if (count < this.doTimes) {
+ throw Error('failed ' + count + ' less than the actual execution times of method');
+ }
+ }
+}
+export default VerificationMode;
diff --git a/MultipleImage/oh_modules/@ohos/hamock/src/main/mock/VerificationMode.ts b/MultipleImage/oh_modules/@ohos/hamock/src/main/mock/VerificationMode.ts
new file mode 100644
index 0000000000000000000000000000000000000000..93d976ce73b2fbde199d31b3efd30eb3544179d8
--- /dev/null
+++ b/MultipleImage/oh_modules/@ohos/hamock/src/main/mock/VerificationMode.ts
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2022-2023 Huawei Device 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.
+ */
+
+
+class VerificationMode {
+
+ private doTimes: number
+
+ constructor(times: number) {
+ this.doTimes = times;
+ }
+
+ times(count: number) {
+ if(count !== this.doTimes) {
+ throw Error(`expect ${count} actual ${this.doTimes}`);
+ }
+ }
+
+ never() {
+ if (this.doTimes !== 0) {
+ throw Error(`expect 0 actual ${this.doTimes}`);
+ }
+ }
+
+ once() {
+ if (this.doTimes !== 1) {
+ throw Error(`expect 1 actual ${this.doTimes}`);
+ }
+ }
+
+ atLeast(count: number) {
+ if (count > this.doTimes) {
+ throw Error('failed ' + count + ' greater than the actual execution times of method');
+ }
+ }
+
+ atMost(count: number) {
+ if (count < this.doTimes) {
+ throw Error('failed ' + count + ' less than the actual execution times of method');
+ }
+ }
+}
+
+export default VerificationMode;
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/@ohos/hamock/src/main/module.json b/MultipleImage/oh_modules/@ohos/hamock/src/main/module.json
new file mode 100644
index 0000000000000000000000000000000000000000..384ae72f9bd2353fea8a5c9c5d6696ab5e67cb21
--- /dev/null
+++ b/MultipleImage/oh_modules/@ohos/hamock/src/main/module.json
@@ -0,0 +1,22 @@
+{
+ "app": {
+ "bundleName": "com.example.hamock",
+ "debug": true,
+ "versionCode": 1000000,
+ "versionName": "1.0.0",
+ "minAPIVersion": 9,
+ "targetAPIVersion": 9,
+ "apiReleaseType": "Release"
+ },
+ "module": {
+ "name": "hamock",
+ "type": "har",
+ "deviceTypes": [
+ "default",
+ "tablet",
+ "tv",
+ "wearable",
+ "car"
+ ]
+ }
+}
diff --git a/MultipleImage/oh_modules/@ohos/hamock/src/res/schemas/mock-config-json5-schema.json b/MultipleImage/oh_modules/@ohos/hamock/src/res/schemas/mock-config-json5-schema.json
new file mode 100644
index 0000000000000000000000000000000000000000..96036325a316d827cb9fcb6908b3de23c53b4b79
--- /dev/null
+++ b/MultipleImage/oh_modules/@ohos/hamock/src/res/schemas/mock-config-json5-schema.json
@@ -0,0 +1,25 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "title": "JSON schema for mock-config.json5 file",
+ "definitions": {
+ "sourceRedirection": {
+ "description": "A source redirection for mocked module.",
+ "type": "object",
+ "required": [
+ "source"
+ ],
+ "properties": {
+ "source": {
+ "type": "string",
+ "maxLength": 128,
+ "minLength": 1
+ }
+ }
+ }
+ },
+ "patternProperties": {
+ ".+": {
+ "$ref": "#/definitions/sourceRedirection"
+ }
+ }
+}
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/@ohos/hypium/BuildProfile.ets b/MultipleImage/oh_modules/@ohos/hypium/BuildProfile.ets
new file mode 100644
index 0000000000000000000000000000000000000000..e84ee338f70bbfe5512c648fc7cc88b019557243
--- /dev/null
+++ b/MultipleImage/oh_modules/@ohos/hypium/BuildProfile.ets
@@ -0,0 +1,5 @@
+export default class BuildProfile {
+ static readonly HAR_VERSION = '1.0.18';
+ static readonly BUILD_MODE_NAME = 'debug';
+ static readonly DEBUG = true;
+}
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/@ohos/hypium/CHANGELOG.md b/MultipleImage/oh_modules/@ohos/hypium/CHANGELOG.md
new file mode 100644
index 0000000000000000000000000000000000000000..b7e0113af1ceafe3ba8abc35ecf69aa9746088be
--- /dev/null
+++ b/MultipleImage/oh_modules/@ohos/hypium/CHANGELOG.md
@@ -0,0 +1,18 @@
+## 1.0.14
+- 堆栈信息打印到cmd
+## 1.0.15
+- 支持获取测试代码的失败堆栈信息
+- mock代码迁移至harmock包
+- 适配arkts语法
+- 修复覆盖率数据容易截断的bug
+## 1.0.16
+- 修改覆盖率文件生成功能
+- 修改静态方法无法ignoreMock函数
+- ## 1.0.17
+- 修改not断言失败提示日志
+- 自定义错误message信息
+- 添加xdescribe, xit API功能
+- ## 1.0.18
+- 添加全局变量存储API get set
+- 自定义断言功能
+
diff --git a/MultipleImage/oh_modules/@ohos/hypium/LICENSE b/MultipleImage/oh_modules/@ohos/hypium/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..4947287f7b5ccb5d1e8b7b2d3aa5d89f322c160d
--- /dev/null
+++ b/MultipleImage/oh_modules/@ohos/hypium/LICENSE
@@ -0,0 +1,177 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
\ No newline at end of file
diff --git a/MultipleImage/oh_modules/@ohos/hypium/README.md b/MultipleImage/oh_modules/@ohos/hypium/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..50cdf9dc5e11bba059f2147354273225bd3781b0
--- /dev/null
+++ b/MultipleImage/oh_modules/@ohos/hypium/README.md
@@ -0,0 +1,220 @@
+
Hypium
+
A unit test framework for OpenHarmonyOS application