提交 40187b9e 编写于 作者: C chengxingzhen

xst失败用例适配

Signed-off-by: Nchengxingzhen <chengxingzhen@huawei.com>
上级 f6f68614
...@@ -19,6 +19,7 @@ import bundle from '@ohos.bundle'; ...@@ -19,6 +19,7 @@ import bundle from '@ohos.bundle';
var TAG1 = "Fa:SupportFunction:MainAbility3:"; var TAG1 = "Fa:SupportFunction:MainAbility3:";
var listPush1 = "Fa_SupportFunction_MainAbility3_"; var listPush1 = "Fa_SupportFunction_MainAbility3_";
var lifeList = []; var lifeList = [];
let setDisplayOrientation1 = 0;
export default { export default {
onCreate() { onCreate() {
console.log(TAG1 + 'onCreate'); console.log(TAG1 + 'onCreate');
...@@ -39,6 +40,11 @@ export default { ...@@ -39,6 +40,11 @@ export default {
ability_featureAbility.getContext().setDisplayOrientation(orientation, (error, setDisplayOrientation) => { ability_featureAbility.getContext().setDisplayOrientation(orientation, (error, setDisplayOrientation) => {
console.log(TAG1 + "setDisplayOrientation data = " + JSON.stringify(setDisplayOrientation)); console.log(TAG1 + "setDisplayOrientation data = " + JSON.stringify(setDisplayOrientation));
console.log(TAG1 + "setDisplayOrientation error = " + JSON.stringify(error)); console.log(TAG1 + "setDisplayOrientation error = " + JSON.stringify(error));
if (setDisplayOrientation == undefined) {
setDisplayOrientation1 = 1
} else {
console.log(`${TAG1} setDisplayOrientation callBack is error: ${JSON.stringify(setDisplayOrientation)}`);
}
ability_featureAbility.getContext().getDisplayOrientation((error, displayOrientationAfter) => { ability_featureAbility.getContext().getDisplayOrientation((error, displayOrientationAfter) => {
console.log(TAG1 + "getDisplayOrientation2 data = " + JSON.stringify(displayOrientationAfter)); console.log(TAG1 + "getDisplayOrientation2 data = " + JSON.stringify(displayOrientationAfter));
...@@ -49,7 +55,7 @@ export default { ...@@ -49,7 +55,7 @@ export default {
displayOrientationBefore: displayOrientationBefore, displayOrientationBefore: displayOrientationBefore,
displayOrientationAfter: displayOrientationAfter, displayOrientationAfter: displayOrientationAfter,
lifeList: lifeList, lifeList: lifeList,
setDisplayOrientation: setDisplayOrientation setDisplayOrientation: setDisplayOrientation1
} }
} }
commonEvent.publish(listPush1 + "onActive", options, (err) => { commonEvent.publish(listPush1 + "onActive", options, (err) => {
......
...@@ -33,7 +33,7 @@ export default { ...@@ -33,7 +33,7 @@ export default {
let displayOrientationBefore = undefined; let displayOrientationBefore = undefined;
let displayOrientationAfter = undefined; let displayOrientationAfter = undefined;
let setDisplayOrientation = undefined; let setDisplayOrientation = 0;
let orientation = undefined; let orientation = undefined;
let number = undefined; let number = undefined;
let wantNum = undefined; let wantNum = undefined;
...@@ -116,7 +116,11 @@ export default { ...@@ -116,7 +116,11 @@ export default {
await ability_featureAbility.getContext().setDisplayOrientation(orientation).then((data) => { await ability_featureAbility.getContext().setDisplayOrientation(orientation).then((data) => {
console.log(TAG1 + "setShowOnLockScreen data = " + JSON.stringify(data)); console.log(TAG1 + "setShowOnLockScreen data = " + JSON.stringify(data));
setDisplayOrientation = data; if (data == undefined) {
setDisplayOrientation = 1
} else {
console.log(`${TAG1} setDisplayOrientation callBack is error: ${JSON.stringify(data)}`);
}
}).catch((error) => { }).catch((error) => {
console.log(TAG1 + "setShowOnLockScreen error = " + JSON.stringify(error)); console.log(TAG1 + "setShowOnLockScreen error = " + JSON.stringify(error));
}) })
......
...@@ -33,7 +33,7 @@ export default { ...@@ -33,7 +33,7 @@ export default {
let displayOrientationBefore = undefined; let displayOrientationBefore = undefined;
let displayOrientationAfter = undefined; let displayOrientationAfter = undefined;
let setDisplayOrientation = undefined; let setDisplayOrientation = 0;
let orientation = bundle.DisplayOrientation.FOLLOW_RECENT; let orientation = bundle.DisplayOrientation.FOLLOW_RECENT;
await ability_featureAbility.getContext().getDisplayOrientation().then((data) => { await ability_featureAbility.getContext().getDisplayOrientation().then((data) => {
...@@ -45,7 +45,11 @@ export default { ...@@ -45,7 +45,11 @@ export default {
await ability_featureAbility.getContext().setDisplayOrientation(orientation).then((data) => { await ability_featureAbility.getContext().setDisplayOrientation(orientation).then((data) => {
console.log(TAG1 + "setShowOnLockScreen data = " + JSON.stringify(data)); console.log(TAG1 + "setShowOnLockScreen data = " + JSON.stringify(data));
setDisplayOrientation = data; if (data == undefined) {
setDisplayOrientation = 1
} else {
console.log(`${TAG1} setDisplayOrientation callBack is error: ${JSON.stringify(data)}`);
}
}).catch((error) => { }).catch((error) => {
console.log(TAG1 + "setShowOnLockScreen error = " + JSON.stringify(error)); console.log(TAG1 + "setShowOnLockScreen error = " + JSON.stringify(error));
}) })
......
...@@ -33,7 +33,7 @@ export default { ...@@ -33,7 +33,7 @@ export default {
let displayOrientationBefore = undefined; let displayOrientationBefore = undefined;
let displayOrientationAfter = undefined; let displayOrientationAfter = undefined;
let setDisplayOrientation = undefined; let setDisplayOrientation = 0;
let orientation = bundle.DisplayOrientation.FOLLOW_RECENT; let orientation = bundle.DisplayOrientation.FOLLOW_RECENT;
await ability_featureAbility.getContext().getDisplayOrientation().then((data) => { await ability_featureAbility.getContext().getDisplayOrientation().then((data) => {
...@@ -45,7 +45,11 @@ export default { ...@@ -45,7 +45,11 @@ export default {
await ability_featureAbility.getContext().setDisplayOrientation(orientation).then((data) => { await ability_featureAbility.getContext().setDisplayOrientation(orientation).then((data) => {
console.log(TAG1 + "setShowOnLockScreen data = " + JSON.stringify(data)); console.log(TAG1 + "setShowOnLockScreen data = " + JSON.stringify(data));
setDisplayOrientation = data; if (data == undefined) {
setDisplayOrientation = 1
} else {
console.log(`${TAG1} setDisplayOrientation callBack is error: ${JSON.stringify(data)}`);
}
}).catch((error) => { }).catch((error) => {
console.log(TAG1 + "setShowOnLockScreen error = " + JSON.stringify(error)); console.log(TAG1 + "setShowOnLockScreen error = " + JSON.stringify(error));
}) })
......
...@@ -33,7 +33,7 @@ export default { ...@@ -33,7 +33,7 @@ export default {
let displayOrientationBefore = undefined; let displayOrientationBefore = undefined;
let displayOrientationAfter = undefined; let displayOrientationAfter = undefined;
let setDisplayOrientation = undefined; let setDisplayOrientation = 0;
let orientation = bundle.DisplayOrientation.FOLLOW_RECENT; let orientation = bundle.DisplayOrientation.FOLLOW_RECENT;
await ability_featureAbility.getContext().getDisplayOrientation().then((data) => { await ability_featureAbility.getContext().getDisplayOrientation().then((data) => {
...@@ -45,7 +45,11 @@ export default { ...@@ -45,7 +45,11 @@ export default {
await ability_featureAbility.getContext().setDisplayOrientation(orientation).then((data) => { await ability_featureAbility.getContext().setDisplayOrientation(orientation).then((data) => {
console.log(TAG1 + "setShowOnLockScreen data = " + JSON.stringify(data)); console.log(TAG1 + "setShowOnLockScreen data = " + JSON.stringify(data));
setDisplayOrientation = data; if (data == undefined) {
setDisplayOrientation = 1
} else {
console.log(`${TAG1} setDisplayOrientation callBack is error: ${JSON.stringify(data)}`);
}
}).catch((error) => { }).catch((error) => {
console.log(TAG1 + "setShowOnLockScreen error = " + JSON.stringify(error)); console.log(TAG1 + "setShowOnLockScreen error = " + JSON.stringify(error));
}) })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册