Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
b6924ba4
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
b6924ba4
编写于
2月 14, 2023
作者:
O
openharmony_ci
提交者:
Gitee
2月 14, 2023
浏览文件
操作
浏览文件
下载
差异文件
!7492 【泛sensor -- miscdevice】修改马达测试用例
Merge pull request !7492 from lixiangpeng5/master-lxp
上级
e8f139c5
0ab2b617
变更
5
展开全部
隐藏空白更改
内联
并排
Showing
5 changed file
with
1193 addition
and
6 deletion
+1193
-6
sensors/miscdevice_standard/src/main/js/test/List.test.js
sensors/miscdevice_standard/src/main/js/test/List.test.js
+2
-2
sensors/miscdevice_standard/src/main/js/test/Vibrator_new.test.js
...miscdevice_standard/src/main/js/test/Vibrator_new.test.js
+2
-2
sensors/miscdevice_standard/src/main/js/test/Vibrator_newSupplement.test.js
..._standard/src/main/js/test/Vibrator_newSupplement.test.js
+2
-2
sensors/miscdevice_standard/src/main/js/test/Vibrator_newSupplement_common.test.js
...rd/src/main/js/test/Vibrator_newSupplement_common.test.js
+760
-0
sensors/miscdevice_standard/src/main/js/test/Vibrator_new_common.test.js
...ice_standard/src/main/js/test/Vibrator_new_common.test.js
+427
-0
未找到文件。
sensors/miscdevice_standard/src/main/js/test/List.test.js
浏览文件 @
b6924ba4
...
...
@@ -13,8 +13,8 @@
* limitations under the License.
*/
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
'
import
VibratorJsTest_misc_2
from
'
./Vibrator_new
_common
.test.js
'
import
VibratorJsTest_misc_3
from
'
./Vibrator_newSupplement
_common
.test.js
'
export
default
function
testsuite
()
{
VibratorJsTest_misc_1
()
VibratorJsTest_misc_2
()
...
...
sensors/miscdevice_standard/src/main/js/test/Vibrator_new.test.js
浏览文件 @
b6924ba4
...
...
@@ -16,8 +16,8 @@ import vibrator from '@ohos.vibrator'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
,
TestType
,
Size
,
Level
}
from
'
@ohos/hypium
'
export
default
function
VibratorJsTest_misc_
2
()
{
describe
(
"
VibratorJsTest_misc_
2
"
,
function
()
{
export
default
function
VibratorJsTest_misc_
4
()
{
describe
(
"
VibratorJsTest_misc_
4
"
,
function
()
{
beforeAll
(
function
()
{
/*
...
...
sensors/miscdevice_standard/src/main/js/test/Vibrator_newSupplement.test.js
浏览文件 @
b6924ba4
...
...
@@ -16,8 +16,8 @@ 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
()
{
export
default
function
VibratorJsTest_misc_
5
()
{
describe
(
"
VibratorJsTest_misc_
5
"
,
function
()
{
beforeAll
(
function
()
{
/*
...
...
sensors/miscdevice_standard/src/main/js/test/Vibrator_newSupplement_common.test.js
0 → 100644
浏览文件 @
b6924ba4
此差异已折叠。
点击以展开。
sensors/miscdevice_standard/src/main/js/test/Vibrator_new_common.test.js
0 → 100644
浏览文件 @
b6924ba4
/*
* 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_2
()
{
describe
(
"
VibratorJsTest_misc_2
"
,
function
()
{
beforeAll
(
function
()
{
/*
* @tc.setup: setup invoked before all testcases
*/
console
.
info
(
'
beforeAll called
'
)
})
afterAll
(
function
()
{
/*
* @tc.teardown: teardown invoked after all testcases
*/
console
.
info
(
'
afterAll called
'
)
})
beforeEach
(
function
()
{
/*
* @tc.setup: setup invoked before each testcases
*/
console
.
info
(
'
beforeEach called
'
)
})
afterEach
(
function
()
{
/*
* @tc.teardown: teardown invoked after each testcases
*/
console
.
info
(
'
afterEach called
'
)
})
const
DEVICE_OPERATION_FAILED
=
14600101
;
const
PERMISSION_ERROR_CODE
=
201
;
const
PARAMETER_ERROR_CODE
=
401
;
const
DEVICE_OPERATION_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.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0010
*/
it
(
"
VibratorJsTest001
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL0
,
async
function
(
done
)
{
function
vibrateCallback
(
error
)
{
if
(
error
)
{
console
.
info
(
'
VibratorJsTest001 vibrator error
'
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
VibratorJsTest001 vibrator success
'
);
expect
(
true
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
}
vibrator
.
vibrate
(
10
,
vibrateCallback
);
})
/*
* @tc.name:VibratorJsTest002
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0020
*/
it
(
"
VibratorJsTest002
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
function
vibrateCallback
(
error
)
{
if
(
error
)
{
console
.
info
(
'
VibratorJsTest002 vibrator success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
VibratorJsTest002 vibrator error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
}
vibrator
.
vibrate
(
-
1
,
vibrateCallback
);
})
/*
* @tc.name:VibratorJsTest003
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0030
*/
it
(
"
VibratorJsTest003
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
function
vibrateCallback
(
error
)
{
if
(
error
)
{
console
.
info
(
'
VibratorJsTest003 vibrator success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
VibratorJsTest003 vibrator error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
}
vibrator
.
vibrate
(
1800000
+
1
,
vibrateCallback
);
})
/*
* @tc.name:VibratorJsTest004
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0040
*/
it
(
"
VibratorJsTest004
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
function
vibrateCallback
(
error
)
{
if
(
error
)
{
console
.
info
(
'
VibratorJsTest004 vibrator error
'
);
expect
(
false
).
assertTrue
();
}
else
{
console
.
info
(
'
VibratorJsTest004 vibrator success
'
);
expect
(
true
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
}
vibrator
.
vibrate
(
1800000
,
vibrateCallback
);
})
/*
* @tc.name:VibratorJsTest005
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0050
*/
it
(
"
VibratorJsTest005
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
function
vibrateCallback
(
error
)
{
if
(
error
)
{
console
.
info
(
'
VibratorJsTest005 vibrator success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
VibratorJsTest005 vibrator error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
}
vibrator
.
vibrate
(
""
,
vibrateCallback
);
})
/*
* @tc.name:VibratorJsTest006
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0060
*/
it
(
"
VibratorJsTest006
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
function
vibrateCallback
(
error
)
{
if
(
error
)
{
console
.
info
(
'
VibratorJsTest006 vibrator success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
VibratorJsTest006 vibrator error
'
);
expect
(
false
).
assertTrue
();
}
setTimeout
(()
=>
{
done
();
},
500
);
}
vibrator
.
vibrate
(
"
xxx
"
,
vibrateCallback
);
})
/*
* @tc.name:VibratorJsTest007
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0090
*/
it
(
"
VibratorJsTest007
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
function
stopPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
vibrator
.
stop
(
"
time
"
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
VibratorJsTest007 stop error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
VibratorJsTest007 stop success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
resolve
();
},
500
);
}
});
})
}
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
vibrator
.
vibrate
(
180000
,
(
error
)
=>
{
if
(
error
)
{
console
.
info
(
'
VibratorJsTest007 vibrate error
'
);
expect
(
false
).
assertTrue
();
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
}
else
{
console
.
info
(
'
VibratorJsTest007 vibrate success
'
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
resolve
();
},
500
);
}
});
})
await
promise
.
then
(()
=>
{
return
stopPromise
();
},
()
=>
{
console
.
info
(
"
VibratorJsTest007 reject
"
);
})
done
();
})
/*
* @tc.name:VibratorJsTest008
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0100
*/
it
(
"
VibratorJsTest008
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
try
{
function
vibrateCallback
(
error
)
{
if
(
error
)
{
console
.
info
(
'
VibratorJsTest008 stop success
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
VibratorJsTest008 stop off
'
);
expect
(
false
).
assertTrue
();
}
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
();
}
})
/*
* @tc.name:VibratorJsTest009
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0110
*/
it
(
"
VibratorJsTest009
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
vibrator
.
vibrate
(
1000
).
then
(()
=>
{
console
.
log
(
"
VibratorJsTest009 vibrate success
"
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
done
();
},
500
);
},
(
error
)
=>
{
expect
(
false
).
assertTrue
();
console
.
log
(
"
VibratorJsTest009 vibrate error
"
);
setTimeout
(()
=>
{
done
();
},
500
);
});
})
/*
* @tc.name:VibratorJsTest010
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0120
*/
it
(
"
VibratorJsTest010
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
vibrator
.
vibrate
(
-
1
).
then
(()
=>
{
console
.
log
(
"
VibratorJsTest010 vibrate error
"
);
expect
(
false
).
assertTrue
();
setTimeout
(()
=>
{
done
();
},
500
);
},
(
error
)
=>
{
expect
(
true
).
assertTrue
();
console
.
log
(
"
VibratorJsTest010 vibrate success
"
);
setTimeout
(()
=>
{
done
();
},
500
);
});
})
/*
* @tc.name:VibratorJsTest011
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0130
*/
it
(
"
VibratorJsTest011
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
vibrator
.
vibrate
(
1800000
+
1
).
then
(()
=>
{
console
.
log
(
"
VibratorJsTest011 vibrate error
"
);
expect
(
false
).
assertTrue
();
setTimeout
(()
=>
{
done
();
},
500
);
},
(
error
)
=>
{
expect
(
true
).
assertTrue
();
console
.
log
(
"
VibratorJsTest011 vibrate success
"
);
setTimeout
(()
=>
{
done
();
},
500
);
});
})
/*
* @tc.name:VibratorJsTest012
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0160
*/
it
(
"
VibratorJsTest012
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
try
{
vibrator
.
stop
(
""
).
then
(()
=>
{
console
.
log
(
"
VibratorJsTest012 stop error
"
);
expect
(
false
).
assertTrue
();
setTimeout
(()
=>
{
done
();
},
500
);
},
(
error
)
=>
{
expect
(
true
).
assertTrue
();
console
.
log
(
"
VibratorJsTest012 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
();
}
})
/*
* @tc.name:VibratorJsTest013
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0170
*/
it
(
"
VibratorJsTest013
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
vibrator
.
vibrate
(
""
).
then
(()
=>
{
console
.
log
(
"
VibratorJsTest013 vibrate error
"
);
expect
(
false
).
assertTrue
();
setTimeout
(()
=>
{
done
();
},
500
);
},
(
error
)
=>
{
expect
(
true
).
assertTrue
();
console
.
log
(
"
VibratorJsTest013 vibrate success
"
);
setTimeout
(()
=>
{
done
();
},
500
);
});
})
/*
* @tc.name:VibratorJsTest014
* @tc.desc:Verification results of the incorrect parameters of the test interface.
* @tc.number:SUB_SensorSystem_Vibrator_JsTest_0180
*/
it
(
"
VibratorJsTest014
"
,
TestType
.
FUNCTION
|
Size
.
MEDIUMTEST
|
Level
.
LEVEL3
,
async
function
(
done
)
{
function
stopPromise
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
vibrator
.
stop
(
vibrator
.
VibratorStopMode
.
VIBRATOR_STOP_MODE_TIME
).
then
(()
=>
{
console
.
log
(
"
VibratorJsTest014 stop success
"
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
resolve
();
},
500
);
},
(
error
)
=>
{
expect
(
false
).
assertTrue
();
console
.
log
(
"
VibratorJsTest014 stop error
"
);
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
});
})
}
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
vibrator
.
vibrate
(
180000
).
then
(()
=>
{
console
.
log
(
"
VibratorJsTest014 vibrate success
"
);
expect
(
true
).
assertTrue
();
setTimeout
(()
=>
{
resolve
();
},
500
);
},
(
error
)
=>
{
expect
(
false
).
assertTrue
();
console
.
log
(
"
VibratorJsTest014 vibrate error
"
);
setTimeout
((
err
)
=>
{
reject
(
err
);
},
500
);
});
})
await
promise
.
then
(()
=>
{
return
stopPromise
();
},
()
=>
{
console
.
info
(
"
VibratorJsTest014 reject
"
);
})
done
();
})
})
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录