Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
5f12dcda
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,发现更多精彩内容 >>
提交
5f12dcda
编写于
4月 11, 2022
作者:
1
18834416147
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
<liangzhenyu6@h-partners.com>
Signed-off-by:
N
18834416147
<
liangzhenyu6@h-partners.com
>
上级
cde435d0
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
24 addition
and
19 deletion
+24
-19
distributeddatamgr/distributeddataObjectjstest/hap/src/main/js/default/test/ObjectStoreJsunit.test.js
...st/hap/src/main/js/default/test/ObjectStoreJsunit.test.js
+24
-19
未找到文件。
distributeddatamgr/distributeddataObjectjstest/hap/src/main/js/default/test/ObjectStoreJsunit.test.js
浏览文件 @
5f12dcda
...
...
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
distributedObject
from
'
@ohos.data.distributedDataObject
'
;
var
baseLine
=
500
;
//0.5 second
...
...
@@ -283,7 +283,7 @@ describe('objectStoreTest', function () {
var
testObject
=
distributedObject
.
createDistributedObject
({
name
:
"
Eric
"
,
age
:
81
,
isVis
:
true
});
testObject
.
setSessionId
(
"
testSession1
"
);
if
(
testObject
!=
undefined
&&
testObject
!=
null
)
{
expect
(
"
testSession1
"
).
assertEqual
(
testObject
.
__sessionId
);
expect
(
"
testSession1
"
==
testObject
.
__sessionId
);
}
else
{
console
.
log
(
TAG
+
"
testMultiObjectOn001 joinSession failed
"
);
}
...
...
@@ -296,25 +296,30 @@ describe('objectStoreTest', function () {
objectTest
.
isVis
=
true
;
expect
(
objectTest
.
name
==
"
jack1
"
);
expect
(
objectTest
.
age
==
19
);
objectTest
.
name
=
"
jack2
"
;
objectTest
.
age
=
20
;
objectTest
.
isVis
=
false
;
expect
(
objectTest
.
name
==
"
jack2
"
);
expect
(
objectTest
.
age
==
20
);
console
.
info
(
TAG
+
"
set data success!
"
);
}
else
{
console
.
info
(
TAG
+
"
object is null,set name fail
"
);
console
.
info
(
TAG
+
"
objectTest is null,set name fail
"
);
}
if
(
testObject
!=
undefined
&&
testObject
!=
null
)
{
testObject
.
name
=
"
jack2
"
;
testObject
.
age
=
20
;
testObject
.
isVis
=
false
;
expect
(
testObject
.
name
==
"
jack2
"
);
expect
(
testObject
.
age
==
20
);
console
.
info
(
TAG
+
"
set data success!
"
);
}
else
{
console
.
info
(
TAG
+
"
testObject is null,set name fail
"
);
}
done
()
console
.
log
(
TAG
+
"
************* testMultiObjectOn001 end *************
"
);
})
/**
* @tc.name: testMultiObjectOff001
* @tc.desc: two objects join session and on&off,then two objects can not receive callbacks
* @tc.number: SUB_DDM_AppDataFWK_Object_Api_Multi_Off_001
*/
/**
* @tc.name: testMultiObjectOff001
* @tc.desc: two objects join session and on&off,then two objects can not receive callbacks
* @tc.number: SUB_DDM_AppDataFWK_Object_Api_Multi_Off_001
*/
it
(
'
testMultiObjectOff001
'
,
0
,
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testMultiObjectOff001 start *************
"
);
var
objectTest
=
distributedObject
.
createDistributedObject
({
name
:
"
Amy
"
,
age
:
18
,
isVis
:
false
});
...
...
@@ -381,13 +386,13 @@ describe('objectStoreTest', function () {
done
()
console
.
log
(
TAG
+
"
************* testMultiObjectOff001 end *************
"
);
})
/**
/**
* @tc.name: testChangeSession001
* @tc.desc: objects join session,then change sessionId
* @tc.number: SUB_DDM_AppDataFWK_Object_Api_Session_001
*/
it
(
'
testChangeSession001
'
,
0
,
function
(
done
)
{
it
(
'
testChangeSession001
'
,
0
,
function
(
done
)
{
console
.
log
(
TAG
+
"
************* testChangeSession001 start *************
"
);
var
objectTest
=
distributedObject
.
createDistributedObject
({
name
:
"
Amy
"
,
age
:
18
,
isVis
:
false
});
objectTest
.
setSessionId
(
"
session9
"
);
...
...
@@ -396,9 +401,9 @@ describe('objectStoreTest', function () {
}
else
{
console
.
log
(
TAG
+
"
testChangeSession001 joinSession failed
"
);
}
console
.
log
(
TAG
+
"
start change sessionId
"
);
console
.
log
(
TAG
+
"
start change sessionId
"
);
setTimeout
(()
=>
objectTest
.
setSessionId
(
"
session9
"
),
1000
);
if
(
objectTest
!=
undefined
&&
objectTest
!=
null
)
{
if
(
objectTest
!=
undefined
&&
objectTest
!=
null
)
{
expect
(
"
session9
"
==
objectTest
.
__sessionId
);
}
else
{
console
.
log
(
TAG
+
"
testChangeSession001 joinSession again failed
"
);
...
...
@@ -600,7 +605,7 @@ describe('objectStoreTest', function () {
var
setTime
=
0
;
var
onTime
=
0
;
var
offTime
=
0
;
for
(
var
i
=
0
;
i
<
100
;
i
++
)
{
for
(
var
i
=
0
;
i
<
100
;
i
++
)
{
st1
=
Date
.
now
();
complexObject
.
setSessionId
(
"
session14
"
);
setSessionIdTime
+=
Date
.
now
()
-
st1
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录