提交 9d65ccd0 编写于 作者: Q qinliwen

<增加medialibrary资源查询条件,适配HOS>

Signed-off-by: Nqinliwen <qinliwen3@huawei.com>
上级 c82ae822
...@@ -23,8 +23,8 @@ const imageType = mediaLibrary.MediaType.IMAGE; ...@@ -23,8 +23,8 @@ const imageType = mediaLibrary.MediaType.IMAGE;
const videoType = mediaLibrary.MediaType.VIDEO; const videoType = mediaLibrary.MediaType.VIDEO;
const audioType = mediaLibrary.MediaType.AUDIO; const audioType = mediaLibrary.MediaType.AUDIO;
const fileFetchOp = { const fileFetchOp = {
selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ? AND relative_path = ?',
selectionArgs: [fileType.toString()], selectionArgs: [fileType.toString(), 'Documents/'],
}; };
const imageFetchOp = { const imageFetchOp = {
selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
...@@ -35,8 +35,8 @@ const videoFetchOp = { ...@@ -35,8 +35,8 @@ const videoFetchOp = {
selectionArgs: [videoType.toString()], selectionArgs: [videoType.toString()],
}; };
const audioFetchOp = { const audioFetchOp = {
selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ? AND bucket_display_name = ?',
selectionArgs: [audioType.toString()], selectionArgs: [audioType.toString(), 'Camera'],
}; };
describe('favoriteTestCallBack.test.js', function () { describe('favoriteTestCallBack.test.js', function () {
......
...@@ -23,8 +23,8 @@ const imageType = mediaLibrary.MediaType.IMAGE; ...@@ -23,8 +23,8 @@ const imageType = mediaLibrary.MediaType.IMAGE;
const videoType = mediaLibrary.MediaType.VIDEO; const videoType = mediaLibrary.MediaType.VIDEO;
const audioType = mediaLibrary.MediaType.AUDIO; const audioType = mediaLibrary.MediaType.AUDIO;
const fileFetchOp = { const fileFetchOp = {
selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ? AND relative_path = ?',
selectionArgs: [fileType.toString()], selectionArgs: [fileType.toString(), 'Documents/'],
}; };
const imageFetchOp = { const imageFetchOp = {
selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
...@@ -35,8 +35,8 @@ const videoFetchOp = { ...@@ -35,8 +35,8 @@ const videoFetchOp = {
selectionArgs: [videoType.toString()], selectionArgs: [videoType.toString()],
}; };
const audioFetchOp = { const audioFetchOp = {
selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ? AND bucket_display_name = ?',
selectionArgs: [audioType.toString()], selectionArgs: [audioType.toString(), 'Camera'],
}; };
describe('favoriteTestPromise.test.js', function () { describe('favoriteTestPromise.test.js', function () {
......
...@@ -42,8 +42,8 @@ describe('fileAssetTestCallback.test.js', async function() { ...@@ -42,8 +42,8 @@ describe('fileAssetTestCallback.test.js', async function() {
try { try {
let fileType = mediaLibrary.MediaType.FILE; let fileType = mediaLibrary.MediaType.FILE;
let fileFetchOp = { let fileFetchOp = {
selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ? AND relative_path = ?',
selectionArgs : [ fileType.toString() ], selectionArgs : [ fileType.toString(), 'Documents/'],
}; };
let fetchFileResult = await media.getFileAssets(fileFetchOp); let fetchFileResult = await media.getFileAssets(fileFetchOp);
const dataList = await fetchFileResult.getAllObject(); const dataList = await fetchFileResult.getAllObject();
...@@ -109,8 +109,8 @@ describe('fileAssetTestCallback.test.js', async function() { ...@@ -109,8 +109,8 @@ describe('fileAssetTestCallback.test.js', async function() {
try { try {
let type = mediaLibrary.MediaType.FILE; let type = mediaLibrary.MediaType.FILE;
let fetchOp = { let fetchOp = {
selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ? AND relative_path = ?',
selectionArgs : [ type.toString() ], selectionArgs : [ type.toString(), 'Documents/'],
}; };
let fetchFileResult = await media.getFileAssets(fetchOp); let fetchFileResult = await media.getFileAssets(fetchOp);
const dataList = await fetchFileResult.getAllObject(); const dataList = await fetchFileResult.getAllObject();
...@@ -173,8 +173,8 @@ describe('fileAssetTestCallback.test.js', async function() { ...@@ -173,8 +173,8 @@ describe('fileAssetTestCallback.test.js', async function() {
try { try {
let type = mediaLibrary.MediaType.FILE; let type = mediaLibrary.MediaType.FILE;
let fetchOp = { let fetchOp = {
selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ? AND relative_path = ?',
selectionArgs : [ type.toString() ], selectionArgs : [ type.toString(), 'Documents/'],
}; };
let fetchFileResult = await media.getFileAssets(fetchOp); let fetchFileResult = await media.getFileAssets(fetchOp);
const dataList = await fetchFileResult.getAllObject(); const dataList = await fetchFileResult.getAllObject();
...@@ -438,8 +438,8 @@ describe('fileAssetTestCallback.test.js', async function() { ...@@ -438,8 +438,8 @@ describe('fileAssetTestCallback.test.js', async function() {
try { try {
let fileType = mediaLibrary.MediaType.AUDIO; let fileType = mediaLibrary.MediaType.AUDIO;
let fileFetchOp = { let fileFetchOp = {
selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ? AND bucket_display_name = ?',
selectionArgs : [ fileType.toString() ], selectionArgs : [ fileType.toString(), 'Camera'],
}; };
let fetchFileResult = await media.getFileAssets(fileFetchOp); let fetchFileResult = await media.getFileAssets(fileFetchOp);
const dataList = await fetchFileResult.getAllObject(); const dataList = await fetchFileResult.getAllObject();
...@@ -499,8 +499,8 @@ describe('fileAssetTestCallback.test.js', async function() { ...@@ -499,8 +499,8 @@ describe('fileAssetTestCallback.test.js', async function() {
try { try {
let type = mediaLibrary.MediaType.AUDIO; let type = mediaLibrary.MediaType.AUDIO;
let fetchOp = { let fetchOp = {
selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ? AND bucket_display_name = ?',
selectionArgs : [ type.toString() ], selectionArgs : [ type.toString(), 'Camera'],
}; };
let fetchFileResult = await media.getFileAssets(fetchOp); let fetchFileResult = await media.getFileAssets(fetchOp);
const dataList = await fetchFileResult.getAllObject(); const dataList = await fetchFileResult.getAllObject();
...@@ -566,8 +566,8 @@ describe('fileAssetTestCallback.test.js', async function() { ...@@ -566,8 +566,8 @@ describe('fileAssetTestCallback.test.js', async function() {
try { try {
let type = mediaLibrary.MediaType.AUDIO; let type = mediaLibrary.MediaType.AUDIO;
let fetchOp = { let fetchOp = {
selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ? AND bucket_display_name = ?',
selectionArgs : [ type.toString() ], selectionArgs : [ type.toString(), 'Camera'],
}; };
let fetchFileResult = await media.getFileAssets(fetchOp); let fetchFileResult = await media.getFileAssets(fetchOp);
const dataList = await fetchFileResult.getAllObject(); const dataList = await fetchFileResult.getAllObject();
...@@ -845,8 +845,8 @@ describe('fileAssetTestCallback.test.js', async function() { ...@@ -845,8 +845,8 @@ describe('fileAssetTestCallback.test.js', async function() {
try { try {
let type = mediaLibrary.MediaType.FILE; let type = mediaLibrary.MediaType.FILE;
let fetchOp = { let fetchOp = {
selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ? AND relative_path = ?',
selectionArgs : [ type.toString() ], selectionArgs : [ type.toString(), 'Documents/'],
}; };
let fetchFileResult = await media.getFileAssets(fetchOp); let fetchFileResult = await media.getFileAssets(fetchOp);
const dataList = await fetchFileResult.getAllObject(); const dataList = await fetchFileResult.getAllObject();
...@@ -941,8 +941,8 @@ describe('fileAssetTestCallback.test.js', async function() { ...@@ -941,8 +941,8 @@ describe('fileAssetTestCallback.test.js', async function() {
try { try {
let type = mediaLibrary.MediaType.AUDIO; let type = mediaLibrary.MediaType.AUDIO;
let fetchOp = { let fetchOp = {
selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ? AND bucket_display_name = ?',
selectionArgs : [ type.toString() ], selectionArgs : [ type.toString(), 'Camera'],
}; };
let fetchFileResult = await media.getFileAssets(fetchOp); let fetchFileResult = await media.getFileAssets(fetchOp);
const dataList = await fetchFileResult.getAllObject(); const dataList = await fetchFileResult.getAllObject();
......
...@@ -42,8 +42,8 @@ describe('fileAssetTestPromise.test.js', async function() { ...@@ -42,8 +42,8 @@ describe('fileAssetTestPromise.test.js', async function() {
try { try {
let fileType = mediaLibrary.MediaType.FILE; let fileType = mediaLibrary.MediaType.FILE;
let fileFetchOp = { let fileFetchOp = {
selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ? AND relative_path = ?',
selectionArgs : [ fileType.toString() ], selectionArgs : [ fileType.toString(), 'Documents/'],
}; };
let fetchFileResult = await media.getFileAssets(fileFetchOp); let fetchFileResult = await media.getFileAssets(fileFetchOp);
const dataList = await fetchFileResult.getAllObject(); const dataList = await fetchFileResult.getAllObject();
...@@ -95,8 +95,8 @@ describe('fileAssetTestPromise.test.js', async function() { ...@@ -95,8 +95,8 @@ describe('fileAssetTestPromise.test.js', async function() {
try { try {
let type = mediaLibrary.MediaType.FILE; let type = mediaLibrary.MediaType.FILE;
let fetchOp = { let fetchOp = {
selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ? AND relative_path = ?',
selectionArgs : [ type.toString() ], selectionArgs : [ type.toString(), 'Documents/'],
}; };
let fetchFileResult = await media.getFileAssets(fetchOp); let fetchFileResult = await media.getFileAssets(fetchOp);
const dataList = await fetchFileResult.getAllObject(); const dataList = await fetchFileResult.getAllObject();
...@@ -136,8 +136,8 @@ describe('fileAssetTestPromise.test.js', async function() { ...@@ -136,8 +136,8 @@ describe('fileAssetTestPromise.test.js', async function() {
try { try {
let type = mediaLibrary.MediaType.FILE; let type = mediaLibrary.MediaType.FILE;
let fetchOp = { let fetchOp = {
selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ? AND relative_path = ?',
selectionArgs : [ type.toString() ], selectionArgs : [ type.toString(), 'Documents/'],
}; };
let fetchFileResult = await media.getFileAssets(fetchOp); let fetchFileResult = await media.getFileAssets(fetchOp);
const dataList = await fetchFileResult.getAllObject(); const dataList = await fetchFileResult.getAllObject();
...@@ -183,7 +183,7 @@ describe('fileAssetTestPromise.test.js', async function() { ...@@ -183,7 +183,7 @@ describe('fileAssetTestPromise.test.js', async function() {
let fileType = mediaLibrary.MediaType.IMAGE; let fileType = mediaLibrary.MediaType.IMAGE;
let fileFetchOp = { let fileFetchOp = {
selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ fileType.toString() ], selectionArgs : [ fileType.toString()],
}; };
let fetchFileResult = await media.getFileAssets(fileFetchOp); let fetchFileResult = await media.getFileAssets(fileFetchOp);
const dataList = await fetchFileResult.getAllObject(); const dataList = await fetchFileResult.getAllObject();
...@@ -320,8 +320,8 @@ describe('fileAssetTestPromise.test.js', async function() { ...@@ -320,8 +320,8 @@ describe('fileAssetTestPromise.test.js', async function() {
try { try {
let fileType = mediaLibrary.MediaType.AUDIO; let fileType = mediaLibrary.MediaType.AUDIO;
let fileFetchOp = { let fileFetchOp = {
selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ? AND bucket_display_name = ?',
selectionArgs : [ fileType.toString() ], selectionArgs : [ fileType.toString(), 'Camera'],
}; };
let fetchFileResult = await media.getFileAssets(fileFetchOp); let fetchFileResult = await media.getFileAssets(fileFetchOp);
const dataList = await fetchFileResult.getAllObject(); const dataList = await fetchFileResult.getAllObject();
...@@ -371,8 +371,8 @@ describe('fileAssetTestPromise.test.js', async function() { ...@@ -371,8 +371,8 @@ describe('fileAssetTestPromise.test.js', async function() {
try { try {
let type = mediaLibrary.MediaType.AUDIO; let type = mediaLibrary.MediaType.AUDIO;
let fetchOp = { let fetchOp = {
selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ? AND bucket_display_name = ?',
selectionArgs : [ type.toString() ], selectionArgs : [ type.toString(), 'Camera'],
}; };
let fetchFileResult = await media.getFileAssets(fetchOp); let fetchFileResult = await media.getFileAssets(fetchOp);
const dataList = await fetchFileResult.getAllObject(); const dataList = await fetchFileResult.getAllObject();
...@@ -412,8 +412,8 @@ describe('fileAssetTestPromise.test.js', async function() { ...@@ -412,8 +412,8 @@ describe('fileAssetTestPromise.test.js', async function() {
try { try {
let type = mediaLibrary.MediaType.AUDIO; let type = mediaLibrary.MediaType.AUDIO;
let fetchOp = { let fetchOp = {
selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ? AND bucket_display_name = ?',
selectionArgs : [ type.toString() ], selectionArgs : [ type.toString(), 'Camera'],
}; };
let fetchFileResult = await media.getFileAssets(fetchOp); let fetchFileResult = await media.getFileAssets(fetchOp);
const dataList = await fetchFileResult.getAllObject(); const dataList = await fetchFileResult.getAllObject();
...@@ -459,7 +459,7 @@ describe('fileAssetTestPromise.test.js', async function() { ...@@ -459,7 +459,7 @@ describe('fileAssetTestPromise.test.js', async function() {
let fileType = mediaLibrary.MediaType.VIDEO; let fileType = mediaLibrary.MediaType.VIDEO;
let fileFetchOp = { let fileFetchOp = {
selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?',
selectionArgs : [ fileType.toString() ], selectionArgs : [ fileType.toString()],
}; };
let fetchFileResult = await media.getFileAssets(fileFetchOp); let fetchFileResult = await media.getFileAssets(fileFetchOp);
const dataList = await fetchFileResult.getAllObject(); const dataList = await fetchFileResult.getAllObject();
...@@ -610,8 +610,8 @@ describe('fileAssetTestPromise.test.js', async function() { ...@@ -610,8 +610,8 @@ describe('fileAssetTestPromise.test.js', async function() {
try { try {
let type = mediaLibrary.MediaType.FILE; let type = mediaLibrary.MediaType.FILE;
let fetchOp = { let fetchOp = {
selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ? AND relative_path = ?',
selectionArgs : [ type.toString() ], selectionArgs : [ type.toString(), 'Documents/'],
}; };
let fetchFileResult = await media.getFileAssets(fetchOp); let fetchFileResult = await media.getFileAssets(fetchOp);
const dataList = await fetchFileResult.getAllObject(); const dataList = await fetchFileResult.getAllObject();
...@@ -698,8 +698,8 @@ describe('fileAssetTestPromise.test.js', async function() { ...@@ -698,8 +698,8 @@ describe('fileAssetTestPromise.test.js', async function() {
try { try {
let type = mediaLibrary.MediaType.AUDIO; let type = mediaLibrary.MediaType.AUDIO;
let fetchOp = { let fetchOp = {
selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ?', selections : mediaLibrary.FileKey.MEDIA_TYPE + '= ? AND bucket_display_name = ?',
selectionArgs : [ type.toString() ], selectionArgs : [ type.toString(), 'Camera'],
}; };
let fetchFileResult = await media.getFileAssets(fetchOp); let fetchFileResult = await media.getFileAssets(fetchOp);
const dataList = await fetchFileResult.getAllObject(); const dataList = await fetchFileResult.getAllObject();
......
...@@ -33,12 +33,12 @@ let videosfetchOp = { ...@@ -33,12 +33,12 @@ let videosfetchOp = {
selectionArgs: [videoType.toString()], selectionArgs: [videoType.toString()],
}; };
let audiosfetchOp = { let audiosfetchOp = {
selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ? AND bucket_display_name = ?',
selectionArgs: [audioType.toString()], selectionArgs: [audioType.toString(), 'Camera'],
}; };
let filesfetchOp = { let filesfetchOp = {
selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ? AND relative_path = ?',
selectionArgs: [fileType.toString()], selectionArgs: [fileType.toString(), 'Documents/'],
}; };
function checkAssetAttr(done, attr, testNum, asset, checkType) { function checkAssetAttr(done, attr, testNum, asset, checkType) {
......
...@@ -33,12 +33,12 @@ let videosfetchOp = { ...@@ -33,12 +33,12 @@ let videosfetchOp = {
selectionArgs: [videoType.toString()], selectionArgs: [videoType.toString()],
}; };
let audiosfetchOp = { let audiosfetchOp = {
selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ? AND bucket_display_name = ?',
selectionArgs: [audioType.toString()], selectionArgs: [audioType.toString(), 'Camera'],
}; };
let filesfetchOp = { let filesfetchOp = {
selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ? AND relative_path = ?',
selectionArgs: [fileType.toString()], selectionArgs: [fileType.toString(), 'Documents/'],
}; };
function checkAssetAttr(done, attr, testNum, asset, checkType) { function checkAssetAttr(done, attr, testNum, asset, checkType) {
......
...@@ -44,12 +44,12 @@ let videosfetchOp = { ...@@ -44,12 +44,12 @@ let videosfetchOp = {
selectionArgs: [videoType.toString()], selectionArgs: [videoType.toString()],
}; };
let audiosfetchOp = { let audiosfetchOp = {
selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ? AND bucket_display_name = ?',
selectionArgs: [audioType.toString()], selectionArgs: [audioType.toString(), 'Camera'],
}; };
let filesfetchOp = { let filesfetchOp = {
selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ? AND relative_path = ?',
selectionArgs: [fileType.toString()], selectionArgs: [fileType.toString(), 'Documents/'],
}; };
let imageAndVideofetchOp = { let imageAndVideofetchOp = {
......
...@@ -44,12 +44,12 @@ let videosfetchOp = { ...@@ -44,12 +44,12 @@ let videosfetchOp = {
selectionArgs: [videoType.toString()], selectionArgs: [videoType.toString()],
}; };
let audiosfetchOp = { let audiosfetchOp = {
selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ? AND bucket_display_name = ?',
selectionArgs: [audioType.toString()], selectionArgs: [audioType.toString(), 'Camera'],
}; };
let filesfetchOp = { let filesfetchOp = {
selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ?', selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ? AND relative_path = ?',
selectionArgs: [fileType.toString()], selectionArgs: [fileType.toString(), 'Documents/'],
}; };
let imageAndVideofetchOp = { let imageAndVideofetchOp = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册