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