Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linphone-desktop
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
linphone-desktop
Commits
cb131ed7
Commit
cb131ed7
authored
Oct 19, 2016
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(utils.spec.qml): add a test on `setTimeout`
parent
e30574e0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
1 deletion
+39
-1
utils.js
tests/ui/scripts/Utils/utils.js
+1
-1
utils.spec.qml
tests/ui/scripts/Utils/utils.spec.qml
+38
-0
No files found.
tests/ui/scripts/Utils/utils.js
View file @
cb131ed7
...
...
@@ -97,7 +97,7 @@ function setTimeout (delay, cb) {
}
function
clearTimeout
(
timer
)
{
timer
.
destroy
()
//
Not necessary
: `timer.stop()`
timer
.
destroy
()
//
Unnecessary call
: `timer.stop()`
}
// -------------------------------------------------------------------
...
...
tests/ui/scripts/Utils/utils.spec.qml
View file @
cb131ed7
...
...
@@ -5,7 +5,11 @@ import QtTest 1.1
// when tests are executed.
import
'
./utils.js
'
as
Utils
// ===================================================================
TestCase
{
id
:
testCase
name
:
'
UtilsTests
'
function
test_snakeToCamel_data
()
{
...
...
@@ -20,4 +24,38 @@ TestCase {
function
test_snakeToCamel
(
data
)
{
compare
(
Utils
.
snakeToCamel
(
data
.
input
),
data
.
output
)
}
function
test_setTimeoutWithoutParent
()
{
try
{
Utils
.
setTimeout
(
0
,
function
()
{
fail
(
'
`setTimeout` was called without parent.
'
)
})
}
catch
(
e
)
{
compare
(
e
,
'
Error: Qt.createQmlObject(): Missing parent object
'
)
}
}
function
test_setTimeout_data
()
{
return
[
{
time
:
0
},
{
time
:
100
}
]
}
function
test_setTimeout
(
data
)
{
var
failed
=
true
Utils
.
setTimeout
.
call
(
testCase
,
data
.
time
,
function
()
{
failed
=
false
})
if
(
!
failed
)
{
fail
(
'
`setTimeout` callback was called before `wait`
'
)
}
wait
(
200
)
if
(
failed
)
{
fail
(
'
`setTimeout` failed because callback it was not called in due course
'
)
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment