未验证 提交 46261fad 编写于 作者: O openharmony_ci 提交者: Gitee

!8158 add xts receive test device code

Merge pull request !8158 from renhw001/master
...@@ -22,6 +22,7 @@ export default function ImageReceiver() { ...@@ -22,6 +22,7 @@ export default function ImageReceiver() {
const CAPACITY = 8; const CAPACITY = 8;
const RGBA = 12; const RGBA = 12;
const Jpg_Stride = 1; const Jpg_Stride = 1;
const DEVICE_CODE = 801;
const { JPEG: FORMATJPEG } = image.ImageFormat; const { JPEG: FORMATJPEG } = image.ImageFormat;
const { JPEG } = image.ComponentType; const { JPEG } = image.ComponentType;
beforeAll(async function () { beforeAll(async function () {
...@@ -67,6 +68,11 @@ export default function ImageReceiver() { ...@@ -67,6 +68,11 @@ export default function ImageReceiver() {
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} else { } else {
var error = receiver.checkDeviceTest;
if (DEVICE_CODE == error) {
expect(error == DEVICE_CODE).assertTrue();
done();
}
receiver.on("imageArrival", () => { receiver.on("imageArrival", () => {
if (once) { if (once) {
return; return;
...@@ -108,6 +114,11 @@ export default function ImageReceiver() { ...@@ -108,6 +114,11 @@ export default function ImageReceiver() {
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} else { } else {
var error = receiver.checkDeviceTest;
if (DEVICE_CODE == error) {
expect(error == DEVICE_CODE).assertTrue();
done();
}
receiver.on("imageArrival", () => { receiver.on("imageArrival", () => {
if (once) { if (once) {
return; return;
...@@ -150,6 +161,11 @@ export default function ImageReceiver() { ...@@ -150,6 +161,11 @@ export default function ImageReceiver() {
expect(false).assertTrue(); expect(false).assertTrue();
return; return;
} }
var error = receiver.checkDeviceTest;
if (DEVICE_CODE == error) {
expect(error == DEVICE_CODE).assertTrue();
done();
}
receiver.on("imageArrival", () => { receiver.on("imageArrival", () => {
if (once) { if (once) {
return; return;
...@@ -199,6 +215,11 @@ export default function ImageReceiver() { ...@@ -199,6 +215,11 @@ export default function ImageReceiver() {
done(); done();
return; return;
} }
var error = receiver.checkDeviceTest;
if (DEVICE_CODE == error) {
expect(error == DEVICE_CODE).assertTrue();
done();
}
receiver.on("imageArrival", () => { receiver.on("imageArrival", () => {
if (once) { if (once) {
return; return;
...@@ -244,6 +265,11 @@ export default function ImageReceiver() { ...@@ -244,6 +265,11 @@ export default function ImageReceiver() {
done(); done();
} else { } else {
try { try {
var error = receiver.checkDeviceTest;
if (DEVICE_CODE == error) {
expect(error == DEVICE_CODE).assertTrue();
done();
}
receiver.on(param, () => { receiver.on(param, () => {
expect(false).assertTrue(); expect(false).assertTrue();
}); });
...@@ -635,6 +661,11 @@ export default function ImageReceiver() { ...@@ -635,6 +661,11 @@ export default function ImageReceiver() {
*/ */
it("SUB_GRAPHIC_IMAGE_RECEIVER_READLATESTIMAGE_PROMISE_0100", 0, async function (done) { it("SUB_GRAPHIC_IMAGE_RECEIVER_READLATESTIMAGE_PROMISE_0100", 0, async function (done) {
var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMATJPEG, CAPACITY); var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMATJPEG, CAPACITY);
var error = receiver.checkDeviceTest;
if (DEVICE_CODE == error) {
expect(error == DEVICE_CODE).assertTrue();
done();
}
var dummy = receiver.test; var dummy = receiver.test;
if (receiver != undefined) { if (receiver != undefined) {
receiver receiver
...@@ -668,6 +699,11 @@ export default function ImageReceiver() { ...@@ -668,6 +699,11 @@ export default function ImageReceiver() {
*/ */
it("SUB_GRAPHIC_IMAGE_RECEIVER_READLATESTIMAGE_CALLBACK_0100", 0, async function (done) { it("SUB_GRAPHIC_IMAGE_RECEIVER_READLATESTIMAGE_CALLBACK_0100", 0, async function (done) {
var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMATJPEG, CAPACITY); var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMATJPEG, CAPACITY);
var error = receiver.checkDeviceTest;
if (DEVICE_CODE == error) {
expect(error == DEVICE_CODE).assertTrue();
done();
}
var dummy = receiver.test; var dummy = receiver.test;
if (receiver != undefined) { if (receiver != undefined) {
receiver.readLatestImage((err, img) => { receiver.readLatestImage((err, img) => {
...@@ -696,6 +732,11 @@ export default function ImageReceiver() { ...@@ -696,6 +732,11 @@ export default function ImageReceiver() {
*/ */
it("SUB_GRAPHIC_IMAGE_RECEIVER_READNEXTIMAGE_PROMISE_0100", 0, async function (done) { it("SUB_GRAPHIC_IMAGE_RECEIVER_READNEXTIMAGE_PROMISE_0100", 0, async function (done) {
var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMATJPEG, CAPACITY); var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMATJPEG, CAPACITY);
var error = receiver.checkDeviceTest;
if (DEVICE_CODE == error) {
expect(error == DEVICE_CODE).assertTrue();
done();
}
var dummy = receiver.test; var dummy = receiver.test;
expect(receiver != undefined).assertTrue(); expect(receiver != undefined).assertTrue();
if (receiver != undefined) { if (receiver != undefined) {
...@@ -730,6 +771,11 @@ export default function ImageReceiver() { ...@@ -730,6 +771,11 @@ export default function ImageReceiver() {
*/ */
it("SUB_GRAPHIC_IMAGE_RECEIVER_READNEXTIMAGE_CALLBACK_0100", 0, async function (done) { it("SUB_GRAPHIC_IMAGE_RECEIVER_READNEXTIMAGE_CALLBACK_0100", 0, async function (done) {
var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMATJPEG, CAPACITY); var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMATJPEG, CAPACITY);
var error = receiver.checkDeviceTest;
if (DEVICE_CODE == error) {
expect(error == DEVICE_CODE).assertTrue();
done();
}
var dummy = receiver.test; var dummy = receiver.test;
if (receiver != undefined) { if (receiver != undefined) {
receiver.readNextImage((err, img) => { receiver.readNextImage((err, img) => {
...@@ -824,6 +870,11 @@ export default function ImageReceiver() { ...@@ -824,6 +870,11 @@ export default function ImageReceiver() {
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} else { } else {
var error = receiver.checkDeviceTest;
if (DEVICE_CODE == error) {
expect(error == DEVICE_CODE).assertTrue();
done();
}
let pass = false; let pass = false;
receiver.on("imageArrival", (err) => { receiver.on("imageArrival", (err) => {
if (err) { if (err) {
...@@ -862,7 +913,11 @@ export default function ImageReceiver() { ...@@ -862,7 +913,11 @@ export default function ImageReceiver() {
done(); done();
return; return;
} }
var error = receiver.checkDeviceTest;
if (DEVICE_CODE == error) {
expect(error == DEVICE_CODE).assertTrue();
done();
}
receiver.on("imageArrival", () => { receiver.on("imageArrival", () => {
expect(true).assertTrue(); expect(true).assertTrue();
}); });
...@@ -922,13 +977,15 @@ export default function ImageReceiver() { ...@@ -922,13 +977,15 @@ export default function ImageReceiver() {
done(); done();
return; return;
} }
var error = receiver.checkDeviceTest;
if (DEVICE_CODE == error) {
expect(error == DEVICE_CODE).assertTrue();
done();
}
receiver.on("imageArrival", () => { receiver.on("imageArrival", () => {
expect(true).assertTrue(); expect(true).assertTrue();
}); });
var dummy = receiver.test; var dummy = receiver.test;
receiver.readLatestImage((err, img) => { receiver.readLatestImage((err, img) => {
if (img == undefined) { if (img == undefined) {
expect(false).assertTrue(); expect(false).assertTrue();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册