diff --git a/tests/ui/modules/Linphone/Chat/Chat.qml b/tests/ui/modules/Linphone/Chat/Chat.qml
index dd0e58f48..8a9254ed4 100644
--- a/tests/ui/modules/Linphone/Chat/Chat.qml
+++ b/tests/ui/modules/Linphone/Chat/Chat.qml
@@ -165,9 +165,9 @@ ColumnLayout {
ListElement { $dateSection: 1465389121000; $outgoing: true; $timestamp: 1465389121000; $type: 'message'; $content: "
www.google.fr" }
ListElement { $dateSection: 1465389121000; $outgoing: true; $timestamp: 1465389121000; $type: 'message'; $content: "Contact mail" }
ListElement { $dateSection: 1465389121000; $timestamp: 1465389133000; $type: 'event'; $content: 'incoming_call' }
- ListElement { $dateSection: 1465389121000; $timestamp: 1465389439000; $type: 'message'; $content: ' bg g vg gv v g v hgv gv gv jhb jh b jb jh hg vg cfcy f v u uyg f tf tf ft f tf t t fy ft f tu ty f rd rd d d uu gu y gg y f r dr ' }
+ ListElement { $dateSection: 1465389121000; $timestamp: 1465389439000; $type: 'message'; $content: 'www.test.fr bg g vg gv v g v hgv gv gv jhb jh b jb jh hg vg cfcy f v u uyg f tf tf ft f tf t t fy ft f tu ty f rd rd d d uu gu y gg y f r dr ' }
ListElement { $dateSection: 1465389121000; $timestamp: 1465389500000; $type: 'event'; $content: 'end_call' }
- ListElement { $dateSection: 1465994221000; $outgoing: true; $timestamp: 1465924321000; $type: 'message'; $content: 'You\'ve heard the expression, "Just believe it and it will come." Well, technically, that is true, however, \'believing\' is not just thinking that you can have it...' }
+ ListElement { $dateSection: 1465994221000; $outgoing: true; $timestamp: 1465924321000; $type: 'message'; $content: 'https://cdn.pixabay.com/photo/2014/03/29/09/17/cat-300572_960_720.jpg You\'ve heard the expression, "Just believe it and http://writm.com/wp-content/uploads/2016/08/Cat-hd-wallpapers.jpg it will https://cdn.pixabay.com/photo/2014/03/29/09/17/cat-300572_960_720.jpg come." http://html.com/wp-content/uploads/html-com-1.png Well, technically, that is true, https://cdn.pixabay.com/photo/2014/03/29/09/17/cat-300572_960_720.jpg however, \'believing\' is not just thinking that you can have it...' }
ListElement { $dateSection: 1465994221000; $timestamp: 1465924391000; $type: 'event'; $content: 'lost_incoming_call' }
}
}
diff --git a/tests/ui/modules/Linphone/Chat/Message.qml b/tests/ui/modules/Linphone/Chat/Message.qml
index 4616c395d..8b8215669 100644
--- a/tests/ui/modules/Linphone/Chat/Message.qml
+++ b/tests/ui/modules/Linphone/Chat/Message.qml
@@ -45,7 +45,7 @@ Item {
// See http://doc.qt.io/qt-5/qml-qtquick-text.html#textFormat-prop
// and http://doc.qt.io/qt-5/richtext-html-subset.html
- textFormat: Text.StyledText
+ textFormat: Text.RichText
onLinkActivated: Qt.openUrlExternally(link)
diff --git a/tests/ui/scripts/Utils/uri-tools.js b/tests/ui/scripts/Utils/uri-tools.js
index 6a4ea8209..b26f5220d 100644
--- a/tests/ui/scripts/Utils/uri-tools.js
+++ b/tests/ui/scripts/Utils/uri-tools.js
@@ -4,6 +4,12 @@
.pragma library
+// Options.
+
+// If true, strings starting with `www.` can be detected.
+// Not standard but helpful.
+var SUPPORTS_URL = true
+
// Level 0. ----------------------------------------------------------
var URI_PCT_ENCODED = '%[A-Fa-f\\d]{2}'
@@ -78,9 +84,11 @@ var URI_HIER_PART = '(?:' +
// Regex to match URI. It respects the RFC 3986.
// But many features are not supported like IP format.
-var URI = URI_SCHEME + ':' + URI_HIER_PART + '(?:' +
- '\\?' + URI_QUERY +
-')?' + '(?:' + '#' + URI_FRAGMENT + ')?'
+var URI = (SUPPORTS_URL
+ ? '(?:' + URI_SCHEME + ':' + '|' + 'www\\.' + ')'
+ : URI_SCHEME + ':'
+) + URI_HIER_PART + '(?:' + '\\?' + URI_QUERY + ')?' +
+'(?:' + '#' + URI_FRAGMENT + ')?'
var URI_REGEX = new RegExp(URI, 'g')
diff --git a/tests/ui/scripts/Utils/utils.js b/tests/ui/scripts/Utils/utils.js
index 9050ea058..08a4254b2 100644
--- a/tests/ui/scripts/Utils/utils.js
+++ b/tests/ui/scripts/Utils/utils.js
@@ -4,6 +4,10 @@
.import 'uri-tools.js' as UriTools
+// ===================================================================
+// QML helpers.
+// ===================================================================
+
// Load by default a window in the ui/views folder.
// If options.isString is equals to true, a marshalling component can
// be used.
@@ -67,24 +71,6 @@ function openConfirmDialog (parent, options) {
// -------------------------------------------------------------------
-function _computeOptimizedCb (func, context) {
- return (context != null)
- ? (function () {
- return func.apply(context, arguments)
- }) : func
-}
-
-// -------------------------------------------------------------------
-
-// Convert a snake_case string to a lowerCamelCase string.
-function snakeToCamel (s) {
- return s.replace(/(\_\w)/g, function (matches) {
- return matches[1].toUpperCase()
- })
-}
-
-// -------------------------------------------------------------------
-
// A copy of `Window.setTimeout` from js.
// delay is in milliseconds.
function setTimeout (parent, delay, cb) {
@@ -121,15 +107,6 @@ function connectOnce (signal, cb) {
// -------------------------------------------------------------------
-// Basic assert function.
-function assert (condition, message) {
- if (!condition) {
- throw new Error('Assert: ' + message)
- }
-}
-
-// -------------------------------------------------------------------
-
// Returns the top (root) parent of one object.
function getTopParent (object, useFakeParent) {
function _getTopParent (object, useFakeParent) {
@@ -165,6 +142,36 @@ function qmlTypeof (object, className) {
// -------------------------------------------------------------------
+function encodeUrisToQmlFormat (text) {
+ var images = ''
+
+ text = text
+ .replace(//g, '\u2063>')
+ .replace(UriTools.URI_REGEX, function (match) {
+ // If it's a simple URL, transforms it in URI.
+ if (startsWith(match, 'www.')) {
+ match = 'http://' + match
+ }
+
+ var ext = getExtension(match)
+ if (includes([ 'jpg', 'jpeg', 'gif', 'png', 'svg' ], ext)) {
+ images += ''
+ }
+
+ return '' + match + ''
+ })
+
+ if (images.length > 0) {
+ images = '