未验证 提交 36952dc3 编写于 作者: O openharmony_ci 提交者: Gitee

!9109 回退 'Pull Request !9047 : 【gn 切hvigor】PART3_FA_storage'

Merge pull request !9109 from openharmony_ci/revert-merge-9047-master
# Copyright (C) 2023 Huawei Device Co., Ltd.
# Copyright (C) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
......@@ -10,13 +10,26 @@
# WITHOUT 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("//test/xts/tools/build/suite.gni")
ohos_js_app_suite("storagefileioerror_js_test") {
test_hap = true
testonly = true
ohos_js_hap_suite("storagefileioerror_js_test") {
hap_profile = "./src/main/config.json"
deps = [
":storagefileioerror_js_assets",
":storagefileioerror_js_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsStorageFileIoErrorJsTest"
subsystem_name = "filemanagement"
part_name = "file_api"
certificate_profile = "./signature/openharmony_sx.p7b"
}
ohos_js_assets("storagefileioerror_js_assets") {
js2abc = true
hap_profile = "./src/main/config.json"
source_dir = "./src/main/js"
}
ohos_resources("storagefileioerror_js_resources") {
sources = [ "./src/main/resources" ]
hap_profile = "./src/main/config.json"
}
......@@ -5,7 +5,7 @@
"test-timeout": "60000",
"shell-timeout": "60000",
"bundle-name": "ohos.acts.storage.fileioerror",
"package-name": "ohos.acts.storage.fileioerror_test"
"package-name": "ohos.acts.storage.fileioerror"
},
"kits": [
{
......
/**
* 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.
*/
{
"app": {
"signingConfigs": [
],
"compileSdkVersion": 10,
"compatibleSdkVersion": 10,
"products": [
{
"name": "default",
"signingConfig": "default"
}
]
},
"modules": [
{
"name": "entry",
"srcPath": "./entry",
"targets": [
{
"name": "default",
"applyToProducts": [
"default"
]
}
]
}
]
}
\ No newline at end of file
/**
* 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": 'faMode',
"buildOption": {
},
"targets": [
{
"name": "default",
},
{
"name": "ohosTest",
}
]
}
\ No newline at end of file
/**
* 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 { legacyHapTasks } from '@ohos/hvigor-ohos-plugin';
/**
* 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.
*/
{
"license": "",
"devDependencies": {},
"author": "",
"name": "entry",
"description": "Please describe the basic information.",
"main": "",
"version": "1.0.0",
"dependencies": {}
}
{
"app":{
"bundleName":"ohos.acts.storage.fileioerror",
"vendor":"example",
"version":{
"code":1000000,
"name":"1.0.0"
}
},
"deviceConfig":{
},
"module":{
"package":"ohos.acts.storage.fileioerror",
"name":".entry",
"mainAbility":".MainAbility",
"deviceType": [
"tablet",
"default"
],
"distro":{
"deliveryWithInstall":true,
"installationFree":true,
"moduleName":"entry",
"moduleType":"entry"
},
"abilities":[
{
"description":"$string:MainAbility_desc",
"formsEnabled":false,
"icon":"$media:icon",
"label":"$string:MainAbility_label",
"launchType":"standard",
"name":".MainAbility",
"orientation":"unspecified",
"skills":[
{
"actions":[
"action.system.home"
],
"entities":[
"entity.system.home"
]
}
],
"srcLanguage":"js",
"srcPath":"MainAbility",
"type":"page",
"visible":true
}
],
"js":[
{
"name":".MainAbility",
"pages":[
"pages/index/index"
],
"window":{
"autoDesignWidth":false,
"designWidth":720
}
}
]
}
}
\ No newline at end of file
/*
* 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.
*/
.container {
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
}
.title {
font-size: 40px;
color: #000000;
opacity: 0.9;
}
@media screen and (device-type: tablet) and (orientation: landscape) {
.title {
font-size: 100px;
}
}
@media screen and (device-type: wearable) {
.title {
font-size: 28px;
color: #FFFFFF;
}
}
@media screen and (device-type: tv) {
.container {
background-image: url("/common/images/Wallpaper.png");
background-size: cover;
background-repeat: no-repeat;
background-position: center;
}
.title {
font-size: 100px;
color: #FFFFFF;
}
}
@media screen and (device-type: phone) and (orientation: landscape) {
.title {
font-size: 60px;
}
}
/*
* 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.
*/
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
{
"app":{
"bundleName":"ohos.acts.storage.fileioerror",
"vendor":"example",
"version":{
"code":1000000,
"name":"1.0.0"
}
},
"deviceConfig":{
},
"module":{
"package":"ohos.acts.storage.fileioerror_test",
"name":".entry_test",
"mainAbility":".TestAbility",
"deviceType": [
"tablet",
"default"
],
"testRunner":{
"name":"OpenHarmonyTestRunner",
"srcPath":"TestRunner"
},
"distro":{
"deliveryWithInstall":true,
"installationFree":true,
"moduleName":"entry_test",
"moduleType":"feature"
},
"abilities":[
{
"description":"$string:TestAbility_desc",
"formsEnabled":false,
"icon":"$media:icon",
"label":"$string:TestAbility_label",
"launchType":"standard",
"name":".TestAbility",
"orientation":"unspecified",
"skills":[
{
"actions":[
"action.system.home"
],
"entities":[
"entity.system.home"
]
}
],
"srcLanguage":"js",
"srcPath":"TestAbility",
"type":"page",
"visible":true
}
],
"js":[
{
"name":".TestAbility",
"pages":[
"pages/index/index"
],
"window":{
"autoDesignWidth":false,
"designWidth":720
}
}
]
}
}
\ No newline at end of file
{
"string": [
{
"name": "app_name",
"value": "storagefileioerrorjstest"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "TestAbility_desc",
"value": "description"
},
{
"name": "TestAbility_label",
"value": "label"
}
]
}
\ No newline at end of file
/**
* 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.
*/
{
"hvigorVersion": "2.0.0",
"dependencies": {
"@ohos/hvigor-ohos-plugin": "2.0.0"
}
}
/**
* 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 { legacyAppTasks } from '@ohos/hvigor-ohos-plugin';
\ No newline at end of file
# 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.
#!/bin/bash
# ----------------------------------------------------------------------------
# Hvigor startup script, version 1.0.0
#
# Required ENV vars:
# ------------------
# NODE_HOME - location of a Node home dir
# or
# Add /usr/local/nodejs/bin to the PATH environment variable
# ----------------------------------------------------------------------------
HVIGOR_APP_HOME=$(dirname $(readlink -f $0))
HVIGOR_WRAPPER_SCRIPT=${HVIGOR_APP_HOME}/hvigor/hvigor-wrapper.js
warn() {
echo ""
echo -e "\033[1;33m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m"
}
error() {
echo ""
echo -e "\033[1;31m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m"
}
fail() {
error "$@"
exit 1
}
# Determine node to start hvigor wrapper script
if [ -n "${NODE_HOME}" ];then
EXECUTABLE_NODE="${NODE_HOME}/bin/node"
if [ ! -x "$EXECUTABLE_NODE" ];then
fail "ERROR: NODE_HOME is set to an invalid directory,check $NODE_HOME\n\nPlease set NODE_HOME in your environment to the location where your nodejs installed"
fi
else
EXECUTABLE_NODE="node"
which ${EXECUTABLE_NODE} > /dev/null 2>&1 || fail "ERROR: NODE_HOME is not set and not 'node' command found in your path"
fi
# Check hvigor wrapper script
if [ ! -r "$HVIGOR_WRAPPER_SCRIPT" ];then
fail "ERROR: Couldn't find hvigor/hvigor-wrapper.js in ${HVIGOR_APP_HOME}"
fi
# start hvigor-wrapper script
exec "${EXECUTABLE_NODE}" \
"${HVIGOR_WRAPPER_SCRIPT}" "$@"
@rem Copyright (C) 2023 Huawei Device Co., Ltd.
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem http://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Hvigor startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
set WRAPPER_MODULE_PATH=%APP_HOME%\hvigor\hvigor-wrapper.js
set NODE_EXE=node.exe
goto start
:start
@rem Find node.exe
if defined NODE_HOME goto findNodeFromNodeHome
%NODE_EXE% --version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH.
echo.
echo Please set the NODE_HOME variable in your environment to match the
echo location of your NodeJs installation.
goto fail
:findNodeFromNodeHome
set NODE_HOME=%NODE_HOME:"=%
set NODE_EXE_PATH=%NODE_HOME%/%NODE_EXE%
if exist "%NODE_EXE_PATH%" goto execute
echo.
echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH.
echo.
echo Please set the NODE_HOME variable in your environment to match the
echo location of your NodeJs installation.
goto fail
:execute
@rem Execute hvigor
"%NODE_EXE%" %WRAPPER_MODULE_PATH% %*
:fail
exit /b 1
/**
* 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.
*/
{
"license": "",
"devDependencies": {
"@ohos/hypium": "1.0.6"
},
"author": "",
"name": "myapplication454434",
"description": "Please describe the basic information.",
"main": "",
"version": "1.0.0",
"dependencies": {}
}
{
"app": {
"bundleName": "ohos.acts.storage.fileioerror",
"vendor": "example",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 4,
"target": 5
}
},
"deviceConfig": {},
"module": {
"package": "ohos.acts.storage.fileioerror",
"name": ".entry",
"deviceType": [
"tablet",
"default",
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": true
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"orientation": "unspecified",
"formsEnabled": false,
"name": ".MainAbility",
"srcLanguage": "js",
"srcPath": "MainAbility",
"icon": "$media:icon",
"description": "$string:MainAbility_desc",
"label": "$string:MainAbility_label",
"type": "page",
"visible": true,
"launchType": "standard"
},
{
"orientation": "unspecified",
"formsEnabled": false,
"name": ".TestAbility",
"srcLanguage": "js",
"srcPath": "TestAbility",
"icon": "$media:icon",
"description": "$string:TestAbility_desc",
"label": "$string:TestAbility_label",
"type": "page",
"visible": true,
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
},
{
"pages": [
"pages/index/index"
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
],
"testRunner": {
"name": "OpenHarmonyTestRunner",
"srcPath": "TestRunner"
},
"mainAbility": ".MainAbility",
"srcPath": ""
}
}
\ No newline at end of file
/**
* 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 default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
}
}
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT 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 default {
onCreate() {
console.info('ohos.acts.distributeddatamgr.distributedfile onCreate');
},
onDestroy() {
console.info('ohos.acts.distributeddatamgr.distributedfile onCreate');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
{
"strings": {
"hello": "Hello",
"world": "Test"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
{
"strings": {
"hello": "您好",
"world": "测试"
}
}
\ No newline at end of file
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
/**
* Copyright (c) 2023 Huawei Device Co., Ltd.
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
......@@ -12,15 +12,23 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import hilog from '@ohos.hilog';
export default {
onCreate() {
hilog.info(0x0000, 'testTag', '%{public}s', 'Application onCreate');
},
onDestroy() {
hilog.info(0x0000, 'testTag', '%{public}s', 'Application onDestroy');
},
}
import app from '@system.app'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: ''
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
},
onReady() {
},
}
\ No newline at end of file
/**
* Copyright (c) 2023 Huawei Device Co., Ltd.
/*
* 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
......@@ -12,22 +12,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import hilog from '@ohos.hilog';
import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
import { Hypium } from '@ohos/hypium';
import testsuite from '../test/List.test';
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
export default {
onCreate() {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestApplication onCreate');
console.info('TestApplication onCreate')
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!');
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
},
onDestroy() {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestApplication onDestroy');
console.info("TestApplication onDestroy");
}
};
/**
* Copyright (c) 2023 Huawei Device Co., Ltd.
/*
* 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
......
/**
* 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 hilog from '@ohos.hilog';
import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
export default {
onPrepare() {
hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare');
},
onRun() {
hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run');
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility'
var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
var debug = abilityDelegatorArguments.parameters["-D"]
if (debug == 'true')
{
cmd += ' -D'
}
hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd);
abilityDelegator.executeShellCommand(cmd, (err, data) => {
hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? '');
hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', data.stdResult ?? '');
hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', data.exitCode ?? '');
})
}
};
\ No newline at end of file
/*
* 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
function translateParamsToString(parameters) {
const keySet = new Set([
'-s class', '-s notClass', '-s suite', '-s itName',
'-s level', '-s testType', '-s size', '-s timeout',
'-s package', '-s dryRun'
])
let targetParams = '';
for (const key in parameters) {
if (keySet.has(key)) {
targetParams += ' ' + key + ' ' + parameters[key]
}
}
return targetParams.trim()
}
export default {
onPrepare() {
console.info('OpenHarmonyTestRunner OnPrepare')
},
onRun() {
console.log('OpenHarmonyTestRunner onRun run')
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility'
var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters)
var debug = abilityDelegatorArguments.parameters["-D"]
console.info('debug value : '+debug)
if (debug == 'true')
{
cmd += ' -D'
}
console.info('cmd : '+cmd)
abilityDelegator.executeShellCommand(cmd, (err, data) => {
console.info('executeShellCommand : err : ' + JSON.stringify(err));
console.info('executeShellCommand : data : ' + data.stdResult);
console.info('executeShellCommand : data : ' + data.exitCode);
})
}
};
/**
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
......
/**
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
......
/**
* Copyright (c) 2023 Huawei Device Co., Ltd.
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
......
# Copyright (C) 2023 Huawei Device Co., Ltd.
# Copyright (C) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
......@@ -13,11 +13,23 @@
import("//test/xts/tools/build/suite.gni")
ohos_js_app_suite("storagefileio_js_test") {
test_hap = true
testonly = true
ohos_js_hap_suite("storagefileio_js_test") {
hap_profile = "./src/main/config.json"
deps = [
":storagefileio_js_assets",
":storagefileio_js_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsStorageFileIoJSTest"
subsystem_name = "filemanagement"
part_name = "file_api"
certificate_profile = "./signature/openharmony_sx.p7b"
}
ohos_js_assets("storagefileio_js_assets") {
js2abc = true
hap_profile = "./src/main/config.json"
source_dir = "./src/main/js"
}
ohos_resources("storagefileio_js_resources") {
sources = [ "./src/main/resources" ]
hap_profile = "./src/main/config.json"
}
{
"description": "Configuration for storage fileio Tests",
"driver": {
"type": "OHJSUnitTest",
"test-timeout": "600000",
"shell-timeout": "600000",
"bundle-name": "ohos.acts.storage.fileio",
"package-name": "ohos.acts.storage.fileio_test"
},
"kits": [
{
"test-file-name": ["ActsStorageFileIoJSTest.hap"],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
{
"description": "Configuration for storage fileio Tests",
"driver": {
"type": "OHJSUnitTest",
"test-timeout": "600000",
"shell-timeout": "600000",
"bundle-name": "ohos.acts.storage.fileio",
"package-name": "ohos.acts.storage.fileio"
},
"kits": [
{
"test-file-name": ["ActsStorageFileIoJSTest.hap"],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
\ No newline at end of file
/**
* 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.
*/
{
"app": {
"signingConfigs": [
],
"compileSdkVersion": 10,
"compatibleSdkVersion": 10,
"products": [
{
"name": "default",
"signingConfig": "default"
}
]
},
"modules": [
{
"name": "entry",
"srcPath": "./entry",
"targets": [
{
"name": "default",
"applyToProducts": [
"default"
]
}
]
}
]
}
\ No newline at end of file
/**
* 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": 'faMode',
"buildOption": {
},
"targets": [
{
"name": "default",
},
{
"name": "ohosTest",
}
]
}
\ No newline at end of file
/**
* 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 { legacyHapTasks } from '@ohos/hvigor-ohos-plugin';
/**
* 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.
*/
{
"license": "",
"devDependencies": {},
"author": "",
"name": "entry",
"description": "Please describe the basic information.",
"main": "",
"version": "1.0.0",
"dependencies": {}
}
{
"app":{
"bundleName":"ohos.acts.storage.fileio",
"vendor":"example",
"version":{
"code":1000000,
"name":"1.0.0"
}
},
"deviceConfig":{
},
"module":{
"package":"ohos.acts.storage.fileio",
"name":".entry",
"mainAbility":".MainAbility",
"deviceType": [
"tablet",
"default"
],
"distro":{
"deliveryWithInstall":true,
"installationFree":true,
"moduleName":"entry",
"moduleType":"entry"
},
"abilities":[
{
"description":"$string:MainAbility_desc",
"formsEnabled":false,
"icon":"$media:icon",
"label":"$string:MainAbility_label",
"launchType":"standard",
"name":".MainAbility",
"orientation":"unspecified",
"skills":[
{
"actions":[
"action.system.home"
],
"entities":[
"entity.system.home"
]
}
],
"srcLanguage":"js",
"srcPath":"MainAbility",
"type":"page",
"visible":true
}
],
"js":[
{
"name":".MainAbility",
"pages":[
"pages/index/index"
],
"window":{
"autoDesignWidth":false,
"designWidth":720
}
}
]
}
}
\ No newline at end of file
/*
* 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.
*/
.container {
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
}
.title {
font-size: 40px;
color: #000000;
opacity: 0.9;
}
@media screen and (device-type: tablet) and (orientation: landscape) {
.title {
font-size: 100px;
}
}
@media screen and (device-type: wearable) {
.title {
font-size: 28px;
color: #FFFFFF;
}
}
@media screen and (device-type: tv) {
.container {
background-image: url("/common/images/Wallpaper.png");
background-size: cover;
background-repeat: no-repeat;
background-position: center;
}
.title {
font-size: 100px;
color: #FFFFFF;
}
}
@media screen and (device-type: phone) and (orientation: landscape) {
.title {
font-size: 60px;
}
}
/*
* 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.
*/
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
{
"app":{
"bundleName":"ohos.acts.storage.fileio",
"vendor":"example",
"version":{
"code":1000000,
"name":"1.0.0"
}
},
"deviceConfig":{
},
"module":{
"package":"ohos.acts.storage.fileio_test",
"name":".entry_test",
"mainAbility":".TestAbility",
"deviceType": [
"tablet",
"default"
],
"testRunner":{
"name":"OpenHarmonyTestRunner",
"srcPath":"TestRunner"
},
"distro":{
"deliveryWithInstall":true,
"installationFree":true,
"moduleName":"entry_test",
"moduleType":"feature"
},
"abilities":[
{
"description":"$string:TestAbility_desc",
"formsEnabled":false,
"icon":"$media:icon",
"label":"$string:TestAbility_label",
"launchType":"standard",
"name":".TestAbility",
"orientation":"unspecified",
"skills":[
{
"actions":[
"action.system.home"
],
"entities":[
"entity.system.home"
]
}
],
"srcLanguage":"js",
"srcPath":"TestAbility",
"type":"page",
"visible":true
}
],
"js":[
{
"name":".TestAbility",
"pages":[
"pages/index/index"
],
"window":{
"autoDesignWidth":false,
"designWidth":720
}
}
]
}
}
\ No newline at end of file
{
"string": [
{
"name": "app_name",
"value": "storagefileiojstest"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "TestAbility_desc",
"value": "description"
},
{
"name": "TestAbility_label",
"value": "label"
}
]
}
/**
* 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.
*/
{
"hvigorVersion": "2.0.0",
"dependencies": {
"@ohos/hvigor-ohos-plugin": "2.0.0"
}
}
/**
* 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 { legacyAppTasks } from '@ohos/hvigor-ohos-plugin';
\ No newline at end of file
# 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.
#!/bin/bash
# ----------------------------------------------------------------------------
# Hvigor startup script, version 1.0.0
#
# Required ENV vars:
# ------------------
# NODE_HOME - location of a Node home dir
# or
# Add /usr/local/nodejs/bin to the PATH environment variable
# ----------------------------------------------------------------------------
HVIGOR_APP_HOME=$(dirname $(readlink -f $0))
HVIGOR_WRAPPER_SCRIPT=${HVIGOR_APP_HOME}/hvigor/hvigor-wrapper.js
warn() {
echo ""
echo -e "\033[1;33m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m"
}
error() {
echo ""
echo -e "\033[1;31m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m"
}
fail() {
error "$@"
exit 1
}
# Determine node to start hvigor wrapper script
if [ -n "${NODE_HOME}" ];then
EXECUTABLE_NODE="${NODE_HOME}/bin/node"
if [ ! -x "$EXECUTABLE_NODE" ];then
fail "ERROR: NODE_HOME is set to an invalid directory,check $NODE_HOME\n\nPlease set NODE_HOME in your environment to the location where your nodejs installed"
fi
else
EXECUTABLE_NODE="node"
which ${EXECUTABLE_NODE} > /dev/null 2>&1 || fail "ERROR: NODE_HOME is not set and not 'node' command found in your path"
fi
# Check hvigor wrapper script
if [ ! -r "$HVIGOR_WRAPPER_SCRIPT" ];then
fail "ERROR: Couldn't find hvigor/hvigor-wrapper.js in ${HVIGOR_APP_HOME}"
fi
# start hvigor-wrapper script
exec "${EXECUTABLE_NODE}" \
"${HVIGOR_WRAPPER_SCRIPT}" "$@"
@rem Copyright (C) 2023 Huawei Device Co., Ltd.
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem http://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Hvigor startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
set WRAPPER_MODULE_PATH=%APP_HOME%\hvigor\hvigor-wrapper.js
set NODE_EXE=node.exe
goto start
:start
@rem Find node.exe
if defined NODE_HOME goto findNodeFromNodeHome
%NODE_EXE% --version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH.
echo.
echo Please set the NODE_HOME variable in your environment to match the
echo location of your NodeJs installation.
goto fail
:findNodeFromNodeHome
set NODE_HOME=%NODE_HOME:"=%
set NODE_EXE_PATH=%NODE_HOME%/%NODE_EXE%
if exist "%NODE_EXE_PATH%" goto execute
echo.
echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH.
echo.
echo Please set the NODE_HOME variable in your environment to match the
echo location of your NodeJs installation.
goto fail
:execute
@rem Execute hvigor
"%NODE_EXE%" %WRAPPER_MODULE_PATH% %*
:fail
exit /b 1
/**
* 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.
*/
{
"license": "",
"devDependencies": {
"@ohos/hypium": "1.0.6"
},
"author": "",
"name": "myapplication454434",
"description": "Please describe the basic information.",
"main": "",
"version": "1.0.0",
"dependencies": {}
}
{
"app": {
"bundleName": "ohos.acts.storage.fileio",
"vendor": "example",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 4,
"target": 5
}
},
"deviceConfig": {},
"module": {
"package": "ohos.acts.storage.fileio",
"name": ".entry",
"deviceType": [
"tablet",
"default",
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": true
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"orientation": "unspecified",
"formsEnabled": false,
"name": ".MainAbility",
"srcLanguage": "js",
"srcPath": "MainAbility",
"icon": "$media:icon",
"description": "$string:MainAbility_desc",
"label": "$string:MainAbility_label",
"type": "page",
"visible": true,
"launchType": "standard"
},
{
"orientation": "unspecified",
"formsEnabled": false,
"name": ".TestAbility",
"srcLanguage": "js",
"srcPath": "TestAbility",
"icon": "$media:icon",
"description": "$string:TestAbility_desc",
"label": "$string:TestAbility_label",
"type": "page",
"visible": true,
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
},
{
"pages": [
"pages/index/index"
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
],
"testRunner": {
"name": "OpenHarmonyTestRunner",
"srcPath": "TestRunner"
},
"mainAbility": ".MainAbility",
"srcPath": ""
}
}
\ No newline at end of file
/**
* 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 default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
}
}
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT 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 default {
onCreate() {
console.info('ohos.acts.storage.fileio onCreate');
},
onDestroy() {
console.info('ohos.acts.storage.fileio onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
{
"strings": {
"hello": "Hello",
"world": "Test"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
{
"strings": {
"hello": "您好",
"world": "测试"
}
}
\ No newline at end of file
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/**
* 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 hilog from '@ohos.hilog';
export default {
onCreate() {
hilog.info(0x0000, 'testTag', '%{public}s', 'Application onCreate');
},
onDestroy() {
hilog.info(0x0000, 'testTag', '%{public}s', 'Application onDestroy');
},
}
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT 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 app from '@system.app'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: ''
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
},
onReady() {
},
}
\ No newline at end of file
/**
* 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 hilog from '@ohos.hilog';
import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
import { Hypium } from '@ohos/hypium';
import testsuite from '../test/List.test';
export default {
onCreate() {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestApplication onCreate');
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!');
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
},
onDestroy() {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestApplication onDestroy');
}
};
/*
* 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
export default {
onCreate() {
console.info('TestApplication onCreate')
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
},
onDestroy() {
console.info("TestApplication onDestroy");
}
};
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
@media screen and (device-type: phone) and (orientation: landscape) {
.title {
font-size: 60px;
}
}
@media screen and (device-type: tablet) and (orientation: landscape) {
.title {
font-size: 100px;
}
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
@media screen and (device-type: phone) and (orientation: landscape) {
.title {
font-size: 60px;
}
}
@media screen and (device-type: tablet) and (orientation: landscape) {
.title {
font-size: 100px;
}
}
\ No newline at end of file
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/**
* Copyright (c) 2023 Huawei Device Co., Ltd.
/*
* 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
......@@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
data: {
title: ""
......
/**
* 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 hilog from '@ohos.hilog';
import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
export default {
onPrepare() {
hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare');
},
onRun() {
hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run');
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility'
var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
var debug = abilityDelegatorArguments.parameters["-D"]
if (debug == 'true')
{
cmd += ' -D'
}
hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd);
abilityDelegator.executeShellCommand(cmd, (err, data) => {
hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? '');
hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', data.stdResult ?? '');
hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', data.exitCode ?? '');
})
}
};
/*
* 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
function translateParamsToString(parameters) {
const keySet = new Set([
'-s class', '-s notClass', '-s suite', '-s itName',
'-s level', '-s testType', '-s size', '-s timeout',
'-s package', '-s dryRun'
])
let targetParams = '';
for (const key in parameters) {
if (keySet.has(key)) {
targetParams += ' ' + key + ' ' + parameters[key]
}
}
return targetParams.trim()
}
export default {
onPrepare() {
console.info('OpenHarmonyTestRunner OnPrepare')
},
onRun() {
console.log('OpenHarmonyTestRunner onRun run')
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility'
var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters)
var debug = abilityDelegatorArguments.parameters["-D"]
console.info('debug value : '+debug)
if (debug == 'true')
{
cmd += ' -D'
}
console.info('cmd : '+cmd)
abilityDelegator.executeShellCommand(cmd, (err, data) => {
console.info('executeShellCommand : err : ' + JSON.stringify(err));
console.info('executeShellCommand : data : ' + data.stdResult);
console.info('executeShellCommand : data : ' + data.exitCode);
})
}
};
/*
* 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 fileio from '@ohos.fileio';
import fileIO from '@ohos.file.fs';
import featureAbility from '@ohos.ability.featureAbility';
export const FILE_CONTENT = 'hello world';
import {
describe, it, expect
}
from '@ohos/hypium'
export function prepareFile(fpath, content) {
try {
let fd = fileio.openSync(fpath, 0o102, 0o666)
fileio.ftruncateSync(fd)
fileio.writeSync(fd, content)
fileio.fsyncSync(fd)
fileio.closeSync(fd)
return true
}
catch (e) {
console.log('Failed to prepareFile for ' + e)
return false
}
}
export function prepareEmptyFile(fpath) {
try {
let fd = fileio.openSync(fpath, 0o102, 0o777)
fileio.closeSync(fd)
return true
}
catch (e) {
console.log('Failed to prepareFile for ' + e)
return false
}
}
export function fileToReadOnly(fpath) {
try {
let fd = fileio.openSync(fpath, 0o1)
fileio.fchmodSync(fd, 0o444)
fileio.fsyncSync(fd)
fileio.closeSync(fd)
return true
}
catch (e) {
console.log('Failed to fileToReadOnly for ' + e);
return false
}
}
export function fileToWriteOnly(fpath) {
try {
let fd = fileio.openSync(fpath, 0o2)
fileio.fchmodSync(fd, 0o222)
fileio.fsyncSync(fd)
fileio.closeSync(fd)
return true
}
catch (e) {
console.log('Failed to fileToWriteOnly ' + e)
return false
}
}
export async function nextFileName(testName) {
let context = featureAbility.getContext();
let data = await context.getCacheDir();
let BASE_PATH = data + '/';
return BASE_PATH + testName + '_' + randomString(testName.length);
}
export async function fileName(testName) {
let context = featureAbility.getContext();
let data = await context.getFilesDir();
let BASE_PATH = data + '/';
return BASE_PATH + testName + '_' + randomString(testName.length);
}
export function randomString(num) {
let len= num;
var $chars = 'aaaabbbbcccc';
var maxPos = $chars.length;
var pwd = '';
for (var i = 0; i < len; i++) {
pwd += $chars.charAt(Math.floor(Math.random() * maxPos));
}
return pwd;
}
export function forceRemoveDir(path, num) {
for (let i = num; i >= 0; i--) {
if (i < num) {
path = path.replace(`/d${i}`, "");
}
fileio.rmdirSync(path);
}
}
function isIntNum(val) {
return typeof val === 'number' && val % 1 === 0;
}
function isBigInt(val) {
return typeof val === 'bigint';
}
function isString(str) {
return (typeof str == 'string') && str.constructor == String;
}
function isBoolean(val) {
return typeof val == 'boolean';
}
function isInclude(error, message) {
return error.toString().indexOf(message) != -1;
}
export {
fileio,
fileIO,
isIntNum,
isBigInt,
isString,
isBoolean,
isInclude,
describe,
it,
expect
/*
* 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 fileio from '@ohos.fileio';
import fileIO from '@ohos.file.fs';
import featureAbility from '@ohos.ability.featureAbility';
export const FILE_CONTENT = 'hello world';
import {
describe, it, expect
}
from '@ohos/hypium'
export function prepareFile(fpath, content) {
try {
let fd = fileio.openSync(fpath, 0o102, 0o666)
fileio.ftruncateSync(fd)
fileio.writeSync(fd, content)
fileio.fsyncSync(fd)
fileio.closeSync(fd)
return true
}
catch (e) {
console.log('Failed to prepareFile for ' + e)
return false
}
}
export function prepareEmptyFile(fpath) {
try {
let fd = fileio.openSync(fpath, 0o102, 0o777)
fileio.closeSync(fd)
return true
}
catch (e) {
console.log('Failed to prepareFile for ' + e)
return false
}
}
export function fileToReadOnly(fpath) {
try {
let fd = fileio.openSync(fpath, 0o1)
fileio.fchmodSync(fd, 0o444)
fileio.fsyncSync(fd)
fileio.closeSync(fd)
return true
}
catch (e) {
console.log('Failed to fileToReadOnly for ' + e);
return false
}
}
export function fileToWriteOnly(fpath) {
try {
let fd = fileio.openSync(fpath, 0o2)
fileio.fchmodSync(fd, 0o222)
fileio.fsyncSync(fd)
fileio.closeSync(fd)
return true
}
catch (e) {
console.log('Failed to fileToWriteOnly ' + e)
return false
}
}
export async function nextFileName(testName) {
let context = featureAbility.getContext();
let data = await context.getCacheDir();
let BASE_PATH = data + '/';
return BASE_PATH + testName + '_' + randomString(testName.length);
}
export async function fileName(testName) {
let context = featureAbility.getContext();
let data = await context.getFilesDir();
let BASE_PATH = data + '/';
return BASE_PATH + testName + '_' + randomString(testName.length);
}
export function randomString(num) {
let len= num;
var $chars = 'aaaabbbbcccc';
var maxPos = $chars.length;
var pwd = '';
for (var i = 0; i < len; i++) {
pwd += $chars.charAt(Math.floor(Math.random() * maxPos));
}
return pwd;
}
export function forceRemoveDir(path, num) {
for (let i = num; i >= 0; i--) {
if (i < num) {
path = path.replace(`/d${i}`, "");
}
fileio.rmdirSync(path);
}
}
function isIntNum(val) {
return typeof val === 'number' && val % 1 === 0;
}
function isBigInt(val) {
return typeof val === 'bigint';
}
function isString(str) {
return (typeof str == 'string') && str.constructor == String;
}
function isBoolean(val) {
return typeof val == 'boolean';
}
function isInclude(error, message) {
return error.toString().indexOf(message) != -1;
}
export {
fileio,
fileIO,
isIntNum,
isBigInt,
isString,
isBoolean,
isInclude,
describe,
it,
expect
};
\ No newline at end of file
/*
* 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 fileIOTest from './FileIO.test.js'
import fileIOTestDir from './FileIODir.test.js'
import fileIOTestDirent from './FileIODirent.test.js'
import fileIOTestStat from './FileIOStat.test.js'
import fileIOTestStream from './FileIOStream.test.js'
import fileioDirClose from './module_fileio/class_dir/close.test.js'
import fileioDirListfile from './module_fileio/class_dir/listfile.test.js'
import fileioDirRead from './module_fileio/class_dir/read.test.js'
import fileioDirent from './module_fileio/class_dirent/all.test.js'
import fileioStream from './module_fileio/class_stream/all.test.js'
import fileioRandomAccessFileClose from './module_fileio/class_randomAccessFile/close.test.js'
import fileioRandomAccessFileRead from './module_fileio/class_randomAccessFile/read.test.js'
import fileioRandomAccessFileSetFilePointer from './module_fileio/class_randomAccessFile/setFilePointer.test.js'
import fileioRandomAccessFileWrite from './module_fileio/class_randomAccessFile/write.test.js'
import fileioStreamClose from './module_fileio/class_stream/close.test.js'
import fileioStreamFlush from './module_fileio/class_stream/flush.test.js'
import fileioStreamRead from './module_fileio/class_stream/read.test.js'
import fileioStreamWrite from './module_fileio/class_stream/write.test.js'
import fileioCreateWatcher from './module_fileio/class_watcher/createWatcher.test.js'
import fileioAccess from './module_fileio/members/access.test.js'
import fileioChmod from './module_fileio/members/chmod.test.js'
import fileioChown from './module_fileio/members/chown.test.js'
import fileioClose from './module_fileio/members/close.test.js'
import fileioCopyfile from './module_fileio/members/copyFile.test.js'
import fileioCreateRandomAccessFile from './module_fileio/members/createRandomAccessFile.test.js'
import fileioCreateStream from './module_fileio/members/createStream.test.js'
import fileioFchmod from './module_fileio/members/fchmod.test.js'
import fileioFchown from './module_fileio/members/fchown.test.js'
import fileioFdatasync from './module_fileio/members/fdatasync.test.js'
import fileioFdOpenStream from './module_fileio/members/fdopenStream.test.js'
import fileioFstat from './module_fileio/members/fstat.test.js'
import fileioFsync from './module_fileio/members/fsync.test.js'
import fileioFtruncate from './module_fileio/members/ftruncate.test.js'
import fileioHash from './module_fileio/members/hash.test.js'
import fileioLchown from './module_fileio/members/lchown.test.js'
import fileioLseek from './module_fileio/members/lseek.test.js'
import fileioLstat from './module_fileio/members/lstat.test.js'
import fileioMkdirRmdir from './module_fileio/members/mkdir_rmdir.test.js'
import fileioMkdtemp from './module_fileio/members/mkdtemp.test.js'
import fileioOpen from './module_fileio/members/open.test.js'
import fileioOpendirClose from './module_fileio/members/opendir_close.test.js'
import fileioOpenClose from './module_fileio/members/open_close.test.js'
import fileioPosixFallocate from './module_fileio/members/posix_fallocate.test.js'
import fileioRead from './module_fileio/members/read.test.js'
import fileioReadtext from './module_fileio/members/readtext.test.js'
import fileioRename from './module_fileio/members/rename.test.js'
import fileioRmdir from './module_fileio/members/rmdir.test.js'
import fileioStat from './module_fileio/members/stat.test.js'
import fileioSymlink from './module_fileio/members/symlink.test.js'
import fileioTruncate from './module_fileio/members/truncate.test.js'
import fileioUnlink from './module_fileio/members/unlink.test.js'
import fileioWrite from './module_fileio/members/write.test.js'
export default function testsuite() {
fileIOTest()
fileIOTestDir()
fileIOTestDirent()
fileIOTestStat()
fileIOTestStream()
fileioDirClose()
fileioDirListfile()
fileioDirRead()
fileioDirent()
fileioStream()
fileioRandomAccessFileClose()
fileioRandomAccessFileRead()
fileioRandomAccessFileSetFilePointer()
fileioRandomAccessFileWrite()
fileioStreamClose()
fileioStreamFlush()
fileioStreamRead()
fileioStreamWrite()
fileioCreateWatcher()
fileioAccess()
fileioChmod()
fileioChown()
fileioClose()
fileioCopyfile()
fileioCreateRandomAccessFile()
fileioCreateStream()
fileioFchmod()
fileioFchown()
fileioFdatasync()
fileioFdOpenStream()
fileioFstat()
fileioFsync()
fileioFtruncate()
fileioHash()
fileioLchown()
fileioLseek()
fileioLstat()
fileioMkdirRmdir()
fileioMkdtemp()
fileioOpen()
fileioOpendirClose()
fileioOpenClose()
fileioPosixFallocate()
fileioRead()
fileioReadtext()
fileioRename()
fileioRmdir()
fileioStat()
fileioSymlink()
fileioTruncate()
fileioUnlink()
fileioWrite()
}
/*
* 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 fileIOTest from './FileIO.test.js'
import fileIOTestDir from './FileIODir.test.js'
import fileIOTestDirent from './FileIODirent.test.js'
import fileIOTestStat from './FileIOStat.test.js'
import fileIOTestStream from './FileIOStream.test.js'
import fileioDirClose from './module_fileio/class_dir/close.test.js'
import fileioDirListfile from './module_fileio/class_dir/listfile.test.js'
import fileioDirRead from './module_fileio/class_dir/read.test.js'
import fileioDirent from './module_fileio/class_dirent/all.test.js'
import fileioStream from './module_fileio/class_stream/all.test.js'
import fileioRandomAccessFileClose from './module_fileio/class_randomAccessFile/close.test.js'
import fileioRandomAccessFileRead from './module_fileio/class_randomAccessFile/read.test.js'
import fileioRandomAccessFileSetFilePointer from './module_fileio/class_randomAccessFile/setFilePointer.test.js'
import fileioRandomAccessFileWrite from './module_fileio/class_randomAccessFile/write.test.js'
import fileioStreamClose from './module_fileio/class_stream/close.test.js'
import fileioStreamFlush from './module_fileio/class_stream/flush.test.js'
import fileioStreamRead from './module_fileio/class_stream/read.test.js'
import fileioStreamWrite from './module_fileio/class_stream/write.test.js'
import fileioCreateWatcher from './module_fileio/class_watcher/createWatcher.test.js'
import fileioAccess from './module_fileio/members/access.test.js'
import fileioChmod from './module_fileio/members/chmod.test.js'
import fileioChown from './module_fileio/members/chown.test.js'
import fileioClose from './module_fileio/members/close.test.js'
import fileioCopyfile from './module_fileio/members/copyFile.test.js'
import fileioCreateRandomAccessFile from './module_fileio/members/createRandomAccessFile.test.js'
import fileioCreateStream from './module_fileio/members/createStream.test.js'
import fileioFchmod from './module_fileio/members/fchmod.test.js'
import fileioFchown from './module_fileio/members/fchown.test.js'
import fileioFdatasync from './module_fileio/members/fdatasync.test.js'
import fileioFdOpenStream from './module_fileio/members/fdopenStream.test.js'
import fileioFstat from './module_fileio/members/fstat.test.js'
import fileioFsync from './module_fileio/members/fsync.test.js'
import fileioFtruncate from './module_fileio/members/ftruncate.test.js'
import fileioHash from './module_fileio/members/hash.test.js'
import fileioLchown from './module_fileio/members/lchown.test.js'
import fileioLseek from './module_fileio/members/lseek.test.js'
import fileioLstat from './module_fileio/members/lstat.test.js'
import fileioMkdirRmdir from './module_fileio/members/mkdir_rmdir.test.js'
import fileioMkdtemp from './module_fileio/members/mkdtemp.test.js'
import fileioOpen from './module_fileio/members/open.test.js'
import fileioOpendirClose from './module_fileio/members/opendir_close.test.js'
import fileioOpenClose from './module_fileio/members/open_close.test.js'
import fileioPosixFallocate from './module_fileio/members/posix_fallocate.test.js'
import fileioRead from './module_fileio/members/read.test.js'
import fileioReadtext from './module_fileio/members/readtext.test.js'
import fileioRename from './module_fileio/members/rename.test.js'
import fileioRmdir from './module_fileio/members/rmdir.test.js'
import fileioStat from './module_fileio/members/stat.test.js'
import fileioSymlink from './module_fileio/members/symlink.test.js'
import fileioTruncate from './module_fileio/members/truncate.test.js'
import fileioUnlink from './module_fileio/members/unlink.test.js'
import fileioWrite from './module_fileio/members/write.test.js'
export default function testsuite() {
fileIOTest()
fileIOTestDir()
fileIOTestDirent()
fileIOTestStat()
fileIOTestStream()
fileioDirClose()
fileioDirListfile()
fileioDirRead()
fileioDirent()
fileioStream()
fileioRandomAccessFileClose()
fileioRandomAccessFileRead()
fileioRandomAccessFileSetFilePointer()
fileioRandomAccessFileWrite()
fileioStreamClose()
fileioStreamFlush()
fileioStreamRead()
fileioStreamWrite()
fileioCreateWatcher()
fileioAccess()
fileioChmod()
fileioChown()
fileioClose()
fileioCopyfile()
fileioCreateRandomAccessFile()
fileioCreateStream()
fileioFchmod()
fileioFchown()
fileioFdatasync()
fileioFdOpenStream()
fileioFstat()
fileioFsync()
fileioFtruncate()
fileioHash()
fileioLchown()
fileioLseek()
fileioLstat()
fileioMkdirRmdir()
fileioMkdtemp()
fileioOpen()
fileioOpendirClose()
fileioOpenClose()
fileioPosixFallocate()
fileioRead()
fileioReadtext()
fileioRename()
fileioRmdir()
fileioStat()
fileioSymlink()
fileioTruncate()
fileioUnlink()
fileioWrite()
}
/**
* 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 {
fileio,
describe, it, expect,
} from '../../Common';
export default function constants() {
describe('constants', function () {
/**
* @tc.number SUB_DF_FILEIO_CONSTANTS
* @tc.name fileio_test_constants
* @tc.desc Test constants() interface.
* @tc.size MEDIUM(中型)
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it('fileio_test_constants', 0, function () {
try {
expect(fileio.constants.F_OK == 0).assertTrue();
expect(fileio.constants.X_OK == 1).assertTrue();
expect(fileio.constants.W_OK == 2).assertTrue();
expect(fileio.constants.R_OK == 4).assertTrue();
expect(fileio.constants.O_RDONLY == 0o0).assertTrue();
expect(fileio.constants.O_WRONLY == 0o1).assertTrue();
expect(fileio.constants.O_RDWR == 0o2).assertTrue();
expect(fileio.constants.O_CREAT == 0o100).assertTrue();
expect(fileio.constants.O_EXCL == 0o200).assertTrue();
expect(fileio.constants.O_TRUNC == 0o1000).assertTrue();
expect(fileio.constants.O_APPEND == 0o2000).assertTrue();
expect(fileio.constants.O_NONBLOCK == 0o4000).assertTrue();
expect(fileio.constants.O_DIRECTORY == 0o200000).assertTrue();
expect(fileio.constants.O_NOFOLLOW == 0o400000).assertTrue();
expect(fileio.constants.O_SYNC == 0o4010000).assertTrue();
expect(fileio.constants.S_IFMT == 0o170000).assertTrue();
expect(fileio.constants.S_IFSOCK == 0o140000).assertTrue();
expect(fileio.constants.S_IFLNK == 0o120000).assertTrue();
expect(fileio.constants.S_IFREG == 0o100000).assertTrue();
expect(fileio.constants.S_IFBLK == 0o060000).assertTrue();
expect(fileio.constants.S_IFDIR == 0o040000).assertTrue();
expect(fileio.constants.S_IFCHR == 0o020000).assertTrue();
expect(fileio.constants.S_IFIFO == 0o010000).assertTrue();
expect(fileio.constants.S_IRWXU == 0o0700).assertTrue();
expect(fileio.constants.S_IRUSR == 0o0400).assertTrue();
expect(fileio.constants.S_IWUSR == 0o0200).assertTrue();
expect(fileio.constants.S_IXUSR == 0o0100).assertTrue();
expect(fileio.constants.S_IRWXG == 0o0070).assertTrue();
expect(fileio.constants.S_IRGRP == 0o0040).assertTrue();
expect(fileio.constants.S_IWGRP == 0o0020).assertTrue();
expect(fileio.constants.S_IXGRP == 0o0010).assertTrue();
expect(fileio.constants.S_IRWXO == 0o0007).assertTrue();
expect(fileio.constants.S_IROTH == 0o0004).assertTrue();
expect(fileio.constants.S_IWOTH == 0o0002).assertTrue();
expect(fileio.constants.S_IXOTH == 0o0001).assertTrue();
} catch (e) {
console.log('fileio_test_constants has failed for ' + e);
expect(null).assertFail();
}
});
});}
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT 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 {
fileio,
describe, it, expect,
} from '../../Common';
export default function constants() {
describe('constants', function () {
/**
* @tc.number SUB_DF_FILEIO_CONSTANTS
* @tc.name fileio_test_constants
* @tc.desc Test constants() interface.
* @tc.size MEDIUM(中型)
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it('fileio_test_constants', 0, function () {
try {
expect(fileio.constants.F_OK == 0).assertTrue();
expect(fileio.constants.X_OK == 1).assertTrue();
expect(fileio.constants.W_OK == 2).assertTrue();
expect(fileio.constants.R_OK == 4).assertTrue();
expect(fileio.constants.O_RDONLY == 0o0).assertTrue();
expect(fileio.constants.O_WRONLY == 0o1).assertTrue();
expect(fileio.constants.O_RDWR == 0o2).assertTrue();
expect(fileio.constants.O_CREAT == 0o100).assertTrue();
expect(fileio.constants.O_EXCL == 0o200).assertTrue();
expect(fileio.constants.O_TRUNC == 0o1000).assertTrue();
expect(fileio.constants.O_APPEND == 0o2000).assertTrue();
expect(fileio.constants.O_NONBLOCK == 0o4000).assertTrue();
expect(fileio.constants.O_DIRECTORY == 0o200000).assertTrue();
expect(fileio.constants.O_NOFOLLOW == 0o400000).assertTrue();
expect(fileio.constants.O_SYNC == 0o4010000).assertTrue();
expect(fileio.constants.S_IFMT == 0o170000).assertTrue();
expect(fileio.constants.S_IFSOCK == 0o140000).assertTrue();
expect(fileio.constants.S_IFLNK == 0o120000).assertTrue();
expect(fileio.constants.S_IFREG == 0o100000).assertTrue();
expect(fileio.constants.S_IFBLK == 0o060000).assertTrue();
expect(fileio.constants.S_IFDIR == 0o040000).assertTrue();
expect(fileio.constants.S_IFCHR == 0o020000).assertTrue();
expect(fileio.constants.S_IFIFO == 0o010000).assertTrue();
expect(fileio.constants.S_IRWXU == 0o0700).assertTrue();
expect(fileio.constants.S_IRUSR == 0o0400).assertTrue();
expect(fileio.constants.S_IWUSR == 0o0200).assertTrue();
expect(fileio.constants.S_IXUSR == 0o0100).assertTrue();
expect(fileio.constants.S_IRWXG == 0o0070).assertTrue();
expect(fileio.constants.S_IRGRP == 0o0040).assertTrue();
expect(fileio.constants.S_IWGRP == 0o0020).assertTrue();
expect(fileio.constants.S_IXGRP == 0o0010).assertTrue();
expect(fileio.constants.S_IRWXO == 0o0007).assertTrue();
expect(fileio.constants.S_IROTH == 0o0004).assertTrue();
expect(fileio.constants.S_IWOTH == 0o0002).assertTrue();
expect(fileio.constants.S_IXOTH == 0o0001).assertTrue();
} catch (e) {
console.log('fileio_test_constants has failed for ' + e);
expect(null).assertFail();
}
});
});}
/**
* 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 {
fileio,
nextFileName,
describe,
it,
expect,
} from '../../Common';
export default function fileioDirClose() {
describe('fileio_dir_close', function () {
/**
* @tc.number SUB_DF_FILEIO_DIR_CLOSE_ASYNC_0000
* @tc.name fileio_test_dir_close_async_000
* @tc.desc Test Dir close() interface,return in promise mode.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it('fileio_test_dir_close_async_000', 0, async function (done) {
let dpath = await nextFileName('fileio_test_dir_close_async_000') + 'd';
try {
fileio.mkdirSync(dpath);
let dd = await fileio.opendir(dpath);
await dd.close();
fileio.rmdirSync(dpath);
done();
} catch (e) {
console.info('fileio_test_dir_close_async_000 has failed for ' + e);
expect(null).assertFail();
}
});
/**
* @tc.number SUB_DF_FileIO_Dir_close_Async_0100
* @tc.name fileio_test_dir_close_async_001
* @tc.desc Test Dir close() interface,return in callback mode.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it('fileio_test_dir_close_async_001', 0, async function (done) {
let dpath = await nextFileName('fileio_test_dir_close_async_001') + 'd';
try {
fileio.mkdirSync(dpath);
let dd = await fileio.opendir(dpath);
dd.close(function (err) {
fileio.rmdirSync(dpath);
done();
});
} catch (e) {
console.info('fileio_test_dir_close_async_001 has failed for ' + e);
expect(null).assertFail();
}
});
/**
* @tc.number SUB_DF_FileIO_Dir_close_Async_0200
* @tc.name fileio_test_dir_close_async_002
* @tc.desc Test Dir close() interface,there are multiple parameters.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it('fileio_test_dir_close_async_002', 0, async function (done) {
let dpath = await nextFileName('fileio_test_dir_close_async_002') + 'd';
try {
fileio.mkdirSync(dpath);
let dd = await fileio.opendir(dpath);
dd.close(-1,function (err) {
});
} catch (e) {
console.info('fileio_test_dir_close_async_002 has failed for ' + e);
expect(e.message == "Number of arguments unmatched").assertTrue();
fileio.rmdirSync(dpath);
done();
}
});
});
}
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT 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 {
fileio,
nextFileName,
describe,
it,
expect,
} from '../../Common';
export default function fileioDirClose() {
describe('fileio_dir_close', function () {
/**
* @tc.number SUB_DF_FILEIO_DIR_CLOSE_ASYNC_0000
* @tc.name fileio_test_dir_close_async_000
* @tc.desc Test Dir close() interface,return in promise mode.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it('fileio_test_dir_close_async_000', 0, async function (done) {
let dpath = await nextFileName('fileio_test_dir_close_async_000') + 'd';
try {
fileio.mkdirSync(dpath);
let dd = await fileio.opendir(dpath);
await dd.close();
fileio.rmdirSync(dpath);
done();
} catch (e) {
console.info('fileio_test_dir_close_async_000 has failed for ' + e);
expect(null).assertFail();
}
});
/**
* @tc.number SUB_DF_FileIO_Dir_close_Async_0100
* @tc.name fileio_test_dir_close_async_001
* @tc.desc Test Dir close() interface,return in callback mode.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it('fileio_test_dir_close_async_001', 0, async function (done) {
let dpath = await nextFileName('fileio_test_dir_close_async_001') + 'd';
try {
fileio.mkdirSync(dpath);
let dd = await fileio.opendir(dpath);
dd.close(function (err) {
fileio.rmdirSync(dpath);
done();
});
} catch (e) {
console.info('fileio_test_dir_close_async_001 has failed for ' + e);
expect(null).assertFail();
}
});
/**
* @tc.number SUB_DF_FileIO_Dir_close_Async_0200
* @tc.name fileio_test_dir_close_async_002
* @tc.desc Test Dir close() interface,there are multiple parameters.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it('fileio_test_dir_close_async_002', 0, async function (done) {
let dpath = await nextFileName('fileio_test_dir_close_async_002') + 'd';
try {
fileio.mkdirSync(dpath);
let dd = await fileio.opendir(dpath);
dd.close(-1,function (err) {
});
} catch (e) {
console.info('fileio_test_dir_close_async_002 has failed for ' + e);
expect(e.message == "Number of arguments unmatched").assertTrue();
fileio.rmdirSync(dpath);
done();
}
});
});
}
/*
* 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 {
fileio, nextFileName,
describe, it, expect
} from '../../Common';
export default function fileioRandomAccessFileClose() {
describe('fileio_randomAccessFile_close', function () {
/**
* @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_CLOSE_SYNC_0000
* @tc.name fileio_randomaccessfile_close_sync_000
* @tc.desc Test closeSync() interface. Close the RandomAccessFile object.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it('fileio_randomaccessfile_close_sync_000', 0, async function () {
let fpath = await nextFileName('fileio_randomaccessfile_close_sync_000');
try {
let randomaccessfile = fileio.createRandomAccessFileSync(fpath, 0, 0o102);
randomaccessfile.closeSync();
fileio.unlinkSync(fpath);
} catch(err) {
console.info('fileio_randomaccessfile_close_sync_000 has failed for ' + err);
expect(null).assertFail();
}
});
/**
* @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_CLOSE_SYNC_0100
* @tc.name fileio_randomaccessfile_close_sync_001
* @tc.desc Test closeSync() interface. Parameter mismatch.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it('fileio_randomaccessfile_close_sync_001', 0, async function () {
let fpath = await nextFileName('fileio_randomaccessfile_close_sync_001');
let randomaccessfile = fileio.createRandomAccessFileSync(fpath, 0, 0o102);
try {
randomaccessfile.closeSync(1);
expect(false).assertTrue();
} catch(err) {
console.info('fileio_randomaccessfile_close_sync_001 has failed for ' + err);
expect(err.message == "Number of arguments unmatched").assertTrue();
randomaccessfile.closeSync();
fileio.unlinkSync(fpath);
}
});
})
/*
* 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 {
fileio, nextFileName,
describe, it, expect
} from '../../Common';
export default function fileioRandomAccessFileClose() {
describe('fileio_randomAccessFile_close', function () {
/**
* @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_CLOSE_SYNC_0000
* @tc.name fileio_randomaccessfile_close_sync_000
* @tc.desc Test closeSync() interface. Close the RandomAccessFile object.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it('fileio_randomaccessfile_close_sync_000', 0, async function () {
let fpath = await nextFileName('fileio_randomaccessfile_close_sync_000');
try {
let randomaccessfile = fileio.createRandomAccessFileSync(fpath, 0, 0o102);
randomaccessfile.closeSync();
fileio.unlinkSync(fpath);
} catch(err) {
console.info('fileio_randomaccessfile_close_sync_000 has failed for ' + err);
expect(null).assertFail();
}
});
/**
* @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_CLOSE_SYNC_0100
* @tc.name fileio_randomaccessfile_close_sync_001
* @tc.desc Test closeSync() interface. Parameter mismatch.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it('fileio_randomaccessfile_close_sync_001', 0, async function () {
let fpath = await nextFileName('fileio_randomaccessfile_close_sync_001');
let randomaccessfile = fileio.createRandomAccessFileSync(fpath, 0, 0o102);
try {
randomaccessfile.closeSync(1);
expect(false).assertTrue();
} catch(err) {
console.info('fileio_randomaccessfile_close_sync_001 has failed for ' + err);
expect(err.message == "Number of arguments unmatched").assertTrue();
randomaccessfile.closeSync();
fileio.unlinkSync(fpath);
}
});
})
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册