Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
b184a22d
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
b184a22d
编写于
5月 26, 2023
作者:
O
openharmony_ci
提交者:
Gitee
5月 26, 2023
浏览文件
操作
浏览文件
下载
差异文件
!8768 image xts memory
Merge pull request !8768 from caochuan/memoryLeak
上级
f8b47e88
f5b7e40d
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
166 addition
and
3 deletion
+166
-3
multimedia/image/image_js_standard/imagePacking/src/main/js/test/packing.test.js
...js_standard/imagePacking/src/main/js/test/packing.test.js
+44
-0
multimedia/image/image_js_standard/imagePixelMapFramework/src/main/js/test/framework.test.js
...imagePixelMapFramework/src/main/js/test/framework.test.js
+20
-2
multimedia/image/image_js_standard/imageRaw/src/main/js/test/raw.test.js
...e/image_js_standard/imageRaw/src/main/js/test/raw.test.js
+23
-0
multimedia/image/image_js_standard/imageReceiver/src/main/js/test/receiver.test.js
..._standard/imageReceiver/src/main/js/test/receiver.test.js
+19
-1
multimedia/image/image_js_standard/imageWebp/src/main/js/test/webp.test.js
...image_js_standard/imageWebp/src/main/js/test/webp.test.js
+30
-0
multimedia/image/image_js_standard/imageYUV/src/main/js/test/yuv.test.js
...e/image_js_standard/imageYUV/src/main/js/test/yuv.test.js
+30
-0
未找到文件。
multimedia/image/image_js_standard/imagePacking/src/main/js/test/packing.test.js
浏览文件 @
b184a22d
...
...
@@ -21,6 +21,8 @@ import fileio from "@ohos.fileio";
export
default
function
imagePacking
()
{
describe
(
"
imagePacking
"
,
function
()
{
let
globalpixelmap
;
let
globalPacker
;
let
globalImagesource
;
let
filePath
;
let
fdNumber
;
async
function
getFd
(
fileName
)
{
...
...
@@ -62,6 +64,22 @@ export default function imagePacking() {
console
.
info
(
"
globalpixelmap release fail
"
);
}
}
if
(
globalImagesource
!=
undefined
)
{
console
.
info
(
"
globalpixelmap release start
"
);
try
{
await
globalImagesource
.
release
();
}
catch
(
error
)
{
console
.
info
(
"
globalImagesource release fail
"
);
}
}
if
(
globalPacker
!=
undefined
)
{
console
.
info
(
"
globalPacker release start
"
);
try
{
await
globalPacker
.
release
();
}
catch
(
error
)
{
console
.
info
(
"
globalPacker release fail
"
);
}
}
console
.
info
(
"
afterEach case
"
);
});
...
...
@@ -92,6 +110,7 @@ export default function imagePacking() {
console
.
info
(
`
${
testNum
}
create imagepacker fail`
);
done
();
}
else
{
globalPacker
=
imagePackerApi
;
imagePackerApi
.
packing
(
pixelmap
,
arg
)
.
then
((
data
)
=>
{
...
...
@@ -142,6 +161,7 @@ export default function imagePacking() {
console
.
info
(
`
${
testNum
}
create imagepacker fail`
);
done
();
}
else
{
globalPacker
=
imagePackerApi
;
imagePackerApi
.
packing
(
pixelmap
,
arg
,
(
err
,
data
)
=>
{
if
(
err
!=
undefined
)
{
console
.
info
(
`
${
testNum
}
packing failerr:
${
err
}
`
);
...
...
@@ -188,6 +208,7 @@ export default function imagePacking() {
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalPacker
=
imagePackerApi
;
imagePackerApi
.
packing
(
pixelmap
,
arg
,
(
err
,
data
)
=>
{
expect
(
err
!=
undefined
).
assertTrue
();
done
();
...
...
@@ -222,6 +243,7 @@ export default function imagePacking() {
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalPacker
=
imagePackerApi
;
imagePackerApi
.
packing
(
pixelmap
,
arg
)
.
then
((
data
)
=>
{
...
...
@@ -563,12 +585,14 @@ export default function imagePacking() {
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalImagesource
=
imageSourceApi
;
const
imagePackerApi
=
image
.
createImagePacker
();
if
(
imagePackerApi
==
undefined
)
{
console
.
info
(
"
SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_PROMISE_0100 create image packer failed
"
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalPacker
=
imagePackerApi
;
let
packOpts
=
{
format
:
"
image/jpeg
"
,
quality
:
99
};
imagePackerApi
.
packing
(
imageSourceApi
,
packOpts
)
...
...
@@ -611,12 +635,14 @@ export default function imagePacking() {
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalImagesource
=
imageSourceApi
;
const
imagePackerApi
=
image
.
createImagePacker
();
if
(
imagePackerApi
==
undefined
)
{
console
.
info
(
"
SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0100 create image packer failed
"
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalPacker
=
imagePackerApi
;
let
packOpts
=
{
format
:
"
image/jpeg
"
,
quality
:
1
};
imagePackerApi
.
packing
(
imageSourceApi
,
packOpts
,
(
err
,
data
)
=>
{
console
.
info
(
...
...
@@ -654,12 +680,14 @@ export default function imagePacking() {
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalImagesource
=
imageSourceApi
;
const
imagePackerApi
=
image
.
createImagePacker
();
if
(
imagePackerApi
==
undefined
)
{
console
.
info
(
"
SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0200 create image packer failed
"
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalPacker
=
imagePackerApi
;
let
packOpts
=
{
format
:
"
image/gif
"
,
quality
:
98
};
imagePackerApi
.
packing
(
imageSourceApi
,
packOpts
,
(
err
,
data
)
=>
{
console
.
info
(
"
SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0200 success
"
);
...
...
@@ -696,12 +724,14 @@ export default function imagePacking() {
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalImagesource
=
imageSourceApi
;
const
imagePackerApi
=
image
.
createImagePacker
();
if
(
imagePackerApi
==
undefined
)
{
console
.
info
(
"
SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0300 create image packer failed
"
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalPacker
=
imagePackerApi
;
let
packOpts
=
{
format
:
"
image/jpeg
"
,
quality
:
101
};
imagePackerApi
.
packing
(
imageSourceApi
,
packOpts
,
(
err
,
data
)
=>
{
console
.
info
(
"
SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0300 success
"
);
...
...
@@ -738,12 +768,14 @@ export default function imagePacking() {
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalImagesource
=
imageSourceApi
;
const
imagePackerApi
=
image
.
createImagePacker
();
if
(
imagePackerApi
==
undefined
)
{
console
.
info
(
"
SUB_GRAPHIC_IMAGE_PACKING_CREATEIMAGEPACKER_0100 create image packer failed
"
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalPacker
=
imagePackerApi
;
console
.
info
(
"
SUB_GRAPHIC_IMAGE_PACKING_CREATEIMAGEPACKER_0100 create image packer success
"
);
expect
(
true
).
assertTrue
();
done
();
...
...
@@ -777,12 +809,14 @@ export default function imagePacking() {
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalImagesource
=
imageSourceApi
;
const
imagePackerApi
=
image
.
createImagePacker
();
if
(
imagePackerApi
==
undefined
)
{
console
.
info
(
"
SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_PROMISE_0200 create image packer failed
"
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalPacker
=
imagePackerApi
;
let
packOpts
=
{
format
:
"
image/jpeg
"
};
imagePackerApi
.
packing
(
imageSourceApi
,
packOpts
)
...
...
@@ -826,12 +860,14 @@ export default function imagePacking() {
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalImagesource
=
imageSourceApi
;
const
imagePackerApi
=
image
.
createImagePacker
();
if
(
imagePackerApi
==
undefined
)
{
console
.
info
(
"
SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_PROMISE_0300 create image packer failed
"
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalPacker
=
imagePackerApi
;
let
packOpts
=
{
quality
:
50
};
imagePackerApi
.
packing
(
imageSourceApi
,
packOpts
)
...
...
@@ -876,12 +912,14 @@ export default function imagePacking() {
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalImagesource
=
imageSourceApi
;
const
imagePackerApi
=
image
.
createImagePacker
();
if
(
imagePackerApi
==
undefined
)
{
console
.
info
(
"
SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0400 create image packer failed
"
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalPacker
=
imagePackerApi
;
let
packOpts
=
{
format
:
"
image/jpeg
"
,
quality
:
100
};
imagePackerApi
.
packing
(
imageSourceApi
,
packOpts
,
(
err
,
data
)
=>
{
if
(
err
)
{
...
...
@@ -929,12 +967,14 @@ export default function imagePacking() {
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalImagesource
=
imageSourceApi
;
const
imagePackerApi
=
image
.
createImagePacker
();
if
(
imagePackerApi
==
undefined
)
{
console
.
info
(
"
SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0500 create image packer failed
"
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalPacker
=
imagePackerApi
;
let
packOpts
=
{
format
:
"
image/jpeg
"
,
quality
:
0
};
imagePackerApi
.
packing
(
imageSourceApi
,
packOpts
,
(
err
,
data
)
=>
{
console
.
info
(
"
SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0500 success
"
);
...
...
@@ -970,12 +1010,14 @@ export default function imagePacking() {
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalImagesource
=
imageSourceApi
;
const
imagePackerApi
=
image
.
createImagePacker
();
if
(
imagePackerApi
==
undefined
)
{
console
.
info
(
"
SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0600 create image packer failed
"
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalPacker
=
imagePackerApi
;
let
packOpts
=
{
format
:
"
image/jpeg
"
,
quality
:
-
1
};
imagePackerApi
.
packing
(
imageSourceApi
,
packOpts
,
(
err
,
data
)
=>
{
console
.
info
(
"
SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0600 success
"
);
...
...
@@ -1008,6 +1050,7 @@ export default function imagePacking() {
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalPacker
=
imagePackerApi
;
imagePackerApi
.
release
()
.
then
(()
=>
{
...
...
@@ -1040,6 +1083,7 @@ export default function imagePacking() {
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalPacker
=
imagePackerApi
;
imagePackerApi
.
release
(()
=>
{
console
.
info
(
"
SUB_GRAPHIC_IMAGE_PACKING_RELEASE_IMAGEPACKER_CALLBACK_0100 success
"
);
expect
(
true
).
assertTrue
();
...
...
multimedia/image/image_js_standard/imagePixelMapFramework/src/main/js/test/framework.test.js
浏览文件 @
b184a22d
...
...
@@ -20,6 +20,7 @@ import { testPng, testJpg } from '../../../../../image/src/main/js/test/testImg'
export
default
function
imagePixelMapFramework
()
{
describe
(
'
imagePixelMapFramework
'
,
function
()
{
let
globalpixelmap
;
let
globalImagesource
;
beforeAll
(
async
function
()
{
console
.
info
(
'
beforeAll case
'
);
})
...
...
@@ -37,6 +38,14 @@ export default function imagePixelMapFramework() {
console
.
info
(
"
globalpixelmap release fail
"
);
}
}
if
(
globalImagesource
!=
undefined
)
{
console
.
info
(
"
globalpixelmap release start
"
);
try
{
await
globalImagesource
.
release
();
}
catch
(
error
)
{
console
.
info
(
"
globalImagesource release fail
"
);
}
}
console
.
info
(
'
afterEach case
'
);
})
...
...
@@ -141,6 +150,7 @@ export default function imagePixelMapFramework() {
async
function
checkAlphaPixelmap
(
done
,
logger
,
alphaPixelMap
)
{
logger
.
log
(
"
AlphaPixelMap
"
+
alphaPixelMap
);
if
(
alphaPixelMap
!=
undefined
)
{
globalpixelmap
=
alphaPixelMap
;
var
imageInfo
=
await
alphaPixelMap
.
getImageInfo
();
logger
.
log
(
"
AlphaPixelMap pixelformat
"
+
imageInfo
.
pixelFormat
);
expect
(
imageInfo
.
pixelFormat
==
6
).
assertTrue
();
...
...
@@ -157,6 +167,7 @@ export default function imagePixelMapFramework() {
let
imageSource
=
image
.
createImageSource
(
imageData
);
logger
.
log
(
"
ImageSource
"
+
(
imageSource
!=
undefined
));
if
(
imageSource
!=
undefined
)
{
globalImagesource
=
imageSource
;
let
pixelMap
=
await
imageSource
.
createPixelMap
();
logger
.
log
(
"
PixelMap
"
+
pixelMap
);
if
(
pixelMap
!=
undefined
)
{
...
...
@@ -193,6 +204,7 @@ export default function imagePixelMapFramework() {
let
imageSource
=
image
.
createImageSource
(
imageData
,
sourceOptions
);
logger
.
log
(
"
ImageSource
"
+
(
imageSource
!=
undefined
));
if
(
imageSource
!=
undefined
)
{
globalImagesource
=
imageSource
;
let
pixelMap
=
await
imageSource
.
createPixelMap
(
decodingOptions
);
logger
.
log
(
"
PixelMap
"
+
pixelMap
);
if
(
pixelMap
!=
undefined
)
{
...
...
@@ -225,6 +237,7 @@ export default function imagePixelMapFramework() {
let
imageSource
=
image
.
createImageSource
(
imageData
,
sourceOptions
);
logger
.
log
(
"
ImageSource
"
+
(
imageSource
!=
undefined
));
if
(
imageSource
!=
undefined
)
{
globalImagesource
=
imageSource
;
let
pixelMap
=
await
imageSource
.
createPixelMap
();
logger
.
log
(
"
PixelMap
"
+
pixelMap
);
if
(
pixelMap
!=
undefined
)
{
...
...
@@ -290,7 +303,7 @@ export default function imagePixelMapFramework() {
async
function
opacityErr
(
done
,
testNum
,
param
,
type
)
{
let
logger
=
loger
(
testNum
)
try
{
var
pixelMap
=
await
genPixelMap
()
var
pixelMap
=
await
genPixelMap
()
;
logger
.
log
(
"
pixelMap
"
+
(
pixelMap
!=
undefined
));
if
(
pixelMap
!=
undefined
)
{
globalpixelmap
=
pixelMap
;
...
...
@@ -327,6 +340,7 @@ export default function imagePixelMapFramework() {
let
imageSource
=
genPicSource
();
logger
.
log
(
"
ImageSource
"
+
(
imageSource
!=
undefined
));
if
(
imageSource
!=
undefined
)
{
globalImagesource
=
imageSource
;
let
pixelMap
=
await
imageSource
.
createPixelMap
();
logger
.
log
(
"
PixelMap
"
+
pixelMap
);
if
(
pixelMap
!=
undefined
)
{
...
...
@@ -363,6 +377,7 @@ export default function imagePixelMapFramework() {
let
imageSource
=
image
.
createImageSource
(
imageData
,
sourceOptions
);
logger
.
log
(
"
ImageSource
"
+
(
imageSource
!=
undefined
));
if
(
imageSource
!=
undefined
)
{
globalImagesource
=
imageSource
;
let
pixelMap
=
await
imageSource
.
createPixelMap
();
logger
.
log
(
"
PixelMap
"
+
pixelMap
);
if
(
pixelMap
!=
undefined
)
{
...
...
@@ -417,20 +432,22 @@ export default function imagePixelMapFramework() {
const
imageSource
=
image
.
createImageSource
(
base64Image
)
logger
.
log
(
"
ImageSource
"
+
(
imageSource
!=
undefined
));
if
(
imageSource
!=
undefined
)
{
globalImagesource
=
imageSource
;
let
pixelMap
=
await
imageSource
.
createPixelMap
();
globalpixelmap
=
pixelMap
;
logger
.
log
(
"
PixelMap
"
+
(
pixelMap
!=
undefined
));
expect
(
pixelMap
!=
undefined
).
assertTrue
();
done
();
}
else
{
logger
.
log
(
"
ImageSource undefined
"
);
expect
(
false
).
assertTrue
();
done
();
}
}
catch
(
error
)
{
logger
.
log
(
'
failed
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
done
();
})
/**
...
...
@@ -670,6 +687,7 @@ export default function imagePixelMapFramework() {
let
imageSource
=
genPicSource
();
logger
.
log
(
"
ImageSource
"
+
(
imageSource
!=
undefined
));
if
(
imageSource
!=
undefined
)
{
globalImagesource
=
imageSource
;
let
pixelMap
=
await
imageSource
.
createPixelMap
();
logger
.
log
(
"
PixelMap
"
+
pixelMap
);
if
(
pixelMap
!=
undefined
)
{
...
...
multimedia/image/image_js_standard/imageRaw/src/main/js/test/raw.test.js
浏览文件 @
b184a22d
...
...
@@ -20,6 +20,8 @@ import featureAbility from "@ohos.ability.featureAbility";
export
default
function
imageRaw
()
{
describe
(
"
imageRaw
"
,
function
()
{
let
globalpixelmap
;
let
globalImagesource
;
let
globalPacker
;
const
RGBA_8888
=
image
.
PixelMapFormat
.
RGBA_8888
;
let
filePath
;
let
fdNumber
;
...
...
@@ -62,6 +64,22 @@ export default function imageRaw() {
console
.
info
(
"
globalpixelmap release fail
"
);
}
}
if
(
globalImagesource
!=
undefined
)
{
console
.
info
(
"
globalpixelmap release start
"
);
try
{
await
globalImagesource
.
release
();
}
catch
(
error
)
{
console
.
info
(
"
globalImagesource release fail
"
);
}
}
if
(
globalPacker
!=
undefined
)
{
console
.
info
(
"
globalPacker release start
"
);
try
{
await
globalPacker
.
release
();
}
catch
(
error
)
{
console
.
info
(
"
globalPacker release fail
"
);
}
}
console
.
info
(
"
afterEach case
"
);
});
...
...
@@ -78,6 +96,7 @@ export default function imageRaw() {
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalPacker
=
imagePackerApi
;
let
packOptsFormat
=
`format:`
+
packOpts
.
format
;
let
packOptsQuality
=
`quality:`
+
packOpts
.
quality
;
console
.
info
(
...
...
@@ -134,6 +153,7 @@ export default function imageRaw() {
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalImagesource
=
imageSourceApi
;
console
.
info
(
`
${
testNum
}
createPixelMapPromise create imagesource success`
);
imageSourceApi
.
createPixelMap
(
decodeOpts
)
...
...
@@ -172,6 +192,7 @@ export default function imageRaw() {
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalImagesource
=
imageSourceApi
;
console
.
info
(
`
${
testNum
}
createPixelMapPromise create imagesource success`
);
imageSourceApi
.
createPixelMap
(
decodeOpts
,
(
err
,
pixelmap
)
=>
{
if
(
pixelmap
!=
undefined
)
{
...
...
@@ -203,6 +224,7 @@ export default function imageRaw() {
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalImagesource
=
imageSourceApi
;
console
.
info
(
`
${
testNum
}
createPixelMapPromise create imagesource success`
);
imageSourceApi
.
createPixelMap
(
decodeOpts
,
(
err
,
pixelmap
)
=>
{
if
(
pixelmap
==
undefined
)
{
...
...
@@ -232,6 +254,7 @@ export default function imageRaw() {
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalImagesource
=
imageSourceApi
;
console
.
info
(
`
${
testNum
}
createPixelMapPromise create imagesource success`
);
imageSourceApi
.
createPixelMap
(
decodeOpts
)
...
...
multimedia/image/image_js_standard/imageReceiver/src/main/js/test/receiver.test.js
浏览文件 @
b184a22d
...
...
@@ -18,6 +18,7 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from
export
default
function
ImageReceiver
()
{
describe
(
"
ImageReceiver
"
,
function
()
{
let
globalreceiver
;
let
globalImg
;
const
WIDTH
=
8192
;
const
HEIGHT
=
8
;
const
CAPACITY
=
8
;
...
...
@@ -35,6 +36,14 @@ export default function ImageReceiver() {
});
afterEach
(
async
function
()
{
if
(
globalImg
!=
undefined
)
{
console
.
info
(
"
globalImg release start
"
);
try
{
await
globalImg
.
release
();
}
catch
(
error
)
{
console
.
info
(
"
globalImg release fail
"
);
}
}
if
(
globalreceiver
!=
undefined
)
{
console
.
info
(
"
globalreceiver release start
"
);
try
{
...
...
@@ -98,6 +107,7 @@ export default function ImageReceiver() {
done
();
return
;
}
else
{
globalImg
=
img
;
expect
(
img
.
size
.
width
==
WIDTH
).
assertTrue
();
expect
(
img
.
size
.
height
==
HEIGHT
).
assertTrue
();
console
.
log
(
`
${
testNum
}
img.format:
${
img
.
format
}
`
)
...
...
@@ -150,6 +160,7 @@ export default function ImageReceiver() {
done
();
return
;
}
else
{
globalImg
=
img
;
expect
(
img
.
size
.
width
==
WIDTH
).
assertTrue
();
expect
(
img
.
size
.
height
==
HEIGHT
).
assertTrue
();
console
.
log
(
`
${
testNum
}
img.format:
${
img
.
format
}
`
)
...
...
@@ -202,6 +213,7 @@ export default function ImageReceiver() {
done
();
return
;
}
else
{
globalImg
=
img
;
expect
(
img
.
size
.
width
==
WIDTH
).
assertTrue
();
expect
(
img
.
size
.
height
==
HEIGHT
).
assertTrue
();
checkFormat
(
img
.
format
);
...
...
@@ -261,6 +273,7 @@ export default function ImageReceiver() {
done
();
return
;
}
else
{
globalImg
=
img
;
expect
(
img
.
size
.
width
==
WIDTH
).
assertTrue
();
expect
(
img
.
size
.
height
==
HEIGHT
).
assertTrue
();
checkFormat
(
img
.
format
);
...
...
@@ -731,6 +744,7 @@ export default function ImageReceiver() {
receiver
.
readLatestImage
()
.
then
((
img
)
=>
{
globalImg
=
img
;
console
.
info
(
"
SUB_GRAPHIC_IMAGE_RECEIVER_READLATESTIMAGE_PROMISE_0100 readLatestImage Success
"
);
expect
(
img
!=
undefined
).
assertTrue
();
done
();
...
...
@@ -772,6 +786,7 @@ export default function ImageReceiver() {
if
(
receiver
!=
undefined
)
{
globalreceiver
=
receiver
;
receiver
.
readLatestImage
((
err
,
img
)
=>
{
globalImg
=
img
;
console
.
info
(
"
SUB_GRAPHIC_IMAGE_RECEIVER_READLATESTIMAGE_CALLBACK_0100 readLatestImage call back Success
"
);
...
...
@@ -812,6 +827,7 @@ export default function ImageReceiver() {
receiver
.
readNextImage
()
.
then
((
img
)
=>
{
globalImg
=
img
;
console
.
info
(
"
SUB_GRAPHIC_IMAGE_RECEIVER_READNEXTIMAGE_PROMISE_0100 readNextImage Success
"
);
expect
(
img
!=
undefined
).
assertTrue
();
done
();
...
...
@@ -858,6 +874,7 @@ export default function ImageReceiver() {
done
();
return
;
}
else
{
globalImg
=
img
;
console
.
info
(
"
SUB_GRAPHIC_IMAGE_RECEIVER_READNEXTIMAGE_CALLBACK_0100 readNextImage call back Success
"
);
...
...
@@ -1016,6 +1033,7 @@ export default function ImageReceiver() {
done
();
return
;
}
else
{
globalImg
=
img
;
expect
(
img
.
size
.
width
==
WIDTH
).
assertTrue
();
expect
(
img
.
size
.
height
==
HEIGHT
).
assertTrue
();
expect
(
img
.
format
==
RGBA
).
assertTrue
();
...
...
@@ -1082,7 +1100,7 @@ export default function ImageReceiver() {
done
();
return
;
}
globalImg
=
img
;
expect
(
img
.
size
.
width
==
WIDTH
).
assertTrue
();
expect
(
img
.
size
.
height
==
HEIGHT
).
assertTrue
();
expect
(
img
.
format
==
RGBA
).
assertTrue
();
...
...
multimedia/image/image_js_standard/imageWebp/src/main/js/test/webp.test.js
浏览文件 @
b184a22d
...
...
@@ -21,6 +21,8 @@ import featureAbility from "@ohos.ability.featureAbility";
export
default
function
imageWebp
()
{
describe
(
"
imageWebp
"
,
function
()
{
let
globalpixelmap
;
let
globalImagesource
;
let
globalPacker
;
let
filePath
;
async
function
getFd
(
fileName
)
{
let
context
=
await
featureAbility
.
getContext
();
...
...
@@ -47,6 +49,22 @@ export default function imageWebp() {
console
.
info
(
"
globalpixelmap release fail
"
);
}
}
if
(
globalImagesource
!=
undefined
)
{
console
.
info
(
"
globalpixelmap release start
"
);
try
{
await
globalImagesource
.
release
();
}
catch
(
error
)
{
console
.
info
(
"
globalImagesource release fail
"
);
}
}
if
(
globalPacker
!=
undefined
)
{
console
.
info
(
"
globalPacker release start
"
);
try
{
await
globalPacker
.
release
();
}
catch
(
error
)
{
console
.
info
(
"
globalPacker release fail
"
);
}
}
console
.
info
(
"
afterEach case
"
);
});
...
...
@@ -62,6 +80,7 @@ export default function imageWebp() {
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalImagesource
=
imageSourceApi
;
imageSourceApi
.
createPixelMap
(
arg
,
(
err
,
pixelmap
)
=>
{
if
(
pixelmap
==
undefined
)
{
expect
(
true
).
assertTrue
();
...
...
@@ -83,6 +102,7 @@ export default function imageWebp() {
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalImagesource
=
imageSourceApi
;
imageSourceApi
.
createPixelMap
(
arg
,
(
err
,
pixelmap
)
=>
{
if
(
err
)
{
console
.
info
(
`
${
testNum
}
- fail
${
err
}
`
);
...
...
@@ -116,6 +136,7 @@ export default function imageWebp() {
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalImagesource
=
imageSourceApi
;
imageSourceApi
.
createPixelMap
(
arg
)
.
then
((
pixelmap
)
=>
{
...
...
@@ -138,6 +159,7 @@ export default function imageWebp() {
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalImagesource
=
imageSourceApi
;
imageSourceApi
.
createPixelMap
(
arg
)
.
then
((
pixelmap
)
=>
{
...
...
@@ -224,6 +246,7 @@ export default function imageWebp() {
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalPacker
=
imagePackerApi
;
imagePackerApi
.
packing
(
pixelmap
,
arg
)
.
then
((
data
)
=>
{
...
...
@@ -309,6 +332,7 @@ export default function imageWebp() {
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalPacker
=
imagePackerApi
;
imagePackerApi
.
packing
(
pixelmap
,
arg
,
(
err
,
data
)
=>
{
console
.
info
(
`
${
testNum
}
success`
);
expect
(
data
!=
undefined
).
assertTrue
();
...
...
@@ -390,6 +414,7 @@ export default function imageWebp() {
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalPacker
=
imagePackerApi
;
imagePackerApi
.
packing
(
pixelmap
,
arg
)
.
then
((
data
)
=>
{
...
...
@@ -469,6 +494,7 @@ export default function imageWebp() {
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalPacker
=
imagePackerApi
;
imagePackerApi
.
packing
(
pixelmap
,
arg
,
(
err
,
data
)
=>
{
console
.
info
(
`
${
testNum
}
success`
);
expect
(
data
==
undefined
).
assertTrue
();
...
...
@@ -505,6 +531,7 @@ export default function imageWebp() {
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalImagesource
=
imageSourceApi
;
let
decodingOptions
=
{
sampleSize
:
1
,
editable
:
true
,
...
...
@@ -554,6 +581,7 @@ export default function imageWebp() {
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalImagesource
=
imageSourceApi
;
let
decodingOptions
=
{
sampleSize
:
1
,
editable
:
true
,
...
...
@@ -603,6 +631,7 @@ export default function imageWebp() {
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalImagesource
=
imageSourceApi
;
imageSourceApi
.
createPixelMap
()
.
then
((
pixelmap
)
=>
{
...
...
@@ -642,6 +671,7 @@ export default function imageWebp() {
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalImagesource
=
imageSourceApi
;
imageSourceApi
.
createPixelMap
((
err
,
pixelmap
)
=>
{
globalpixelmap
=
pixelmap
;
expect
(
pixelmap
!=
undefined
).
assertTrue
();
...
...
multimedia/image/image_js_standard/imageYUV/src/main/js/test/yuv.test.js
浏览文件 @
b184a22d
...
...
@@ -19,6 +19,8 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from
export
default
function
imageYuv
()
{
describe
(
"
imageYuv
"
,
function
()
{
let
globalpixelmap
;
let
globalImagesource
;
let
globalPacker
;
const
{
NV21
,
NV12
}
=
image
.
PixelMapFormat
;
const
WRONG_FORMAT
=
10
;
...
...
@@ -40,6 +42,22 @@ export default function imageYuv() {
console
.
info
(
"
globalpixelmap release fail
"
);
}
}
if
(
globalImagesource
!=
undefined
)
{
console
.
info
(
"
globalpixelmap release start
"
);
try
{
await
globalImagesource
.
release
();
}
catch
(
error
)
{
console
.
info
(
"
globalImagesource release fail
"
);
}
}
if
(
globalPacker
!=
undefined
)
{
console
.
info
(
"
globalPacker release start
"
);
try
{
await
globalPacker
.
release
();
}
catch
(
error
)
{
console
.
info
(
"
globalPacker release fail
"
);
}
}
console
.
info
(
"
afterEach case
"
);
});
...
...
@@ -77,6 +95,7 @@ export default function imageYuv() {
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalImagesource
=
imageSource
;
imageSource
.
createPixelMap
()
.
then
((
pixelmap
)
=>
{
...
...
@@ -121,6 +140,7 @@ export default function imageYuv() {
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalImagesource
=
imageSource
;
imageSource
.
createPixelMap
()
.
then
((
pixelmap
)
=>
{
...
...
@@ -149,6 +169,7 @@ export default function imageYuv() {
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalImagesource
=
imageSource
;
imageSource
.
createPixelMap
((
err
,
pixelmap
)
=>
{
if
(
err
!=
undefined
||
pixelmap
==
undefined
)
{
console
.
info
(
`
${
testNum
}
err2: `
+
err
);
...
...
@@ -187,6 +208,7 @@ export default function imageYuv() {
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalImagesource
=
imageSource
;
imageSource
.
createPixelMap
((
err
,
pixelmap
)
=>
{
if
(
err
!=
undefined
||
pixelmap
==
undefined
)
{
console
.
info
(
`
${
testNum
}
err: `
+
err
);
...
...
@@ -212,12 +234,14 @@ export default function imageYuv() {
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalImagesource
=
imageSource
;
const
imagePackerApi
=
image
.
createImagePacker
();
if
(
imagePackerApi
==
undefined
)
{
console
.
info
(
`
${
testNum
}
create ImagePacker failed`
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalPacker
=
imagePackerApi
;
imagePackerApi
.
packing
(
imageSource
,
arg
)
.
then
((
data
)
=>
{
...
...
@@ -251,12 +275,14 @@ export default function imageYuv() {
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalImagesource
=
imageSource
;
const
imagePackerApi
=
image
.
createImagePacker
();
if
(
imagePackerApi
==
undefined
)
{
console
.
info
(
`
${
testNum
}
create ImagePacker failed`
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalPacker
=
imagePackerApi
;
imagePackerApi
.
packing
(
imageSource
,
arg
)
.
then
((
data
)
=>
{
...
...
@@ -279,12 +305,14 @@ export default function imageYuv() {
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalImagesource
=
imageSource
;
const
imagePackerApi
=
image
.
createImagePacker
();
if
(
imagePackerApi
==
undefined
)
{
console
.
info
(
`
${
testNum
}
create ImagePacker failed`
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalPacker
=
imagePackerApi
;
imagePackerApi
.
packing
(
imageSource
,
arg
,
(
err
,
data
)
=>
{
if
(
err
!=
undefined
)
{
expect
(
false
).
assertTrue
();
...
...
@@ -315,12 +343,14 @@ export default function imageYuv() {
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalImagesource
=
imageSource
;
const
imagePackerApi
=
image
.
createImagePacker
();
if
(
imagePackerApi
==
undefined
)
{
console
.
info
(
`
${
testNum
}
create ImagePacker failed`
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
globalPacker
=
imagePackerApi
;
imagePackerApi
.
packing
(
imageSource
,
arg
,
(
err
,
data
)
=>
{
expect
(
err
!=
undefined
||
data
==
undefined
).
assertTrue
();
done
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录