Cleanup chatkeyhelp and tests

This commit is contained in:
James Graham
2026-02-14 12:18:07 +00:00
parent c5457a893f
commit 0341da5868
9 changed files with 57 additions and 28 deletions

View File

@@ -31,12 +31,6 @@ TestCase {
textItem: textItemHelper
}
SignalSpy {
id: spyItem
target: textItemHelper
signalName: "textItemChanged"
}
SignalSpy {
id: spyUp
target: testHelper.keyHelper
@@ -63,7 +57,6 @@ TestCase {
function init(): void {
textEdit.clear();
spyItem.clear();
spyUp.clear();
spyDown.clear();
spyDelete.clear();
@@ -71,6 +64,11 @@ TestCase {
textEdit.forceActiveFocus();
}
function cleanupTestCase(): void {
testHelper.textItem = null;
textItemHelper.textItem = null;
}
function test_upDown(): void {
textEdit.insert(0, "line 1\nline 2\nline 3")
textEdit.cursorPosition = 0;

View File

@@ -30,14 +30,13 @@ public:
ChatTextItemHelper *textItem() const
{
return m_textItem;
return m_keyHelper->textItem;
}
void setTextItem(ChatTextItemHelper *textItem)
{
if (textItem == m_textItem) {
if (textItem == m_keyHelper->textItem) {
return;
}
m_textItem = textItem;
m_keyHelper->textItem = textItem;
Q_EMIT textItemChanged();
}
@@ -51,6 +50,5 @@ Q_SIGNALS:
void textItemChanged();
private:
QPointer<ChatTextItemHelper> m_textItem;
QPointer<ChatKeyHelper> m_keyHelper;
};

View File

@@ -253,7 +253,6 @@ TestCase {
compare(testHelper.checkFormatsAtCursor([]), true);
testHelper.mergeFormatOnCursor(RichFormat.Strikethrough);
compare(testHelper.checkFormatsAtCursor([RichFormat.Strikethrough]), true);
compare(testHelper.markdownText(), "***lots*** _of_ ~~text~~");
textEdit.clear();
textEdit.insert(0, "heading");