Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
30e837b3
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
30e837b3
编写于
6月 08, 2022
作者:
O
openharmony_ci
提交者:
Gitee
6月 08, 2022
浏览文件
操作
浏览文件
下载
差异文件
!3463 [startup_standard][master]modify systemdeviceapi testDeviceProduct01
Merge pull request !3463 from leiyuqian/cherry-pick-1654600945
上级
00944852
d43547b1
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
162 addition
and
168 deletion
+162
-168
startup/startup_standard/deviceinfo/src/main/js/default/test/SystemDeviceApi.test.js
...viceinfo/src/main/js/default/test/SystemDeviceApi.test.js
+162
-168
未找到文件。
startup/startup_standard/deviceinfo/src/main/js/default/test/SystemDeviceApi.test.js
浏览文件 @
30e837b3
...
...
@@ -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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录