Commit 13f63a3f authored by David Edmundson's avatar David Edmundson

Update unit test to match change to reselecting top entry

Summary:
37014e64 introduced a change in the
behaviour of what happens when you select the top entry in the list.

Change makes some sense. Unit test was not updated, it therefore failed.

Test Plan: Ran unit test

Reviewers: #plasma, mart

Reviewed By: mart

Subscribers: joselema, rikmills, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D5570
parent ea3f87c5
......@@ -87,6 +87,8 @@ void HistoryTest::testInsertRemove()
{
QScopedPointer<History> history(new History(nullptr));
QSignalSpy topSpy(history.data(), SIGNAL(topChanged()));
QSignalSpy topUserSelectedSpy(history.data(), SIGNAL(topIsUserSelectedSet()));
history->setMaxSize(10);
QVERIFY(history->empty());
QVERIFY(!history->topIsUserSelected());
......@@ -147,7 +149,7 @@ void HistoryTest::testInsertRemove()
QVERIFY(topSpy.isEmpty());
// move one to top using the slot
// already on top, shouldn't change anything
// as well as the top changing, topIsUserSelected will also be signalled to show that it got re-selected
history->slotMoveToTop(barUuid);
QVERIFY(history->topIsUserSelected());
QCOMPARE(history->first()->text(), barText);
......@@ -157,7 +159,12 @@ void HistoryTest::testInsertRemove()
QCOMPARE(history->find(fooUuid)->previous_uuid(), foobarUuid);
QCOMPARE(history->find(foobarUuid)->next_uuid(), fooUuid);
QCOMPARE(history->find(foobarUuid)->previous_uuid(), barUuid);
QCOMPARE(topSpy.size(), 1);
topSpy.clear();
QVERIFY(topSpy.isEmpty());
QCOMPARE(topUserSelectedSpy.size(), 1);
topUserSelectedSpy.clear();
QVERIFY(topUserSelectedSpy.isEmpty());
// another one should change, though
history->slotMoveToTop(foobarUuid);
......
Markdown is supported
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