Verified Commit efdcea70 authored by Eugene Popov's avatar Eugene Popov 🇺🇦 Committed by Fushan Wen
Browse files

Revert "klipper: Add `testTrimmedText`"

This reverts commit fc888e5d.
parent 00710125
......@@ -22,11 +22,6 @@ private Q_SLOTS:
void testIndexOf();
void testType_data();
void testType();
/**
* Test if the text is correctly trimmed, and can still provide the full text.
*/
void testTrimmedText();
};
void HistoryModelTest::testSetMaxSize()
......@@ -237,26 +232,5 @@ void HistoryModelTest::testType()
QCOMPARE(history->index(0).data(HistoryModel::TypeRole).value<HistoryItemType>(), expectedType);
}
void HistoryModelTest::testTrimmedText()
{
QScopedPointer<HistoryModel> history(new HistoryModel(nullptr));
QScopedPointer<QAbstractItemModelTester> modelTest(new QAbstractItemModelTester(history.data()));
history->setMaxSize(10);
QCOMPARE(history->rowCount(), 0);
// insert one item with a very long text
QString veryLongText;
for (int i = 0; i < 500; i++) {
veryLongText.append(QStringLiteral("a")); // Text length is 500
}
history->insert(QSharedPointer<HistoryItem>(new HistoryStringItem(veryLongText)));
const QModelIndex index = history->index(0, 0);
// Test full text
QCOMPARE(index.data(HistoryModel::FullTextRole).value<QString>(), veryLongText);
// Test trimmed text, 200 is from HistoryStringItem::text()
QCOMPARE(index.data(Qt::DisplayRole).value<QString>(), veryLongText.left(200 - 1) + QStringLiteral("…"));
}
QTEST_MAIN(HistoryModelTest)
#include "historymodeltest.moc"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment