Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
f2717f6d
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看板
未验证
提交
f2717f6d
编写于
10月 10, 2022
作者:
O
openharmony_ci
提交者:
Gitee
10月 10, 2022
浏览文件
操作
浏览文件
下载
差异文件
!5836 马达xts用例修改
Merge pull request !5836 from 白露/master
上级
96a8ac55
08d868db
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
241 addition
and
148 deletion
+241
-148
sensors/miscdevice_standard/src/main/js/test/Vibrator_new.test.js
...miscdevice_standard/src/main/js/test/Vibrator_new.test.js
+46
-24
sensors/miscdevice_standard/src/main/js/test/Vibrator_newSupplement.test.js
..._standard/src/main/js/test/Vibrator_newSupplement.test.js
+182
-115
sensors/miscdevice_standard/src/main/js/test/Vibrator_old.test.js
...miscdevice_standard/src/main/js/test/Vibrator_old.test.js
+13
-9
未找到文件。
sensors/miscdevice_standard/src/main/js/test/Vibrator_new.test.js
浏览文件 @
f2717f6d
...
...
@@ -50,6 +50,14 @@ describe("VibratorJsTest_misc_2", function () {
console
.
info
(
'
afterEach caled
'
)
})
const
OPERATION_FAIL_CODE
=
14600101
;
const
PERMISSION_ERROR_CODE
=
201
;
const
PARAMETER_ERROR_CODE
=
401
;
const
OPERATION_FAIL_MSG
=
'
Device operation failed.
'
const
PERMISSION_ERROR_MSG
=
'
Permission denied.
'
const
PARAMETER_ERROR_MSG
=
'
The parameter invalid.
'
/*
* @tc.name:VibratorJsTest001
* @tc.desc:Verification results of the incorrect parameters of the test interface.
...
...
@@ -277,19 +285,26 @@ describe("VibratorJsTest_misc_2", function () {
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0100
*/
it
(
"
VibratorJsTest010
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
function
vibrateCallback
(
error
)
{
if
(
error
)
{
console
.
info
(
'
VibratorJsTest010 stop success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
VibratorJsTest010 stop off
'
);
expect
(
false
).
assertTrue
();
try
{
function
vibrateCallback
(
error
)
{
if
(
error
)
{
console
.
info
(
'
VibratorJsTest010 stop success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
VibratorJsTest010 stop off
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
}
setTimeout
(()
=>
{
done
();
},
500
);
vibrator
.
stop
(
""
,
vibrateCallback
);
}
catch
(
error
)
{
console
.
info
(
error
);
expect
(
error
.
code
).
assertEqual
(
PARAMETER_ERROR_CODE
);
expect
(
error
.
message
).
assertEqual
(
PARAMETER_ERROR_MSG
);
done
();
}
vibrator
.
stop
(
""
,
vibrateCallback
);
})
/*
...
...
@@ -403,19 +418,26 @@ describe("VibratorJsTest_misc_2", function () {
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0160
*/
it
(
"
VibratorJsTest016
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
vibrator
.
stop
(
""
).
then
(()
=>
{
console
.
log
(
"
VibratorJsTest016 stop error
"
);
expect
(
false
).
assertTrue
();
setTimeout
(()
=>
{
done
();
},
500
);
},
(
error
)
=>
{
expect
(
true
).
assertTrue
();
console
.
log
(
"
VibratorJsTest016 stop success
"
);
setTimeout
(()
=>
{
done
();
},
500
);
});
try
{
vibrator
.
stop
(
""
).
then
(()
=>
{
console
.
log
(
"
VibratorJsTest016 stop error
"
);
expect
(
false
).
assertTrue
();
setTimeout
(()
=>
{
done
();
},
500
);
},
(
error
)
=>
{
expect
(
true
).
assertTrue
();
console
.
log
(
"
VibratorJsTest016 stop success
"
);
setTimeout
(()
=>
{
done
();
},
500
);
});
}
catch
(
error
)
{
console
.
info
(
error
);
expect
(
error
.
code
).
assertEqual
(
PARAMETER_ERROR_CODE
);
expect
(
error
.
message
).
assertEqual
(
PARAMETER_ERROR_MSG
);
done
();
}
})
/*
...
...
sensors/miscdevice_standard/src/main/js/test/Vibrator_newSupplement.test.js
浏览文件 @
f2717f6d
...
...
@@ -52,6 +52,14 @@ describe("VibratorJsTest_misc_3", function () {
vibrator
.
stop
(
"
time
"
);
console
.
info
(
'
afterEach called
'
)
})
const
OPERATION_FAIL_CODE
=
14600101
;
const
PERMISSION_ERROR_CODE
=
201
;
const
PARAMETER_ERROR_CODE
=
401
;
const
OPERATION_FAIL_MSG
=
'
Device operation failed.
'
const
PERMISSION_ERROR_MSG
=
'
Permission denied.
'
const
PARAMETER_ERROR_MSG
=
'
The parameter invalid.
'
/*
* @tc.name:VibratorJsTest019
...
...
@@ -84,21 +92,28 @@ describe("VibratorJsTest_misc_3", function () {
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0300
*/
it
(
"
VibratorJsTest020
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
vibrator
.
vibrate
({
type
:
""
,
duration
:
1000
},
{
usage
:
"
unknown
"
},
(
error
)
=>
{
if
(
error
)
{
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
});
try
{
vibrator
.
vibrate
({
type
:
""
,
duration
:
1000
},
{
usage
:
"
unknown
"
},
(
error
)
=>
{
if
(
error
)
{
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
});
}
catch
(
error
)
{
console
.
info
(
error
);
expect
(
error
.
code
).
assertEqual
(
PARAMETER_ERROR_CODE
);
expect
(
error
.
message
).
assertEqual
(
PARAMETER_ERROR_MSG
);
done
();
}
})
/*
...
...
@@ -133,22 +148,30 @@ describe("VibratorJsTest_misc_3", function () {
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0320
*/
it
(
"
VibratorJsTest022
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
vibrator
.
vibrate
({
type
:
"
preset
"
,
effectId
:
""
,
count
:
3
,
},
{
usage
:
"
unknown
"
},
(
error
)
=>
{
if
(
error
)
{
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
});
try
{
vibrator
.
vibrate
({
type
:
"
preset
"
,
effectId
:
""
,
count
:
3
,
},
{
usage
:
"
unknown
"
},
(
error
)
=>
{
if
(
error
)
{
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
});
}
catch
(
error
)
{
console
.
info
(
error
);
expect
(
error
.
code
).
assertEqual
(
PARAMETER_ERROR_CODE
);
expect
(
error
.
message
).
assertEqual
(
PARAMETER_ERROR_MSG
);
done
();
}
})
/*
...
...
@@ -157,22 +180,30 @@ describe("VibratorJsTest_misc_3", function () {
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0330
*/
it
(
"
VibratorJsTest023
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
vibrator
.
vibrate
({
type
:
"
preset
"
,
effectId
:
"
haptic.clock.timer
"
,
count
:
3
,
},
{
usage
:
""
},
(
error
)
=>
{
if
(
error
)
{
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
});
try
{
vibrator
.
vibrate
({
type
:
"
preset
"
,
effectId
:
"
haptic.clock.timer
"
,
count
:
3
,
},
{
usage
:
""
},
(
error
)
=>
{
if
(
error
)
{
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
});
}
catch
(
error
)
{
console
.
info
(
error
);
expect
(
error
.
code
).
assertEqual
(
PARAMETER_ERROR_CODE
);
expect
(
error
.
message
).
assertEqual
(
PARAMETER_ERROR_MSG
);
done
();
}
})
/*
...
...
@@ -215,17 +246,24 @@ describe("VibratorJsTest_misc_3", function () {
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0360
*/
it
(
"
VibratorJsTest026
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
await
vibrator
.
vibrate
({
type
:
""
,
duration
:
1000
},
{
usage
:
"
unknown
"
}).
then
(()
=>
{
expect
(
false
).
assertTrue
();
}).
catch
((
error
)
=>
{
expect
(
true
).
assertTrue
();
});
done
();
try
{
await
vibrator
.
vibrate
({
type
:
""
,
duration
:
1000
},
{
usage
:
"
unknown
"
}).
then
(()
=>
{
expect
(
false
).
assertTrue
();
}).
catch
((
error
)
=>
{
expect
(
true
).
assertTrue
();
});
done
();
}
catch
(
error
)
{
console
.
info
(
error
);
expect
(
error
.
code
).
assertEqual
(
PARAMETER_ERROR_CODE
);
expect
(
error
.
message
).
assertEqual
(
PARAMETER_ERROR_MSG
);
done
();
}
})
/*
...
...
@@ -254,19 +292,26 @@ describe("VibratorJsTest_misc_3", function () {
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0380
*/
it
(
"
VibratorJsTest028
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
vibrator
.
vibrate
({
type
:
"
preset
"
,
effectId
:
""
,
count
:
3
,
},
{
usage
:
"
unknown
"
}).
then
(()
=>
{
expect
(
false
).
assertTrue
();
done
();
}).
catch
((
error
)
=>
{
expect
(
true
).
assertTrue
();
try
{
vibrator
.
vibrate
({
type
:
"
preset
"
,
effectId
:
""
,
count
:
3
,
},
{
usage
:
"
unknown
"
}).
then
(()
=>
{
expect
(
false
).
assertTrue
();
done
();
}).
catch
((
error
)
=>
{
expect
(
true
).
assertTrue
();
done
();
});
}
catch
(
error
)
{
console
.
info
(
error
);
expect
(
error
.
code
).
assertEqual
(
PARAMETER_ERROR_CODE
);
expect
(
error
.
message
).
assertEqual
(
PARAMETER_ERROR_MSG
);
done
();
}
);
}
})
/*
...
...
@@ -275,19 +320,26 @@ describe("VibratorJsTest_misc_3", function () {
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0390
*/
it
(
"
VibratorJsTest029
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
vibrator
.
vibrate
({
type
:
"
preset
"
,
effectId
:
"
haptic.clock.timer
"
,
count
:
3
,
},
{
usage
:
""
}).
then
(()
=>
{
expect
(
false
).
assertTrue
();
done
();
}).
catch
((
error
)
=>
{
expect
(
true
).
assertTrue
();
try
{
vibrator
.
vibrate
({
type
:
"
preset
"
,
effectId
:
"
haptic.clock.timer
"
,
count
:
3
,
},
{
usage
:
""
}).
then
(()
=>
{
expect
(
false
).
assertTrue
();
done
();
}).
catch
((
error
)
=>
{
expect
(
true
).
assertTrue
();
done
();
});
}
catch
(
error
)
{
console
.
info
(
error
);
expect
(
error
.
code
).
assertEqual
(
PARAMETER_ERROR_CODE
);
expect
(
error
.
message
).
assertEqual
(
PARAMETER_ERROR_MSG
);
done
();
}
);
}
})
/*
...
...
@@ -812,22 +864,29 @@ describe("VibratorJsTest_misc_3", function () {
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0510
*/
it
(
"
VibratorJsTest041
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
vibrator
.
vibrate
({
type
:
""
,
duration
:
1000
},
{
id
:
1
,
usage
:
"
unknown
"
},
(
error
)
=>
{
if
(
error
)
{
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
});
try
{
vibrator
.
vibrate
({
type
:
""
,
duration
:
1000
},
{
id
:
1
,
usage
:
"
unknown
"
},
(
error
)
=>
{
if
(
error
)
{
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
});
}
catch
(
error
)
{
console
.
info
(
error
);
expect
(
error
.
code
).
assertEqual
(
PARAMETER_ERROR_CODE
);
expect
(
error
.
message
).
assertEqual
(
PARAMETER_ERROR_MSG
);
done
();
}
})
/*
...
...
@@ -863,23 +922,31 @@ describe("VibratorJsTest_misc_3", function () {
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0530
*/
it
(
"
VibratorJsTest043
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
vibrator
.
vibrate
({
type
:
"
preset
"
,
effectId
:
""
,
count
:
3
,
},
{
id
:
null
,
usage
:
"
unknown
"
},
(
error
)
=>
{
if
(
error
)
{
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
});
try
{
vibrator
.
vibrate
({
type
:
"
preset
"
,
effectId
:
""
,
count
:
3
,
},
{
id
:
null
,
usage
:
"
unknown
"
},
(
error
)
=>
{
if
(
error
)
{
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
});
}
catch
(
error
)
{
console
.
info
(
error
);
expect
(
error
.
code
).
assertEqual
(
PARAMETER_ERROR_CODE
);
expect
(
error
.
message
).
assertEqual
(
PARAMETER_ERROR_MSG
);
done
();
}
})
})
}
sensors/miscdevice_standard/src/main/js/test/Vibrator_old.test.js
浏览文件 @
f2717f6d
...
...
@@ -50,9 +50,13 @@ describe("VibratorJsTest_misc_1", function () {
console
.
info
(
'
afterEach caled
'
)
})
let
errMessages
=
[
'
Error: ParseParameter: "Get vibrate type fail"
'
,
'
Error: ParseParameter: "Wrong argument number"
'
]
let
errMessage
;
const
OPERATION_FAIL_CODE
=
14600101
;
const
PERMISSION_ERROR_CODE
=
201
;
const
PARAMETER_ERROR_CODE
=
401
;
const
OPERATION_FAIL_MSG
=
'
Device operation failed.
'
const
PERMISSION_ERROR_MSG
=
'
Permission denied.
'
const
PARAMETER_ERROR_MSG
=
'
The parameter invalid.
'
/*
* @tc.name:SubVibratorJsTest0001
...
...
@@ -193,9 +197,9 @@ describe("VibratorJsTest_misc_1", function () {
},
},
25
);
}
catch
(
error
)
{
errMessage
=
error
.
toString
();
console
.
info
(
'
SubVibratorJsTest0007 error:
'
+
error
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
0
]);
expect
(
error
.
code
).
assertEqual
(
PARAMETER_ERROR_CODE
);
expect
(
error
.
message
).
assertEqual
(
PARAMETER_ERROR_MSG
);
done
();
}
})
...
...
@@ -242,9 +246,9 @@ describe("VibratorJsTest_misc_1", function () {
try
{
vibrator
.
vibrate
();
}
catch
(
error
)
{
errMessage
=
error
.
toString
();
console
.
info
(
'
SubVibratorJsTest0009 error:
'
+
error
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
1
]);
expect
(
error
.
code
).
assertEqual
(
PARAMETER_ERROR_CODE
);
expect
(
error
.
message
).
assertEqual
(
PARAMETER_ERROR_MSG
);
done
();
}
})
...
...
@@ -267,9 +271,9 @@ describe("VibratorJsTest_misc_1", function () {
},
function
()
{
},
25
);
}
catch
(
error
)
{
errMessage
=
error
.
toString
();
console
.
info
(
'
SubVibratorJsTest0010 error:
'
+
error
);
expect
(
errMessage
).
assertEqual
(
errMessages
[
0
]);
expect
(
error
.
code
).
assertEqual
(
PARAMETER_ERROR_CODE
);
expect
(
error
.
message
).
assertEqual
(
PARAMETER_ERROR_MSG
);
done
();
}
})
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录