Fix tests
This commit is contained in:
@@ -109,6 +109,34 @@ TestCase {
|
||||
compare(spyCursor.count, 5);
|
||||
}
|
||||
|
||||
function test_longFixedChars(): void {
|
||||
textEdit.forceActiveFocus();
|
||||
testHelper.setFixedChars("111", "222");
|
||||
compare(textEdit.text, "111222");
|
||||
compare(textEdit.cursorPosition, 3);
|
||||
compare(spyCursor.count, 0);
|
||||
keyClick("b");
|
||||
compare(textEdit.text, "111b222");
|
||||
compare(textEdit.cursorPosition, 4);
|
||||
compare(spyCursor.count, 1);
|
||||
keyClick(Qt.Key_Left);
|
||||
compare(textEdit.text, "111b222");
|
||||
compare(textEdit.cursorPosition, 3);
|
||||
compare(spyCursor.count, 2);
|
||||
keyClick(Qt.Key_Left);
|
||||
compare(textEdit.text, "111b222");
|
||||
compare(textEdit.cursorPosition, 3);
|
||||
compare(spyCursor.count, 3);
|
||||
keyClick(Qt.Key_Right);
|
||||
compare(textEdit.text, "111b222");
|
||||
compare(textEdit.cursorPosition, 4);
|
||||
compare(spyCursor.count, 4);
|
||||
keyClick(Qt.Key_Right);
|
||||
compare(textEdit.text, "111b222");
|
||||
compare(textEdit.cursorPosition, 4);
|
||||
compare(spyCursor.count, 5);
|
||||
}
|
||||
|
||||
function test_document(): void {
|
||||
// We can't get to the QTextDocument from QML so we have to use a helper function.
|
||||
compare(testHelper.compareDocuments(textEdit.textDocument), true);
|
||||
|
||||
@@ -626,10 +626,10 @@ void TextHandlerTest::componentOutput_data()
|
||||
MessageComponent{MessageComponentType::Code, u"Some code"_s, QVariantMap{{u"class"_s, u"html"_s}}}};
|
||||
QTest::newRow("quote") << u"<p>Text</p>\n<blockquote>\n<p>blockquote</p>\n</blockquote>"_s
|
||||
<< QList<MessageComponent>{MessageComponent{MessageComponentType::Text, u"Text"_s, {}},
|
||||
MessageComponent{MessageComponentType::Quote, u"“blockquote”"_s, {}}};
|
||||
MessageComponent{MessageComponentType::Quote, u"\"blockquote\""_s, {}}};
|
||||
QTest::newRow("multiple paragraph quote") << u"<blockquote>\n<p>blockquote</p>\n<p>next paragraph</p>\n</blockquote>"_s
|
||||
<< QList<MessageComponent>{
|
||||
MessageComponent{MessageComponentType::Quote, u"<p>“blockquote</p>\n<p>next paragraph”</p>"_s, {}}};
|
||||
MessageComponent{MessageComponentType::Quote, u"<p>\"blockquote</p>\n<p>next paragraph\"</p>"_s, {}}};
|
||||
QTest::newRow("no tag first paragraph") << u"Text\n<p>Text</p>"_s
|
||||
<< QList<MessageComponent>{MessageComponent{MessageComponentType::Text, u"Text"_s, {}},
|
||||
MessageComponent{MessageComponentType::Text, u"Text"_s, {}}};
|
||||
|
||||
@@ -186,7 +186,7 @@ void ChatTextItemHelper::initialize()
|
||||
cursor.movePosition(QTextCursor::End);
|
||||
cursor.movePosition(QTextCursor::PreviousCharacter, QTextCursor::KeepAnchor, m_fixedEndChars.length());
|
||||
if (cursor.selectedText() != m_fixedEndChars) {
|
||||
cursor.keepPositionOnInsert();
|
||||
cursor.movePosition(QTextCursor::End);
|
||||
cursor.insertText(m_fixedEndChars);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user