提交 9e7320cb 编写于 作者: H hk_js

add testcase of callback interface

Signed-off-by: Nhk_js <hekun18@huawei.com>
上级 b403a943
......@@ -206,5 +206,189 @@ describe('display_test', function () {
}
})
/**
* @tc.number SUB_WMS_WATERFALLDISPLAYAREARECTS_JSAPI_001
* @tc.name Test waterfallDisplayAreaRects_Test_001.
* @tc.desc To test value of waterfallDisplayAreaRects.
*/
it('waterfallDisplayAreaRects_Test_001', 0, async function (done) {
console.info('test the value of waterfallDisplayAreaRects begin');
try {
var waterfallDisplayAreaRects = {
left : {
left:20,
top:20,
width:20,
height:20
},
right : {
left:800,
top:0,
width:600,
height:600
},
top : {
left:20,
top:20,
width:20,
height:20
},
bottom : {
left:20,
top:20,
width:600,
height:600
},
}
expect(waterfallDisplayAreaRects.left != null).assertTrue();
expect(waterfallDisplayAreaRects.right != null).assertTrue();
expect(waterfallDisplayAreaRects.top != null).assertTrue();
expect(waterfallDisplayAreaRects.bottom != null).assertTrue();
done();
} catch (err) {
console.error('test value of waterfallDisplayAreaRects error ' + JSON.stringify(err));
expect.assertFail();
done();
}
})
/**
* @tc.number SUB_WMS_RECT_JSAPI_001
* @tc.name Test RECT_Test_001.
* @tc.desc To test value of RECT.
*/
it('displayAreaRects_Test_001', 0, async function (done) {
console.info('test the value of aRect begin');
try {
var rect = {
left : 20,
right : 40,
width : 100,
height : 200
}
expect(20).assertEqual(rect.left);
expect(40).assertEqual(rect.right);
expect(100).assertEqual(rect.width);
expect(200).assertEqual(rect.height);
done();
} catch (err) {
console.error('test value of rect error ' + JSON.stringify(err));
expect.assertFail();
done();
}
})
/**
* @tc.number SUB_WMS_CutoutInfo_JSAPI_001
* @tc.name Test CutoutInfo_Test_001.
* @tc.desc To test value of CutoutInfo.
*/
it('CutoutInfo_Test_001', 0, async function (done) {
console.info('test the CutoutInfo of aRect begin');
try {
var cutoutInfo = {
boudingRects : [{
left : 20,
right : 40,
width : 100,
height : 200
}],
waterfallDisplayAreaRects : {
left : {
left:20,
top:20,
width:20,
height:20
},
right : {
left:800,
top:0,
width:600,
height:600
},
top : {
left:20,
top:20,
width:20,
height:20
},
bottom : {
left:20,
top:20,
width:600,
height:600
},
}
}
expect(1).assertEqual(cutoutInfo.boudingRects.length);
expect(cutoutInfo.waterfallDisplayAreaRects.left != null).assertTrue();
expect(cutoutInfo.waterfallDisplayAreaRects.right != null).assertTrue();
expect(cutoutInfo.waterfallDisplayAreaRects.top != null).assertTrue();
expect(cutoutInfo.waterfallDisplayAreaRects.bottom != null).assertTrue();
done();
} catch (err) {
console.error('test value of CutoutInfo error ' + JSON.stringify(err));
expect().assertFail();
done();
}
})
/**
* @tc.number SUB_WMS_GETDISPLAYCUtOUTINFO_JSAPI_001
* @tc.name Test getDisplayCutoutInfo_Test_001
* @tc.desc To test the function of getCutoutInfo
*/
it('getDisplayCutoutInfo_Test_001', 0, async function (done) {
console.info('getCutoutInfo begin');
display.getDefaultDisplay().then(dsp => {
console.info('displayTest getCutoutInfo getDefaultDisplay id :' + JSON.stringify(dsp));
expect(dsp != null).assertTrue();
dsp.getCutoutInfo((err, data) => {
console.info('Succeeded in getting cutoutInfo. data: ' + JSON.stringify(data));
if (err.code) {
console.error('Failed to get cutoutInfo. Cause: ' + JSON.stringify(err));
expect().assertFail();
done();
} else {
console.error('success to get cutoutInfo. Cause: ' + JSON.stringify(err));
expect(data != null).assertTrue();
done();
}
})
}, (err) => {
console.log('displayTest getgetCutoutInfo getDefaultDisplay failed, err :' + JSON.stringify(err));
expect().assertFail();
done();
})
})
/**
* @tc.number SUB_WMS_GETDISPLAYCUtOUTINFO_JSAPI_002
* @tc.name Test getDisplayCutoutInfo_Test_002
* @tc.desc To test the function of getCutoutInfo
*/
it('getDisplayCutoutInfo_Test_002', 0, async function (done) {
console.info('getCutoutInfo begin');
display.getDefaultDisplay().then(dsp => {
console.info('displayTest getCutoutInfo getDefaultDisplay id2 :' + JSON.stringify(dsp));
expect(dsp != null).assertTrue();
dsp.getCutoutInfo().then(data => {
console.info('Succeeded in getting cutoutInfo2. data: ' + JSON.stringify(data));
expect(data != null).assertTrue();
done();
} ,err => {
console.log('displayTest getCutoutInfo getDefaultDisplay id2 failed, err :' + JSON.stringify(err));
expect().assertFail();
done();
})
}, (err) => {
console.log('displayTest getgetCutoutInfo getDefaultDisplay failed, err :' + JSON.stringify(err));
expect().assertFail();
done();
})
})
})
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册