未验证 提交 30e837b3 编写于 作者: O openharmony_ci 提交者: Gitee

!3463 [startup_standard][master]modify systemdeviceapi testDeviceProduct01

Merge pull request !3463 from leiyuqian/cherry-pick-1654600945
......@@ -37,7 +37,7 @@ describe('SystemDeviceTest', function () {
console.info('beforeAll: Prerequisites at the test suite level, \
which are executed before the test suite is executed.');
device.getInfo({
success: function(data){
success: function (data) {
console.log('getInfo success:' + JSON.stringify(data));
brandInfo = data.brand;
manufactureInfo = data.manufacturer;
......@@ -51,9 +51,9 @@ describe('SystemDeviceTest', function () {
windowHeightInfo = data.windowHeight;
screenDensityInfo = data.screenDensity;
screenShapeInfo = data.screenShape;
},
fail: function(data, code){
fail: function (data, code) {
console.log('getInfo failed.Error code:' + code + ';Error information: ' + JSON.stringify(data));
brandInfo = data.brand;
manufactureInfo = data.manufacturer;
......@@ -68,7 +68,7 @@ describe('SystemDeviceTest', function () {
screenDensityInfo = data.screenDensity;
screenShapeInfo = data.screenShape;
},
complete: function(){
complete: function () {
console.log('getInfo complete');
}
});
......@@ -97,35 +97,35 @@ describe('SystemDeviceTest', function () {
* @tc.name testDeviceBrand01
* @tc.desc Get the device brand represented by a string and the return value is not null.
*/
it('testDeviceBrand01', 0, function () {
console.info('testDeviceBrand01 start');
let ret = false;
console.info('the value of the deviceinfo brand is :' + brandInfo);
expect(brandInfo).assertInstanceOf('String');
if (brandInfo != "" && brandInfo != null && brandInfo != undefined) {
ret = true;
}
expect(ret).assertTrue();
let str = /^[A-Za-z]+$/g;
let arr = brandInfo.match(str);
let bufferstr = arr.join('');
console.info('the value of the bufferstr is :' + bufferstr);
expect(brandInfo).assertEqual(bufferstr);
console.info('testDeviceBrand01 :end');
})
it('testDeviceBrand01', 0, function () {
console.info('testDeviceBrand01 start');
let ret = false;
console.info('the value of the deviceinfo brand is :' + brandInfo);
expect(brandInfo).assertInstanceOf('String');
if (brandInfo != "" && brandInfo != null && brandInfo != undefined) {
ret = true;
}
expect(ret).assertTrue();
let str = /^[A-Za-z]+$/g;
let arr = brandInfo.match(str);
let bufferstr = arr.join('');
console.info('the value of the bufferstr is :' + bufferstr);
expect(brandInfo).assertEqual(bufferstr);
console.info('testDeviceBrand01 :end');
})
/**
* @tc.number SUB_STARTUP_SYSTEM_DEVICE_002
* @tc.name testDeviceManufacture01
* @tc.desc Get the manufacture name represented by a string and the return value is not null.
*/
it('testDeviceManufacture01', 0, function () {
it('testDeviceManufacture01', 0, function () {
console.info('testDeviceManufacture01 start');
let ret = false;
console.info('the value of the deviceinfo manufacture is :' + manufactureInfo);
expect(manufactureInfo).assertInstanceOf('String');
......@@ -147,196 +147,190 @@ describe('SystemDeviceTest', function () {
* @tc.name testDeviceModel01
* @tc.desc Get the internal software sub-model represented by a string and the return value is not null.
*/
it('testDeviceModel01', 0, function () {
console.info('testDeviceModel01 start');
let ret = false;
console.info('the value of the deviceinfo model is :' + deviceModelInfo);
expect(deviceModelInfo).assertInstanceOf('String');
if (deviceModelInfo != "" && deviceModelInfo != null && deviceModelInfo != undefined) {
ret = true;
}
expect(ret).assertTrue();
console.info('testDeviceModel01 : end');
})
it('testDeviceModel01', 0, function () {
console.info('testDeviceModel01 start');
let ret = false;
console.info('the value of the deviceinfo model is :' + deviceModelInfo);
expect(deviceModelInfo).assertInstanceOf('String');
if (deviceModelInfo != "" && deviceModelInfo != null && deviceModelInfo != undefined) {
ret = true;
}
expect(ret).assertTrue();
console.info('testDeviceModel01 : end');
})
/**
* @tc.number SUB_STARTUP_SYSTEM_DEVICE_004
* @tc.name testDeviceProduct01
* @tc.desc Get the product represented by a string and the return value is not null.
*/
it('testDeviceProduct01', 0, function () {
console.info('testDeviceProduct01 start');
let ret = false;
console.info('the value of the deviceinfo product is :' + deviceProductInfo);
expect(deviceProductInfo).assertInstanceOf('String');
if (deviceProductInfo != "" && deviceProductInfo != null && deviceProductInfo != undefined) {
ret = true;
}
expect(ret).assertTrue();
let str = /^[A-Za-z]+[ ][\d](.[\d])[ ][A-Za-z]+$/g;
let arr = deviceProductInfo.match(str);
let bufferstr = arr.join('');
console.info('the value of the bufferstr is :' + bufferstr);
expect(deviceProductInfo).assertEqual(bufferstr);
console.info('testDeviceProduct01 :end');
})
it('testDeviceProduct01', 0, function () {
console.info('testDeviceProduct01 start');
let ret = false;
console.info('the value of the deviceinfo product is :' + deviceProductInfo);
expect(deviceProductInfo).assertInstanceOf('String');
if (deviceProductInfo != "" && deviceProductInfo != null && deviceProductInfo != undefined) {
ret = true;
}
expect(ret).assertTrue();
console.info('testDeviceProduct01 :end');
})
/**
* @tc.number SUB_STARTUP_SYSTEM_DEVICE_005
* @tc.name testDeviceApiVersion01
* @tc.desc Get the API version number, which return value type is number.
*/
it('testDeviceApiVersion01', 0, function () {
console.info('testDeviceApiVersion01 start');
let ret = false;
console.info('the value of the deviceinfo sdkApiVersion is :' + apiVersionInfo);
expect(apiVersionInfo).assertInstanceOf('Number');
if (apiVersionInfo >= 0) {
ret = true;
}
expect(ret).assertTrue();
console.info('testDeviceApiVersion01 :end');
})
it('testDeviceApiVersion01', 0, function () {
console.info('testDeviceApiVersion01 start');
let ret = false;
console.info('the value of the deviceinfo sdkApiVersion is :' + apiVersionInfo);
expect(apiVersionInfo).assertInstanceOf('Number');
if (apiVersionInfo >= 0) {
ret = true;
}
expect(ret).assertTrue();
console.info('testDeviceApiVersion01 :end');
})
/**
* @tc.number SUB_STARTUP_SYSTEM_DEVICE_006
* @tc.name testDeviceType01
* @tc.desc Get a string representing the device type and the return value is not null.
*/
it('testDeviceType01', 0, function () {
console.info('testDeviceType01 start');
let ret = false;
console.info('the value of the deviceinfo deviceType is :' + deviceTypeInfo);
expect(deviceTypeInfo).assertInstanceOf('String');
if (deviceTypeInfo != "" && deviceTypeInfo != null && deviceTypeInfo != undefined) {
ret = true;
}
expect(ret).assertTrue()
console.info('testDeviceType01 : end');
})
it('testDeviceType01', 0, function () {
console.info('testDeviceType01 start');
let ret = false;
console.info('the value of the deviceinfo deviceType is :' + deviceTypeInfo);
expect(deviceTypeInfo).assertInstanceOf('String');
if (deviceTypeInfo != "" && deviceTypeInfo != null && deviceTypeInfo != undefined) {
ret = true;
}
expect(ret).assertTrue()
console.info('testDeviceType01 : end');
})
/**
* @tc.number SUB_STARTUP_SYSTEM_DEVICE_007
* @tc.name testDeviceLanguage01
* @tc.desc Get a string representing the device language and the return value is not null.
*/
it('testDeviceLanguage01', 0, function () {
console.info('testDeviceLanguage01 start');
let ret = false;
console.info('the value of the deviceinfo language is :' + languageInfo);
expect(languageInfo).assertInstanceOf('String');
if (languageInfo != "" && languageInfo != null && languageInfo != undefined) {
ret = true;
}
expect(ret).assertTrue()
console.info('testDeviceLanguage01 : end');
})
it('testDeviceLanguage01', 0, function () {
console.info('testDeviceLanguage01 start');
let ret = false;
console.info('the value of the deviceinfo language is :' + languageInfo);
expect(languageInfo).assertInstanceOf('String');
if (languageInfo != "" && languageInfo != null && languageInfo != undefined) {
ret = true;
}
expect(ret).assertTrue()
console.info('testDeviceLanguage01 : end');
})
/**
* @tc.number SUB_STARTUP_SYSTEM_DEVICE_008
* @tc.name testDeviceRegion01
* @tc.desc Get a string representing the device region and the return value is not null.
*/
it('testDeviceRegion01', 0, function () {
console.info('testDeviceRegion01 start');
let ret = false;
console.info('the value of the deviceinfo region is :' + regionInfo);
expect(regionInfo).assertInstanceOf('String');
if (regionInfo != "" && regionInfo != null && regionInfo != undefined) {
ret = true;
}
expect(ret).assertTrue()
console.info('testDeviceRegion01 : end');
})
it('testDeviceRegion01', 0, function () {
console.info('testDeviceRegion01 start');
let ret = false;
console.info('the value of the deviceinfo region is :' + regionInfo);
expect(regionInfo).assertInstanceOf('String');
if (regionInfo != "" && regionInfo != null && regionInfo != undefined) {
ret = true;
}
expect(ret).assertTrue()
console.info('testDeviceRegion01 : end');
})
/**
* @tc.number SUB_STARTUP_SYSTEM_DEVICE_009
* @tc.name testDeviceWindowWidth01
* @tc.desc Get a number representing the device window width and return value is greater than 0.
*/
it('testDeviceWindowWidth01', 0, function () {
console.info('testDeviceWindowWidth01 start');
let ret = false;
console.info('the value of the deviceinfo window width is :' + windowWidthInfo);
expect(windowWidthInfo).assertInstanceOf('Number');
if (windowWidthInfo >= 0) {
ret = true;
}
expect(ret).assertTrue();
console.info('testDeviceWindowWidth01 : end');
})
it('testDeviceWindowWidth01', 0, function () {
console.info('testDeviceWindowWidth01 start');
let ret = false;
console.info('the value of the deviceinfo window width is :' + windowWidthInfo);
expect(windowWidthInfo).assertInstanceOf('Number');
if (windowWidthInfo >= 0) {
ret = true;
}
expect(ret).assertTrue();
console.info('testDeviceWindowWidth01 : end');
})
/**
* @tc.number SUB_STARTUP_SYSTEM_DEVICE_010
* @tc.name testDeviceWindowHeight01
* @tc.desc Get a number representing the device window height and return value is greater than 0.
*/
it('testDeviceWindowHeight01', 0, function () {
console.info('testDeviceWindowHeight01 start');
let ret = false;
console.info('the value of the deviceinfo window height is :' + windowHeightInfo);
expect(windowHeightInfo).assertInstanceOf('Number');
if (windowHeightInfo >= 0) {
ret = true;
}
expect(ret).assertTrue();
console.info('testDeviceWindowHeight01 : end');
})
it('testDeviceWindowHeight01', 0, function () {
console.info('testDeviceWindowHeight01 start');
let ret = false;
console.info('the value of the deviceinfo window height is :' + windowHeightInfo);
expect(windowHeightInfo).assertInstanceOf('Number');
if (windowHeightInfo >= 0) {
ret = true;
}
expect(ret).assertTrue();
console.info('testDeviceWindowHeight01 : end');
})
/**
* @tc.number SUB_STARTUP_SYSTEM_DEVICE_011
* @tc.name testDeviceScreenDensity01
* @tc.desc Get a number representing the screen density and return value is greater than 0.
*/
it('testDeviceScreenDensity01', 0, function () {
console.info('testDeviceScreenDensity01 start');
let ret = false;
console.info('the value of the deviceinfo screen density is :' + screenDensityInfo);
expect(screenDensityInfo).assertInstanceOf('Number');
if (screenDensityInfo >= 0) {
ret = true;
}
expect(ret).assertTrue();
console.info('testDeviceScreenDensity01 : end');
})
it('testDeviceScreenDensity01', 0, function () {
console.info('testDeviceScreenDensity01 start');
let ret = false;
console.info('the value of the deviceinfo screen density is :' + screenDensityInfo);
expect(screenDensityInfo).assertInstanceOf('Number');
if (screenDensityInfo >= 0) {
ret = true;
}
expect(ret).assertTrue();
console.info('testDeviceScreenDensity01 : end');
})
/**
* @tc.number SUB_STARTUP_SYSTEM_DEVICE_012
* @tc.name testDeviceScreenShape01
* @tc.desc Get a string representing the device screen shape and the return value is not null.
*/
it('testDeviceScreenShape01', 0, function () {
console.info('testDeviceScreenShape01 start');
let ret = false;
console.info('the value of the deviceinfo screenShape is :' + screenShapeInfo);
expect(screenShapeInfo).assertInstanceOf('String');
if (screenShapeInfo != "" && screenShapeInfo != null && screenShapeInfo != undefined) {
ret = true;
}
expect(ret).assertTrue()
console.info('testDeviceScreenShape01 : end');
})
it('testDeviceScreenShape01', 0, function () {
console.info('testDeviceScreenShape01 start');
let ret = false;
console.info('the value of the deviceinfo screenShape is :' + screenShapeInfo);
expect(screenShapeInfo).assertInstanceOf('String');
if (screenShapeInfo != "" && screenShapeInfo != null && screenShapeInfo != undefined) {
ret = true;
}
expect(ret).assertTrue()
console.info('testDeviceScreenShape01 : end');
})
})
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册