Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
feebfe95
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看板
提交
feebfe95
编写于
7月 31, 2023
作者:
Y
yaocui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
Signed-off-by:
N
yaocui
<
yaocui2@h-partners.com
>
上级
0c87149f
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
136 addition
and
137 deletion
+136
-137
graphic/windowStage/entry/src/main/ets/MainAbility/pages/second/pageTwo.ets
...e/entry/src/main/ets/MainAbility/pages/second/pageTwo.ets
+1
-1
graphic/windowStage/entry/src/main/ets/test/parameterVerificationIsOptional.test.ets
...rc/main/ets/test/parameterVerificationIsOptional.test.ets
+135
-136
未找到文件。
graphic/windowStage/entry/src/main/ets/MainAbility/pages/second/pageTwo.ets
浏览文件 @
feebfe95
...
...
@@ -19,7 +19,7 @@ struct PageTwo {
build() {
Row(){
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.
Center
}) {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.
Start
}) {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
...
...
graphic/windowStage/entry/src/main/ets/test/parameterVerificationIsOptional.test.ets
浏览文件 @
feebfe95
...
...
@@ -336,142 +336,6 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
done
();
}
})
/**
* @tc.number SUB_WINDOW_WINDOWOFFKEYBOARDHEIGHTCHANGE_JSAPI_001
* @tc.name Test window_off_keyboardHeightChange_Test_001
* @tc.desc Turn off listening for keyboard height changes
*/
it
(
'window_off_keyboardHeightChange_Test_001'
,
0
,
async
function
(
done
)
{
let
caseName
=
'window_off_keyboardHeightChange_Test_001'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
console
.
log
(
msgStr
+
'begin'
);
let
firstListenFlag
=
false
let
secondListenFlag
=
false
let
windowId
=
'window_off_keyboardHeightChange_Test_001'
;
let
windowConfig
=
{
name
:
windowId
,
windowType
:
ohosWindow
.
WindowType
.
TYPE_SYSTEM_ALERT
,
ctx
:
context
};
let
tempWnd
=
null
;
tempWnd
=
await
ohosWindow
.
createWindow
(
windowConfig
)
.
catch
((
err
)
=>
{
unexpectedError
(
err
,
caseName
,
'ohosWindow.createWindow'
,
done
);
});
expect
(
!!
tempWnd
)
.
assertTrue
();
await
tempWnd
.
loadContent
(
'MainAbility/pages/second/pageTwo'
)
.
catch
((
err
)
=>
{
unexpectedError
(
err
,
caseName
,
'tempWnd.loadContent'
,
done
);
});
await
tempWnd
.
resize
(
800
,
800
)
.
catch
((
err
)
=>
{
unexpectedError
(
err
,
caseName
,
'tempWnd.resetSize'
,
done
);
});
await
tempWnd
.
moveWindowTo
(
100
,
100
)
.
catch
((
err
)
=>
{
unexpectedError
(
err
,
caseName
,
'tempWnd.moveWindowTo '
,
done
);
});
await
tempWnd
.
showWindow
()
.
catch
((
err
)
=>
{
unexpectedError
(
err
,
caseName
,
'tempWnd.showWindow'
,
done
);
});
tempWnd
.
on
(
'keyboardHeightChange'
,
(
data
)
=>
{
console
.
info
(
msgStr
+
"first listener trigger"
);
firstListenFlag
=
true
});
tempWnd
.
on
(
'keyboardHeightChange'
,
(
data
)
=>
{
console
.
info
(
msgStr
+
"second listener trigger"
);
secondListenFlag
=
true
});
await
inputClick
(
'pageTwoinput'
,
msgStr
)
.
catch
(
async
err
=>
{
console
.
info
(
msgStr
+
err
);
await
tempWnd
.
destroyWindow
();
expect
(
TRUE_FLAG
)
.
assertFail
();
done
();
})
await
sleep
(
1000
);
tempWnd
.
off
(
'keyboardHeightChange'
);
firstListenFlag
=
false
secondListenFlag
=
false
await
inputClick
(
'pageTwoinputSecond'
,
msgStr
)
.
catch
(
async
err
=>
{
console
.
info
(
msgStr
+
err
);
await
tempWnd
.
destroyWindow
();
expect
(
TRUE_FLAG
)
.
assertFail
();
done
();
})
await
sleep
(
2000
);
if
(
firstListenFlag
===
false
&&
secondListenFlag
===
false
)
{
await
tempWnd
.
destroyWindow
();
done
();
}
})
/**
* @tc.number SUB_WINDOW_WINDOWOFFKEYBOARDHEIGHTCHANGE_JSAPI_002
* @tc.name Test window_off_keyboardHeightChange_Test_002
* @tc.desc Turn off listening for keyboard height changes
*/
it
(
'window_off_keyboardHeightChange_Test_002'
,
0
,
async
function
(
done
)
{
let
caseName
=
'window_off_keyboardHeightChange_Test_002'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
console
.
log
(
msgStr
+
'begin'
);
let
firstListenFlag
=
false
let
secondListenFlag
=
false
function
firstCall
()
{
console
.
log
(
msgStr
+
"first listener trigger"
)
firstListenFlag
=
true
}
function
secondCall
()
{
console
.
log
(
msgStr
+
"second listener trigger"
)
secondListenFlag
=
true
}
let
windowId
=
'window_off_keyboardHeightChange_Test_002'
;
let
windowConfig
=
{
name
:
windowId
,
windowType
:
ohosWindow
.
WindowType
.
TYPE_SYSTEM_ALERT
,
ctx
:
context
};
let
tempWnd
=
null
;
tempWnd
=
await
ohosWindow
.
createWindow
(
windowConfig
)
.
catch
((
err
)
=>
{
unexpectedError
(
err
,
caseName
,
'ohosWindow.createWindow'
,
done
);
});
expect
(
!!
tempWnd
)
.
assertTrue
();
await
tempWnd
.
loadContent
(
'MainAbility/pages/second/pageTwo'
)
.
catch
((
err
)
=>
{
unexpectedError
(
err
,
caseName
,
'tempWnd.loadContent'
,
done
);
});
await
tempWnd
.
resize
(
800
,
800
)
.
catch
((
err
)
=>
{
unexpectedError
(
err
,
caseName
,
'tempWnd.resetSize'
,
done
);
});
await
tempWnd
.
moveWindowTo
(
100
,
100
)
.
catch
((
err
)
=>
{
unexpectedError
(
err
,
caseName
,
'tempWnd.moveWindowTo '
,
done
);
});
await
tempWnd
.
showWindow
()
.
catch
((
err
)
=>
{
unexpectedError
(
err
,
caseName
,
'tempWnd.showWindow'
,
done
);
});
tempWnd
.
on
(
'keyboardHeightChange'
,
firstCall
);
tempWnd
.
on
(
'keyboardHeightChange'
,
secondCall
);
await
inputClick
(
'pageTwoinput'
,
msgStr
)
.
catch
(
async
err
=>
{
console
.
info
(
msgStr
+
err
);
await
tempWnd
.
destroyWindow
();
expect
(
TRUE_FLAG
)
.
assertFail
();
done
();
})
await
sleep
(
1000
);
tempWnd
.
off
(
'keyboardHeightChange'
,
firstCall
);
firstListenFlag
=
false
secondListenFlag
=
false
await
inputClick
(
'pageTwoinputSecond'
,
msgStr
)
.
catch
(
async
err
=>
{
console
.
info
(
msgStr
+
err
);
await
tempWnd
.
destroyWindow
();
expect
(
TRUE_FLAG
)
.
assertFail
();
done
();
})
await
sleep
(
2000
);
if
(
!
firstListenFlag
&&
secondListenFlag
)
{
tempWnd
.
off
(
'keyboardHeightChange'
);
await
tempWnd
.
destroyWindow
();
done
();
}
else
{
tempWnd
.
off
(
'keyboardHeightChange'
);
await
tempWnd
.
destroyWindow
();
expect
(
TRUE_FLAG
)
.
assertFail
();
done
();
}
})
/**
* @tc.number SUB_WINDOW_WINDOWOFFSCREENSHOT_JSAPI_001
* @tc.name Test window_off_screenshot_Test_001
...
...
@@ -744,6 +608,141 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
done
();
}
})
/**
* @tc.number SUB_WINDOW_WINDOWOFFKEYBOARDHEIGHTCHANGE_JSAPI_001
* @tc.name Test window_off_keyboardHeightChange_Test_001
* @tc.desc Turn off listening for keyboard height changes
*/
it
(
'window_off_keyboardHeightChange_Test_001'
,
0
,
async
function
(
done
)
{
let
caseName
=
'window_off_keyboardHeightChange_Test_001'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
console
.
log
(
msgStr
+
'begin'
);
let
firstListenFlag
=
false
let
secondListenFlag
=
false
let
windowId
=
'window_off_keyboardHeightChange_Test_001'
;
let
windowConfig
=
{
name
:
windowId
,
windowType
:
ohosWindow
.
WindowType
.
TYPE_DIALOG
,
ctx
:
context
};
let
tempWnd
=
null
;
tempWnd
=
await
ohosWindow
.
createWindow
(
windowConfig
)
.
catch
((
err
)
=>
{
unexpectedError
(
err
,
caseName
,
'ohosWindow.createWindow'
,
done
);
});
expect
(
!!
tempWnd
)
.
assertTrue
();
await
tempWnd
.
loadContent
(
'MainAbility/pages/second/pageTwo'
)
.
catch
((
err
)
=>
{
unexpectedError
(
err
,
caseName
,
'tempWnd.loadContent'
,
done
);
});
await
tempWnd
.
resize
(
800
,
1000
)
.
catch
((
err
)
=>
{
unexpectedError
(
err
,
caseName
,
'tempWnd.resetSize'
,
done
);
});
await
tempWnd
.
moveWindowTo
(
0
,
0
)
.
catch
((
err
)
=>
{
unexpectedError
(
err
,
caseName
,
'tempWnd.moveWindowTo '
,
done
);
});
await
tempWnd
.
showWindow
()
.
catch
((
err
)
=>
{
unexpectedError
(
err
,
caseName
,
'tempWnd.showWindow'
,
done
);
});
tempWnd
.
on
(
'keyboardHeightChange'
,
(
data
)
=>
{
console
.
info
(
msgStr
+
"first listener trigger"
);
firstListenFlag
=
true
});
tempWnd
.
on
(
'keyboardHeightChange'
,
(
data
)
=>
{
console
.
info
(
msgStr
+
"second listener trigger"
);
secondListenFlag
=
true
});
await
inputClick
(
'pageTwoinput'
,
msgStr
)
.
catch
(
async
err
=>
{
console
.
info
(
msgStr
+
err
);
await
tempWnd
.
destroyWindow
();
expect
(
TRUE_FLAG
)
.
assertFail
();
done
();
})
await
sleep
(
1000
);
tempWnd
.
off
(
'keyboardHeightChange'
);
firstListenFlag
=
false
secondListenFlag
=
false
await
inputClick
(
'pageTwoinputSecond'
,
msgStr
)
.
catch
(
async
err
=>
{
console
.
info
(
msgStr
+
err
);
await
tempWnd
.
destroyWindow
();
expect
(
TRUE_FLAG
)
.
assertFail
();
done
();
})
await
sleep
(
2000
);
if
(
firstListenFlag
===
false
&&
secondListenFlag
===
false
)
{
await
tempWnd
.
destroyWindow
();
done
();
}
})
/**
* @tc.number SUB_WINDOW_WINDOWOFFKEYBOARDHEIGHTCHANGE_JSAPI_002
* @tc.name Test window_off_keyboardHeightChange_Test_002
* @tc.desc Turn off listening for keyboard height changes
*/
it
(
'window_off_keyboardHeightChange_Test_002'
,
0
,
async
function
(
done
)
{
let
caseName
=
'window_off_keyboardHeightChange_Test_002'
;
let
msgStr
=
'jsunittest '
+
caseName
+
' '
;
console
.
log
(
msgStr
+
'begin'
);
let
firstListenFlag
=
false
let
secondListenFlag
=
false
function
firstCall
()
{
console
.
log
(
msgStr
+
"first listener trigger"
)
firstListenFlag
=
true
}
function
secondCall
()
{
console
.
log
(
msgStr
+
"second listener trigger"
)
secondListenFlag
=
true
}
let
windowId
=
'window_off_keyboardHeightChange_Test_002'
;
let
windowConfig
=
{
name
:
windowId
,
windowType
:
ohosWindow
.
WindowType
.
TYPE_DIALOG
,
ctx
:
context
};
let
tempWnd
=
null
;
tempWnd
=
await
ohosWindow
.
createWindow
(
windowConfig
)
.
catch
((
err
)
=>
{
unexpectedError
(
err
,
caseName
,
'ohosWindow.createWindow'
,
done
);
});
expect
(
!!
tempWnd
)
.
assertTrue
();
await
tempWnd
.
loadContent
(
'MainAbility/pages/second/pageTwo'
)
.
catch
((
err
)
=>
{
unexpectedError
(
err
,
caseName
,
'tempWnd.loadContent'
,
done
);
});
await
tempWnd
.
resize
(
800
,
1000
)
.
catch
((
err
)
=>
{
unexpectedError
(
err
,
caseName
,
'tempWnd.resetSize'
,
done
);
});
await
tempWnd
.
moveWindowTo
(
0
,
0
)
.
catch
((
err
)
=>
{
unexpectedError
(
err
,
caseName
,
'tempWnd.moveWindowTo '
,
done
);
});
await
tempWnd
.
showWindow
()
.
catch
((
err
)
=>
{
unexpectedError
(
err
,
caseName
,
'tempWnd.showWindow'
,
done
);
});
tempWnd
.
on
(
'keyboardHeightChange'
,
firstCall
);
tempWnd
.
on
(
'keyboardHeightChange'
,
secondCall
);
await
inputClick
(
'pageTwoinput'
,
msgStr
)
.
catch
(
async
err
=>
{
console
.
info
(
msgStr
+
err
);
await
tempWnd
.
destroyWindow
();
expect
(
TRUE_FLAG
)
.
assertFail
();
done
();
})
await
sleep
(
1000
);
tempWnd
.
off
(
'keyboardHeightChange'
,
firstCall
);
firstListenFlag
=
false
secondListenFlag
=
false
await
inputClick
(
'pageTwoinputSecond'
,
msgStr
)
.
catch
(
async
err
=>
{
console
.
info
(
msgStr
+
err
);
await
tempWnd
.
destroyWindow
();
expect
(
TRUE_FLAG
)
.
assertFail
();
done
();
})
await
sleep
(
2000
);
if
(
!
firstListenFlag
&&
secondListenFlag
)
{
tempWnd
.
off
(
'keyboardHeightChange'
);
await
tempWnd
.
destroyWindow
();
done
();
}
else
{
tempWnd
.
off
(
'keyboardHeightChange'
);
await
tempWnd
.
destroyWindow
();
expect
(
TRUE_FLAG
)
.
assertFail
();
done
();
}
})
/**
* @tc.number SUB_WINDOW_WINDOWSTAGEOFFWINDOWSTAGEVENT_JSAPI_001
* @tc.name Test windowStage_off_windowStageEvent_Test_001
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录