未验证 提交 0e3e88de 编写于 作者: O openharmony_ci 提交者: Gitee

!5954 modify cases on 20221018

Merge pull request !5954 from 杨清/1228
...@@ -90,6 +90,30 @@ describe('I18nTest', function () { ...@@ -90,6 +90,30 @@ describe('I18nTest', function () {
expect(locale).assertInstanceOf('String'); expect(locale).assertInstanceOf('String');
}) })
/* *
* @tc.number SUB_GLOBAL_I18N_JS_2110
* @tc.name getSystemLanguages test
* @tc.desc check the getSystemLanguages
*/
it('i18n_test_2110', 0, function () {
let value = I18n.System.getSystemLanguages();
let len = value.length;
console.log('i18n_test_2110 ' + len);
expect(len).assertLarger(0);
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_2120
* @tc.name getSystemCountries with en param
* @tc.desc check the getSystemCountries
*/
it('i18n_test_2120', 0, function () {
let value = I18n.System.getSystemCountries('en');
let len = value.length;
console.log('i18n_test_2120 ' + len);
expect(len).assertLarger(0);
})
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_2310 * @tc.number SUB_GLOBAL_I18N_JS_2310
* @tc.name isSuggested with zh param * @tc.name isSuggested with zh param
......
...@@ -106,7 +106,7 @@ describe('resMgrTest', function () { ...@@ -106,7 +106,7 @@ describe('resMgrTest', function () {
*/ */
it('getString_test_003', 0, async function (done) { it('getString_test_003', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => { resmgr.getResourceManager((error, mgr) => {
mgr.getString({ bundleName:"ohos.intl.test", mgr.getStringValue({ bundleName:"ohos.intl.test",
moduleName:"entry", moduleName:"entry",
id:$r(app.string.app_name).id}, (err, value) => { id:$r(app.string.app_name).id}, (err, value) => {
expect(value !== null).assertTrue(); expect(value !== null).assertTrue();
...@@ -124,7 +124,7 @@ describe('resMgrTest', function () { ...@@ -124,7 +124,7 @@ describe('resMgrTest', function () {
*/ */
it('getString_test_004', 0, async function (done) { it('getString_test_004', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => { resmgr.getResourceManager((error, mgr) => {
mgr.getString({ bundleName:"ohos.intl.test", mgr.getStringValue({ bundleName:"ohos.intl.test",
moduleName:"entry", moduleName:"entry",
id:$r(app.string.app_name).id}).then(value => { id:$r(app.string.app_name).id}).then(value => {
expect(value !== null).assertTrue(); expect(value !== null).assertTrue();
...@@ -135,6 +135,38 @@ describe('resMgrTest', function () { ...@@ -135,6 +135,38 @@ describe('resMgrTest', function () {
done(); done();
}) })
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_0500
* @tc.name test getString method in callback mode
* @tc.desc get the string in callback mode
*/
it('getString_test_006', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => {
mgr.getStringValue($r(app.string.app_name).id, (err, value) => {
expect(value !== null).assertTrue();
console.log('getString_test_006 ' + value);
expect(value).assertEqual('L2Test');
})
})
done();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_0600
* @tc.name test getString method in promise mode
* @tc.desc get the string in promise mode
*/
it('getString_test_007', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => {
mgr.getStringValue($r(app.string.app_name).id).then(value => {
expect(value !== null).assertTrue();
console.log('getString_test_007 ' + value);
expect(value).assertEqual('L2Test');
})
})
done();
})
/* * /* *
* @tc.number SUB_GLOBAL_RESMGR_JS_0700 * @tc.number SUB_GLOBAL_RESMGR_JS_0700
* @tc.name test getStringArray method in callback mode * @tc.name test getStringArray method in callback mode
...@@ -186,7 +218,7 @@ describe('resMgrTest', function () { ...@@ -186,7 +218,7 @@ describe('resMgrTest', function () {
*/ */
it('getStringArray_test_003', 0, async function (done) { it('getStringArray_test_003', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => { resmgr.getResourceManager((error, mgr) => {
mgr.getStringArray({bundleName:"ohos.intl.test", mgr.getStringArrayValue({bundleName:"ohos.intl.test",
moduleName:"entry", moduleName:"entry",
id:$r(app.strarray.sizeList).id}, (err, value) => { id:$r(app.strarray.sizeList).id}, (err, value) => {
expect(value !== null).assertTrue(); expect(value !== null).assertTrue();
...@@ -210,7 +242,7 @@ describe('resMgrTest', function () { ...@@ -210,7 +242,7 @@ describe('resMgrTest', function () {
*/ */
it('getStringArray_test_004', 0, async function (done) { it('getStringArray_test_004', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => { resmgr.getResourceManager((error, mgr) => {
mgr.getStringArray({bundleName:"ohos.intl.test", mgr.getStringArrayValue({bundleName:"ohos.intl.test",
moduleName:"entry", moduleName:"entry",
id:$r(app.strarray.sizeList).id}).then(value => { id:$r(app.strarray.sizeList).id}).then(value => {
expect(value !== null).assertTrue(); expect(value !== null).assertTrue();
...@@ -227,6 +259,50 @@ describe('resMgrTest', function () { ...@@ -227,6 +259,50 @@ describe('resMgrTest', function () {
done(); done();
}) })
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_0700
* @tc.name test getStringArray method in callback mode
* @tc.desc get the string array in callback mode
*/
it('getStringArray_test_005', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => {
mgr.getStringArrayValue($r(app.strarray.sizeList).id, (err, value) => {
expect(value !== null).assertTrue();
console.log('getStringArray_test_005 ' + value);
console.log('getStringArray_test_005 ' + value.length);
console.log('getStringArray_test_005 ' + value[0]);
expect(value.length).assertEqual(4);
expect(value[0]).assertEqual('small');
expect(value[1]).assertEqual('middle');
expect(value[2]).assertEqual('large');
expect(value[3]).assertEqual('extra large');
})
})
done();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_0800
* @tc.name test getStringArray method in promise mode
* @tc.desc get the string array in promise mode
*/
it('getStringArray_test_006', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => {
mgr.getStringArrayValue($r(app.strarray.sizeList).id).then(value => {
expect(value !== null).assertTrue();
console.log('getStringArray_test_006 ' + value);
console.log('getStringArray_test_006 ' + value.length);
console.log('getStringArray_test_006 ' + value[0]);
expect(value.length).assertEqual(4);
expect(value[0]).assertEqual('small');
expect(value[1]).assertEqual('middle');
expect(value[2]).assertEqual('large');
expect(value[3]).assertEqual('extra large');
})
})
done();
})
/* * /* *
* @tc.number SUB_GLOBAL_RESMGR_JS_0900 * @tc.number SUB_GLOBAL_RESMGR_JS_0900
* @tc.name test getMedia method in callback mode * @tc.name test getMedia method in callback mode
...@@ -264,7 +340,7 @@ describe('resMgrTest', function () { ...@@ -264,7 +340,7 @@ describe('resMgrTest', function () {
*/ */
it('getMedia_test_003', 0, async function (done) { it('getMedia_test_003', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => { resmgr.getResourceManager((error, mgr) => {
mgr.getMedia({bundleName:"ohos.intl.test", mgr.getMediaContent({bundleName:"ohos.intl.test",
moduleName:"entry", moduleName:"entry",
id:$r(app.media.icon).id}, (err, value) => { id:$r(app.media.icon).id}, (err, value) => {
console.log('getMedia_test_003 ' + value.length); console.log('getMedia_test_003 ' + value.length);
...@@ -281,7 +357,7 @@ describe('resMgrTest', function () { ...@@ -281,7 +357,7 @@ describe('resMgrTest', function () {
*/ */
it('getMedia_test_004', 0, async function (done) { it('getMedia_test_004', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => { resmgr.getResourceManager((error, mgr) => {
mgr.getMedia({bundleName:"ohos.intl.test", mgr.getMediaContent({bundleName:"ohos.intl.test",
moduleName:"entry", moduleName:"entry",
id:$r(app.media.icon).id}).then(value => { id:$r(app.media.icon).id}).then(value => {
console.log('getMedia_test_004 ' + value.length); console.log('getMedia_test_004 ' + value.length);
...@@ -291,6 +367,36 @@ describe('resMgrTest', function () { ...@@ -291,6 +367,36 @@ describe('resMgrTest', function () {
done(); done();
}) })
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_0900
* @tc.name test getMedia method in callback mode
* @tc.desc get the media in callback mode
*/
it('getMedia_test_005', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => {
mgr.getMediaContent($r(app.media.icon).id, (err, value) => {
console.log('getMedia_test_005 ' + value.length);
expect(value.length > 0).assertTrue();
})
})
done();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_1000
* @tc.name test getMedia method in promise mode
* @tc.desc get the media in promise mode
*/
it('getMedia_test_006', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => {
mgr.getMediaContent($r(app.media.icon).id).then(value => {
console.log('getMedia_test_006 ' + value.length);
expect(value.length > 0).assertTrue();
})
})
done();
})
/* * /* *
* @tc.number SUB_GLOBAL_RESMGR_JS_1100 * @tc.number SUB_GLOBAL_RESMGR_JS_1100
* @tc.name test getMediaBase64 method in callback mode * @tc.name test getMediaBase64 method in callback mode
...@@ -328,7 +434,7 @@ describe('resMgrTest', function () { ...@@ -328,7 +434,7 @@ describe('resMgrTest', function () {
*/ */
it('getMediaBase64_test_003', 0, async function (done) { it('getMediaBase64_test_003', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => { resmgr.getResourceManager((error, mgr) => {
mgr.getMediaBase64({bundleName:"ohos.intl.test", mgr.getMediaContentBase64({bundleName:"ohos.intl.test",
moduleName:"entry", moduleName:"entry",
id:$r(app.media.icon).id}, (err, value) => { id:$r(app.media.icon).id}, (err, value) => {
expect(value.length > 0).assertTrue(); expect(value.length > 0).assertTrue();
...@@ -345,7 +451,7 @@ describe('resMgrTest', function () { ...@@ -345,7 +451,7 @@ describe('resMgrTest', function () {
*/ */
it('getMediaBase64_test_004', 0, async function (done) { it('getMediaBase64_test_004', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => { resmgr.getResourceManager((error, mgr) => {
mgr.getMediaBase64({bundleName:"ohos.intl.test", mgr.getMediaContentBase64({bundleName:"ohos.intl.test",
moduleName:"entry", moduleName:"entry",
id:$r(app.media.icon).id}).then(value => { id:$r(app.media.icon).id}).then(value => {
expect(value.length > 0).assertTrue(); expect(value.length > 0).assertTrue();
...@@ -355,6 +461,36 @@ describe('resMgrTest', function () { ...@@ -355,6 +461,36 @@ describe('resMgrTest', function () {
done(); done();
}) })
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_1100
* @tc.name test getMediaBase64 method in callback mode
* @tc.desc get the media base64 in callback mode
*/
it('getMediaBase64_test_005', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => {
mgr.getMediaContentBase64($r(app.media.icon).id, (err, value) => {
expect(value.length > 0).assertTrue();
console.log('getMediaBase64_test_005 ' + value);
})
})
done();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_1200
* @tc.name test getMediaBase64 method in promise mode
* @tc.desc get the media base64 in promise mode
*/
it('getMediaBase64_test_006', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => {
mgr.getMediaContentBase64($r(app.media.icon).id).then(value => {
expect(value.length > 0).assertTrue();
console.log('getMediaBase64_test_002 ' + value);
})
})
done();
})
/* * /* *
* @tc.number SUB_GLOBAL_RESMGR_JS_1300 * @tc.number SUB_GLOBAL_RESMGR_JS_1300
* @tc.name test getConfiguration method in callback mode * @tc.name test getConfiguration method in callback mode
...@@ -466,7 +602,7 @@ describe('resMgrTest', function () { ...@@ -466,7 +602,7 @@ describe('resMgrTest', function () {
*/ */
it('getPluralString_test_003', 0, async function (done) { it('getPluralString_test_003', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => { resmgr.getResourceManager((error, mgr) => {
mgr.getPluralString({bundleName:"ohos.intl.test", mgr.getPluralStringValue({bundleName:"ohos.intl.test",
moduleName:"entry", moduleName:"entry",
id:$r(app.plural.plural_name).id}, 1, (error, value) => { id:$r(app.plural.plural_name).id}, 1, (error, value) => {
expect(value !== null).assertTrue(); expect(value !== null).assertTrue();
...@@ -484,7 +620,7 @@ describe('resMgrTest', function () { ...@@ -484,7 +620,7 @@ describe('resMgrTest', function () {
*/ */
it('getPluralString_test_004', 0, async function (done) { it('getPluralString_test_004', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => { resmgr.getResourceManager((error, mgr) => {
mgr.getPluralString({bundleName:"ohos.intl.test", mgr.getPluralStringValue({bundleName:"ohos.intl.test",
moduleName:"entry", moduleName:"entry",
id:$r(app.plural.plural_name).id}, 1).then(value => { id:$r(app.plural.plural_name).id}, 1).then(value => {
expect(value !== null).assertTrue(); expect(value !== null).assertTrue();
...@@ -495,6 +631,38 @@ describe('resMgrTest', function () { ...@@ -495,6 +631,38 @@ describe('resMgrTest', function () {
done(); done();
}) })
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_1700
* @tc.name test getPluralString method in callback mode
* @tc.desc get the plural string in callback mode
*/
it('getPluralString_test_005', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => {
mgr.getPluralStringValue($r(app.plural.plural_name).id, 1, (error, value) => {
expect(value !== null).assertTrue();
console.log('getPluralString_test_005 ' + value);
expect(value).assertEqual('1 test other');
})
})
done();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_1800
* @tc.name test getPluralString method in promise mode
* @tc.desc get the plural string in promise mode
*/
it('getPluralString_test_006', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => {
mgr.getPluralStringValue($r(app.plural.plural_name).id, 1).then(value => {
expect(value !== null).assertTrue();
console.log('getPluralString_test_006 ' + value);
expect(value).assertEqual('1 test other');
})
})
done();
})
/* * /* *
* @tc.number SUB_GLOBAL_RESMGR_JS_1900 * @tc.number SUB_GLOBAL_RESMGR_JS_1900
* @tc.name test getString method in callback mode * @tc.name test getString method in callback mode
...@@ -541,6 +709,36 @@ describe('resMgrTest', function () { ...@@ -541,6 +709,36 @@ describe('resMgrTest', function () {
done(); done();
}) })
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_1700
* @tc.name test getRawFile method in callback mode
* @tc.desc get the getRawFile in callback mode
*/
it('getRawFile_test_003', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => {
mgr.getRawFileContent('rawfile/rawfiletest.xml', (error, value) => {
expect(value !== null).assertTrue();
console.log('getRawFile_test_003 ' + value);
})
})
done();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_1800
* @tc.name test getRawFile method in promise mode
* @tc.desc get the getRawFile in promise mode
*/
it('getRawFile_test_004', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => {
mgr.getRawFileContent('rawfile/rawfiletest.xml').then(value => {
expect(value !== null).assertTrue();
console.log('getRawFile_test_004 ' + value);
})
})
done();
})
/* * /* *
* @tc.number SUB_GLOBAL_RESMGR_JS_1900 * @tc.number SUB_GLOBAL_RESMGR_JS_1900
* @tc.name test release method * @tc.name test release method
...@@ -599,6 +797,49 @@ describe('resMgrTest', function () { ...@@ -599,6 +797,49 @@ describe('resMgrTest', function () {
done(); done();
}) })
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_2000
* @tc.name test getRawFileDescriptor method in callback mode
* @tc.desc get the RawFileDescriptor in callback mode
*/
it('getRawFileDescriptor_test_003', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => {
mgr.getRawFd('rawfiletest.xml', (error, rawfile) => {
let fdValue = rawfile.fd;
let offsetValue = rawfile.offset;
let lengthValue = rawfile.length;
expect(rawfile !== null).assertTrue();
console.log('getRawFileDescriptor_test_003--'
+'fd:' + fdValue
+ ' offset:' + offsetValue
+ ' length:' + lengthValue);
})
})
done();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_2100
* @tc.name test getRawFileDescriptor method in promise mode
* @tc.desc get the RawFileDescriptor in promise mode
*/
it('getRawFileDescriptor_test_004', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => {
mgr.getRawFd('rawfiletest.xml').then(rawfile => {
rawfile.fd = 2000;
rawfile.offset = 20;
rawfile.length = 200;
expect(rawfile !== null).assertTrue();
console.log('getRawFileDescriptor_test_004--' + rawfile);
console.log('getRawFileDescriptor_test_004--'
+'fd:' + rawfile.fd
+ ' offset:' + rawfile.offset
+ ' length:' + rawfile.length);
})
})
done();
})
/* * /* *
* @tc.number SUB_GLOBAL_RESMGR_JS_2200 * @tc.number SUB_GLOBAL_RESMGR_JS_2200
* @tc.name test closeRawFileDescriptor method in callback mode * @tc.name test closeRawFileDescriptor method in callback mode
...@@ -629,6 +870,36 @@ describe('resMgrTest', function () { ...@@ -629,6 +870,36 @@ describe('resMgrTest', function () {
done(); done();
}) })
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_2200
* @tc.name test closeRawFileDescriptor method in callback mode
* @tc.desc get the closeRawFileDescriptor in callback mode
*/
it('closeRawFileDescriptor_test_003', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => {
mgr.closeRawFd('rawfiletest.xml', (error, value) => {
expect(error == null).assertTrue();
console.log('closeRawFileDescriptor_test_003--' + error);
})
})
done();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_2300
* @tc.name test closeRawFileDescriptor method in promise mode
* @tc.desc get the closeRawFileDescriptor in promise mode
*/
it('closeRawFileDescriptor_test_004', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => {
mgr.closeRawFd('rawfiletest.xml').then(value => {
expect(value !== null).assertTrue();
console.log('closeRawFileDescriptor_test_004--' + value);
})
})
done();
})
/* * /* *
* @tc.number SUB_GLOBAL_RESMGR_JS_2400 * @tc.number SUB_GLOBAL_RESMGR_JS_2400
* @tc.name test getStringByName method in callback mode * @tc.name test getStringByName method in callback mode
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册