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
260cebc8
Commit
260cebc8
authored
Oct 20, 2016
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(app): add new tool `test_qml` that run unit tests on all `*.spec.qml` files
parent
0e12f049
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
77 additions
and
29 deletions
+77
-29
CMakeLists.txt
tests/CMakeLists.txt
+1
-1
resources.qrc
tests/resources.qrc
+2
-1
check_qml_syntax
tests/tools/check_qml_syntax
+1
-1
pre-commit
tests/tools/private/pre-commit
+5
-19
test_qml
tests/tools/test_qml
+62
-0
update_resources
tests/tools/update_resources
+5
-5
ConfirmDialog.spec.qml
tests/ui/modules/Common/Dialog/ConfirmDialog.spec.qml
+0
-1
CaterpillarAnimationStyle.qml
...es/Common/Styles/Animations/CaterpillarAnimationStyle.qml
+1
-1
No files found.
tests/CMakeLists.txt
View file @
260cebc8
...
...
@@ -96,7 +96,7 @@ endforeach ()
add_custom_target
(
check_qml DEPENDS
${
QML_SOURCES
}
COMMAND
"
${
CMAKE_SOURCE_DIR
}
/tools/check_qml"
COMMAND
"
${
CMAKE_SOURCE_DIR
}
/tools/check_qml
_syntax
"
)
# --------------------------------------------------------------------
...
...
tests/resources.qrc
View file @
260cebc8
<!DOCTYPE RCC>
<RCC
version=
"1.0"
>
<qresource
prefix=
"
/
"
>
<qresource
prefix=
""
>
<file>
imgs/add_field.svg
</file>
<file>
imgs/call.svg
</file>
<file>
imgs/cam.svg
</file>
...
...
@@ -32,6 +32,7 @@
<file>
ui/modules/Common/Colors.qml
</file>
<file>
ui/modules/Common/Constants.qml
</file>
<file>
ui/modules/Common/Dialog/ConfirmDialog.qml
</file>
<file>
ui/modules/Common/Dialog/ConfirmDialog.spec.qml
</file>
<file>
ui/modules/Common/Dialog/DialogDescription.qml
</file>
<file>
ui/modules/Common/Dialog/DialogPlus.qml
</file>
<file>
ui/modules/Common/DroppableTextArea.qml
</file>
...
...
tests/tools/check_qml
→
tests/tools/check_qml
_syntax
View file @
260cebc8
...
...
@@ -4,7 +4,7 @@
# Tool to check the syntax of `.qml`/`.js` files.
# ====================================================================
RESOURCES_FILE
=
"resources.qrc"
RESOURCES_FILE
=
'resources.qrc'
LINTER
=
qmllint-qt5
RED
=
'\e[1;31m'
...
...
tests/tools/private/pre-commit
View file @
260cebc8
#!/usr/bin/sh
RED
=
'\e[1;31m'
GREEN
=
'\e[1;32m'
BLUE
=
'\e[1;34m'
NC
=
'\e[0m'
# Check QML files, quit on failure.
sh
"./tests/tools/check_qml"
sh
'./tests/tools/check_qml_syntax'
if
[[
$?
!=
0
]]
;
then
exit
1
fi
# Check JS lib.
printf
"
${
BLUE
}
Testing scripts lib...
${
NC
}
\n
"
so_far_so_good
=
0
qmltestrunner
-input
"./tests/ui/scripts/Utils/utils.spec.qml"
printf
'\n'
if
[[
$?
==
0
]]
;
then
printf
"
${
GREEN
}
Done. No error found in scripts lib.
\n
"
else
printf
"
${
RED
}
One or more errors were found. Please to fix them.
\n
"
so_far_so_good
=
1
fi
printf
"
${
NC
}
"
# Run unit tests.
sh
'./tests/tools/test_qml'
exit
$
so_far_so_good
exit
$
?
tests/tools/test_qml
0 → 100644
View file @
260cebc8
#!/usr/bin/sh
RESOURCES_FILE
=
'resources.qrc'
TEST_RUNNER
=
'qmltestrunner-qt5'
TEST_FILE_EXTENSION
=
'spec.qml'
RED
=
'\e[1;31m'
GREEN
=
'\e[1;32m'
BLUE
=
'\e[1;34m'
NC
=
'\e[0m'
SCRIPT_DIR
=
"
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
"
&&
pwd
)
"
cd
$SCRIPT_DIR
/..
# Check JS lib.
printf
"
${
BLUE
}
Testing scripts lib...
${
NC
}
\n
"
so_far_so_good
=
0
$TEST_RUNNER
-input
'./ui/scripts/Utils/utils.spec.qml'
if
[[
$?
==
0
]]
;
then
printf
"
${
GREEN
}
Done. No error found in scripts lib.
\n
"
else
printf
"
${
RED
}
One or more errors were found. Please to fix them.
\n
"
so_far_so_good
=
1
fi
printf
"
${
NC
}
\n
"
# Check all `*.spec.qml` files
while
read
line
do
qml_file
=
$(
printf
"
$line
"
|
sed
-n
's/^\s*<\s*file\s*>\s*\(.*\.qml\)\s*<\s*\/\s*file\s*>\s*$/\1/p'
)
if
[[
!
-z
$qml_file
]]
;
then
spec_qml_file
=
"
${
qml_file
%.*
}
.
${
TEST_FILE_EXTENSION
}
"
if
[
-f
$spec_qml_file
]
;
then
printf
"
${
BLUE
}
Running unit qml tests of '
${
qml_file
}
'...
${
NC
}
\n
"
$TEST_RUNNER
-import
'./ui/modules/'
-input
"
$spec_qml_file
"
if
[[
$?
==
0
]]
;
then
printf
"
${
GREEN
}
All unit tests have succeeded for '
${
spec_qml_file
}
'.
\n
"
else
printf
"
${
RED
}
Unit tests have failed for '
${
spec_qml_file
}
'.
\n
"
so_far_so_good
=
1
fi
fi
fi
done
<
$RESOURCES_FILE
printf
"
\n
"
if
[[
$so_far_so_good
==
0
]]
;
then
printf
"
${
GREEN
}
Done. All tests have succeeded.
\n
"
else
printf
"
${
RED
}
Fail. One or many tests have failed.
\n
"
so_far_so_good
=
1
fi
printf
"
${
NC
}
\n
"
exit
$so_far_so_good
tests/tools/update_resources
View file @
260cebc8
...
...
@@ -10,13 +10,13 @@
# If you don't want to add a particular file, do not use this script!
# ====================================================================
RESOURCES_FILE
=
"resources.qrc"
RESOURCES_FILE
=
'resources.qrc'
SCRIPT_DIR
=
"
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
"
&&
pwd
)
"
cd
$SCRIPT_DIR
/..
echo
"<!DOCTYPE RCC><RCC version=
\"
1.0
\
"
>
<qresource prefix=
\"
/
\"
>"
>
$RESOURCES_FILE
echo
'<!DOCTYPE RCC><RCC version="1.0
">
<qresource prefix=
"/">'
>
$RESOURCES_FILE
for
filename
in
$(
find ui/ imgs/
-type
f |
sort
)
do
...
...
@@ -29,5 +29,5 @@ do
fi
done
echo
"
</qresource>
</RCC>
"
>>
$RESOURCES_FILE
echo
'
</qresource>
</RCC>
'
>>
$RESOURCES_FILE
tests/ui/modules/Common/Dialog/ConfirmDialog.spec.qml
View file @
260cebc8
...
...
@@ -26,7 +26,6 @@ TestCase {
return
dialog
}
function
test_exitStatusViaButtons_data
()
{
return
[
{
button
:
0
,
expectedStatus
:
0
},
...
...
tests/ui/modules/Common/Styles/Animations/CaterpillarAnimationStyle.qml
View file @
260cebc8
pragma
Singleton
import
QtQuick
2.7
import
Common
.
Styles
1.0
import
Common
1.0
// ===================================================================
...
...
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