提交 bea9266b 编写于 作者: WOSHIMAHAIFENG's avatar WOSHIMAHAIFENG

Merge branch 'dev_file' into 'dev'

添加file测试用例

See merge request !14
...@@ -4,18 +4,24 @@ ...@@ -4,18 +4,24 @@
<text style="margin: 2px; padding: 2px; border: 1px solid #000000;">{{ log }}</text> <text style="margin: 2px; padding: 2px; border: 1px solid #000000;">{{ log }}</text>
<scroll-view style="flex: 1;"> <scroll-view style="flex: 1;">
<!-- #endif --> <!-- #endif -->
<button class="btnstyle" type="primary" @tap="statFileInfoTest" id="btn-stat-file">递归获取目录files的Stats对象{{statFile}}</button> <button class="btnstyle" type="primary" @tap="statFileInfoTest"
id="btn-stat-file">递归获取目录files的Stats对象{{statFile}}</button>
<button class="btnstyle" type="primary" @tap="mkdirTest" id="btn-mkdir">创建文件夹{{mkdirFile}}</button> <button class="btnstyle" type="primary" @tap="mkdirTest" id="btn-mkdir">创建文件夹{{mkdirFile}}</button>
<button class="btnstyle" type="primary" @tap="writeFileTest" id="btn-write-file">覆盖写入文件{{writeFile}}</button> <button class="btnstyle" type="primary" @tap="writeFileTest" id="btn-write-file">覆盖写入文件{{writeFile}}</button>
<button class="btnstyle" type="primary" @tap="readDirTest" id="btn-read-dir">读取文件夹{{readDir}}</button> <button class="btnstyle" type="primary" @tap="readDirTest" id="btn-read-dir">读取文件夹{{readDir}}</button>
<button class="btnstyle" type="primary" @tap="readFileTest" id="btn-read-file">读取文件{{readFile}}</button> <button class="btnstyle" type="primary" @tap="readFileTest" id="btn-read-file">读取文件{{readFile}}</button>
<button class="btnstyle" type="primary" @tap="copyFileTest" id="btn-copy-file">复制文件{{copyFromFile}}到{{copyToFile}}</button> <button class="btnstyle" type="primary" @tap="copyFileTest"
<button class="btnstyle" type="primary" @tap="renameFileTest" id="btn-rename-file">重命名文件{{renameFromFile}}到{{renameToFile}}</button> id="btn-copy-file">复制文件{{copyFromFile}}到{{copyToFile}}</button>
<button class="btnstyle" type="primary" @tap="renameFileTest"
id="btn-rename-file">重命名文件{{renameFromFile}}到{{renameToFile}}</button>
<button class="btnstyle" type="primary" @tap="accessFileTest" id="btn-access-file">判断文件{{accessFile}}是否存在</button> <button class="btnstyle" type="primary" @tap="accessFileTest" id="btn-access-file">判断文件{{accessFile}}是否存在</button>
<button class="btnstyle" type="primary" @tap="getFileInfoTest" id="btn-get-file-info">获取文件信息{{getFileInfoFile}}</button> <button class="btnstyle" type="primary" @tap="getFileInfoTest"
id="btn-get-file-info">获取文件信息{{getFileInfoFile}}</button>
<button class="btnstyle" type="primary" @tap="unlinkTest" id="btn-unlink-file">删除文件{{unlinkFile}}</button> <button class="btnstyle" type="primary" @tap="unlinkTest" id="btn-unlink-file">删除文件{{unlinkFile}}</button>
<button class="btnstyle" type="primary" @tap="copyStaticToFilesTest" id="btn-copyStatic-file">从static目录复制文件到a目录</button> <button class="btnstyle" type="primary" @tap="copyStaticToFilesTest"
<button class="btnstyle" type="primary" @tap="unlinkAllFileTest" id="btn-clear-file">删除文件夹{{rmDirFile}}下的所有文件</button> id="btn-copyStatic-file">从static目录复制文件到a目录</button>
<button class="btnstyle" type="primary" @tap="unlinkAllFileTest"
id="btn-clear-file">删除文件夹{{rmDirFile}}下的所有文件</button>
<button class="btnstyle" type="primary" @tap="rmdirTest" id="btn-remove-dir">删除文件夹{{rmDirFile}}</button> <button class="btnstyle" type="primary" @tap="rmdirTest" id="btn-remove-dir">删除文件夹{{rmDirFile}}</button>
...@@ -23,14 +29,18 @@ ...@@ -23,14 +29,18 @@
<button class="btnstyle" type="primary" @tap="statFileInfoSyncTest" <button class="btnstyle" type="primary" @tap="statFileInfoSyncTest"
id="btn-stat-file-sync">同步递归获取目录files的Stats对象{{statFile}}</button> id="btn-stat-file-sync">同步递归获取目录files的Stats对象{{statFile}}</button>
<button class="btnstyle" type="primary" @tap="appendFileTest" id="btn-append-file">在文件{{readFile}}结尾追加内容</button> <button class="btnstyle" type="primary" @tap="appendFileTest" id="btn-append-file">在文件{{readFile}}结尾追加内容</button>
<button class="btnstyle" type="primary" @tap="appendFileSyncTest" id="btn-append-file-sync">同步在文件{{readFile}}结尾追加内容</button> <button class="btnstyle" type="primary" @tap="appendFileSyncTest"
<button class="btnstyle" type="primary" @tap="writeFileSyncTest" id="btn-write-file-sync">同步覆盖写入文件{{writeFile}}</button> id="btn-append-file-sync">同步在文件{{readFile}}结尾追加内容</button>
<button class="btnstyle" type="primary" @tap="writeFileSyncTest"
id="btn-write-file-sync">同步覆盖写入文件{{writeFile}}</button>
<button class="btnstyle" type="primary" @tap="readFileSyncTest" id="btn-read-file-sync">同步读取文件{{readFile}}</button> <button class="btnstyle" type="primary" @tap="readFileSyncTest" id="btn-read-file-sync">同步读取文件{{readFile}}</button>
<button class="btnstyle" type="primary" @tap="unlinkSyncTest" id="btn-unlink-file-sync">同步删除文件{{unlinkFile}}</button> <button class="btnstyle" type="primary" @tap="unlinkSyncTest"
id="btn-unlink-file-sync">同步删除文件{{unlinkFile}}</button>
<button class="btnstyle" type="primary" @tap="mkdirSyncTest" id="btn-mkdir-sync">同步创建文件夹{{mkdirFile}}</button> <button class="btnstyle" type="primary" @tap="mkdirSyncTest" id="btn-mkdir-sync">同步创建文件夹{{mkdirFile}}</button>
<button class="btnstyle" type="primary" @tap="rmdirSyncTest" id="btn-remove-dir-sync">同步删除文件夹{{rmDirFile}}</button> <button class="btnstyle" type="primary" @tap="rmdirSyncTest" id="btn-remove-dir-sync">同步删除文件夹{{rmDirFile}}</button>
<button class="btnstyle" type="primary" @tap="readDirSyncTest" id="btn-read-dir-sync">同步读取文件夹{{readDir}}</button> <button class="btnstyle" type="primary" @tap="readDirSyncTest" id="btn-read-dir-sync">同步读取文件夹{{readDir}}</button>
<button class="btnstyle" type="primary" @tap="accessFileSyncTest" id="btn-access-file-sync">同步判断文件{{accessFile}}是否存在</button> <button class="btnstyle" type="primary" @tap="accessFileSyncTest"
id="btn-access-file-sync">同步判断文件{{accessFile}}是否存在</button>
<button class="btnstyle" type="primary" @tap="renameFileSync" <button class="btnstyle" type="primary" @tap="renameFileSync"
id="btn-rename-file-sync">同步重命名文件{{renameFromFile}}到{{renameToFile}}</button> id="btn-rename-file-sync">同步重命名文件{{renameFromFile}}到{{renameToFile}}</button>
<button class="btnstyle" type="primary" @tap="copyFileSyncTest" <button class="btnstyle" type="primary" @tap="copyFileSyncTest"
...@@ -39,20 +49,29 @@ ...@@ -39,20 +49,29 @@
<button class="btnstyle" type="primary" @tap="saveFileSyncTest" id="btn-save-file-sync">同步保存临时文件到本地</button> <button class="btnstyle" type="primary" @tap="saveFileSyncTest" id="btn-save-file-sync">同步保存临时文件到本地</button>
<button class="btnstyle" type="primary" @tap="removeSavedFileTest" id="btn-remove-saved-file">删除已保存的本地文件</button> <button class="btnstyle" type="primary" @tap="removeSavedFileTest" id="btn-remove-saved-file">删除已保存的本地文件</button>
<button class="btnstyle" type="primary" @tap="unzipFileTest" id="btn-unzip-file-sync">解压文件</button> <button class="btnstyle" type="primary" @tap="unzipFileTest" id="btn-unzip-file-sync">解压文件</button>
<button class="btnstyle" type="primary" @tap="getSavedFileListTest" id="btn-getsaved-filelist">获取该已保存的本地缓存文件列表</button> <button class="btnstyle" type="primary" @tap="getSavedFileListTest"
<button class="btnstyle" type="primary" @tap="truncateFileTest" id="btn-truncate-file">对文件{{writeFile}}内容进行截断操作</button> id="btn-getsaved-filelist">获取该已保存的本地缓存文件列表</button>
<button class="btnstyle" type="primary" @tap="truncateFileSyncTest" id="btn-truncate-file-sync">同步对文件{{writeFile}}内容进行截断操作</button> <button class="btnstyle" type="primary" @tap="truncateFileTest"
<button class="btnstyle" type="primary" @tap="readCompressedFileTest" id="btn-compressed-file">读取指定压缩类型的本地文件内容</button> id="btn-truncate-file">对文件{{writeFile}}内容进行截断操作</button>
<button class="btnstyle" type="primary" @tap="readCompressedFileSyncTest" id="btn-compressed-file-sync">同步读取指定压缩类型的本地文件内容</button> <button class="btnstyle" type="primary" @tap="truncateFileSyncTest"
id="btn-truncate-file-sync">同步对文件{{writeFile}}内容进行截断操作</button>
<button class="btnstyle" type="primary" @tap="readCompressedFileTest"
id="btn-compressed-file">读取指定压缩类型的本地文件内容</button>
<button class="btnstyle" type="primary" @tap="readCompressedFileSyncTest"
id="btn-compressed-file-sync">同步读取指定压缩类型的本地文件内容</button>
<button class="btnstyle" type="primary" @tap="openFileTest" id="btn-open-file">打开文件{{readFile}},返回描述符</button> <button class="btnstyle" type="primary" @tap="openFileTest" id="btn-open-file">打开文件{{readFile}},返回描述符</button>
<button class="btnstyle" type="primary" @tap="openFileSyncTest" id="btn-open-file-sync">同步打开文件{{readFile}},返回描述符</button> <button class="btnstyle" type="primary" @tap="openFileSyncTest"
id="btn-open-file-sync">同步打开文件{{readFile}},返回描述符</button>
<button class="btnstyle" type="primary" @tap="closeTest" id="btn-close-file">通过文件描述符关闭文件{{readFile}}</button> <button class="btnstyle" type="primary" @tap="closeTest" id="btn-close-file">通过文件描述符关闭文件{{readFile}}</button>
<button class="btnstyle" type="primary" @tap="closeSyncTest" id="btn-close-file-sync">通过文件描述符同步关闭文件{{readFile}}</button> <button class="btnstyle" type="primary" @tap="closeSyncTest"
id="btn-close-file-sync">通过文件描述符同步关闭文件{{readFile}}</button>
<button class="btnstyle" type="primary" @tap="writeTest" id="btn-write">通过文件描述符写入文件{{readFile}}</button> <button class="btnstyle" type="primary" @tap="writeTest" id="btn-write">通过文件描述符写入文件{{readFile}}</button>
<button class="btnstyle" type="primary" @tap="writeSyncTest" id="btn-read-file">同步通过文件描述符写入文件{{readFile}}</button> <button class="btnstyle" type="primary" @tap="writeSyncTest" id="btn-read-file">同步通过文件描述符写入文件{{readFile}}</button>
<button class="btnstyle" type="primary" @tap="fstatTest" id="btn-fstat-file">通过文件描述符获取{{statFile}}的状态信息</button> <button class="btnstyle" type="primary" @tap="fstatTest" id="btn-fstat-file">通过文件描述符获取{{statFile}}的状态信息</button>
<button class="btnstyle" type="primary" @tap="fstatSyncTest" id="btn-fstat-file-sync">同步通过文件描述符获取{{statFile}}的状态信息</button> <button class="btnstyle" type="primary" @tap="fstatSyncTest"
<button class="btnstyle" type="primary" @tap="ftruncateFileTest" id="btn-ftruncate-file">通过文件描述符对文件{{writeFile}}内容进行截断</button> id="btn-fstat-file-sync">同步通过文件描述符获取{{statFile}}的状态信息</button>
<button class="btnstyle" type="primary" @tap="ftruncateFileTest"
id="btn-ftruncate-file">通过文件描述符对文件{{writeFile}}内容进行截断</button>
<button class="btnstyle" type="primary" @tap="ftruncateFileSyncTest" <button class="btnstyle" type="primary" @tap="ftruncateFileSyncTest"
id="btn-ftruncate-file-sync">同步通过文件描述符对文件{{writeFile}}内容进行截断</button> id="btn-ftruncate-file-sync">同步通过文件描述符对文件{{writeFile}}内容进行截断</button>
<button class="btnstyle" type="primary" @tap="readZipEntry" id="btn-readzip-entry">读取压缩包内的文件</button> <button class="btnstyle" type="primary" @tap="readZipEntry" id="btn-readzip-entry">读取压缩包内的文件</button>
...@@ -489,7 +508,9 @@ ...@@ -489,7 +508,9 @@
}); });
}, },
fail: (res : UniError) => { fail: (res : UniError) => {
this.log += 'unlinkAllFileTest fail:' + JSON.stringify(res) + '\n\n' if (this.logAble) {
this.log += 'unlinkAllFileTest fail:' + JSON.stringify(res) + '\n\n'
}
console.log('fail to readdir', res) console.log('fail to readdir', res)
this.lastFailError = res this.lastFailError = res
}, },
...@@ -753,7 +774,7 @@ ...@@ -753,7 +774,7 @@
//todo 后面打开 //todo 后面打开
// this.saveFileRet=res // this.saveFileRet=res
} catch (e) { } catch (e) {
console.log('saveFileSyncTest:'+e) console.log('saveFileSyncTest:' + e)
this.done = true this.done = true
} }
}, },
...@@ -998,7 +1019,9 @@ ...@@ -998,7 +1019,9 @@
fileManager.closeSync({ fileManager.closeSync({
fd: res.fd fd: res.fd
} as CloseSyncOptions) } as CloseSyncOptions)
this.log += 'closeSyncTest success:' + '\n\n' if (this.logAble) {
this.log += 'closeSyncTest success:' + '\n\n'
}
this.done = true this.done = true
this.closeFileRet = "close:ok" this.closeFileRet = "close:ok"
} catch (e) { } catch (e) {
...@@ -1279,7 +1302,7 @@ ...@@ -1279,7 +1302,7 @@
</script> </script>
<style> <style>
.btnstyle{ .btnstyle {
margin: 4px; margin: 4px;
} }
</style> </style>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册