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
3a8bf11f
Commit
3a8bf11f
authored
Oct 21, 2016
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(InvertedMouseArea.spec.qml): add fixed tests (outside/inside clicks)
parent
47c733bb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
9 deletions
+42
-9
InvertedMouseArea.spec.qml
tests/ui/modules/Common/InvertedMouseArea.spec.qml
+42
-9
No files found.
tests/ui/modules/Common/InvertedMouseArea.spec.qml
View file @
3a8bf11f
...
...
@@ -32,18 +32,17 @@ Rectangle {
id
:
spy
signalName
:
'
pressed
'
target
:
invertedMouseArea
}
TestCase
{
when
:
windowShown
function
test_randomInsideMouseArea
()
{
var
failFun
=
function
()
{
fail
(
'
`pressed` signal was emitted.
'
)
}
invertedMouseArea
.
pressed
.
connect
(
failFun
)
function
init
()
{
spy
.
clear
()
}
function
test_randomClickInsideMouseArea
()
{
Utils
.
times
(
100
,
function
()
{
var
x
=
Math
.
floor
(
Utils
.
genRandomNumber
(
item
.
x
,
item
.
x
+
width
))
var
y
=
Math
.
floor
(
Utils
.
genRandomNumber
(
item
.
y
,
item
.
y
+
height
))
...
...
@@ -52,12 +51,12 @@ Rectangle {
})
wait
(
100
)
invertedMouseArea
.
pressed
.
disconnect
(
failFun
)
compare
(
spy
.
count
,
0
,
'
`pressed` signal was emitted
'
)
}
function
test_randomOutsideMouseArea
()
{
spy
.
target
=
invertedMouseArea
// ---------------------------------------------------------------
function
test_randomClickOutsideMouseArea
()
{
Utils
.
times
(
50
,
function
()
{
var
x
=
Math
.
floor
(
Utils
.
genRandomNumberBetweenIntervals
([
[
0
,
item
.
x
],
[
item
.
x
+
item
.
width
,
root
.
width
]
...
...
@@ -80,5 +79,39 @@ Rectangle {
spy
.
wait
(
100
)
})
}
// ---------------------------------------------------------------
function
test_clickInsideMouseArea_data
()
{
return
[
{
x
:
item
.
x
,
y
:
item
.
y
},
{
x
:
item
.
x
+
item
.
width
-
1
,
y
:
item
.
y
},
{
x
:
item
.
x
,
y
:
item
.
y
+
item
.
height
-
1
},
{
x
:
item
.
x
+
item
.
width
-
1
,
y
:
item
.
y
+
item
.
height
-
1
},
{
}
// item center.
]
}
function
test_clickInsideMouseArea
(
data
)
{
mouseClick
(
root
,
data
.
x
,
data
.
y
)
wait
(
100
)
compare
(
spy
.
count
,
0
,
'
`pressed` signal was emitted
'
)
}
// ---------------------------------------------------------------
function
test_clickOutsideMouseArea_data
()
{
return
[
{
x
:
item
.
x
-
1
,
y
:
item
.
y
-
1
},
{
x
:
item
.
x
+
item
.
width
,
y
:
item
.
y
},
{
x
:
item
.
x
,
y
:
item
.
y
+
item
.
height
},
{
x
:
item
.
x
+
item
.
width
,
y
:
item
.
y
+
item
.
height
}
]
}
function
test_clickOutsideMouseArea
(
data
)
{
mouseClick
(
root
,
data
.
x
,
data
.
y
)
spy
.
wait
(
100
)
}
}
}
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