From 75a923cbf3d95887baed1820e80bc0c38d9b26f5 Mon Sep 17 00:00:00 2001 From: renhongwei Date: Thu, 23 Mar 2023 15:15:18 +0800 Subject: [PATCH] add device doce Signed-off-by: renhongwei --- .../src/main/js/test/receiver.test.js | 58 ++++++++++++++++++- 1 file changed, 56 insertions(+), 2 deletions(-) diff --git a/multimedia/image/image_js_standard/imageReceiver/src/main/js/test/receiver.test.js b/multimedia/image/image_js_standard/imageReceiver/src/main/js/test/receiver.test.js index 65832cee7..ec8b2c51f 100644 --- a/multimedia/image/image_js_standard/imageReceiver/src/main/js/test/receiver.test.js +++ b/multimedia/image/image_js_standard/imageReceiver/src/main/js/test/receiver.test.js @@ -22,6 +22,7 @@ export default function ImageReceiver() { const CAPACITY = 8; const RGBA = 12; const Jpg_Stride = 1; + const DEVICE_CODE = 801; const { JPEG: FORMATJPEG } = image.ImageFormat; const { JPEG } = image.ComponentType; beforeAll(async function () { @@ -67,6 +68,11 @@ export default function ImageReceiver() { expect(false).assertTrue(); done(); } else { + var error = receiver.checkDeviceTest; + if (DEVICE_CODE == error) { + expect(error == DEVICE_CODE).assertTrue(); + done(); + } receiver.on("imageArrival", () => { if (once) { return; @@ -108,6 +114,11 @@ export default function ImageReceiver() { expect(false).assertTrue(); done(); } else { + var error = receiver.checkDeviceTest; + if (DEVICE_CODE == error) { + expect(error == DEVICE_CODE).assertTrue(); + done(); + } receiver.on("imageArrival", () => { if (once) { return; @@ -150,6 +161,11 @@ export default function ImageReceiver() { expect(false).assertTrue(); return; } + var error = receiver.checkDeviceTest; + if (DEVICE_CODE == error) { + expect(error == DEVICE_CODE).assertTrue(); + done(); + } receiver.on("imageArrival", () => { if (once) { return; @@ -199,6 +215,11 @@ export default function ImageReceiver() { done(); return; } + var error = receiver.checkDeviceTest; + if (DEVICE_CODE == error) { + expect(error == DEVICE_CODE).assertTrue(); + done(); + } receiver.on("imageArrival", () => { if (once) { return; @@ -635,6 +656,11 @@ export default function ImageReceiver() { */ it("SUB_GRAPHIC_IMAGE_RECEIVER_READLATESTIMAGE_PROMISE_0100", 0, async function (done) { 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; if (receiver != undefined) { receiver @@ -668,6 +694,11 @@ export default function ImageReceiver() { */ it("SUB_GRAPHIC_IMAGE_RECEIVER_READLATESTIMAGE_CALLBACK_0100", 0, async function (done) { 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; if (receiver != undefined) { receiver.readLatestImage((err, img) => { @@ -696,6 +727,11 @@ export default function ImageReceiver() { */ it("SUB_GRAPHIC_IMAGE_RECEIVER_READNEXTIMAGE_PROMISE_0100", 0, async function (done) { 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; expect(receiver != undefined).assertTrue(); if (receiver != undefined) { @@ -730,6 +766,11 @@ export default function ImageReceiver() { */ it("SUB_GRAPHIC_IMAGE_RECEIVER_READNEXTIMAGE_CALLBACK_0100", 0, async function (done) { 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; if (receiver != undefined) { receiver.readNextImage((err, img) => { @@ -824,6 +865,11 @@ export default function ImageReceiver() { expect(false).assertTrue(); done(); } else { + var error = receiver.checkDeviceTest; + if (DEVICE_CODE == error) { + expect(error == DEVICE_CODE).assertTrue(); + done(); + } let pass = false; receiver.on("imageArrival", (err) => { if (err) { @@ -862,7 +908,11 @@ export default function ImageReceiver() { done(); return; } - + var error = receiver.checkDeviceTest; + if (DEVICE_CODE == error) { + expect(error == DEVICE_CODE).assertTrue(); + done(); + } receiver.on("imageArrival", () => { expect(true).assertTrue(); }); @@ -922,7 +972,11 @@ export default function ImageReceiver() { done(); return; } - + var error = receiver.checkDeviceTest; + if (DEVICE_CODE == error) { + expect(error == DEVICE_CODE).assertTrue(); + done(); + } receiver.on("imageArrival", () => { expect(true).assertTrue(); }); -- GitLab