Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
d7faec8f
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看板
提交
d7faec8f
编写于
4月 15, 2022
作者:
R
renyi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Modify options
Signed-off-by:
N
renyi
<
ry.renyi@huawei.com
>
上级
fd250659
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
4 addition
and
173 deletion
+4
-173
appexecfwk/zlib/actszipfileandunzipfiletest/entry/src/main/js/test/actszipfileandunzipfiletest.test.js
...ntry/src/main/js/test/actszipfileandunzipfiletest.test.js
+4
-173
未找到文件。
appexecfwk/zlib/actszipfileandunzipfiletest/entry/src/main/js/test/actszipfileandunzipfiletest.test.js
浏览文件 @
d7faec8f
...
@@ -44,7 +44,7 @@ it('ACTS_ZipFile_0100', 0, async function (done) {
...
@@ -44,7 +44,7 @@ it('ACTS_ZipFile_0100', 0, async function (done) {
var
path
=
""
;
var
path
=
""
;
var
zipDest
=
dir
+
"
/ACTS_ZipFile_0100.zip
"
var
zipDest
=
dir
+
"
/ACTS_ZipFile_0100.zip
"
var
options
=
{};
var
options
=
{};
options
.
flush
=
zlib
.
FlushType
.
FLUSH_TYPE_NO_FLUSH
;
options
.
level
=
zlib
.
CompressLevel
.
COMPRESS_LEVEL_NO_COMPRESSION
;
zlib
.
zipFile
(
path
,
zipDest
,
options
).
then
((
data
)
=>
{
zlib
.
zipFile
(
path
,
zipDest
,
options
).
then
((
data
)
=>
{
console
.
log
(
"
ACTS_ZipFile_0100 data:
"
+
data
);
console
.
log
(
"
ACTS_ZipFile_0100 data:
"
+
data
);
expect
(
data
).
assertEqual
(
zlib
.
ErrorCode
.
ERROR_CODE_ERRNO
);
expect
(
data
).
assertEqual
(
zlib
.
ErrorCode
.
ERROR_CODE_ERRNO
);
...
@@ -69,7 +69,7 @@ it('ACTS_ZipFile_0200', 0, async function (done) {
...
@@ -69,7 +69,7 @@ it('ACTS_ZipFile_0200', 0, async function (done) {
fileio
.
write
(
fd
,
infos
).
then
(
function
(
number
)
{
fileio
.
write
(
fd
,
infos
).
then
(
function
(
number
)
{
console
.
info
(
"
ACTS_ZipFile_0200 write data to file successfully:
"
+
number
);
console
.
info
(
"
ACTS_ZipFile_0200 write data to file successfully:
"
+
number
);
var
options
=
{};
var
options
=
{};
options
.
flush
=
zlib
.
FlushType
.
FLUSH_TYPE_NO_FLUSH
;
options
.
level
=
zlib
.
CompressLevel
.
COMPRESS_LEVEL_DEFAULT_COMPRESSION
;
zlib
.
zipFile
(
src
,
dir
,
options
).
then
((
data
)
=>
{
zlib
.
zipFile
(
src
,
dir
,
options
).
then
((
data
)
=>
{
console
.
log
(
"
ACTS_ZipFile_0200 data:
"
+
data
);
console
.
log
(
"
ACTS_ZipFile_0200 data:
"
+
data
);
expect
(
data
).
assertEqual
(
zlib
.
ErrorCode
.
ERROR_CODE_ERRNO
);
expect
(
data
).
assertEqual
(
zlib
.
ErrorCode
.
ERROR_CODE_ERRNO
);
...
@@ -98,7 +98,7 @@ it('ACTS_ZipFile_0300', 0, async function (done) {
...
@@ -98,7 +98,7 @@ it('ACTS_ZipFile_0300', 0, async function (done) {
fileio
.
write
(
fd
,
infos
).
then
(
function
(
number
)
{
fileio
.
write
(
fd
,
infos
).
then
(
function
(
number
)
{
console
.
info
(
"
ACTS_ZipFile_0300 write data to file successfully:
"
+
number
);
console
.
info
(
"
ACTS_ZipFile_0300 write data to file successfully:
"
+
number
);
var
options
=
{};
var
options
=
{};
options
.
flush
=
zlib
.
FlushType
.
FLUSH_TYPE_NO_FLUSH
;
options
.
level
=
zlib
.
CompressLevel
.
COMPRESS_LEVEL_DEFAULT_COMPRESSION
;
zlib
.
zipFile
(
path
,
zipDest
,
options
).
then
((
data
)
=>
{
zlib
.
zipFile
(
path
,
zipDest
,
options
).
then
((
data
)
=>
{
console
.
log
(
"
ACTS_ZipFile_0300 data:
"
+
data
);
console
.
log
(
"
ACTS_ZipFile_0300 data:
"
+
data
);
expect
(
data
).
assertEqual
(
zlib
.
ErrorCode
.
ERROR_CODE_ERRNO
);
expect
(
data
).
assertEqual
(
zlib
.
ErrorCode
.
ERROR_CODE_ERRNO
);
...
@@ -127,7 +127,7 @@ it('ACTS_ZipFile_0400', 0, async function (done) {
...
@@ -127,7 +127,7 @@ it('ACTS_ZipFile_0400', 0, async function (done) {
fileio
.
write
(
fd
,
infos
).
then
(
function
(
number
)
{
fileio
.
write
(
fd
,
infos
).
then
(
function
(
number
)
{
console
.
info
(
"
ACTS_ZipFile_0400 write data to file successfully:
"
+
number
);
console
.
info
(
"
ACTS_ZipFile_0400 write data to file successfully:
"
+
number
);
var
options
=
{};
var
options
=
{};
options
.
flush
=
zlib
.
FlushType
.
FLUSH_TYPE_NO_FLUSH
;
options
.
level
=
zlib
.
CompressLevel
.
COMPRESS_LEVEL_DEFAULT_COMPRESSION
;
zlib
.
zipFile
(
path
,
zipDest
,
options
).
then
((
data
)
=>
{
zlib
.
zipFile
(
path
,
zipDest
,
options
).
then
((
data
)
=>
{
console
.
log
(
"
ACTS_ZipFile_0400 data:
"
+
data
);
console
.
log
(
"
ACTS_ZipFile_0400 data:
"
+
data
);
expect
(
data
).
assertEqual
(
zlib
.
ErrorCode
.
ERROR_CODE_ERRNO
);
expect
(
data
).
assertEqual
(
zlib
.
ErrorCode
.
ERROR_CODE_ERRNO
);
...
@@ -143,175 +143,6 @@ it('ACTS_ZipFile_0400', 0, async function (done) {
...
@@ -143,175 +143,6 @@ it('ACTS_ZipFile_0400', 0, async function (done) {
});
});
})
})
/*
* @tc.number: ACTS_ZipFile_1900
* @tc.name: zipFile
* @tc.desc: chunkSize: 64,
*/
it
(
'
ACTS_ZipFile_1900
'
,
0
,
async
function
(
done
)
{
console
.
log
(
"
==================ACTS_ZipFile_1900 start==================
"
);
var
path
=
dir
+
"
/ACTS_ZipFile_1900.txt
"
;
var
zipDest
=
dir
+
"
/ACTS_ZipFile_1900.zip
"
var
unzipdir
=
dir
+
"
/ACTS_ZipFile_1900
"
;
var
unzipresultfile
=
unzipdir
+
"
/ACTS_ZipFile_1900.txt
"
;
var
fd
=
fileio
.
openSync
(
path
,
0o100
|
0o2
,
0o666
);
var
options
=
{
chunkSize
:
64
,
};
fileio
.
write
(
fd
,
infos
).
then
(
function
(
number
)
{
console
.
info
(
"
ACTS_ZipFile_1900 write data to file successfully:
"
+
number
);
zlib
.
zipFile
(
path
,
zipDest
,
options
).
then
((
data
)
=>
{
var
zipStat
=
fileio
.
statSync
(
zipDest
);
var
isFile
=
zipStat
.
isFile
();
expect
(
isFile
).
assertTrue
();
var
srcSize
=
fileio
.
statSync
(
path
).
size
;
var
destSize
=
zipStat
.
size
;
expect
(
srcSize
>
destSize
).
assertTrue
();
expect
(
data
).
assertEqual
(
zlib
.
ErrorCode
.
ERROR_CODE_OK
);
fileio
.
mkdir
(
unzipdir
).
then
(
function
()
{
console
.
info
(
"
ACTS_ZipFile_1900 mkdir successfully
"
);
zlib
.
unzipFile
(
zipDest
,
unzipdir
,
options
).
then
((
data
)
=>
{
var
unzipStat
=
fileio
.
statSync
(
unzipresultfile
);
var
isFile
=
unzipStat
.
isFile
();
expect
(
isFile
).
assertTrue
();
var
destSize
=
unzipStat
.
size
;
var
originSize
=
fileio
.
statSync
(
path
).
size
;
var
result
=
(
originSize
==
destSize
);
expect
(
result
).
assertTrue
();
expect
(
data
).
assertEqual
(
zlib
.
ErrorCode
.
ERROR_CODE_OK
);
console
.
error
(
'
ACTS_ZipFile_1900 unzipFile
'
);
done
();
}).
catch
((
err
)
=>
{
console
.
log
(
"
ACTS_ZipFile_1900 err:
"
+
err
);
done
();
})
}).
catch
(
function
(
error
)
{
console
.
info
(
"
ACTS_ZipFile_1900 mkdir failed with error:
"
+
error
);
done
();
});
}).
catch
((
err
)
=>
{
console
.
log
(
"
zipFile fail:
"
+
err
);
expect
(
err
).
assertFail
();
done
();
})
}).
catch
(
function
(
err
)
{
console
.
info
(
"
ACTS_ZipFile_1900 write data to file failed with error:
"
+
err
);
done
();
});
console
.
log
(
"
==================ACTS_ZipFile_1900 end==================
"
);
});
/*
* @tc.number: ACTS_ZipFile_2000
* @tc.name: zipFile
* @tc.desc: chunkSize: 1024,
*/
it
(
'
ACTS_ZipFile_2000
'
,
0
,
async
function
(
done
)
{
console
.
log
(
"
==================ACTS_ZipFile_2000 start==================
"
);
var
path
=
dir
+
"
/ACTS_ZipFile_2000.txt
"
;
var
zipDest
=
dir
+
"
/ACTS_ZipFile_2000.zip
"
var
unzipdir
=
dir
+
"
/ACTS_ZipFile_2000
"
;
var
unzipresultfile
=
unzipdir
+
"
/ACTS_ZipFile_2000.txt
"
;
var
options
=
{
chunkSize
:
1024
,
};
var
fd
=
fileio
.
openSync
(
path
,
0o100
|
0o2
,
0o666
);
fileio
.
write
(
fd
,
infos
).
then
(
function
(
number
)
{
console
.
info
(
"
ACTS_ZipFile_2000 write data to file successfully:
"
+
number
);
zlib
.
zipFile
(
path
,
zipDest
,
options
).
then
((
data
)
=>
{
var
zipStat
=
fileio
.
statSync
(
zipDest
);
var
isFile
=
zipStat
.
isFile
();
expect
(
isFile
).
assertTrue
();
var
srcSize
=
fileio
.
statSync
(
path
).
size
;
var
destSize
=
zipStat
.
size
;
expect
(
srcSize
>
destSize
).
assertTrue
();
expect
(
data
).
assertEqual
(
zlib
.
ErrorCode
.
ERROR_CODE_OK
);
fileio
.
mkdir
(
unzipdir
).
then
(
function
()
{
console
.
info
(
"
ACTS_ZipFile_2000 mkdir successfully
"
);
zlib
.
unzipFile
(
zipDest
,
unzipdir
,
options
).
then
((
data
)
=>
{
var
unzipStat
=
fileio
.
statSync
(
unzipresultfile
);
var
isFile
=
unzipStat
.
isFile
();
expect
(
isFile
).
assertTrue
();
var
destSize
=
unzipStat
.
size
;
var
originSize
=
fileio
.
statSync
(
path
).
size
;
var
result
=
(
originSize
==
destSize
);
expect
(
result
).
assertTrue
();
expect
(
data
).
assertEqual
(
zlib
.
ErrorCode
.
ERROR_CODE_OK
);
console
.
error
(
'
ACTS_ZipFile_2000 unzipFile
'
);
done
();
}).
catch
((
err
)
=>
{
console
.
log
(
"
ACTS_ZipFile_2000 err:
"
+
err
);
done
();
})
}).
catch
(
function
(
error
)
{
console
.
info
(
"
ACTS_ZipFile_2000 mkdir failed with error:
"
+
error
);
});
}).
catch
((
err
)
=>
{
console
.
log
(
"
zipFile fail:
"
+
err
);
expect
(
err
).
assertFail
();
})
}).
catch
(
function
(
err
)
{
console
.
info
(
"
ACTS_ZipFile_2000 write data to file failed with error:
"
+
err
);
});
console
.
log
(
"
==================ACTS_ZipFile_2000 end==================
"
);
});
/*
* @tc.number: ACTS_ZipFile_2100
* @tc.name: zipFile
* @tc.desc: chunkSize: 999,
*/
it
(
'
ACTS_ZipFile_2100
'
,
0
,
async
function
(
done
)
{
console
.
log
(
"
==================ACTS_ZipFile_2100 start==================
"
);
var
path
=
dir
+
"
/ACTS_ZipFile_2100.txt
"
;
var
zipDest
=
dir
+
"
/ACTS_ZipFile_2100.zip
"
var
unzipdir
=
dir
+
"
/ACTS_ZipFile_2100
"
;
var
unzipresultfile
=
unzipdir
+
"
/ACTS_ZipFile_2100.txt
"
;
var
options
=
{
chunkSize
:
999
,
};
var
fd
=
fileio
.
openSync
(
path
,
0o100
|
0o2
,
0o666
);
fileio
.
write
(
fd
,
infos
).
then
(
function
(
number
)
{
console
.
info
(
"
ACTS_ZipFile_2100 write data to file successfully:
"
+
number
);
zlib
.
zipFile
(
path
,
zipDest
,
options
).
then
((
data
)
=>
{
var
zipStat
=
fileio
.
statSync
(
zipDest
);
var
isFile
=
zipStat
.
isFile
();
expect
(
isFile
).
assertTrue
();
var
srcSize
=
fileio
.
statSync
(
path
).
size
;
var
destSize
=
zipStat
.
size
;
expect
(
srcSize
>
destSize
).
assertTrue
();
expect
(
data
).
assertEqual
(
zlib
.
ErrorCode
.
ERROR_CODE_OK
);
fileio
.
mkdir
(
unzipdir
).
then
(
function
()
{
console
.
info
(
"
ACTS_ZipFile_2100 mkdir successfully
"
);
zlib
.
unzipFile
(
zipDest
,
unzipdir
,
options
).
then
((
data
)
=>
{
var
unzipStat
=
fileio
.
statSync
(
unzipresultfile
);
var
isFile
=
unzipStat
.
isFile
();
expect
(
isFile
).
assertTrue
();
var
destSize
=
unzipStat
.
size
;
var
originSize
=
fileio
.
statSync
(
path
).
size
;
var
result
=
(
originSize
==
destSize
);
expect
(
result
).
assertTrue
();
expect
(
data
).
assertEqual
(
zlib
.
ErrorCode
.
ERROR_CODE_OK
);
console
.
error
(
'
ACTS_ZipFile_2100 unzipFile
'
);
done
();
}).
catch
((
err
)
=>
{
console
.
log
(
"
ACTS_ZipFile_2100 err:
"
+
err
);
done
();
})
}).
catch
(
function
(
error
)
{
console
.
info
(
"
ACTS_ZipFile_2100 mkdir failed with error:
"
+
error
);
});
}).
catch
((
err
)
=>
{
console
.
log
(
"
zipFile fail:
"
+
err
);
expect
(
err
).
assertFail
();
})
}).
catch
(
function
(
err
)
{
console
.
info
(
"
ACTS_ZipFile_2100 write data to file failed with error:
"
+
err
);
});
console
.
log
(
"
==================ACTS_ZipFile_2100 end==================
"
);
});
/*
/*
* @tc.number: ACTS_ZipFile_2200
* @tc.number: ACTS_ZipFile_2200
* @tc.name: zipFile
* @tc.name: zipFile
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录