Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
b752e97b
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看板
未验证
提交
b752e97b
编写于
8月 19, 2022
作者:
O
openharmony_ci
提交者:
Gitee
8月 19, 2022
浏览文件
操作
浏览文件
下载
差异文件
!4977 杂散子系统适配开发修改
Merge pull request !4977 from 高曦/OpenHarmony-3.1-Release
上级
37adfc46
a25dc02c
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
58 addition
and
33 deletion
+58
-33
miscservices/wallpaper_js/src/main/js/Test/Wallpaper/WallpaperJsunit.test.js
...per_js/src/main/js/Test/Wallpaper/WallpaperJsunit.test.js
+58
-33
未找到文件。
miscservices/wallpaper_js/src/main/js/Test/Wallpaper/WallpaperJsunit.test.js
浏览文件 @
b752e97b
...
...
@@ -76,7 +76,7 @@ describe('WallpaperJsunitTest', function () {
console
.
info
(
'
wallpaperXTS ===> testGetColorsCallbackSystem data :
'
+
data
[
0
][
2
]);
console
.
info
(
'
wallpaperXTS ===> testGetColorsCallbackSystem data :
'
+
data
[
0
][
3
]);
if
(
err
)
{
expect
(
null
).
assertFail
(
);
expect
(
err
.
code
).
assertEqual
(
801
);
}
if
((
data
!=
undefined
)
&&
(
data
!=
null
)
&&
(
data
!=
''
))
{
expect
(
true
).
assertTrue
();
...
...
@@ -100,7 +100,7 @@ describe('WallpaperJsunitTest', function () {
}).
catch
((
err
)
=>
{
console
.
info
(
'
wallpaperXTS ===> testGetColorsPromiseSystem err :
'
+
JSON
.
stringify
(
err
));
if
(
err
)
{
expect
(
err
.
code
!=
null
).
assertTrue
(
);
expect
(
err
.
code
).
assertEqual
(
801
);
}
});
done
();
...
...
@@ -117,7 +117,7 @@ describe('WallpaperJsunitTest', function () {
console
.
info
(
'
wallpaperXTS ===> testGetColorsCallbackLock err :
'
+
JSON
.
stringify
(
err
));
console
.
info
(
'
wallpaperXTS ===> testGetColorsCallbackLock data :
'
+
JSON
.
stringify
(
data
));
if
(
err
)
{
expect
(
err
.
code
===
null
).
assertFalse
(
);
expect
(
err
.
code
).
assertEqual
(
801
);
done
();
}
if
((
data
!=
undefined
)
&&
(
data
!=
null
)
&&
(
data
!=
''
))
{
...
...
@@ -144,7 +144,7 @@ describe('WallpaperJsunitTest', function () {
}).
catch
((
err
)
=>
{
console
.
info
(
'
wallpaperXTS ===> testGetColorsPromiseSystem err :
'
+
JSON
.
stringify
(
err
));
if
(
err
)
{
expect
(
err
.
code
===
null
).
assertFalse
(
);
expect
(
err
.
code
).
assertEqual
(
801
);
}
done
();
});
...
...
@@ -489,8 +489,11 @@ describe('WallpaperJsunitTest', function () {
console
.
info
(
'
wallpaperXTS ===> testSetWallpaperURLPromiseLock data :
'
+
JSON
.
stringify
(
data
));
if
((
data
!=
undefined
)
&&
(
data
!=
null
)
&&
(
data
!=
''
))
{
expect
(
true
).
assertTrue
();
done
();
}
else
{
expect
().
assertFail
();
done
();
}
done
();
}).
catch
((
err
)
=>
{
console
.
info
(
'
wallpaperXTS ===> testSetWallpaperURLPromiseLock err :
'
+
JSON
.
stringify
(
err
));
expect
(
true
).
assertTrue
();
...
...
@@ -509,14 +512,14 @@ describe('WallpaperJsunitTest', function () {
await
wallpaper
.
setWallpaper
(
imageSource
,
WALLPAPER_SYSTEM
,
function
(
err
,
data
)
{
console
.
info
(
'
wallpaperXTS ===> testSetWallpaperURLCallbackSystem err :
'
+
JSON
.
stringify
(
err
));
console
.
info
(
'
wallpaperXTS ===> testSetWallpaperURLCallbackSystem data :
'
+
JSON
.
stringify
(
data
));
if
(
err
)
{
expect
(
null
).
assertFail
();
}
if
((
data
!=
undefined
)
&&
(
data
!=
null
)
&&
(
data
!=
''
))
{
if
(
data
!=
undefined
)
{
expect
().
assertFail
();
done
();
}
else
{
expect
(
true
).
assertTrue
();
done
();
}
});
done
();
})
/*
...
...
@@ -556,14 +559,14 @@ describe('WallpaperJsunitTest', function () {
await
wallpaper
.
setWallpaper
(
imageSource
,
WALLPAPER_LOCKSCREEN
,
function
(
err
,
data
)
{
console
.
info
(
'
wallpaperXTS ===> testSetWallpaperURLCallbackLock err :
'
+
JSON
.
stringify
(
err
));
console
.
info
(
'
wallpaperXTS ===> testSetWallpaperURLCallbackLock data :
'
+
JSON
.
stringify
(
data
));
if
(
err
)
{
expect
(
null
).
assertFail
();
}
if
((
data
!=
undefined
)
&&
(
data
!=
null
)
&&
(
data
!=
''
))
{
if
(
data
!=
undefined
)
{
expect
().
assertFail
();
done
();
}
else
{
expect
(
true
).
assertTrue
();
done
();
}
});
done
();
})
/*
...
...
@@ -574,7 +577,7 @@ describe('WallpaperJsunitTest', function () {
* @tc.level 0
*/
it
(
'
testOnCallback101
'
,
0
,
async
function
(
done
)
{
await
wallpaper
.
on
(
'
colorChange
'
,
function
(
colors
,
wallpaperType
)
{
let
listener
=
(
colors
,
wallpaperType
)
=>
{
console
.
info
(
'
wallpaperXTS ===> testOnCallback colors :
'
+
JSON
.
stringify
(
colors
));
console
.
info
(
'
wallpaperXTS ===> testOnCallback wallpaperType :
'
+
JSON
.
stringify
(
wallpaperType
));
if
((
colors
!=
undefined
)
&&
(
colors
!=
null
)
&&
(
colors
!=
''
))
{
...
...
@@ -583,28 +586,50 @@ describe('WallpaperJsunitTest', function () {
if
((
wallpaperType
!=
undefined
)
&&
(
wallpaperType
!=
null
)
&&
(
wallpaperType
!=
''
))
{
expect
(
true
).
assertTrue
();
}
})
done
();
};
await
wallpaper
.
on
(
'
colorChange
'
,
listener
)
await
wallpaper
.
off
(
'
colorChange
'
,
listener
)
done
()
})
/*
/*
* @tc.number testOffCallback101
* @tc.name Test on_colorChange to registers a listener for wallpaper color changes to
receive notifications about the changes.
* @tc.number testGetFileCallback101
* @tc.name Test getfiule() to the ID of the wallpaper of the specified type.
* @tc.desc Function test
* @tc.level 0
*/
it
(
'
testOffCallback101
'
,
0
,
async
function
(
done
)
{
await
wallpaper
.
off
(
'
colorChange
'
,
function
(
colors
,
wallpaperType
)
{
console
.
info
(
'
wallpaperXTS ===> testOffCallback colors :
'
+
JSON
.
stringify
(
colors
));
console
.
info
(
'
wallpaperXTS ===> testOffCallback wallpaperType :
'
+
JSON
.
stringify
(
wallpaperType
));
if
((
colors
!=
undefined
)
&&
(
colors
!=
null
)
&&
(
colors
!=
''
))
{
expect
(
true
).
assertTrue
();
}
if
((
wallpaperType
!=
undefined
)
&&
(
wallpaperType
!=
null
)
&&
(
wallpaperType
!=
''
))
{
expect
(
true
).
assertTrue
();
it
(
'
testGetFileCallback101
'
,
0
,
async
function
(
done
)
{
wallpaper
.
getFile
(
wallpaper
.
WallpaperType
.
WALLPAPER_SYSTEM
,
(
error
,
data
)
=>
{
if
(
error
)
{
console
.
error
(
`failed to testGetFileCallback101 because: `
+
JSON
.
stringify
(
error
));
expect
(
error
.
code
).
assertEqual
(
"
801
"
);
done
();
}
})
done
(
);
console
.
info
(
`success to getFile: `
+
JSON
.
stringify
(
data
));
}
);
})
/*
* @tc.number testGetFilePromise101
* @tc.name Test getfile() to the ID of the wallpaper of the specified type.
* @tc.desc Function test
* @tc.level 0
*/
it
(
'
testGetFilePromise101
'
,
0
,
async
function
(
done
)
{
await
wallpaper
.
getFile
(
wallpaper
.
WallpaperType
.
WALLPAPER_SYSTEM
).
then
((
data
)
=>
{
console
.
info
(
`success to getFile: `
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertTrue
();
done
();
}).
catch
((
error
)
=>
{
console
.
error
(
`failed to testGetFilePromise101 because: `
+
JSON
.
stringify
(
error
));
console
.
info
(
typeof
(
error
.
code
));
expect
(
error
.
code
).
assertEqual
(
"
801
"
);
done
();
});
})
})
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录