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
7a3d0f2c
Commit
7a3d0f2c
authored
Dec 19, 2016
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(app): coding style
parent
0b4a1725
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
48 deletions
+48
-48
uri-tools.spec.qml
tests/ui/scripts/Utils/uri-tools.spec.qml
+1
-1
utils.js
tests/ui/scripts/Utils/utils.js
+30
-30
utils.spec.qml
tests/ui/scripts/Utils/utils.spec.qml
+17
-17
No files found.
tests/ui/scripts/Utils/uri-tools.spec.qml
View file @
7a3d0f2c
...
...
@@ -2,7 +2,7 @@ import QtTest 1.1
import
'
./uri-tools.js
'
as
UriTools
// ===================================================================
// ===================================================================
==========
TestCase
{
function
test_regexExists
()
{
...
...
tests/ui/scripts/Utils/utils.js
View file @
7a3d0f2c
// ===================================================================
// ===================================================================
==========
// Contains many common helpers.
// ===================================================================
// ===================================================================
==========
.
pragma
library
.
import
'
uri-tools.js
'
as
UriTools
// ===================================================================
// ===================================================================
==========
// QML helpers.
// ===================================================================
// ===================================================================
==========
// Destroy timeout.
function
clearTimeout
(
timer
)
{
...
...
@@ -16,7 +16,7 @@ function clearTimeout (timer) {
timer
.
destroy
()
}
// -------------------------------------------------------------------
// -------------------------------------------------------------------
----------
// Connect a signal to a function only for one call.
function
connectOnce
(
signal
,
cb
)
{
...
...
@@ -29,7 +29,7 @@ function connectOnce (signal, cb) {
return
func
}
// -------------------------------------------------------------------
// -------------------------------------------------------------------
----------
function
encodeTextToQmlRichFormat
(
text
,
options
)
{
var
images
=
''
...
...
@@ -81,7 +81,7 @@ function extractFirstUri (str) {
:
res
[
0
]
}
// -------------------------------------------------------------------
// -------------------------------------------------------------------
----------
// Returns the top (root) parent of one object.
function
getTopParent
(
object
,
useFakeParent
)
{
...
...
@@ -98,7 +98,7 @@ function getTopParent (object, useFakeParent) {
return
parent
}
// -------------------------------------------------------------------
// -------------------------------------------------------------------
----------
// Display a simple ConfirmDialog component.
// Wrap the openWindow function.
...
...
@@ -117,7 +117,7 @@ function openConfirmDialog (parent, options) {
)
}
// -------------------------------------------------------------------
// -------------------------------------------------------------------
----------
// Load by default a window in the ui/views folder.
// If options.isString is equals to true, a marshalling component can
...
...
@@ -161,7 +161,7 @@ function openWindow (window, parent, options) {
return
object
}
// -------------------------------------------------------------------
// -------------------------------------------------------------------
----------
// Test if a point is in a item.
//
...
...
@@ -179,7 +179,7 @@ function pointIsInItem (source, target, point) {
)
}
// -------------------------------------------------------------------
// -------------------------------------------------------------------
----------
// Test the type of a qml object.
// Warning: this function is probably not portable
...
...
@@ -196,7 +196,7 @@ function qmlTypeof (object, className) {
)
}
// -------------------------------------------------------------------
// -------------------------------------------------------------------
----------
// A copy of `Window.setTimeout` from js.
// delay is in milliseconds.
...
...
@@ -213,9 +213,9 @@ function setTimeout (parent, delay, cb) {
return
timer
}
// ===================================================================
// ===================================================================
==========
// GENERIC.
// ===================================================================
// ===================================================================
==========
function
_computeOptimizedCb
(
func
,
context
)
{
return
context
...
...
@@ -248,7 +248,7 @@ function _keyFinder (obj, cb, context) {
}
}
// -------------------------------------------------------------------
// -------------------------------------------------------------------
----------
// Basic assert function.
function
assert
(
condition
,
message
)
{
...
...
@@ -257,7 +257,7 @@ function assert (condition, message) {
}
}
// -------------------------------------------------------------------
// -------------------------------------------------------------------
----------
// Returns an array from a `object` or `array` argument.
function
ensureArray
(
obj
)
{
...
...
@@ -276,7 +276,7 @@ function ensureArray (obj) {
return
values
}
// -------------------------------------------------------------------
// -------------------------------------------------------------------
----------
function
escapeQuotes
(
str
)
{
return
str
!=
null
...
...
@@ -284,7 +284,7 @@ function escapeQuotes (str) {
:
''
}
// -------------------------------------------------------------------
// -------------------------------------------------------------------
----------
// Get the first matching value in a array or object.
// The matching value is obtained if `cb` returns true.
...
...
@@ -297,7 +297,7 @@ function find (obj, cb, context) {
return
key
!=
null
&&
key
!==
-
1
?
obj
[
key
]
:
null
}
// -------------------------------------------------------------------
// -------------------------------------------------------------------
----------
// Generate a random number in the [min, max[ interval.
// Uniform distrib.
...
...
@@ -305,7 +305,7 @@ function genRandomNumber (min, max) {
return
Math
.
random
()
*
(
max
-
min
)
+
min
}
// -------------------------------------------------------------------
// -------------------------------------------------------------------
----------
// Generate a random number between a set of intervals.
// The `intervals` param must be orderer like this:
...
...
@@ -337,7 +337,7 @@ function genRandomNumberBetweenIntervals (intervals) {
return
n
}
// -------------------------------------------------------------------
// -------------------------------------------------------------------
----------
// Returns the extension of a filename.
function
getExtension
(
str
)
{
...
...
@@ -350,7 +350,7 @@ function getExtension (str) {
return
str
.
slice
(
index
+
1
)
}
// -------------------------------------------------------------------
// -------------------------------------------------------------------
----------
// Test if a value is included in an array or object.
function
includes
(
obj
,
value
,
startIndex
)
{
...
...
@@ -375,37 +375,37 @@ function includes (obj, value, startIndex) {
return
false
}
// -------------------------------------------------------------------
// -------------------------------------------------------------------
----------
function
isArray
(
array
)
{
return
(
array
instanceof
Array
)
}
// -------------------------------------------------------------------
// -------------------------------------------------------------------
----------
function
isFunction
(
func
)
{
return
typeof
func
===
'
function
'
}
// -------------------------------------------------------------------
// -------------------------------------------------------------------
----------
function
isInteger
(
integer
)
{
return
integer
===
parseInt
(
integer
,
10
)
}
// -------------------------------------------------------------------
// -------------------------------------------------------------------
----------
function
isObject
(
object
)
{
return
object
!==
null
&&
typeof
object
===
'
object
'
}
// -------------------------------------------------------------------
// -------------------------------------------------------------------
----------
function
isString
(
string
)
{
return
typeof
string
===
'
string
'
||
string
instanceof
String
}
// -------------------------------------------------------------------
// -------------------------------------------------------------------
----------
// Convert a snake_case string to a lowerCamelCase string.
function
snakeToCamel
(
s
)
{
...
...
@@ -414,7 +414,7 @@ function snakeToCamel (s) {
})
}
// -------------------------------------------------------------------
// -------------------------------------------------------------------
----------
// Test if a string starts by a given string.
function
startsWith
(
str
,
searchStr
)
{
...
...
@@ -425,7 +425,7 @@ function startsWith (str, searchStr) {
return
str
.
slice
(
0
,
searchStr
.
length
)
===
searchStr
}
// -------------------------------------------------------------------
// -------------------------------------------------------------------
----------
// Invoke a `cb` function with each value of the interval: `[0, n[`.
// Return a mapped array created with the returned values of `cb`.
...
...
tests/ui/scripts/Utils/utils.spec.qml
View file @
7a3d0f2c
...
...
@@ -5,14 +5,14 @@ import QtTest 1.1
// when tests are executed.
import
'
./utils.js
'
as
Utils
// ===================================================================
// ===================================================================
==========
TestCase
{
id
:
testCase
// =================================================================
// =================================================================
==========
// QML helpers.
// =================================================================
// =================================================================
==========
function
test_clearTimeout_data
()
{
return
[
...
...
@@ -39,7 +39,7 @@ TestCase {
}
}
// -----------------------------------------------------------------
// -----------------------------------------------------------------
----------
// Test only if a confirm dialog can be opened.
// The other tests are launched by `ConfirmDialog.spec.qml`.
...
...
@@ -62,7 +62,7 @@ TestCase {
dialog
.
close
()
}
// -----------------------------------------------------------------
// -----------------------------------------------------------------
----------
function
test_qmlTypeof_data
()
{
return
[
...
...
@@ -93,7 +93,7 @@ TestCase {
compare
(
Utils
.
qmlTypeof
(
object
,
data
.
type
),
data
.
result
)
}
// -----------------------------------------------------------------
// -----------------------------------------------------------------
----------
function
test_setTimeoutWithoutParent
()
{
try
{
...
...
@@ -129,9 +129,9 @@ TestCase {
}
}
// =================================================================
// =================================================================
==========
// GENERIC.
// =================================================================
// =================================================================
==========
function
test_ensureArray_data
()
{
return
[
...
...
@@ -149,7 +149,7 @@ TestCase {
compare
(
Utils
.
ensureArray
(
data
.
input
).
sort
(),
data
.
output
.
sort
())
}
// -----------------------------------------------------------------
// -----------------------------------------------------------------
----------
function
test_genRandomNumber_data
()
{
return
[
...
...
@@ -171,7 +171,7 @@ TestCase {
compare
(
Utils
.
genRandomNumber
(
42
,
42
),
42
)
}
// -----------------------------------------------------------------
// -----------------------------------------------------------------
----------
function
test_genRandomNumberBetweenIntervals_data
()
{
return
[
...
...
@@ -207,7 +207,7 @@ TestCase {
})
}
// -----------------------------------------------------------------
// -----------------------------------------------------------------
----------
function
test_getExtension_data
()
{
return
[
...
...
@@ -222,7 +222,7 @@ TestCase {
compare
(
Utils
.
getExtension
(
data
.
input
),
data
.
output
)
}
// -----------------------------------------------------------------
// -----------------------------------------------------------------
----------
function
test_includes_data
()
{
return
[
...
...
@@ -255,7 +255,7 @@ TestCase {
)
}
// -----------------------------------------------------------------
// -----------------------------------------------------------------
----------
function
test_isArray_data
()
{
return
[
...
...
@@ -275,7 +275,7 @@ TestCase {
compare
(
Utils
.
isArray
(
data
.
input
),
data
.
output
)
}
// -----------------------------------------------------------------
// -----------------------------------------------------------------
----------
function
test_isString_data
()
{
return
[
...
...
@@ -293,7 +293,7 @@ TestCase {
compare
(
Utils
.
isString
(
data
.
input
),
data
.
output
)
}
// -----------------------------------------------------------------
// -----------------------------------------------------------------
----------
function
test_snakeToCamel_data
()
{
return
[
...
...
@@ -308,7 +308,7 @@ TestCase {
compare
(
Utils
.
snakeToCamel
(
data
.
input
),
data
.
output
)
}
// -----------------------------------------------------------------
// -----------------------------------------------------------------
----------
function
test_startsWith_data
()
{
return
[
...
...
@@ -333,7 +333,7 @@ TestCase {
)
}
// -----------------------------------------------------------------
// -----------------------------------------------------------------
----------
function
test_times1_data
()
{
return
[
...
...
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