From 69c2e873e74727526cf197ab4a06b368a1d820ec Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 31 Jul 2018 13:46:48 +0200 Subject: Fixed texteditor test --- framework/qml/tests/tst_texteditor.qml | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) (limited to 'framework/qml/tests') diff --git a/framework/qml/tests/tst_texteditor.qml b/framework/qml/tests/tst_texteditor.qml index f80afe66..544270e5 100644 --- a/framework/qml/tests/tst_texteditor.qml +++ b/framework/qml/tests/tst_texteditor.qml @@ -33,41 +33,27 @@ TestCase { Kube.TextEditor {} } - function test_1initialText() { - var editor = createTemporaryObject(editorComponent, testCase, {initialText: "Foobar\nBarBar", htmlEnabled: false}) - compare(editor.text, editor.initialText) - } + property string htmlText: "

Foobar
BarBar

" + property string plainText: "Foobar\nBarBar" - function test_2plainToHtmlConversion() { - var editor = createTemporaryObject(editorComponent, testCase, {initialText: "Foobar\nBarBar", htmlEnabled: false}) - editor.htmlEnabled = true - verify(editor.text.indexOf("") !== -1) - //It's converted into two paragraphs, so we can't check as a single string - verify(editor.text.indexOf("Foobar") !== -1) - verify(editor.text.indexOf("BarBar") !== -1) - editor.htmlEnabled = false + function test_1initialText() { + var editor = createTemporaryObject(editorComponent, testCase, {initialText: plainText}) compare(editor.text, editor.initialText) - - editor.htmlEnabled = true - verify(editor.text.indexOf("") !== -1) } function test_3htmlToPlainConversion() { - var editor = createTemporaryObject(editorComponent, testCase, {initialText: "

test

", htmlEnabled: true}) - editor.htmlEnabled = false - compare(editor.text, "test") - - editor.htmlEnabled = true - verify(editor.text.indexOf("") !== -1) + var editor = createTemporaryObject(editorComponent, testCase, {initialText: htmlText}) + editor.clearFormatting() + compare(editor.text, plainText) } function test_4detectPlain() { - var editor = createTemporaryObject(editorComponent, testCase, {initialText: "Foobar\nBarBar", htmlEnabled: true}) + var editor = createTemporaryObject(editorComponent, testCase, {initialText: plainText}) compare(editor.htmlEnabled, false) } function test_5detectHtml() { - var editor = createTemporaryObject(editorComponent, testCase, {initialText: "

test

", htmlEnabled: false}) + var editor = createTemporaryObject(editorComponent, testCase, {initialText: htmlText}) compare(editor.htmlEnabled, true) } } -- cgit v1.2.3