Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
816f92c5
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,发现更多精彩内容 >>
未验证
提交
816f92c5
编写于
3月 19, 2022
作者:
O
openharmony_ci
提交者:
Gitee
3月 19, 2022
浏览文件
操作
浏览文件
下载
差异文件
!2659 【窗口子系统】修改窗口截屏用例耗时 和 修改接口错误码
Merge pull request !2659 from liziqiang/cherry-pick-1647664905
上级
d762b06a
c7400cfb
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
478 addition
and
34 deletion
+478
-34
graphic/windowstandard/src/main/js/default/pages/index/index.js
...c/windowstandard/src/main/js/default/pages/index/index.js
+3
-0
graphic/windowstandard/src/main/js/default/test/List.test.js
graphic/windowstandard/src/main/js/default/test/List.test.js
+1
-1
graphic/windowstandard/src/main/js/default/test/screenshot.test.js
...indowstandard/src/main/js/default/test/screenshot.test.js
+443
-0
graphic/windowstandard/src/main/js/default/test/window.api.part2.js
...ndowstandard/src/main/js/default/test/window.api.part2.js
+29
-31
graphic/windowstandard/src/main/js/default/test/window.promise.js
...windowstandard/src/main/js/default/test/window.promise.js
+2
-2
未找到文件。
graphic/windowstandard/src/main/js/default/pages/index/index.js
浏览文件 @
816f92c5
...
@@ -24,5 +24,8 @@ export default {
...
@@ -24,5 +24,8 @@ export default {
},
},
onInit
()
{
onInit
()
{
this
.
title
=
this
.
$t
(
'
strings.world
'
);
this
.
title
=
this
.
$t
(
'
strings.world
'
);
const
configService
=
core
.
getDefaultService
(
'
config
'
);
this
.
timeout
=
15000
;
configService
.
setConfig
(
this
);
}
}
}
}
graphic/windowstandard/src/main/js/default/test/List.test.js
浏览文件 @
816f92c5
...
@@ -17,5 +17,5 @@ require('./window.api.part2.js')
...
@@ -17,5 +17,5 @@ require('./window.api.part2.js')
require
(
'
./window.test.js
'
)
require
(
'
./window.test.js
'
)
require
(
'
./window.parameter.js
'
)
require
(
'
./window.parameter.js
'
)
require
(
'
./window.promise.js
'
)
require
(
'
./window.promise.js
'
)
require
(
'
./
display.screenshot.api
.js
'
)
require
(
'
./
screenshot.test
.js
'
)
graphic/windowstandard/src/main/js/default/test/
display.screenshot.api
.js
→
graphic/windowstandard/src/main/js/default/test/
screenshot.test
.js
浏览文件 @
816f92c5
...
@@ -12,16 +12,14 @@
...
@@ -12,16 +12,14 @@
* * See the License for the specific language governing permissions and
* * See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
* */
* */
import
app
from
'
@system.app
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
display
from
'
@ohos.display
'
import
display
from
'
@ohos.display
'
import
screenshot
from
'
@ohos.screenshot
'
import
screenshot
from
'
@ohos.screenshot
'
import
image
from
'
@ohos.multimedia.image
'
import
image
from
'
@ohos.multimedia.image
'
import
screen
from
'
@ohos.screen
'
describe
(
'
screenshot_test
'
,
function
()
{
describe
(
'
screenshot_test
'
,
function
()
{
const
TRUE_FLAG
=
true
;
const
FALSE_FLAG
=
false
;
beforeAll
(
function
()
{
beforeAll
(
function
()
{
})
})
beforeEach
(
function
()
{
beforeEach
(
function
()
{
...
@@ -33,13 +31,14 @@ describe('screenshot_test', function () {
...
@@ -33,13 +31,14 @@ describe('screenshot_test', function () {
/**
/**
* @tc.number SUB_SCREENSHOT_SAVE_JSAPI_001
* @tc.number SUB_SCREENSHOT_SAVE_JSAPI_001
* @tc.name Test screenShotSave
Test
1
* @tc.name Test screenShotSave
_Test_00
1
* @tc.desc Set the screenshot area to be larger than the screen width and height
* @tc.desc Set the screenshot area to be larger than the screen width and height
*/
*/
it
(
'
screenShotSave
Test
1
'
,
0
,
function
(
done
)
{
it
(
'
screenShotSave
_Test_00
1
'
,
0
,
function
(
done
)
{
console
.
log
(
'
jsunitt
est screenShotSaveTest1 begin
'
);
console
.
log
(
'
screenshotT
est screenShotSaveTest1 begin
'
);
display
.
getDefaultDisplay
().
then
((
dsp
)
=>
{
display
.
getDefaultDisplay
().
then
((
dsp
)
=>
{
console
.
log
(
'
jsunittest screenShotSaveTest1 display.getDefaultDisplay success, dsp :
'
+
JSON
.
stringify
(
dsp
));
console
.
log
(
'
screenshotTest screenShotSaveTest1 display.getDefaultDisplay success, dsp :
'
+
JSON
.
stringify
(
dsp
));
expect
(
dsp
!=
null
).
assertTrue
();
var
screenshotOptions
=
{
var
screenshotOptions
=
{
screenRect
:
{
screenRect
:
{
left
:
0
,
left
:
0
,
...
@@ -54,30 +53,31 @@ describe('screenshot_test', function () {
...
@@ -54,30 +53,31 @@ describe('screenshot_test', function () {
displayId
:
dsp
.
id
displayId
:
dsp
.
id
};
};
screenshot
.
save
(
screenshotOptions
).
then
((
data
)
=>
{
screenshot
.
save
(
screenshotOptions
).
then
((
data
)
=>
{
console
.
log
(
'
jsunitt
est screenShotSaveTest1 screenshot.save success, data :
'
+
JSON
.
stringify
(
data
));
console
.
log
(
'
screenshotT
est screenShotSaveTest1 screenshot.save success, data :
'
+
JSON
.
stringify
(
data
));
expect
(
TRUE_FLAG
).
assertFail
();
expect
().
assertFail
();
done
();
done
();
},
(
err
)
=>
{
},
(
err
)
=>
{
console
.
log
(
'
jsunitt
est screenShotSaveTest1 screenshot.save failed, err :
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
screenshotT
est screenShotSaveTest1 screenshot.save failed, err :
'
+
JSON
.
stringify
(
err
));
expect
(
TRUE_FLAG
).
assertTrue
();
expect
(
err
.
code
==
120
).
assertTrue
();
done
();
done
();
})
})
},
(
err
)
=>
{
},
(
err
)
=>
{
console
.
log
(
'
jsunitt
est screenShotSaveTest1 display.getDefaultDisplay failed, err :
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
screenshotT
est screenShotSaveTest1 display.getDefaultDisplay failed, err :
'
+
JSON
.
stringify
(
err
));
expect
(
TRUE_FLAG
).
assertFail
();
expect
().
assertFail
();
done
();
done
();
})
})
})
})
/**
/**
* @tc.number SUB_SCREENSHOT_SAVE_JSAPI_002
* @tc.number SUB_SCREENSHOT_SAVE_JSAPI_002
* @tc.name Test screenShotSave
Test
2
* @tc.name Test screenShotSave
_Test_00
2
* @tc.desc Set the size of the screenshot area and the generated image to be larger than the screen width and height
* @tc.desc Set the size of the screenshot area and the generated image to be larger than the screen width and height
*/
*/
it
(
'
screenShotSave
Test
2
'
,
0
,
function
(
done
)
{
it
(
'
screenShotSave
_Test_00
2
'
,
0
,
function
(
done
)
{
console
.
log
(
'
jsunitt
est screenShotSaveTest2 begin
'
);
console
.
log
(
'
screenshotT
est screenShotSaveTest2 begin
'
);
display
.
getDefaultDisplay
().
then
((
dsp
)
=>
{
display
.
getDefaultDisplay
().
then
((
dsp
)
=>
{
console
.
log
(
'
jsunittest screenShotSaveTest2 display.getDefaultDisplay success, dsp :
'
+
JSON
.
stringify
(
dsp
));
console
.
log
(
'
screenshotTest screenShotSaveTest2 display.getDefaultDisplay success, dsp :
'
+
JSON
.
stringify
(
dsp
));
expect
(
dsp
!=
null
).
assertTrue
();
var
screenshotOptions
=
{
var
screenshotOptions
=
{
screenRect
:
{
screenRect
:
{
left
:
0
,
left
:
0
,
...
@@ -92,30 +92,31 @@ describe('screenshot_test', function () {
...
@@ -92,30 +92,31 @@ describe('screenshot_test', function () {
displayId
:
dsp
.
id
displayId
:
dsp
.
id
};
};
screenshot
.
save
(
screenshotOptions
).
then
((
data
)
=>
{
screenshot
.
save
(
screenshotOptions
).
then
((
data
)
=>
{
console
.
log
(
'
jsunitt
est screenShotSaveTest2 screenshot.save success, data :
'
+
JSON
.
stringify
(
data
));
console
.
log
(
'
screenshotT
est screenShotSaveTest2 screenshot.save success, data :
'
+
JSON
.
stringify
(
data
));
expect
(
TRUE_FLAG
).
assertFail
();
expect
().
assertFail
();
done
();
done
();
},
(
err
)
=>
{
},
(
err
)
=>
{
console
.
log
(
'
jsunitt
est screenShotSaveTest2 screenshot.save failed, err :
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
screenshotT
est screenShotSaveTest2 screenshot.save failed, err :
'
+
JSON
.
stringify
(
err
));
expect
(
TRUE_FLAG
).
assertTrue
();
expect
(
err
.
code
==
120
).
assertTrue
();
done
();
done
();
})
})
},
(
err
)
=>
{
},
(
err
)
=>
{
console
.
log
(
'
jsunitt
est screenShotSaveTest2 display.getDefaultDisplay failed, err :
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
screenshotT
est screenShotSaveTest2 display.getDefaultDisplay failed, err :
'
+
JSON
.
stringify
(
err
));
expect
(
TRUE_FLAG
).
assertFail
();
expect
().
assertFail
();
done
()
done
()
})
})
})
})
/**
/**
* @tc.number SUB_SCREENSHOT_SAVE_JSAPI_003
* @tc.number SUB_SCREENSHOT_SAVE_JSAPI_003
* @tc.name Test screenShotSave
Test
3
* @tc.name Test screenShotSave
_Test_00
3
* @tc.desc Set the screenshot area and the size of the generated image to be smaller than the screen width and height
* @tc.desc Set the screenshot area and the size of the generated image to be smaller than the screen width and height
*/
*/
it
(
'
screenShotSave
Test
3
'
,
0
,
function
(
done
)
{
it
(
'
screenShotSave
_Test_00
3
'
,
0
,
function
(
done
)
{
console
.
log
(
'
jsunitt
est screenShotSaveTest3 begin
'
);
console
.
log
(
'
screenshotT
est screenShotSaveTest3 begin
'
);
display
.
getDefaultDisplay
().
then
((
dsp
)
=>
{
display
.
getDefaultDisplay
().
then
((
dsp
)
=>
{
console
.
log
(
'
jsunittest screenShotSaveTest3 display.getDefaultDisplay success, dsp :
'
+
JSON
.
stringify
(
dsp
));
console
.
log
(
'
screenshotTest screenShotSaveTest3 display.getDefaultDisplay success, dsp :
'
+
JSON
.
stringify
(
dsp
));
expect
(
dsp
!=
null
).
assertTrue
();
var
screenshotOptions
=
{
var
screenshotOptions
=
{
screenRect
:
{
screenRect
:
{
left
:
0
,
left
:
0
,
...
@@ -130,30 +131,31 @@ describe('screenshot_test', function () {
...
@@ -130,30 +131,31 @@ describe('screenshot_test', function () {
displayId
:
dsp
.
id
displayId
:
dsp
.
id
};
};
screenshot
.
save
(
screenshotOptions
).
then
((
data
)
=>
{
screenshot
.
save
(
screenshotOptions
).
then
((
data
)
=>
{
console
.
log
(
'
jsunitt
est screenShotSaveTest3 screenshot.save success, data :
'
+
JSON
.
stringify
(
data
));
console
.
log
(
'
screenshotT
est screenShotSaveTest3 screenshot.save success, data :
'
+
JSON
.
stringify
(
data
));
expect
(
!!
data
).
assertTrue
();
expect
(
data
!=
null
).
assertTrue
();
done
();
done
();
},
(
err
)
=>
{
},
(
err
)
=>
{
console
.
log
(
'
jsunitt
est screenShotSaveTest3 screenshot.save failed, err :
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
screenshotT
est screenShotSaveTest3 screenshot.save failed, err :
'
+
JSON
.
stringify
(
err
));
expect
(
TRUE_FLAG
).
assertFail
();
expect
().
assertFail
();
done
();
done
();
})
})
},
(
err
)
=>
{
},
(
err
)
=>
{
console
.
log
(
'
jsunitt
est screenShotSaveTest3 display.getDefaultDisplay failed, err :
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
screenshotT
est screenShotSaveTest3 display.getDefaultDisplay failed, err :
'
+
JSON
.
stringify
(
err
));
expect
(
TRUE_FLAG
).
assertFail
();
expect
().
assertFail
();
done
();
done
();
})
})
})
})
/**
/**
* @tc.number SUB_SCREENSHOT_SAVE_JSAPI_004
* @tc.number SUB_SCREENSHOT_SAVE_JSAPI_004
* @tc.name Test screenShotSave
Test
4
* @tc.name Test screenShotSave
_Test_00
4
* @tc.desc Set the size of the generated image to be smaller than the screen width and height
* @tc.desc Set the size of the generated image to be smaller than the screen width and height
*/
*/
it
(
'
screenShotSave
Test
4
'
,
0
,
function
(
done
)
{
it
(
'
screenShotSave
_Test_00
4
'
,
0
,
function
(
done
)
{
console
.
log
(
'
jsunitt
est screenShotSaveTest4 begin
'
);
console
.
log
(
'
screenshotT
est screenShotSaveTest4 begin
'
);
display
.
getDefaultDisplay
().
then
((
dsp
)
=>
{
display
.
getDefaultDisplay
().
then
((
dsp
)
=>
{
console
.
log
(
'
jsunittest screenShotSaveTest4 display.getDefaultDisplay success, dsp :
'
+
JSON
.
stringify
(
dsp
));
console
.
log
(
'
screenshotTest screenShotSaveTest4 display.getDefaultDisplay success, dsp :
'
+
JSON
.
stringify
(
dsp
));
expect
(
dsp
!=
null
).
assertTrue
();
var
screenshotOptions
=
{
var
screenshotOptions
=
{
screenRect
:
{
screenRect
:
{
left
:
0
,
left
:
0
,
...
@@ -168,30 +170,31 @@ describe('screenshot_test', function () {
...
@@ -168,30 +170,31 @@ describe('screenshot_test', function () {
displayId
:
dsp
.
id
displayId
:
dsp
.
id
};
};
screenshot
.
save
(
screenshotOptions
).
then
((
data
)
=>
{
screenshot
.
save
(
screenshotOptions
).
then
((
data
)
=>
{
console
.
log
(
'
jsunitt
est screenShotSaveTest4 screenshot.save success, data :
'
+
JSON
.
stringify
(
data
));
console
.
log
(
'
screenshotT
est screenShotSaveTest4 screenshot.save success, data :
'
+
JSON
.
stringify
(
data
));
expect
(
!!
data
).
assertTrue
()
expect
(
data
!=
null
).
assertTrue
();
done
();
done
();
},
(
err
)
=>
{
},
(
err
)
=>
{
console
.
log
(
'
jsunitt
est screenShotSaveTest4 screenshot.save failed, err :
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
screenshotT
est screenShotSaveTest4 screenshot.save failed, err :
'
+
JSON
.
stringify
(
err
));
expect
(
TRUE_FLAG
).
assertFail
();
expect
().
assertFail
();
done
();
done
();
})
})
},
(
err
)
=>
{
},
(
err
)
=>
{
console
.
log
(
'
jsunitt
est screenShotSaveTest4 display.getDefaultDisplay failed, err :
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
screenshotT
est screenShotSaveTest4 display.getDefaultDisplay failed, err :
'
+
JSON
.
stringify
(
err
));
expect
(
TRUE_FLAG
).
assertFail
();
expect
().
assertFail
();
done
();
done
();
})
})
})
})
/**
/**
* @tc.number SUB_SCREENSHOT_SAVE_JSAPI_005
* @tc.number SUB_SCREENSHOT_SAVE_JSAPI_005
* @tc.name Test screenShotSave
Test
5
* @tc.name Test screenShotSave
_Test_00
5
* @tc.desc Set the screenshot area to a negative value
* @tc.desc Set the screenshot area to a negative value
*/
*/
it
(
'
screenShotSave
Test
5
'
,
0
,
function
(
done
)
{
it
(
'
screenShotSave
_Test_00
5
'
,
0
,
function
(
done
)
{
console
.
log
(
'
jsunitt
est screenShotSaveTest5 begin
'
);
console
.
log
(
'
screenshotT
est screenShotSaveTest5 begin
'
);
display
.
getDefaultDisplay
().
then
((
dsp
)
=>
{
display
.
getDefaultDisplay
().
then
((
dsp
)
=>
{
console
.
log
(
'
jsunittest screenShotSaveTest5 display.getDefaultDisplay success, dsp :
'
+
JSON
.
stringify
(
dsp
));
console
.
log
(
'
screenshotTest screenShotSaveTest5 display.getDefaultDisplay success, dsp :
'
+
JSON
.
stringify
(
dsp
));
expect
(
dsp
!=
null
).
assertTrue
();
var
screenshotOptions
=
{
var
screenshotOptions
=
{
screenRect
:
{
screenRect
:
{
left
:
-
50
,
left
:
-
50
,
...
@@ -206,30 +209,31 @@ describe('screenshot_test', function () {
...
@@ -206,30 +209,31 @@ describe('screenshot_test', function () {
displayId
:
dsp
.
id
displayId
:
dsp
.
id
};
};
screenshot
.
save
(
screenshotOptions
).
then
((
data
)
=>
{
screenshot
.
save
(
screenshotOptions
).
then
((
data
)
=>
{
console
.
log
(
'
jsunitt
est screenShotSaveTest5 screenshot.save success, data :
'
+
JSON
.
stringify
(
data
));
console
.
log
(
'
screenshotT
est screenShotSaveTest5 screenshot.save success, data :
'
+
JSON
.
stringify
(
data
));
expect
(
TRUE_FLAG
).
assertFail
();
expect
().
assertFail
();
done
();
done
();
},
(
err
)
=>
{
},
(
err
)
=>
{
console
.
log
(
'
jsunitt
est screenShotSaveTest5 screenshot.save failed, err :
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
screenshotT
est screenShotSaveTest5 screenshot.save failed, err :
'
+
JSON
.
stringify
(
err
));
expect
(
TRUE_FLAG
).
assertTrue
();
expect
(
err
.
code
==
120
).
assertTrue
();
done
();
done
();
})
})
},
(
err
)
=>
{
},
(
err
)
=>
{
console
.
log
(
'
jsunitt
est screenShotSaveTest5 display.getDefaultDisplay failed, err :
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
screenshotT
est screenShotSaveTest5 display.getDefaultDisplay failed, err :
'
+
JSON
.
stringify
(
err
));
expect
(
TRUE_FLAG
).
assertFail
();
expect
().
assertFail
();
done
();
done
();
})
})
})
})
/**
/**
* @tc.number SUB_SCREENSHOT_SAVE_JSAPI_006
* @tc.number SUB_SCREENSHOT_SAVE_JSAPI_006
* @tc.name Test screenShotSave
Test
6
* @tc.name Test screenShotSave
_Test_00
6
* @tc.desc Set the screenshot area to 0
* @tc.desc Set the screenshot area to 0
*/
*/
it
(
'
screenShotSave
Test
6
'
,
0
,
function
(
done
)
{
it
(
'
screenShotSave
_Test_00
6
'
,
0
,
function
(
done
)
{
console
.
log
(
'
jsunitt
est screenShotSaveTest6 begin
'
);
console
.
log
(
'
screenshotT
est screenShotSaveTest6 begin
'
);
display
.
getDefaultDisplay
().
then
((
dsp
)
=>
{
display
.
getDefaultDisplay
().
then
((
dsp
)
=>
{
console
.
log
(
'
jsunittest screenShotSaveTest6 display.getDefaultDisplay success, dsp :
'
+
JSON
.
stringify
(
dsp
));
console
.
log
(
'
screenshotTest screenShotSaveTest6 display.getDefaultDisplay success, dsp :
'
+
JSON
.
stringify
(
dsp
));
expect
(
dsp
!=
null
).
assertTrue
();
var
screenshotOptions
=
{
var
screenshotOptions
=
{
screenRect
:
{
screenRect
:
{
left
:
0
,
left
:
0
,
...
@@ -244,30 +248,31 @@ describe('screenshot_test', function () {
...
@@ -244,30 +248,31 @@ describe('screenshot_test', function () {
displayId
:
dsp
.
id
displayId
:
dsp
.
id
};
};
screenshot
.
save
(
screenshotOptions
).
then
((
data
)
=>
{
screenshot
.
save
(
screenshotOptions
).
then
((
data
)
=>
{
console
.
log
(
'
jsunitt
est screenShotSaveTest6 screenshot.save success, data :
'
+
JSON
.
stringify
(
data
));
console
.
log
(
'
screenshotT
est screenShotSaveTest6 screenshot.save success, data :
'
+
JSON
.
stringify
(
data
));
expect
(
!!
data
).
assertTrue
()
expect
(
data
!=
null
).
assertTrue
();
done
();
done
();
},
(
err
)
=>
{
},
(
err
)
=>
{
console
.
log
(
'
jsunitt
est screenShotSaveTest6 screenshot.save failed, err :
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
screenshotT
est screenShotSaveTest6 screenshot.save failed, err :
'
+
JSON
.
stringify
(
err
));
expect
(
TRUE_FLAG
).
assertFail
();
expect
().
assertFail
();
done
()
done
()
})
})
},
(
err
)
=>
{
},
(
err
)
=>
{
console
.
log
(
'
jsunitt
est screenShotSaveTest6 display.getDefaultDisplay failed, err :
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
screenshotT
est screenShotSaveTest6 display.getDefaultDisplay failed, err :
'
+
JSON
.
stringify
(
err
));
expect
(
TRUE_FLAG
).
assertFail
();
expect
().
assertFail
();
done
();
done
();
})
})
})
})
/**
/**
* @tc.number SUB_SCREENSHOT_SAVE_JSAPI_007
* @tc.number SUB_SCREENSHOT_SAVE_JSAPI_007
* @tc.name Test screenShotSave
Test
7
* @tc.name Test screenShotSave
_Test_00
7
* @tc.desc Set the generated image size to a negative value
* @tc.desc Set the generated image size to a negative value
*/
*/
it
(
'
screenShotSave
Test
7
'
,
0
,
function
(
done
)
{
it
(
'
screenShotSave
_Test_00
7
'
,
0
,
function
(
done
)
{
console
.
log
(
'
jsunitt
est screenShotSaveTest7 begin
'
);
console
.
log
(
'
screenshotT
est screenShotSaveTest7 begin
'
);
display
.
getDefaultDisplay
().
then
((
dsp
)
=>
{
display
.
getDefaultDisplay
().
then
((
dsp
)
=>
{
console
.
log
(
'
jsunittest screenShotSaveTest7 display.getDefaultDisplay success, dsp :
'
+
JSON
.
stringify
(
dsp
));
console
.
log
(
'
screenshotTest screenShotSaveTest7 display.getDefaultDisplay success, dsp :
'
+
JSON
.
stringify
(
dsp
));
expect
(
dsp
!=
null
).
assertTrue
();
var
screenshotOptions
=
{
var
screenshotOptions
=
{
screenRect
:
{
screenRect
:
{
left
:
0
,
left
:
0
,
...
@@ -282,30 +287,31 @@ describe('screenshot_test', function () {
...
@@ -282,30 +287,31 @@ describe('screenshot_test', function () {
displayId
:
dsp
.
id
displayId
:
dsp
.
id
};
};
screenshot
.
save
(
screenshotOptions
).
then
((
data
)
=>
{
screenshot
.
save
(
screenshotOptions
).
then
((
data
)
=>
{
console
.
log
(
'
jsunitt
est screenShotSaveTest7 screenshot.save success, data :
'
+
JSON
.
stringify
(
data
));
console
.
log
(
'
screenshotT
est screenShotSaveTest7 screenshot.save success, data :
'
+
JSON
.
stringify
(
data
));
expect
(
TRUE_FLAG
).
assertFail
();
expect
().
assertFail
();
done
();
done
();
},
(
err
)
=>
{
},
(
err
)
=>
{
console
.
log
(
'
jsunitt
est screenShotSaveTest7 screenshot.save failed, err :
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
screenshotT
est screenShotSaveTest7 screenshot.save failed, err :
'
+
JSON
.
stringify
(
err
));
expect
(
TRUE_FLAG
).
assertTrue
();
expect
(
err
.
code
==
120
).
assertTrue
();
done
();
done
();
})
})
},
(
err
)
=>
{
},
(
err
)
=>
{
console
.
log
(
'
jsunitt
est screenShotSaveTest7 display.getDefaultDisplay failed, err :
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
screenshotT
est screenShotSaveTest7 display.getDefaultDisplay failed, err :
'
+
JSON
.
stringify
(
err
));
expect
(
TRUE_FLAG
).
assertFail
();
expect
().
assertFail
();
done
();
done
();
})
})
})
})
/**
/**
* @tc.number SUB_SCREENSHOT_SAVE_JSAPI_008
* @tc.number SUB_SCREENSHOT_SAVE_JSAPI_008
* @tc.name Test screenShotSave
Test
8
* @tc.name Test screenShotSave
_Test_00
8
* @tc.desc Set the generated image size to 0
* @tc.desc Set the generated image size to 0
*/
*/
it
(
'
screenShotSave
Test
8
'
,
0
,
function
(
done
)
{
it
(
'
screenShotSave
_Test_00
8
'
,
0
,
function
(
done
)
{
console
.
log
(
'
jsunitt
est screenShotSaveTest8 begin
'
);
console
.
log
(
'
screenshotT
est screenShotSaveTest8 begin
'
);
display
.
getDefaultDisplay
().
then
((
dsp
)
=>
{
display
.
getDefaultDisplay
().
then
((
dsp
)
=>
{
console
.
log
(
'
jsunittest screenShotSaveTest8 display.getDefaultDisplay success, dsp :
'
+
JSON
.
stringify
(
dsp
));
console
.
log
(
'
screenshotTest screenShotSaveTest8 display.getDefaultDisplay success, dsp :
'
+
JSON
.
stringify
(
dsp
));
expect
(
dsp
!=
null
).
assertTrue
();
var
screenshotOptions
=
{
var
screenshotOptions
=
{
screenRect
:
{
screenRect
:
{
left
:
0
,
left
:
0
,
...
@@ -320,30 +326,31 @@ describe('screenshot_test', function () {
...
@@ -320,30 +326,31 @@ describe('screenshot_test', function () {
displayId
:
dsp
.
id
displayId
:
dsp
.
id
};
};
screenshot
.
save
(
screenshotOptions
).
then
((
data
)
=>
{
screenshot
.
save
(
screenshotOptions
).
then
((
data
)
=>
{
console
.
log
(
'
jsunitt
est screenShotSaveTest8 screenshot.save success, data :
'
+
JSON
.
stringify
(
data
));
console
.
log
(
'
screenshotT
est screenShotSaveTest8 screenshot.save success, data :
'
+
JSON
.
stringify
(
data
));
expect
(
!!
data
).
assertTrue
()
expect
(
data
!=
null
).
assertTrue
();
done
();
done
();
},
(
err
)
=>
{
},
(
err
)
=>
{
console
.
log
(
'
jsunitt
est screenShotSaveTest8 screenshot.save failed, err :
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
screenshotT
est screenShotSaveTest8 screenshot.save failed, err :
'
+
JSON
.
stringify
(
err
));
expect
(
TRUE_FLAG
).
assertFail
();
expect
().
assertFail
();
done
();
done
();
})
})
},
(
err
)
=>
{
},
(
err
)
=>
{
console
.
log
(
'
jsunitt
est screenShotSaveTest8 display.getDefaultDisplay failed, err :
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
screenshotT
est screenShotSaveTest8 display.getDefaultDisplay failed, err :
'
+
JSON
.
stringify
(
err
));
expect
(
TRUE_FLAG
).
assertFail
();
expect
().
assertFail
();
done
();
done
();
})
})
})
})
/**
/**
* @tc.number SUB_SCREENSHOT_SAVE_JSAPI_009
* @tc.number SUB_SCREENSHOT_SAVE_JSAPI_009
* @tc.name Test screenShotSave
Test
9
* @tc.name Test screenShotSave
_Test_00
9
* @tc.desc Set the screenshot area and the size of the generated image to be equal to the screen width and height
* @tc.desc Set the screenshot area and the size of the generated image to be equal to the screen width and height
*/
*/
it
(
'
screenShotSave
Test
9
'
,
0
,
function
(
done
)
{
it
(
'
screenShotSave
_Test_00
9
'
,
0
,
function
(
done
)
{
console
.
log
(
'
jsunitt
est screenShotSaveTest9 begin
'
);
console
.
log
(
'
screenshotT
est screenShotSaveTest9 begin
'
);
display
.
getDefaultDisplay
().
then
((
dsp
)
=>
{
display
.
getDefaultDisplay
().
then
((
dsp
)
=>
{
console
.
log
(
'
jsunittest screenShotSaveTest9 display.getDefaultDisplay success, dsp :
'
+
JSON
.
stringify
(
dsp
));
console
.
log
(
'
screenshotTest screenShotSaveTest9 display.getDefaultDisplay success, dsp :
'
+
JSON
.
stringify
(
dsp
));
expect
(
dsp
!=
null
).
assertTrue
();
var
screenshotOptions
=
{
var
screenshotOptions
=
{
screenRect
:
{
screenRect
:
{
left
:
0
,
left
:
0
,
...
@@ -358,27 +365,27 @@ describe('screenshot_test', function () {
...
@@ -358,27 +365,27 @@ describe('screenshot_test', function () {
displayId
:
dsp
.
id
displayId
:
dsp
.
id
};
};
screenshot
.
save
(
screenshotOptions
).
then
((
data
)
=>
{
screenshot
.
save
(
screenshotOptions
).
then
((
data
)
=>
{
console
.
log
(
'
jsunitt
est screenShotSaveTest9 screenshot.save success, data :
'
+
JSON
.
stringify
(
data
));
console
.
log
(
'
screenshotT
est screenShotSaveTest9 screenshot.save success, data :
'
+
JSON
.
stringify
(
data
));
expect
(
!!
data
).
assertTrue
()
expect
(
data
!=
null
).
assertTrue
();
done
();
done
();
},
(
err
)
=>
{
},
(
err
)
=>
{
console
.
log
(
'
jsunitt
est screenShotSaveTest9 screenshot.save failed, err :
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
screenshotT
est screenShotSaveTest9 screenshot.save failed, err :
'
+
JSON
.
stringify
(
err
));
expect
(
TRUE_FLAG
).
assertFail
();
expect
().
assertFail
();
})
})
},
(
err
)
=>
{
},
(
err
)
=>
{
console
.
log
(
'
jsunitt
est screenShotSaveTest9 display.getDefaultDisplay failed, err :
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
screenshotT
est screenShotSaveTest9 display.getDefaultDisplay failed, err :
'
+
JSON
.
stringify
(
err
));
expect
(
TRUE_FLAG
).
assertFail
();
expect
().
assertFail
();
done
();
done
();
})
})
})
})
/**
/**
* @tc.number SUB_SCREENSHOT_SAVE_JSAPI_010
* @tc.number SUB_SCREENSHOT_SAVE_JSAPI_010
* @tc.name Test screenShotSave
Test
10
* @tc.name Test screenShotSave
_Test_0
10
* @tc.desc Take a screenshot of a screen that doesn't exist
* @tc.desc Take a screenshot of a screen that doesn't exist
*/
*/
it
(
'
screenShotSave
Test
10
'
,
0
,
function
(
done
)
{
it
(
'
screenShotSave
_Test_0
10
'
,
0
,
function
(
done
)
{
console
.
log
(
'
jsunitt
est screenShotSaveTest10 begin
'
);
console
.
log
(
'
screenshotT
est screenShotSaveTest10 begin
'
);
var
screenshotOptions
=
{
var
screenshotOptions
=
{
screenRect
:
{
screenRect
:
{
left
:
0
,
left
:
0
,
...
@@ -393,11 +400,11 @@ describe('screenshot_test', function () {
...
@@ -393,11 +400,11 @@ describe('screenshot_test', function () {
displayId
:
null
displayId
:
null
};
};
screenshot
.
save
(
screenshotOptions
).
then
((
data
)
=>
{
screenshot
.
save
(
screenshotOptions
).
then
((
data
)
=>
{
console
.
log
(
'
jsunitt
est screenShotSaveTest10 screenshot.save success, data :
'
+
JSON
.
stringify
(
data
));
console
.
log
(
'
screenshotT
est screenShotSaveTest10 screenshot.save success, data :
'
+
JSON
.
stringify
(
data
));
expect
(
!!
data
).
assertTrue
()
expect
(
data
!=
null
).
assertTrue
()
done
();
done
();
},
(
err
)
=>
{
},
(
err
)
=>
{
console
.
log
(
'
jsunitt
est screenShotSaveTest10 screenshot.save failed, err :
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
screenshotT
est screenShotSaveTest10 screenshot.save failed, err :
'
+
JSON
.
stringify
(
err
));
expect
(
TRUE_FLAG
).
assertFail
();
expect
(
TRUE_FLAG
).
assertFail
();
done
();
done
();
})
})
...
@@ -405,17 +412,16 @@ describe('screenshot_test', function () {
...
@@ -405,17 +412,16 @@ describe('screenshot_test', function () {
/**
/**
* @tc.number SUB_SCREENSHOT_SAVE_JSAPI_011
* @tc.number SUB_SCREENSHOT_SAVE_JSAPI_011
* @tc.name Test screenShotSave
Test
11
* @tc.name Test screenShotSave
_Test_0
11
* @tc.desc Test screenshot.save API function test11
.
* @tc.desc Test screenshot.save API function test11
*/
*/
it
(
'
screenShotSave
Test
11
'
,
0
,
function
(
done
)
{
it
(
'
screenShotSave
_Test_0
11
'
,
0
,
function
(
done
)
{
console
.
log
(
'
jsunitt
est screenShotSaveTest11 begin
'
);
console
.
log
(
'
screenshotT
est screenShotSaveTest11 begin
'
);
var
screenshotOptions
=
{
var
screenshotOptions
=
{
screenRect
:
{
screenRect
:
{
left
:
0
,
left
:
0
,
top
:
0
,
top
:
0
,
width
:
100
,
width
:
100
,
height
:
100
,
height
:
100
,
},
},
imageSize
:
{
imageSize
:
{
...
@@ -425,14 +431,13 @@ describe('screenshot_test', function () {
...
@@ -425,14 +431,13 @@ describe('screenshot_test', function () {
displayId
:
1000
displayId
:
1000
};
};
screenshot
.
save
(
screenshotOptions
).
then
((
data
)
=>
{
screenshot
.
save
(
screenshotOptions
).
then
((
data
)
=>
{
console
.
log
(
'
jsunitt
est screenShotSaveTest11 screenshot.save success, data :
'
+
JSON
.
stringify
(
data
));
console
.
log
(
'
screenshotT
est screenShotSaveTest11 screenshot.save success, data :
'
+
JSON
.
stringify
(
data
));
expect
(
TRUE_FLAG
).
assertFail
();
expect
().
assertFail
();
done
();
done
();
},
(
err
)
=>
{
},
(
err
)
=>
{
console
.
log
(
'
jsunitt
est screenShotSaveTest11 screenshot.save failed, err :
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
screenshotT
est screenShotSaveTest11 screenshot.save failed, err :
'
+
JSON
.
stringify
(
err
));
expect
(
TRUE_FLAG
).
assertTrue
();
expect
(
err
.
code
==
120
).
assertTrue
();
done
();
done
();
})
})
})
})
})
})
\ No newline at end of file
graphic/windowstandard/src/main/js/default/test/window.api.part2.js
浏览文件 @
816f92c5
...
@@ -29,49 +29,48 @@ describe('window_api_test', function() {
...
@@ -29,49 +29,48 @@ describe('window_api_test', function() {
* @tc.name Test faModelOnOffTest1.
* @tc.name Test faModelOnOffTest1.
* @tc.desc To verify the function of enabling and disabling the monitoring function for tone change on the system bar..
* @tc.desc To verify the function of enabling and disabling the monitoring function for tone change on the system bar..
*/
*/
it
(
'
faModelOnOffTest1
'
,
0
,
async
function
(
done
)
{
it
(
'
faModelOnOffTest1
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
jsunittest faModelOnOffTest1 begin
'
);
console
.
log
(
'
jsunittest faModelOnOffTest1 begin
'
);
var
listenerStatus
;
//1表示开启 其他为关闭
var
listenerStatus
;
var
callback
=
(
data
)
=>
{
var
callback
=
(
data
)
=>
{
console
.
log
(
'
jsunittest faModelOnOffTest1 create callback
'
+
JSON
.
stringify
(
data
));
console
.
log
(
'
jsunittest faModelOnOffTest1 create callback
'
+
JSON
.
stringify
(
data
));
listenerStatus
=
1
;
listenerStatus
=
1
;
console
.
log
(
'
jsunittest faModelOnOffTest1 listenerStatus 1:
'
+
listenerStatus
);
console
.
log
(
'
jsunittest faModelOnOffTest1 listenerStatus 1:
'
+
listenerStatus
);
}
}
window
.
on
(
'
systemBarTintChange
'
,
callback
);
window
.
on
(
'
systemBarTintChange
'
,
callback
);
setTimeout
(()
=>
{
window
.
getTopWindow
((
err
,
data
)
=>
{
window
.
getTopWindow
((
err
,
data
)
=>
{
if
(
err
.
code
!=
0
)
{
console
.
log
(
'
jsunittest faModelOnOffTest1 getTopWindow callback fail
'
+
JSON
.
stringify
(
err
.
code
));
expect
().
assertFail
();
done
();
}
expect
(
data
!=
null
).
assertTrue
();
data
.
setLayoutFullScreen
(
true
,
(
err
)
=>
{
if
(
err
.
code
!=
0
)
{
if
(
err
.
code
!=
0
)
{
console
.
log
(
'
jsunittest faModelOnOffTest1
getTopWindow
callback fail
'
+
JSON
.
stringify
(
err
.
code
));
console
.
log
(
'
jsunittest faModelOnOffTest1
setLayoutFullScreen
callback fail
'
+
JSON
.
stringify
(
err
.
code
));
expect
().
assertFail
();
expect
().
assertFail
();
done
();
done
();
}
}
else
{
expect
(
data
!=
null
).
assertTrue
();
setTimeout
(()
=>
{
data
.
setLayoutFullScreen
(
true
,
(
err
)
=>
{
if
(
err
.
code
!=
0
)
{
console
.
log
(
'
jsunittest faModelOnOffTest1 setLayoutFullScreen callback fail
'
+
JSON
.
stringify
(
err
.
code
));
expect
().
assertFail
();
done
();
}
else
{
expect
(
listenerStatus
==
1
).
assertTrue
();
expect
(
listenerStatus
==
1
).
assertTrue
();
window
.
off
(
'
systemBarTintChange
'
);
window
.
off
(
'
systemBarTintChange
'
);
listenerStatus
=
0
;
listenerStatus
=
0
;
}
data
.
setLayoutFullScreen
(
false
,
(
err
)
=>
{
data
.
setLayoutFullScreen
(
false
,
(
err
)
=>
{
console
.
log
(
'
jsunittest faModelOnOffTest1 listenerStatus 2:
'
+
listenerStatus
);
console
.
log
(
'
jsunittest faModelOnOffTest1 listenerStatus 2:
'
+
listenerStatus
);
if
(
err
.
code
!=
0
||
listenerStatus
==
1
)
{
if
(
err
.
code
!=
0
||
listenerStatus
==
1
)
{
console
.
log
(
'
jsunittest faModelOnOffTest1 setLayoutFullScreen callback fail
'
+
JSON
.
stringify
(
err
.
code
));
console
.
log
(
'
jsunittest faModelOnOffTest1 setLayoutFullScreen callback fail
'
+
JSON
.
stringify
(
err
.
code
));
expect
().
assertFail
();
expect
().
assertFail
();
done
();
done
();
}
else
{
}
else
{
console
.
log
(
'
jsunittest faModelOnOffTest1 listenerStatus 3:
'
+
listenerStatus
);
console
.
log
(
'
jsunittest faModelOnOffTest1 listenerStatus 3:
'
+
listenerStatus
);
console
.
log
(
'
jsunittest faModelOnOffTest1 off callback success
'
);
console
.
log
(
'
jsunittest faModelOnOffTest1 off callback success
'
);
done
();
done
();
}
}
})
})
},
2000
);
})
}
})
})
}
,
1000
);
}
)
})
})
/**
/**
...
@@ -101,7 +100,6 @@ describe('window_api_test', function() {
...
@@ -101,7 +100,6 @@ describe('window_api_test', function() {
if
(
err
.
code
!=
0
)
{
if
(
err
.
code
!=
0
)
{
console
.
log
(
'
jsunittest faModelOnOffTest2 setLayoutFullScreen callback fail
'
+
JSON
.
stringify
(
err
.
code
));
console
.
log
(
'
jsunittest faModelOnOffTest2 setLayoutFullScreen callback fail
'
+
JSON
.
stringify
(
err
.
code
));
expect
().
assertFail
();
expect
().
assertFail
();
done
();
}
else
{
}
else
{
setTimeout
((
async
function
()
{
setTimeout
((
async
function
()
{
console
.
log
(
'
jsunittest faModelOnOffTest2 listenerStatus 111:
'
+
listenerStatus
);
console
.
log
(
'
jsunittest faModelOnOffTest2 listenerStatus 111:
'
+
listenerStatus
);
...
@@ -759,7 +757,7 @@ describe('window_api_test', function() {
...
@@ -759,7 +757,7 @@ describe('window_api_test', function() {
console
.
log
(
'
jsunittest faModelSetColorSpaceTest4 setColorSpace callback begin
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
jsunittest faModelSetColorSpaceTest4 setColorSpace callback begin
'
+
JSON
.
stringify
(
err
));
if
(
err
.
code
!=
0
)
{
if
(
err
.
code
!=
0
)
{
console
.
log
(
'
jsunittest faModelSetColorSpaceTest4 setColorSpace callback fail
'
+
JSON
.
stringify
(
err
.
code
));
console
.
log
(
'
jsunittest faModelSetColorSpaceTest4 setColorSpace callback fail
'
+
JSON
.
stringify
(
err
.
code
));
expect
(
err
.
code
).
assertEqual
(
1
2
0
);
expect
(
err
.
code
).
assertEqual
(
1
3
0
);
done
();
done
();
}
else
{
}
else
{
expect
().
assertFail
();
expect
().
assertFail
();
...
...
graphic/windowstandard/src/main/js/default/test/window.promise.js
浏览文件 @
816f92c5
...
@@ -84,7 +84,7 @@ describe('window_test', function() {
...
@@ -84,7 +84,7 @@ describe('window_test', function() {
done
();
done
();
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
log
(
'
jsunittest faModelSetColorSpaceTest2 wnd.setColorSpace failed, err :
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
jsunittest faModelSetColorSpaceTest2 wnd.setColorSpace failed, err :
'
+
JSON
.
stringify
(
err
));
expect
(
err
.
code
).
assertEqual
(
1
2
0
);
expect
(
err
.
code
).
assertEqual
(
1
3
0
);
done
();
done
();
})
})
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
...
@@ -462,7 +462,7 @@ describe('window_test', function() {
...
@@ -462,7 +462,7 @@ describe('window_test', function() {
done
();
done
();
})
})
})
})
},
1
000
)
},
3
000
)
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
log
(
'
jsunittest faModelMinimizeAllTest1 minimizeAll failed, err :
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
jsunittest faModelMinimizeAllTest1 minimizeAll failed, err :
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
expect
().
assertFail
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录