Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
805ee00c
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看板
未验证
提交
805ee00c
编写于
9月 14, 2022
作者:
O
openharmony_ci
提交者:
Gitee
9月 14, 2022
浏览文件
操作
浏览文件
下载
差异文件
!5447 【Openharmony3.2.7.2】【master分支】【sensor子系统】【ToC】【RK3568】【必现】新增马达优先级用例
Merge pull request !5447 from ldy/master
上级
c47fc317
8f9c3ced
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
786 addition
and
0 deletion
+786
-0
sensors/miscdevice_standard/src/main/js/test/List.test.js
sensors/miscdevice_standard/src/main/js/test/List.test.js
+2
-0
sensors/miscdevice_standard/src/main/js/test/Vibrator_newSupplement.test.js
..._standard/src/main/js/test/Vibrator_newSupplement.test.js
+784
-0
未找到文件。
sensors/miscdevice_standard/src/main/js/test/List.test.js
浏览文件 @
805ee00c
...
...
@@ -14,7 +14,9 @@
*/
import
VibratorJsTest_misc_1
from
'
./Vibrator_old.test.js
'
import
VibratorJsTest_misc_2
from
'
./Vibrator_new.test.js
'
import
VibratorJsTest_misc_3
from
'
./Vibrator_newSupplement.test.js
'
export
default
function
testsuite
()
{
VibratorJsTest_misc_1
()
VibratorJsTest_misc_2
()
VibratorJsTest_misc_3
()
}
sensors/miscdevice_standard/src/main/js/test/Vibrator_newSupplement.test.js
0 → 100644
浏览文件 @
805ee00c
/*
* 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
vibrator
from
'
@ohos.vibrator
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
,
TestType
,
Size
,
Level
}
from
'
@ohos/hypium
'
export
default
function
VibratorJsTest_misc_3
()
{
describe
(
"
VibratorJsTest_misc_3
"
,
function
()
{
beforeAll
(
function
()
{
/*
* @tc.setup: setup invoked before all testcases
*/
console
.
info
(
'
beforeAll caled
'
)
})
afterAll
(
function
()
{
/*
* @tc.teardown: teardown invoked after all testcases
*/
console
.
info
(
'
afterAll caled
'
)
})
beforeEach
(
function
()
{
/*
* @tc.setup: setup invoked before each testcases
*/
console
.
info
(
'
beforeEach caled
'
)
})
afterEach
(
function
()
{
/*
* @tc.teardown: teardown invoked after each testcases
*/
console
.
info
(
'
afterEach caled
'
)
vibrator
.
stop
(
"
preset
"
);
vibrator
.
stop
(
"
time
"
);
console
.
info
(
'
afterEach called
'
)
})
/*
* @tc.name:VibratorJsTest019
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0290
*/
it
(
"
VibratorJsTest019
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL0
,
async
function
(
done
)
{
vibrator
.
vibrate
({
type
:
"
time
"
,
duration
:
1000
},
{
usage
:
"
unknown
"
},
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
VibratorJsTest019 vibrator error
'
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
VibratorJsTest019 vibrator success
'
);
expect
(
true
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
});
})
/*
* @tc.name:VibratorJsTest020
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @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
);
});
})
/*
* @tc.name:VibratorJsTest021
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0310
*/
it
(
"
VibratorJsTest021
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
vibrator
.
vibrate
({
type
:
"
preset
"
,
effectId
:
"
haptic.clock.timer
"
,
count
:
1
,
},
{
usage
:
"
unknown
"
},
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
VibratorJsTest021 vibrator error
'
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
VibratorJsTest021 vibrator success
'
);
expect
(
true
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
});
})
/*
* @tc.name:VibratorJsTest022
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @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
);
});
})
/*
* @tc.name:VibratorJsTest023
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @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
);
});
})
/*
* @tc.name:VibratorJsTest024
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0340
*/
it
(
"
VibratorJsTest024
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
try
{
vibrator
.
vibrate
(
null
,
null
);
}
catch
(
error
)
{
console
.
info
(
error
);
expect
(
true
).
assertTrue
();
done
();
}
})
/*
* @tc.name:VibratorJsTest025
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0350
*/
it
(
"
VibratorJsTest025
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
await
vibrator
.
vibrate
({
type
:
"
time
"
,
duration
:
1000
,
},
{
usage
:
"
unknown
"
}).
then
(()
=>
{
expect
(
true
).
assertTrue
();
}).
catch
((
error
)
=>
{
expect
(
false
).
assertTrue
();
});
done
();
})
/*
* @tc.name:VibratorJsTest026
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @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
();
})
/*
* @tc.name:VibratorJsTest027
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0370
*/
it
(
"
VibratorJsTest027
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
await
vibrator
.
vibrate
({
type
:
"
preset
"
,
effectId
:
"
haptic.clock.timer
"
,
count
:
1
,
},
{
usage
:
"
unknown
"
}).
then
(()
=>
{
expect
(
true
).
assertTrue
();
}).
catch
((
error
)
=>
{
expect
(
false
).
assertTrue
();
});
done
();
})
/*
* @tc.name:VibratorJsTest028
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @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
();
done
();
});
})
/*
* @tc.name:VibratorJsTest029
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @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
();
done
();
});
})
/*
* @tc.name:VibratorJsTest030
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0400
*/
it
(
"
VibratorJsTest030
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
try
{
vibrator
.
vibrate
({
type
:
1
,
count
:
3
,
},
{
usage
:
""
})
}
catch
(
error
)
{
console
.
info
(
error
);
expect
(
true
).
assertTrue
();
done
();
}
})
/*
* @tc.name:VibratorJsTest031
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0410
*/
it
(
"
VibratorJsTest031
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
function
vibratePromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
vibrator
.
vibrate
({
type
:
"
time
"
,
duration
:
100
},
{
usage
:
"
unknown
"
},
(
error
)
=>
{
if
(
error
)
{
expect
(
false
).
assertTrue
();
}
else
{
expect
(
true
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
});
})
}
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
vibrator
.
vibrate
({
type
:
"
time
"
,
duration
:
100
},
{
usage
:
"
unknown
"
},
(
error
)
=>
{
if
(
error
)
{
expect
(
false
).
assertTrue
();
reject
();
}
else
{
expect
(
true
).
assertTrue
();
resolve
();
}
});
})
await
promise
.
then
(()
=>
{
return
vibratePromise
();
},
()
=>
{
console
.
info
(
"
VibratorJsTest031 reject
"
);
})
done
();
})
/*
* @tc.name:VibratorJsTest032
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0420
*/
it
(
"
VibratorJsTest032
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
function
vibratePromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
vibrator
.
vibrate
({
type
:
"
preset
"
,
effectId
:
"
haptic.clock.timer
"
,
count
:
1
,
},
{
usage
:
"
unknown
"
},
(
error
)
=>
{
if
(
error
)
{
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
});
})
}
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
vibrator
.
vibrate
({
type
:
"
time
"
,
duration
:
100
},
{
usage
:
"
alarm
"
},
(
error
)
=>
{
if
(
error
)
{
expect
(
false
).
assertTrue
();
reject
();
}
else
{
expect
(
true
).
assertTrue
();
resolve
();
}
});
})
await
promise
.
then
(()
=>
{
return
vibratePromise
();
},
()
=>
{
console
.
info
(
"
VibratorJsTest032 reject
"
);
})
done
();
})
/*
* @tc.name:VibratorJsTest033
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0430
*/
it
(
"
VibratorJsTest033
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
function
vibratePromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
vibrator
.
vibrate
({
type
:
"
preset
"
,
effectId
:
"
haptic.clock.timer
"
,
count
:
3
,
},
{
usage
:
"
unknown
"
,
},
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
"
VibratorJsTest033 success
"
);
expect
(
false
).
assertTrue
();
}
else
{
expect
(
true
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
});
})
}
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
vibrator
.
vibrate
({
type
:
"
time
"
,
duration
:
10000
},
{
usage
:
"
alarm
"
},
(
error
)
=>
{
if
(
error
)
{
expect
(
false
).
assertTrue
();
reject
();
}
else
{
expect
(
true
).
assertTrue
();
resolve
();
}
});
})
await
promise
.
then
(()
=>
{
return
vibratePromise
();
},
()
=>
{
console
.
info
(
"
VibratorJsTest033 reject
"
);
})
done
();
})
/*
* @tc.name:VibratorJsTest034
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0440
*/
it
(
"
VibratorJsTest034
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
function
vibratePromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
vibrator
.
vibrate
({
type
:
"
preset
"
,
effectId
:
"
haptic.clock.timer
"
,
count
:
1
,
},
{
usage
:
"
unknown
"
,
},
(
error
)
=>
{
if
(
error
)
{
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
});
})
}
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
vibrator
.
vibrate
({
type
:
"
preset
"
,
effectId
:
"
haptic.clock.timer
"
,
count
:
3
,
},
{
usage
:
"
unknown
"
,
},
(
error
)
=>
{
if
(
error
)
{
expect
(
false
).
assertTrue
();
reject
();
}
else
{
expect
(
true
).
assertTrue
();
resolve
();
}
});
})
await
promise
.
then
(()
=>
{
return
vibratePromise
();
},
()
=>
{
console
.
info
(
"
VibratorJsTest034 reject
"
);
})
done
();
})
/*
* @tc.name:VibratorJsTest035
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0450
*/
it
(
"
VibratorJsTest035
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
function
vibratePromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
vibrator
.
vibrate
({
type
:
"
time
"
,
duration
:
3000
,
},
{
usage
:
"
alarm
"
},
(
error
)
=>
{
if
(
error
)
{
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
});
})
}
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
vibrator
.
vibrate
({
type
:
"
preset
"
,
effectId
:
"
haptic.clock.timer
"
,
count
:
3
,
},
{
usage
:
"
unknown
"
},
(
error
)
=>
{
if
(
error
)
{
expect
(
false
).
assertTrue
();
reject
();
}
else
{
expect
(
true
).
assertTrue
();
resolve
();
}
});
})
await
promise
.
then
(()
=>
{
return
vibratePromise
();
},
()
=>
{
console
.
info
(
"
VibratorJsTest035 reject
"
);
})
done
();
})
/*
* @tc.name:VibratorJsTest036
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0460
*/
it
(
"
VibratorJsTest036
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
function
vibratePromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
vibrator
.
vibrate
({
type
:
"
time
"
,
duration
:
3000
,
},
{
usage
:
"
alarm
"
},
(
error
)
=>
{
if
(
error
)
{
expect
(
false
).
assertTrue
();
}
else
{
expect
(
true
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
});
})
}
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
vibrator
.
vibrate
({
type
:
"
preset
"
,
effectId
:
"
haptic.clock.timer
"
,
count
:
1
,
},
{
usage
:
"
unknown
"
},
(
error
)
=>
{
if
(
error
)
{
expect
(
false
).
assertTrue
();
reject
();
}
else
{
expect
(
true
).
assertTrue
();
resolve
();
}
});
})
await
promise
.
then
(()
=>
{
return
vibratePromise
();
},
()
=>
{
console
.
info
(
"
VibratorJsTest036 reject
"
);
})
done
();
})
/*
* @tc.name:VibratorJsTest037
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0470
*/
it
(
"
VibratorJsTest037
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
function
vibratePromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
vibrator
.
vibrate
({
type
:
"
preset
"
,
effectId
:
"
haptic.clock.timer
"
,
count
:
3
,
},
{
usage
:
"
unknown
"
},
(
error
)
=>
{
if
(
error
)
{
expect
(
false
).
assertTrue
();
}
else
{
expect
(
true
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
});
})
}
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
vibrator
.
vibrate
({
type
:
"
preset
"
,
effectId
:
"
haptic.clock.timer
"
,
count
:
3
,
},
{
usage
:
"
unknown
"
},
(
error
)
=>
{
if
(
error
)
{
expect
(
false
).
assertTrue
();
reject
();
}
else
{
expect
(
true
).
assertTrue
();
resolve
();
}
});
})
await
promise
.
then
(()
=>
{
return
vibratePromise
();
},
()
=>
{
console
.
info
(
"
VibratorJsTest037 reject
"
);
})
done
();
})
/*
* @tc.name:VibratorJsTest038
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0480
*/
it
(
"
VibratorJsTest038
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
function
vibratePromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
vibrator
.
vibrate
({
type
:
"
preset
"
,
effectId
:
"
haptic.clock.timer
"
,
count
:
1
,
},
{
usage
:
"
ring
"
},
(
error
)
=>
{
if
(
error
)
{
expect
(
false
).
assertTrue
();
}
else
{
expect
(
true
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
});
})
}
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
vibrator
.
vibrate
({
type
:
"
preset
"
,
effectId
:
"
haptic.clock.timer
"
,
count
:
1
,
},
{
usage
:
"
notification
"
},
(
error
)
=>
{
if
(
error
)
{
expect
(
false
).
assertTrue
();
reject
();
}
else
{
expect
(
true
).
assertTrue
();
resolve
();
}
});
})
await
promise
.
then
(()
=>
{
return
vibratePromise
();
},
()
=>
{
console
.
info
(
"
VibratorJsTest038 reject
"
);
})
done
();
})
/*
* @tc.name:VibratorJsTest039
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0490
*/
it
(
"
VibratorJsTest039
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
function
vibratePromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
vibrator
.
vibrate
({
type
:
"
preset
"
,
effectId
:
"
haptic.clock.timer
"
,
count
:
1
,
},
{
usage
:
"
unknown
"
},
(
error
)
=>
{
if
(
error
)
{
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
});
})
}
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
vibrator
.
vibrate
({
type
:
"
preset
"
,
effectId
:
"
haptic.clock.timer
"
,
count
:
1
,
},
{
usage
:
"
notification
"
},
(
error
)
=>
{
if
(
error
)
{
expect
(
false
).
assertTrue
();
reject
();
}
else
{
expect
(
true
).
assertTrue
();
resolve
();
}
});
})
await
promise
.
then
(()
=>
{
return
vibratePromise
();
},
()
=>
{
console
.
info
(
"
VibratorJsTest039 reject
"
);
})
done
();
})
})
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录