Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
c2129dee
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
c2129dee
编写于
8月 19, 2021
作者:
J
jiyong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
jiyong@huawei.com
Signed-off-by:
N
jiyong
<
jiyong@huawei.com
>
上级
bdc343f7
变更
18
显示空白变更内容
内联
并排
Showing
18 changed file
with
334 addition
and
215 deletion
+334
-215
ace/ace_standard/project/entry/src/main/config.json
ace/ace_standard/project/entry/src/main/config.json
+13
-25
ace/ace_standard/project/entry/src/main/js/default/app.js
ace/ace_standard/project/entry/src/main/js/default/app.js
+2
-17
ace/ace_standard/project/entry/src/main/js/default/i18n/en-US.json
...tandard/project/entry/src/main/js/default/i18n/en-US.json
+0
-2
ace/ace_standard/project/entry/src/main/js/default/i18n/zh-CN.json
...tandard/project/entry/src/main/js/default/i18n/zh-CN.json
+0
-2
ace/ace_standard/project/entry/src/main/js/default/pages/index/index.css
...d/project/entry/src/main/js/default/pages/index/index.css
+5
-2
ace/ace_standard/project/entry/src/main/js/default/pages/index/index.hml
...d/project/entry/src/main/js/default/pages/index/index.hml
+1
-1
ace/ace_standard/project/entry/src/main/js/default/pages/index/index.js
...rd/project/entry/src/main/js/default/pages/index/index.js
+3
-3
ace/ace_standard/project/entry/src/main/js/default/pages/routerPush/index.css
...ject/entry/src/main/js/default/pages/routerPush/index.css
+12
-0
ace/ace_standard/project/entry/src/main/js/default/pages/routerPush/index.hml
...ject/entry/src/main/js/default/pages/routerPush/index.hml
+5
-0
ace/ace_standard/project/entry/src/main/js/default/pages/routerPush/index.js
...oject/entry/src/main/js/default/pages/routerPush/index.js
+25
-0
ace/ace_standard/project/entry/src/main/js/default/pages/routerReplace/index.css
...t/entry/src/main/js/default/pages/routerReplace/index.css
+12
-0
ace/ace_standard/project/entry/src/main/js/default/pages/routerReplace/index.hml
...t/entry/src/main/js/default/pages/routerReplace/index.hml
+5
-0
ace/ace_standard/project/entry/src/main/js/default/pages/routerReplace/index.js
...ct/entry/src/main/js/default/pages/routerReplace/index.js
+25
-0
ace/ace_standard/project/entry/src/main/js/test/basicabilityapi.test.js
...rd/project/entry/src/main/js/test/basicabilityapi.test.js
+224
-103
ace/ace_standard/project/entry/src/main/resources/base/element/plural.json
...project/entry/src/main/resources/base/element/plural.json
+0
-33
ace/ace_standard/project/entry/src/main/resources/base/element/strarray.json
...oject/entry/src/main/resources/base/element/strarray.json
+0
-21
ace/ace_standard/project/entry/src/main/resources/base/element/string.json
...project/entry/src/main/resources/base/element/string.json
+2
-6
ace/ace_standard/project/entry/src/main/resources/base/media/icon_small.png
...roject/entry/src/main/resources/base/media/icon_small.png
+0
-0
未找到文件。
ace/ace_standard/project/entry/src/main/config.json
浏览文件 @
c2129dee
...
...
@@ -3,49 +3,37 @@
"bundleName"
:
"com.example.aceceshi"
,
"vendor"
:
"example"
,
"version"
:
{
"code"
:
1
,
"name"
:
"1.0"
},
"apiVersion"
:
{
"compatible"
:
5
,
"target"
:
5
,
"releaseType"
:
"Release"
"code"
:
1000000
,
"name"
:
"1.0.0"
}
},
"deviceConfig"
:
{},
"module"
:
{
"package"
:
"com.example.aceceshi"
,
"name"
:
"testModule"
,
"deviceType"
:
[
"phone"
"liteWearable"
,
"smartVision"
],
"distro"
:
{
"deliveryWithInstall"
:
true
,
"moduleName"
:
"entry
_test
"
,
"moduleType"
:
"
feature
"
"moduleName"
:
"entry"
,
"moduleType"
:
"
entry
"
},
"abilities"
:
[
{
"name"
:
"decc.testkit.runner.JsEntryAbility"
,
"description"
:
"Test Entry Ability"
,
"name"
:
"default"
,
"icon"
:
"$media:icon"
,
"label"
:
"TestAbility"
,
"launchType"
:
"standard"
,
"orientation"
:
"landscape"
,
"visible"
:
true
,
"label"
:
"$string:entry_MainAbility"
,
"type"
:
"page"
}
],
"js"
:
[
{
"pages"
:
[
"pages/index/index"
],
"name"
:
"default"
,
"window"
:
{
"designWidth"
:
750
,
"autoDesignWidth"
:
false
}
"pages"
:
[
"pages/index/index"
,
"pages/routerPush/index"
,
"pages/routerReplace/index"
]
}
]
}
...
...
ace/ace_standard/project/entry/src/main/js/default/app.js
浏览文件 @
c2129dee
/*
* 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
(
'
TestApplication onCreate
'
);
console
.
info
(
"
Application onCreate
"
);
},
onDestroy
()
{
console
.
info
(
'
TestApplication onDestroy
'
);
console
.
info
(
"
Application onDestroy
"
);
}
};
ace/ace_standard/project/entry/src/main/js/default/i18n/en-US.json
浏览文件 @
c2129dee
...
...
@@ -2,7 +2,5 @@
"strings"
:
{
"hello"
:
"Hello"
,
"world"
:
"World"
},
"Files"
:
{
}
}
\ No newline at end of file
ace/ace_standard/project/entry/src/main/js/default/i18n/zh-CN.json
浏览文件 @
c2129dee
...
...
@@ -2,7 +2,5 @@
"strings"
:
{
"hello"
:
"您好"
,
"world"
:
"世界"
},
"Files"
:
{
}
}
\ No newline at end of file
ace/ace_standard/project/entry/src/main/js/default/pages/index/index.css
浏览文件 @
c2129dee
.container
{
flex-direction
:
column
;
width
:
454px
;
height
:
454px
;
justify-content
:
center
;
align-items
:
center
;
}
.title
{
font-size
:
100px
;
width
:
200px
;
font-size
:
30px
;
text-align
:
center
;
}
ace/ace_standard/project/entry/src/main/js/default/pages/index/index.hml
浏览文件 @
c2129dee
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{title
}}
Hello {{ title
}}
</text>
</div>
ace/ace_standard/project/entry/src/main/js/default/pages/index/index.js
浏览文件 @
c2129dee
...
...
@@ -21,9 +21,6 @@ export default {
},
onInit
()
{
this
.
title
=
this
.
$t
(
'
strings.world
'
);
},
onShow
()
{
console
.
info
(
'
onShow finish
'
)
const
core
=
Core
.
getInstance
()
const
expectExtend
=
new
ExpectExtend
({
'
id
'
:
'
extend
'
...
...
@@ -39,6 +36,9 @@ export default {
require
(
'
../../../test/List.test
'
)
core
.
execute
()
},
onShow
()
{
console
.
info
(
'
onShow finish
'
)
},
onReady
()
{
},
}
ace/ace_standard/project/entry/src/main/js/default/pages/routerPush/index.css
0 → 100644
浏览文件 @
c2129dee
.container
{
width
:
454px
;
height
:
454px
;
justify-content
:
center
;
align-items
:
center
;
}
.title
{
width
:
200px
;
font-size
:
30px
;
text-align
:
center
;
}
ace/ace_standard/project/entry/src/main/js/default/pages/routerPush/index.hml
0 → 100644
浏览文件 @
c2129dee
<div class="container">
<text class="title">
{{ title }}
</text>
</div>
ace/ace_standard/project/entry/src/main/js/default/pages/routerPush/index.js
0 → 100644
浏览文件 @
c2129dee
/*
* 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
{
data
:
{
title
:
"
router push test
"
},
onInit
()
{
},
onShow
()
{
},
onReady
()
{
},
}
ace/ace_standard/project/entry/src/main/js/default/pages/routerReplace/index.css
0 → 100644
浏览文件 @
c2129dee
.container
{
width
:
454px
;
height
:
454px
;
justify-content
:
center
;
align-items
:
center
;
}
.title
{
width
:
200px
;
font-size
:
30px
;
text-align
:
center
;
}
ace/ace_standard/project/entry/src/main/js/default/pages/routerReplace/index.hml
0 → 100644
浏览文件 @
c2129dee
<div class="container">
<text class="title">
{{ title }}
</text>
</div>
ace/ace_standard/project/entry/src/main/js/default/pages/routerReplace/index.js
0 → 100644
浏览文件 @
c2129dee
/*
* 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
{
data
:
{
title
:
"
router replace test
"
},
onInit
()
{
},
onShow
()
{
},
onReady
()
{
},
}
ace/ace_standard/project/entry/src/main/js/test/basicabilityapi.test.js
浏览文件 @
c2129dee
...
...
@@ -16,33 +16,47 @@
import
configuration
from
'
@system.configuration
'
;
import
prompt
from
'
@system.prompt
'
;
import
router
from
'
@system.router
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
;
describe
(
'
basicabilityapi
'
,
function
()
{
describe
(
'
basicabilityapi
'
,
function
()
{
let
testResult
;
let
testResultFail
;
let
test
;
beforeAll
(
function
()
{
beforeAll
(
function
()
{
testResult
=
true
;
testResultFail
=
false
;
test
=
"
success
"
test
=
"
success
"
});
beforeEach
(
function
()
{
});
afterEach
(
function
()
{
});
afterAll
(
function
()
{
});
beforeEach
(
function
()
{});
afterEach
(
function
()
{});
/**
* @tc.number SUB_ACE_BASICABILITY_JS_API_0100
* @tc.name testClearInterval
* @tc.desc Cancel the repetitive timing tasks previously set by setInterval.
*/
it
(
'
testClearInterval
'
,
0
,
function
(
)
{
it
(
'
testClearInterval
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testClearInterval START
'
);
let
intervalID
=
setInterval
(
function
()
{
console
.
info
(
'
TEST do very 1s.
'
);
},
1000
);
let
res
=
0
;
let
intervalID
=
await
setInterval
(
function
()
{
res
++
;
console
.
info
(
'
testClearInterval res =
'
+
res
);
},
100
);
await
setTimeout
(
function
()
{
console
.
info
(
'
[clearInterval] start
'
);
clearInterval
(
intervalID
);
expect
(
test
).
assertEqual
(
'
success
'
);
console
.
info
(
'
[clearInterval] success
'
);
console
.
info
(
'
[clearInterval] end
'
);
},
600
);
await
setTimeout
(
function
()
{
console
.
info
(
'
testClearInterval finally
'
);
expect
(
5
).
assertEqual
(
res
);
console
.
info
(
'
testClearInterval END
'
);
done
();
},
1000
);
});
/**
...
...
@@ -50,7 +64,7 @@ describe('basicabilityapi', function() {
* @tc.name testConsole
* @tc.desc Print a text message.
*/
it
(
'
testConsole
'
,
0
,
function
()
{
it
(
'
testConsole
'
,
0
,
function
()
{
console
.
info
(
'
testConsole START
'
);
const
versionCode
=
1.1
;
console
.
info
(
'
[console.info] versionCode:
'
+
versionCode
);
...
...
@@ -67,18 +81,47 @@ describe('basicabilityapi', function() {
* @tc.name testRouterPush
* @tc.desc Go to the specified page of the application.
*/
it
(
'
testRouterPush
'
,
0
,
function
()
{
it
(
'
testRouterPush
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testRouterPush START
'
);
await
setTimeout
(()
=>
{
router
.
push
({
uri
:
'
pages/routePush/index
'
,
params
:
{
myData
:
'
this is params data
'
}
uri
:
'
pages/routerPush/index
'
});
setTimeout
(()
=>
{
},
500
);
await
setTimeout
(()
=>
{
let
pages
=
router
.
getState
();
console
.
info
(
"
[router.clear] getState
"
+
JSON
.
stringify
(
pages
));
console
.
info
(
"
[router.push] getState
"
+
JSON
.
stringify
(
pages
));
expect
(
"
pages/routerPush/
"
).
assertEqual
(
pages
.
path
);
console
.
info
(
"
[router.push] getLength:
"
+
router
.
getLength
());
expect
(
"
2
"
).
assertEqual
(
router
.
getLength
());
console
.
info
(
'
testRouterPush SUCCESS
'
);
router
.
back
();
console
.
info
(
'
testRouterPush END
'
);
done
();
},
1000
);
});
/**
* @tc.number SUB_ACE_BASICABILITY_JS_API_0310
* @tc.name testRouterPushNotExist
* @tc.desc Test push not exist page.
*/
it
(
'
testRouterPushNotExist
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testRouterPushNotExist START
'
);
await
setTimeout
(()
=>
{
router
.
push
({
uri
:
'
pages/routerNotExist/index
'
});
},
500
);
expect
(
test
).
assertEqual
(
'
success
'
);
await
setTimeout
(()
=>
{
let
pages
=
router
.
getState
();
console
.
info
(
"
testRouterPushNotExist getState
"
+
JSON
.
stringify
(
pages
));
expect
(
"
pages/index/
"
).
assertEqual
(
pages
.
path
);
console
.
info
(
"
testRouterPushNotExist getLength:
"
+
router
.
getLength
());
expect
(
"
1
"
).
assertEqual
(
router
.
getLength
());
console
.
info
(
'
testRouterPushNotExist END
'
);
done
();
},
1000
);
});
/**
...
...
@@ -86,17 +129,52 @@ describe('basicabilityapi', function() {
* @tc.name testRouterReplace
* @tc.desc Replace the current page with a page in the application, and destroy the replaced page.
*/
it
(
'
testRouterReplace
'
,
0
,
function
(
)
{
it
(
'
testRouterReplace
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testRouterReplace START
'
);
await
setTimeout
(()
=>
{
router
.
push
({
uri
:
'
pages/routerPush/index
'
});
},
500
);
await
setTimeout
(()
=>
{
router
.
replace
({
uri
:
'
pages/routerReplace/index
'
,
params
:
{
data1
:
'
message
'
,
}
uri
:
'
pages/routerReplace/index
'
});
expect
(
test
).
assertEqual
(
'
success
'
);
console
.
info
(
"
[router.replace] success
"
);
},
1000
);
await
setTimeout
(()
=>
{
let
pages
=
router
.
getState
();
console
.
info
(
"
[router.replace] getState
"
+
JSON
.
stringify
(
pages
));
expect
(
"
pages/routerReplace/
"
).
assertEqual
(
pages
.
path
);
console
.
info
(
"
[router.replace] getLength:
"
+
router
.
getLength
());
expect
(
"
2
"
).
assertEqual
(
router
.
getLength
());
console
.
info
(
'
testRouterReplace SUCCESS
'
);
router
.
back
();
console
.
info
(
'
testRouterReplace END
'
);
done
();
},
1500
);
});
/**
* @tc.number SUB_ACE_BASICABILITY_JS_API_0410
* @tc.name testRouterReplaceNotExist
* @tc.desc Test replace not exist page.
*/
it
(
'
testRouterReplaceNotExist
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testRouterReplaceNotExist START
'
);
await
setTimeout
(()
=>
{
router
.
replace
({
uri
:
'
pages/routerNotExist/index
'
});
},
500
);
await
setTimeout
(()
=>
{
let
pages
=
router
.
getState
();
console
.
info
(
"
testRouterReplaceNotExist getState
"
+
JSON
.
stringify
(
pages
));
expect
(
"
pages/index/
"
).
assertEqual
(
pages
.
path
);
console
.
info
(
"
testRouterReplaceNotExist getLength:
"
+
router
.
getLength
());
expect
(
"
1
"
).
assertEqual
(
router
.
getLength
());
console
.
info
(
'
testRouterReplaceNotExist END
'
);
done
();
},
1000
);
});
/**
...
...
@@ -104,17 +182,27 @@ describe('basicabilityapi', function() {
* @tc.name testRouterBack
* @tc.desc Return to the previous page or the specified page.
*/
it
(
'
testRouterBack
'
,
0
,
function
(
)
{
it
(
'
testRouterBack
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testRouterBack START
'
);
await
setTimeout
(()
=>
{
router
.
push
({
uri
:
'
pages/detail/detail
'
uri
:
'
pages/routerPush/index
'
});
},
500
);
await
setTimeout
(()
=>
{
router
.
back
({
path
:
'
pages/mediaquery/mediaquery
'
uri
:
'
pages/index/index
'
});
expect
(
test
).
assertEqual
(
'
success
'
);
console
.
info
(
'
[router.back] success
'
);
},
1000
);
await
setTimeout
(()
=>
{
let
pages
=
router
.
getState
();
console
.
info
(
"
[router.back] getState
"
+
JSON
.
stringify
(
pages
));
expect
(
"
pages/index/
"
).
assertEqual
(
pages
.
path
);
console
.
info
(
"
[router.back] getLength:
"
+
router
.
getLength
());
expect
(
"
1
"
).
assertEqual
(
router
.
getLength
());
console
.
info
(
'
testRouterBack END
'
);
done
();
},
1500
);
});
/**
...
...
@@ -122,25 +210,11 @@ describe('basicabilityapi', function() {
* @tc.name testRouterClear
* @tc.desc Clear all historical pages in the page stack, and only keep the current page as the top page.
*/
it
(
'
testRouterClear
'
,
0
,
function
()
{
it
(
'
testRouterClear
'
,
0
,
function
()
{
console
.
info
(
'
testRouterClear START
'
);
new
Promise
(
function
(
resolve
,
reject
)
{
router
.
push
({
uri
:
'
pages/routePush/index
'
,
params
:{
myData
:
'
message
'
}
});
setTimeout
(()
=>
{
console
.
info
(
"
[router.clear] getLength:
"
+
router
.
getLength
());
},
2000
);
resolve
();
}).
then
(
function
()
{
expect
(
testResult
).
toBeTrue
();
},
function
()
{
console
.
log
(
'
[router.clear] fail
'
);
expect
(
testResultFail
).
toBeTrue
();
});
router
.
clear
();
console
.
info
(
"
[router.clear] router.getLength:
"
+
router
.
getLength
());
expect
(
"
1
"
).
assertEqual
(
router
.
getLength
());
console
.
info
(
'
testRouterClear END
'
);
});
...
...
@@ -149,24 +223,55 @@ describe('basicabilityapi', function() {
* @tc.name testRouterLength
* @tc.desc Get the number of pages currently in the page stack.
*/
it
(
'
testRouterLength
'
,
0
,
function
()
{
router
.
push
({
uri
:
'
pages/dialog/dialog
'
,
params
:
{
data1
:
'
message
'
,
data2
:
{
data3
:
[
123
,
456
,
789
],
data4
:
{
data5
:
'
message
'
}
}
}
});
it
(
'
testRouterLength
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testRouterLength START
'
);
let
size
=
router
.
getLength
();
console
.
info
(
'
[router.getLength] pages stack size =
'
+
size
);
expect
(
size
).
assertEqual
(
'
1
'
);
console
.
info
(
'
testRouterLength END
'
);
await
setTimeout
(()
=>
{
router
.
push
({
uri
:
'
pages/routerPush/index
'
});
},
500
);
await
setTimeout
(()
=>
{
console
.
info
(
"
testRouterLength getLength:
"
+
router
.
getLength
());
expect
(
"
2
"
).
assertEqual
(
router
.
getLength
());
console
.
info
(
'
testRouterPush SUCCESS
'
);
router
.
back
();
console
.
info
(
'
testRouterPush END
'
);
done
();
},
1000
);
});
/**
* @tc.number SUB_ACE_BASICABILITY_JS_API_0710
* @tc.name testRouterMaxLength
* @tc.desc Test the max number of the page stack is 32.
*/
it
(
'
testRouterMaxLength
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testRouterLength START
'
);
let
intervalID
=
await
setInterval
(
async
function
()
{
await
router
.
push
({
uri
:
'
pages/routerPush/index
'
});
await
router
.
push
({
uri
:
'
pages/routerReplace/index
'
});
console
.
info
(
'
testRouterMaxLength router.getLength:
'
+
router
.
getLength
());
},
500
);
await
setTimeout
(()
=>
{
clearInterval
(
intervalID
);
},
1000
*
17
);
await
setTimeout
(()
=>
{
console
.
info
(
"
testRouterMaxLength getLength:
"
+
router
.
getLength
());
expect
(
"
32
"
).
assertEqual
(
router
.
getLength
());
console
.
info
(
'
testRouterMaxLength SUCCESS
'
);
router
.
back
({
uri
:
'
pages/index/index
'
});
console
.
info
(
'
testRouterMaxLength END
'
);
done
();
},
(
1000
*
18
));
});
/**
...
...
@@ -174,7 +279,7 @@ describe('basicabilityapi', function() {
* @tc.name testRouterGetState
* @tc.desc Get the status information of the current page.
*/
it
(
'
testRouterGetState
'
,
0
,
function
()
{
it
(
'
testRouterGetState
'
,
0
,
function
()
{
console
.
info
(
'
testRouterGetState START
'
);
let
page
=
router
.
getState
();
console
.
info
(
'
[router.getState] index:
'
+
page
.
index
);
...
...
@@ -191,12 +296,12 @@ describe('basicabilityapi', function() {
* @tc.name testPromptShowToast
* @tc.desc Show text pop-up window.
*/
it
(
'
testPromptShowToast
'
,
0
,
function
()
{
it
(
'
testPromptShowToast
'
,
0
,
function
()
{
console
.
info
(
'
testPromptShowToast START
'
);
const
delay
=
5000
;
prompt
.
showToast
({
message
:
'
message
'
,
duration
:
delay
,
message
:
'
message
'
,
duration
:
delay
,
});
expect
(
test
).
assertEqual
(
'
success
'
);
console
.
info
(
'
[prompt.showToast] success
'
);
...
...
@@ -208,7 +313,7 @@ describe('basicabilityapi', function() {
* @tc.name testPromptDialog
* @tc.desc Display the dialog box in the page.
*/
it
(
'
testPromptDialog
'
,
0
,
function
()
{
it
(
'
testPromptDialog
'
,
0
,
function
()
{
console
.
info
(
'
testPromptDialog START
'
)
prompt
.
showDialog
({
title
:
'
dialog showDialog test
'
,
...
...
@@ -220,15 +325,15 @@ describe('basicabilityapi', function() {
index
:
0
}
],
success
:
function
(
ret
)
{
success
:
function
(
ret
)
{
console
.
info
(
"
[prompt.showDialog] ret.index
"
+
ret
.
index
);
expect
(
testResult
).
toBeTrue
();
},
cancel
:
function
()
{
cancel
:
function
()
{
console
.
log
(
'
[prompt.showDialog] dialog cancel callback
'
);
expect
(
testResultFail
).
toBeTrue
();
},
complete
:
function
()
{
complete
:
function
()
{
console
.
log
(
'
[prompt.showDialog] complete
'
);
}
});
...
...
@@ -240,7 +345,7 @@ describe('basicabilityapi', function() {
* @tc.name testConfigurationGetLocale
* @tc.desc Get the current language and region of the app. Synchronize with the language and region.
*/
it
(
'
testConfigurationGetLocale
'
,
0
,
function
()
{
it
(
'
testConfigurationGetLocale
'
,
0
,
function
()
{
console
.
info
(
'
testConfigurationGetLocale START
'
);
const
localeInfo
=
configuration
.
getLocale
();
console
.
info
(
"
[configuration.getLocale] language:
"
+
localeInfo
.
language
);
...
...
@@ -257,19 +362,23 @@ describe('basicabilityapi', function() {
* @tc.name testSetTimeout
* @tc.desc Set up a timer that executes a function or a specified piece of code after the timer expires.
*/
it
(
'
testSetTimeout
'
,
0
,
function
(
)
{
it
(
'
testSetTimeout
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testSetTimeout START
'
);
let
start_time
=
new
Date
().
getTime
();
const
delay
=
200
;
console
.
info
(
"
[settimeout] start_time:
"
+
start_time
);
setTimeout
(
function
(
v1
,
v2
)
{
await
setTimeout
(
function
(
v1
,
v2
)
{
let
end_time
=
new
Date
().
getTime
();
console
.
info
(
'
[settimeout] delay:
'
+
(
end_time
-
start_time
)
/
1000
);
console
.
info
(
"
[settimeout] start_time:
"
+
start_time
);
console
.
info
(
"
[settimeout] end_time:
"
+
end_time
);
console
.
info
(
'
[settimeout] delay:
'
+
(
end_time
-
start_time
));
console
.
info
(
'
[settimeout] v1:
'
+
v1
);
console
.
info
(
'
[settimeout] v2:
'
+
v2
);
expect
(
testResult
).
toBeTrue
();
},
delay
,
'
test
'
,
'
message
'
);
expect
(
'
test
'
).
assertEqual
(
v1
);
expect
(
'
message
'
).
assertEqual
(
v2
);
expect
(
delay
).
assertLess
(
end_time
-
start_time
);
console
.
info
(
'
testSetTimeout END
'
);
done
();
},
delay
,
'
test
'
,
'
message
'
);
});
/**
...
...
@@ -277,15 +386,22 @@ describe('basicabilityapi', function() {
* @tc.name testClearTimeout
* @tc.desc The timer previously established by calling setTimeout() is cancelled.
*/
it
(
'
testClearTimeout
'
,
0
,
function
(
)
{
it
(
'
testClearTimeout
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testClearTimeout START
'
);
let
timeoutID
=
setTimeout
(
function
()
{
console
.
info
(
'
delay 1s
'
);
},
1000
);
let
res
=
0
;
let
timeoutID
=
setTimeout
(
function
()
{
res
++
;
},
700
);
await
setTimeout
(
function
()
{
console
.
info
(
'
testClearTimeout delay 0.5s
'
)
clearTimeout
(
timeoutID
);
expect
(
test
).
assertEqual
(
'
success
'
);
console
.
info
(
"
[clearTimeout] success
"
);
},
500
);
await
setTimeout
(
function
()
{
expect
(
0
).
assertEqual
(
res
);
console
.
info
(
'
testClearTimeout END
'
);
done
();
},
1000
);
});
/**
...
...
@@ -293,13 +409,18 @@ describe('basicabilityapi', function() {
* @tc.name testSetInterval
* @tc.desc Call a function or execute a code segment repeatedly, with a fixed time delay between each call.
*/
it
(
'
testSetInterval
'
,
0
,
function
(
)
{
it
(
'
testSetInterval
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testSetInterval START
'
);
let
intervalID
=
setInterval
(
function
()
{
console
.
log
(
'
do very 1s.
'
);
expect
(
testResult
).
toBeTrue
()
;
let
res
=
0
;
let
intervalID
=
setInterval
(
function
()
{
res
++
;
},
1000
);
console
.
info
(
"
[setInterval] intervalID:
"
+
intervalID
);
await
setTimeout
(
function
()
{
expect
(
9
).
assertEqual
(
res
);
console
.
info
(
'
testSetInterval SUCCESS
'
);
clearInterval
(
intervalID
);
console
.
info
(
'
testSetInterval END
'
);
done
();
},
1000
);
});
});
\ No newline at end of file
ace/ace_standard/project/entry/src/main/resources/base/element/plural.json
已删除
100755 → 0
浏览文件 @
bdc343f7
{
"plural"
:[
{
"name"
:
"plural_name"
,
"value"
:[
{
"quantity"
:
"zero"
,
"value"
:
"%d test zero"
},
{
"quantity"
:
"one"
,
"value"
:
"%d test one"
},
{
"quantity"
:
"two"
,
"value"
:
"%d test two"
},
{
"quantity"
:
"few"
,
"value"
:
"%d test few"
},
{
"quantity"
:
"many"
,
"value"
:
"%d test many"
},
{
"quantity"
:
"other"
,
"value"
:
"%d test other"
}
]
}
]
}
\ No newline at end of file
ace/ace_standard/project/entry/src/main/resources/base/element/strarray.json
已删除
100755 → 0
浏览文件 @
bdc343f7
{
"strarray"
:
[
{
"name"
:
"sizeList"
,
"value"
:[
{
"value"
:
"small"
},
{
"value"
:
"middle"
},
{
"value"
:
"large"
},
{
"value"
:
"extra large"
}
]
}
]
}
\ No newline at end of file
ace/ace_standard/project/entry/src/main/resources/base/element/string.json
浏览文件 @
c2129dee
{
"string"
:
[
{
"name"
:
"app_name"
,
"value"
:
"aceceshi"
},
{
"name"
:
"mainability_description"
,
"value"
:
"hap sample empty page"
"name"
:
"entry_MainAbility"
,
"value"
:
"entry_MainAbility"
}
]
}
ace/ace_standard/project/entry/src/main/resources/base/media/icon_small.png
0 → 100644
浏览文件 @
c2129dee
5.8 KB
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录