提交 ab15557c 编写于 作者: F fengzewu

fix receiver crash beta

Signed-off-by: Nfengzewu <fengzewu@huawei.com>
上级 4ada2535
......@@ -28,20 +28,19 @@ describe('ImageReceiver', function () {
const YCBCR_422_SP = 1000;
const FORMATJPEG = 2000;
beforeAll(function () {
beforeAll(async function () {
console.info('beforeAll case');
})
beforeEach(function () {
isTimeOut = false;
console.info('beforeEach case');
})
afterEach(function () {
afterEach(async function () {
console.info('afterEach case');
})
afterAll(function () {
afterAll(async function () {
console.info('afterAll case');
})
......@@ -49,7 +48,7 @@ describe('ImageReceiver', function () {
await new Promise(res => setTimeout(() => { res() }, times));
}
function createRecriver(done, testNum, wid, hei, fmt, cap) {
async function createRecriver(done, testNum, wid, hei, fmt, cap) {
try {
image.createImageReceiver(wid, hei, fmt, cap);
expect(false).assertTrue();
......@@ -62,21 +61,21 @@ describe('ImageReceiver', function () {
}
async function getComponentProErr(done, testNum, param) {
var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMAT, CAPACITY)
var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMAT, CAPACITY);
let once = false;
if (receiver == undefined) {
expect(false).assertTrue();
done()
done();
} else {
receiver.on('imageArrival', () => {
expect(true).assertTrue();
})
var dummy = receiver.test
if (once) {
return;
}
once = true;
receiver.readLatestImage(async (err, img) => {
if (img == undefined) {
expect(false).assertTrue();
done()
done();
} else {
expect(img.size.width == WIDTH).assertTrue();
expect(img.size.height == HEIGHT).assertTrue();
......@@ -95,25 +94,28 @@ describe('ImageReceiver', function () {
}
}
})
expect(true).assertTrue();
})
var dummy = receiver.test;
}
}
async function getComponentCbErr(done, testNum, param) {
var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMAT, CAPACITY)
var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMAT, CAPACITY);
let once = false;
if (receiver == undefined) {
expect(false).assertTrue();
done()
done();
} else {
receiver.on('imageArrival', () => {
expect(true).assertTrue();
})
var dummy = receiver.test
if (once) {
return;
}
once = true;
receiver.readLatestImage(async (err, img) => {
if (img == undefined) {
expect(false).assertTrue();
done()
done();
} else {
expect(img.size.width == WIDTH).assertTrue();
expect(img.size.height == HEIGHT).assertTrue();
......@@ -122,7 +124,6 @@ describe('ImageReceiver', function () {
expect(img.clipRect.size.height == HEIGHT).assertTrue();
expect(img.clipRect.x == 0).assertTrue();
expect(img.clipRect.y == 0).assertTrue();
try {
img.getComponent(param, (err, component) => {
expect(false).assertTrue();
......@@ -134,22 +135,25 @@ describe('ImageReceiver', function () {
}
}
})
expect(true).assertTrue();
})
var dummy = receiver.test;
}
}
async function getComponentP(done, testNum, param) {
var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMAT, CAPACITY)
var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMAT, CAPACITY);
let once = false;
if (receiver == undefined) {
expect(false).assertTrue();
done()
done();
return;
}
receiver.on('imageArrival', () => {
expect(true).assertTrue();
})
var dummy = receiver.test
if (once) {
return;
}
once = true;
receiver.readLatestImage((err, img) => {
if (err) {
expect(false).assertTrue();
......@@ -181,22 +185,25 @@ describe('ImageReceiver', function () {
})
}
})
expect(true).assertTrue();
})
var dummy = receiver.test;
}
async function getComponentCb(done, testNum, param) {
var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMAT, CAPACITY)
var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMAT, CAPACITY);
let once = false;
if (receiver == undefined) {
expect(false).assertTrue();
done()
done();
return;
}
receiver.on('imageArrival', () => {
expect(true).assertTrue();
})
var dummy = receiver.test
if (once) {
return;
}
once = true;
receiver.readLatestImage((err, img) => {
if (err) {
expect(false).assertTrue();
......@@ -225,6 +232,9 @@ describe('ImageReceiver', function () {
})
}
})
expect(true).assertTrue();
})
var dummy = receiver.test;
}
async function onErr(done, testNum, param) {
......@@ -243,7 +253,7 @@ describe('ImageReceiver', function () {
console.log(`${testNum} error msg: ` + error);
done();
}
var dummy = receiver.test
var dummy = receiver.test;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册