提交 8e5f18f7 编写于 作者: Y yaocui

add new case and remove system case

Signed-off-by: Nyaocui <yaocui2@h-partners.com>
上级 1e8d80aa
......@@ -16,10 +16,12 @@ import windowPromiseTest from './windowPromise.test'
import windowCallbackTest from './windowCallback.test'
import windowRefactorInterfaceTest from './windowRefactorInterface.test'
import displayAndWindowRefactorInterfaceTest from './displayAndWindowRefactorInterface.test'
import parameterVerificationIsOptional from './parameterVerificationIsOptional.test'
export default function testsuite() {
windowCallbackTest(globalThis.abilityContext,globalThis.windowStage,globalThis.abilityStorage)
windowPromiseTest(globalThis.abilityContext,globalThis.windowStage,globalThis.abilityStorage)
windowRefactorInterfaceTest(globalThis.abilityContext,globalThis.windowStage,globalThis.abilityStorage)
displayAndWindowRefactorInterfaceTest(globalThis.abilityContext,globalThis.windowStage,globalThis.abilityStorage)
parameterVerificationIsOptional(globalThis.abilityContext,globalThis.windowStage,globalThis.abilityStorage)
}
\ No newline at end of file
......@@ -2212,112 +2212,6 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
}
})
})
/**
* @tc.number SUB_WINDOW_SHOWWITHANIMATION_JSAPI_002
* @tc.name Test showWithAnimationTest2
* @tc.desc Displays the current window, playing an animation in the process
*/
it('showWithAnimationTest2', 0, async function (done) {
let caseName = 'showWithAnimationTest2';
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin context==' + JSON.stringify(context));
let wndId = 'showWithAnimationTest2';
let baseType = ohosWindow.WindowType.TYPE_FLOAT;
let tempWnd = null;
function createWin() {
return new Promise(function (resolve, reject) {
ohosWindow.create(context, wndId, baseType, (err, data) => {
if (err && err.code) {
reject(null)
} else {
resolve(data)
}
})
})
}
await createWin().then((data) => {
console.info(msgStr + `ohosWindow.create success data: ${JSON.stringify(data)}`)
tempWnd = data;
}).catch(err => {
console.info(msgStr + `ohosWindow.create failed error: ${JSON.stringify(err)}`)
expect().assertFail();
done();
})
expect(!!tempWnd).assertTrue();
console.info(msgStr + `ohosWindow.create success tempWnd: ${JSON.stringify(tempWnd)}`)
tempWnd.showWithAnimation(async (error, animationData) => {
if (error && error.code) {
console.info(msgStr + 'showWithAnimation fail. error: ' + JSON.stringify(error));
await tempWnd.destroy()
expectedError(error, caseName, 'tempWnd.showWithAnimation', done, 202);
} else {
console.info(msgStr + 'Succeeded in showing the window with animation. Data: ' + JSON.stringify(animationData));
done()
}
})
})
/**
* @tc.number SUB_WINDOW_HIDEWITHANIMATION_JSAPI_002
* @tc.name Test hideWithAnimationTest2
* @tc.desc Hide the current window and play an animation in the process
*/
it('hideWithAnimationTest2', 0, async function (done) {
let caseName = 'hideWithAnimationTest2';
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin context==' + JSON.stringify(context));
let wndId = 'hideWithAnimationTest2';
let baseType = ohosWindow.WindowType.TYPE_FLOAT;
let tempWnd = null
function createWin() {
return new Promise(function (resolve, reject) {
ohosWindow.create(context, wndId, baseType, (creare_err, data) => {
if (creare_err && creare_err.code) {
reject(null)
} else {
resolve(data)
}
})
})
}
function findWin() {
return new Promise(function (resolve, reject) {
ohosWindow.find(wndId, (findErr, findWnd) => {
if (findErr && findErr.code) {
reject(null)
} else {
resolve(findWnd)
}
})
})
}
tempWnd = await createWin().catch(err => {
console.info(msgStr + `ohosWindow.create failed error: ${JSON.stringify(err)}`)
expect().assertFail();
done();
})
expect(!!tempWnd).assertTrue();
let findWnd;
findWnd = await findWin().catch(err => {
console.info(msgStr + `ohosWindow.find failed error: ${JSON.stringify(err)}`)
expect().assertFail();
done();
})
expect(!!findWnd).assertTrue();
findWnd.hideWithAnimation(async (err, data) => {
if (err && err.code) {
unexpectedError(err, caseName, 'Failed to hide the window with animation', done);
} else {
console.info('Succeeded in hiding the window with animation. Data: ' + JSON.stringify(data));
await tempWnd.destroy();
done();
}
})
})
/**
* @tc.number SUB_WINDOW_SETASPECTRATIO_JSAPI_001
* @tc.name Test setAspectRatioTest1
......
......@@ -1574,86 +1574,6 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
unexpectedError(err, caseName, 'displayClass.getCutoutInfo', done);
});
})
/**
* @tc.number SUB_WINDOW_SHOWWITHANIMATION_JSAPI_001
* @tc.name Test showWithAnimationTest1
* @tc.desc Displays the current window, playing an animation in the process
*/
it('showWithAnimationTest1', 0, async function (done) {
let caseName = 'showWithAnimationTest1';
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin context==' + JSON.stringify(context));
let wndId = 'showWithAnimationTest1';
let baseType = ohosWindow.WindowType.TYPE_FLOAT;
let createWindowObj = {
name: wndId, windowType: baseType, ctx: context
}
let tempWnd = null;
try {
await ohosWindow.createWindow(createWindowObj).then((data) => {
tempWnd = data
console.log(msgStr + 'ohosWindow.create ' + baseType + ', tempWnd: ' + JSON.stringify(tempWnd));
expect(!!tempWnd).assertTrue();
}).catch((err) => {
unexpectedError(err, caseName, 'ohosWindow.create ' + baseType, done);
});
}
catch (err) {
console.log(msgStr + 'ohosWindow.create catch err:' + JSON.stringify(err));
}
await tempWnd.showWithAnimation().then((data) => {
console.info(msgStr + 'Succeeded in showing the window with animation. Data: ' + JSON.stringify(data));
done();
}).catch((err) => {
tempWnd.destroy();
expectedError(err, caseName, 'tempWnd.showWithAnimation', done, 202);
})
})
/**
* @tc.number SUB_WINDOW_HIDEWITHANIMATION_JSAPI_001
* @tc.name Test hideWithAnimationTest1
* @tc.desc Hide the current window and play an animation in the process
*/
it('hideWithAnimationTest1', 0, async function (done) {
let caseName = 'hideWithAnimationTest1';
let msgStr = 'jsunittest ' + caseName + ' ';
console.log(msgStr + 'begin context==' + JSON.stringify(context));
let wndId = 'hideWithAnimationTest1';
let baseType = ohosWindow.WindowType.TYPE_FLOAT;
let createWindowObj = {
name: wndId, windowType: baseType, ctx: context
}
let tempWnd = null;
try {
await ohosWindow.createWindow(createWindowObj).then((data) => {
tempWnd = data
console.log(msgStr + 'ohosWindow.create ' + baseType + ', tempWnd: ' + JSON.stringify(tempWnd));
expect(!!tempWnd).assertTrue();
}).catch((err) => {
unexpectedError(err, caseName, 'ohosWindow.create ' + baseType, done);
});
}
catch (err) {
console.log(msgStr + 'ohosWindow.create catch err:' + JSON.stringify(err));
}
let findWnd = null;
await ohosWindow.find(wndId).then((data) => {
findWnd = data
}).catch((err) => {
unexpectedError(err, caseName, 'ohosWindow.find', done);
});
console.log(msgStr + 'find findWnd: ' + JSON.stringify(findWnd));
expect(!!findWnd).assertTrue();
let promise = findWnd.hideWithAnimation();
promise.then((data) => {
console.info('Succeeded in hiding the window with animation. Data: ' + JSON.stringify(data));
tempWnd.destroy();
done();
}).catch((err) => {
console.error('Failed to hide the window with animation. Cause: ' + JSON.stringify(err));
})
})
/**
* @tc.number SUB_WINDOW_SETASPECTRATIO_JSAPI_002
* @tc.name Test setAspectRatioTest2
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册