Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
336f2bc7
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看板
未验证
提交
336f2bc7
编写于
6月 13, 2022
作者:
O
openharmony_ci
提交者:
Gitee
6月 13, 2022
浏览文件
操作
浏览文件
下载
差异文件
!3536 【location-biuetooth】新增location用例+Bluetooth用例
Merge pull request !3536 from 权力/myfeature
上级
fdda3204
5dc5ddf5
变更
2
展开全部
隐藏空白更改
内联
并排
Showing
2 changed file
with
727 addition
and
34 deletion
+727
-34
communication/bluetooth_ble/src/main/js/default/test/BluetoothBle.test.js
...uetooth_ble/src/main/js/default/test/BluetoothBle.test.js
+116
-6
location/geolocation_standard/src/main/js/default/test/GeocoderTest.test.js
...on_standard/src/main/js/default/test/GeocoderTest.test.js
+611
-28
未找到文件。
communication/bluetooth_ble/src/main/js/default/test/BluetoothBle.test.js
浏览文件 @
336f2bc7
...
...
@@ -298,6 +298,30 @@ describe('bluetoothhostTest', function() {
done
();
})
/**
* @tc.number SUB_COMMUNACATION_bluetooth_GET_DEVICE_NAME_CALLBACK_0001
* @tc.name testGetDeviceName
* @tc.desc Test GetDeviceName api by callback.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_COMMUNACATION_bluetooth_GET_DEVICE_NAME_CALLBACK_0001
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
[bluetooth_js] BLE get device name callback start
'
);
await
tryToEnableBt
();
let
promise
=
new
Promise
((
resolve
)
=>
{
let
gattClient
=
bluetooth
.
BLE
.
createGattClientDevice
(
"
00:00:00:00:00:00
"
);
gattClient
.
getDeviceName
((
err
,
data
)
=>
{
console
.
info
(
'
[bluetooth_js] device name
'
+
JSON
.
stringify
(
data
))
expect
(
data
).
assertNull
();
done
();
})
resolve
()
})
await
promise
.
then
(
done
)
done
();
})
/**
* @tc.number SUB_COMMUNACATION_bluetooth_GATT_GETSERVICES_CALLBACK_0001
* @tc.name testGetServices
...
...
@@ -363,7 +387,7 @@ describe('bluetoothhostTest', function() {
* @tc.level Level 2
*/
it
(
'
SUB_COMMUNACATION_bluetooth_GATT_READ_CHARA_VALUE_0001
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
[bluetooth_js] readCharacteristicValue start
'
);
console
.
info
(
'
[bluetooth_js] readCharacteristicValue
promise
start
'
);
await
tryToEnableBt
();
let
promise
=
new
Promise
((
resolve
)
=>
{
let
descriptors
=
[];
...
...
@@ -384,12 +408,12 @@ describe('bluetoothhostTest', function() {
if
(
object
!=
null
)
{
expect
(
true
).
assertEqual
(
true
);
}
else
{
console
.
info
(
'
[bluetooth_js] readCharacValue data:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
[bluetooth_js] readCharacValue
promise
data:
'
+
JSON
.
stringify
(
data
));
expect
(
null
).
assertFail
();
}
done
();
}).
catch
(
err
=>
{
console
.
error
(
`bluetooth readCharacteristicValue has error:
${
err
}
`
);
console
.
error
(
`bluetooth readCharacteristicValue
promise
has error:
${
err
}
`
);
expect
(
true
).
assertEqual
(
true
);
done
();
});
...
...
@@ -399,6 +423,53 @@ describe('bluetoothhostTest', function() {
done
();
})
/**
* @tc.number SUB_COMMUNACATION_bluetooth_GATT_READ_CHARA_VALUE_0002
* @tc.name testReadCharacteristicValue
* @tc.desc Test ReadCharacteristicValue api by callback.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_COMMUNACATION_bluetooth_GATT_READ_CHARA_VALUE_0002
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
[bluetooth_js] readCharacteristicValue callback start
'
);
await
tryToEnableBt
();
let
promise
=
new
Promise
((
resolve
)
=>
{
let
descriptors
=
[];
let
arrayBuffer
=
new
ArrayBuffer
(
8
);
let
desValue
=
new
Uint8Array
(
arrayBuffer
);
desValue
[
0
]
=
11
;
let
descriptor
=
{
serviceUuid
:
'
00001810-0000-1000-8000-00805F9B34FB
'
,
descriptorUuid
:
'
00001830-0000-1000-8000-00805F9B34FB
'
,
descriptorValue
:
arrayBuffer
};
descriptors
[
0
]
=
descriptor
;
let
arrayBufferCCC
=
new
ArrayBuffer
(
8
);
let
cccValue
=
new
Uint8Array
(
arrayBufferCCC
);
cccValue
[
0
]
=
32
;
let
characteristic
=
{
serviceUuid
:
'
00001810-0000-1000-8000-00805F9B34FB
'
,
characteristicUuid
:
'
00001820-0000-1000-8000-00805F9B34FB
'
,
characteristicValue
:
arrayBufferCCC
,
descriptors
:
descriptors
};
let
gattClient
=
bluetooth
.
BLE
.
createGattClientDevice
(
"
00:00:00:00:00:00
"
);
gattClient
.
readCharacteristicValue
(
characteristic
,(
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
`bluetooth readCharacteristicValue callback has error:
${
err
}
`
);
expect
(
true
).
assertEqual
(
true
);
done
();
return
;
}
if
(
object
!=
null
)
{
expect
(
true
).
assertEqual
(
true
);
}
else
{
console
.
info
(
'
[bluetooth_js] readCharacValue callback data:
'
+
JSON
.
stringify
(
data
));
expect
(
null
).
assertFail
();
}
done
();
})
resolve
()
})
await
promise
.
then
(
done
)
done
();
})
/**
* @tc.number SUB_COMMUNACATION_bluetooth_GATT_READ_DESCRI_VALUE_0001
* @tc.name testReadDescriptorValue
...
...
@@ -408,7 +479,7 @@ describe('bluetoothhostTest', function() {
* @tc.level Level 2
*/
it
(
'
SUB_COMMUNACATION_bluetooth_GATT_READ_DESCRI_VALUE_0001
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
[bluetooth_js] readDescriptorValue start
'
);
console
.
info
(
'
[bluetooth_js] readDescriptorValue
promise
start
'
);
await
tryToEnableBt
();
let
promise
=
new
Promise
((
resolve
)
=>
{
let
arrayBuffer
=
new
ArrayBuffer
(
8
);
...
...
@@ -421,12 +492,12 @@ describe('bluetoothhostTest', function() {
if
(
object
!=
null
)
{
expect
(
true
).
assertEqual
(
true
);
}
else
{
console
.
info
(
'
[bluetooth_js] BLEDescriptor data:
'
+
JSON
.
stringify
(
object
));
console
.
info
(
'
[bluetooth_js] BLEDescriptor
promise
data:
'
+
JSON
.
stringify
(
object
));
expect
(
null
).
assertFail
();
}
done
();
}).
catch
(
err
=>
{
console
.
error
(
`bluetooth readDescriptorValue has error:
${
err
}
`
);
console
.
error
(
`bluetooth readDescriptorValue
promise
has error:
${
err
}
`
);
expect
(
true
).
assertEqual
(
true
);
done
();
});
...
...
@@ -436,6 +507,44 @@ describe('bluetoothhostTest', function() {
done
();
})
/**
* @tc.number SUB_COMMUNACATION_bluetooth_GATT_READ_DESCRI_VALUE_0002
* @tc.name testReadDescriptorValue
* @tc.desc Test ReadDescriptorValue api by callback.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 2
*/
it
(
'
SUB_COMMUNACATION_bluetooth_GATT_READ_DESCRI_VALUE_0002
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
[bluetooth_js] readDescriptorValue callback start
'
);
await
tryToEnableBt
();
let
promise
=
new
Promise
((
resolve
)
=>
{
let
arrayBuffer
=
new
ArrayBuffer
(
8
);
let
desValue
=
new
Uint8Array
(
arrayBuffer
);
desValue
[
0
]
=
11
;
let
descriptor
=
{
serviceUuid
:
'
00001810-0000-1000-8000-00805F9B34FB
'
,
descriptorUuid
:
'
00001830-0000-1000-8000-00805F9B34FB
'
,
descriptorValue
:
arrayBuffer
};
let
gattClient
=
bluetooth
.
BLE
.
createGattClientDevice
(
"
00:00:00:00:00:00
"
);
gattClient
.
readDescriptorValue
(
descriptor
,(
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
`bluetooth readDescriptorValue callback has error:
${
err
}
`
);
expect
(
true
).
assertEqual
(
true
);
done
();
return
;
}
if
(
object
!=
null
)
{
expect
(
true
).
assertEqual
(
true
);
}
else
{
console
.
info
(
'
[bluetooth_js] BLEDescriptor callback data:
'
+
JSON
.
stringify
(
object
));
expect
(
null
).
assertFail
();
}
done
();
})
resolve
()
})
await
promise
.
then
(
done
)
done
();
})
/**
* @tc.number SUB_COMMUNACATION_bluetooth_GATT_WRITE_CHARACT_VALUE_0001
...
...
@@ -743,3 +852,4 @@ describe('bluetoothhostTest', function() {
})
})
location/geolocation_standard/src/main/js/default/test/GeocoderTest.test.js
浏览文件 @
336f2bc7
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录