提交 df7212e0 编写于 作者: L leiyuqian

[startup_standard][master]modify systemdeviceapi testDeviceProduct01

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