2
* Copyright 2013 Canonical Ltd.
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; version 3.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
21
import Unity.Test 0.1 as UT
30
model: test.test_highlightedText_data().length
34
nameText: test.test_highlightedText_data()[index].text
35
nameHighlights: test.test_highlightedText_data()[index].highlights
48
function test_highlightedText_data() {
58
result: "<font color=\"#ffffff\">C</font>opy"
63
result: "C<font color=\"#ffffff\">o</font>py"
67
highlights: [1, 1, 3, 4],
68
result: "P<font color=\"#ffffff\">a</font>s<font color=\"#ffffff\">te</font>l"
72
highlights: [1, 1, 3, 5],
73
result: "P<font color=\"#ffffff\">a</font>s<font color=\"#ffffff\">tel</font>"
77
highlights: [0, 0, 3, 5],
78
result: "<font color=\"#ffffff\">P</font>as<font color=\"#ffffff\">tel</font>"
83
result: "Paste<font color=\"#ffffff\">l</font>"
87
highlights: [1, 2, 5, 5],
88
result: "T<font color=\"#ffffff\">wo</font> W<font color=\"#ffffff\">o</font>rds"
93
function test_highlightedText(data) {
94
var hText = result.highlightedText(data.text, data.highlights);
95
compare(hText, data.result);