Commit cef4d96c authored by Elvis Angelaccio's avatar Elvis Angelaccio

Port QSignalSpy to new signal syntax

More compile-time safety. Tests still pass.

This also fixes a krazy warning about "normalised signal/slot
signatures".
parent 4709626a
......@@ -87,9 +87,9 @@ void KFileItemListViewTest::cleanup()
*/
void KFileItemListViewTest::testGroupedItemChanges()
{
QSignalSpy itemsInsertedSpy(m_model, SIGNAL(itemsInserted(KItemRangeList)));
QSignalSpy itemsInsertedSpy(m_model, &KFileItemModel::itemsInserted);
QVERIFY(itemsInsertedSpy.isValid());
QSignalSpy itemsRemovedSpy(m_model, SIGNAL(itemsRemoved(KItemRangeList)));
QSignalSpy itemsRemovedSpy(m_model, &KFileItemModel::itemsRemoved);
QVERIFY(itemsRemovedSpy.isValid());
m_model->setGroupedSorting(true);
......
......@@ -167,8 +167,8 @@ void KFileItemModelBenchmark::insertAndRemoveManyItems()
model.m_naturalSorting = false;
model.setRoles({"text"});
QSignalSpy spyItemsInserted(&model, SIGNAL(itemsInserted(KItemRangeList)));
QSignalSpy spyItemsRemoved(&model, SIGNAL(itemsRemoved(KItemRangeList)));
QSignalSpy spyItemsInserted(&model, &KFileItemModel::itemsInserted);
QSignalSpy spyItemsRemoved(&model, &KFileItemModel::itemsRemoved);
QBENCHMARK {
model.slotClear();
......
This diff is collapsed.
......@@ -139,7 +139,7 @@ void KItemListControllerTest::initTestCase()
m_testDir->createFiles(files);
m_model->loadDirectory(m_testDir->url());
QSignalSpy spyDirectoryLoadingCompleted(m_model, SIGNAL(directoryLoadingCompleted()));
QSignalSpy spyDirectoryLoadingCompleted(m_model, &KFileItemModel::directoryLoadingCompleted);
QVERIFY(spyDirectoryLoadingCompleted.wait());
m_container->show();
......@@ -507,8 +507,8 @@ void KItemListControllerTest::testKeyboardNavigation()
adjustGeometryForColumnCount(columnCount);
QCOMPARE(m_view->m_layouter->m_columnCount, columnCount);
QSignalSpy spySingleItemActivated(m_controller, SIGNAL(itemActivated(int)));
QSignalSpy spyMultipleItemsActivated(m_controller, SIGNAL(itemsActivated(KItemSet)));
QSignalSpy spySingleItemActivated(m_controller, &KItemListController::itemActivated);
QSignalSpy spyMultipleItemsActivated(m_controller, &KItemListController::itemsActivated);
while (!testList.isEmpty()) {
const QPair<KeyPress, ViewState> test = testList.takeFirst();
......@@ -584,7 +584,7 @@ void KItemListControllerTest::testMouseClickActivation()
mouseReleaseEvent.setButton(Qt::LeftButton);
mouseReleaseEvent.setButtons(Qt::NoButton);
QSignalSpy spyItemActivated(m_controller, SIGNAL(itemActivated(int)));
QSignalSpy spyItemActivated(m_controller, &KItemListController::itemActivated);
// Default setting: single click activation.
m_testStyle->setActivateItemOnSingleClick(true);
......
......@@ -46,7 +46,7 @@ void KItemListKeyboardSearchManagerTest::init()
void KItemListKeyboardSearchManagerTest::testBasicKeyboardSearch()
{
QSignalSpy spy(&m_keyboardSearchManager, SIGNAL(changeCurrentItem(QString, bool)));
QSignalSpy spy(&m_keyboardSearchManager, &KItemListKeyboardSearchManager::changeCurrentItem);
QVERIFY(spy.isValid());
m_keyboardSearchManager.addKeys("f");
......@@ -72,7 +72,7 @@ void KItemListKeyboardSearchManagerTest::testAbortedKeyboardSearch()
// to save time when running this test.
m_keyboardSearchManager.setTimeout(100);
QSignalSpy spy(&m_keyboardSearchManager, SIGNAL(changeCurrentItem(QString, bool)));
QSignalSpy spy(&m_keyboardSearchManager, &KItemListKeyboardSearchManager::changeCurrentItem);
QVERIFY(spy.isValid());
m_keyboardSearchManager.addKeys("f");
......@@ -104,7 +104,7 @@ void KItemListKeyboardSearchManagerTest::testRepeatedKeyPress()
// 1. the string contains the repeated key only once, and
// 2. the bool searchFromNextItem is true.
QSignalSpy spy(&m_keyboardSearchManager, SIGNAL(changeCurrentItem(QString, bool)));
QSignalSpy spy(&m_keyboardSearchManager, &KItemListKeyboardSearchManager::changeCurrentItem);
QVERIFY(spy.isValid());
m_keyboardSearchManager.addKeys("p");
......@@ -132,7 +132,7 @@ void KItemListKeyboardSearchManagerTest::testPressShift()
// string. Make sure that this does not reset the current search. See
// https://bugs.kde.org/show_bug.cgi?id=321286
QSignalSpy spy(&m_keyboardSearchManager, SIGNAL(changeCurrentItem(QString, bool)));
QSignalSpy spy(&m_keyboardSearchManager, &KItemListKeyboardSearchManager::changeCurrentItem);
QVERIFY(spy.isValid());
// Simulate that the user enters "a_b".
......
......@@ -115,7 +115,7 @@ void KItemListSelectionManagerTest::testConstructor()
void KItemListSelectionManagerTest::testCurrentItemAnchorItem()
{
QSignalSpy spyCurrent(m_selectionManager, SIGNAL(currentChanged(int,int)));
QSignalSpy spyCurrent(m_selectionManager, &KItemListSelectionManager::currentChanged);
// Set current item and check that the selection manager emits the currentChanged(int,int) signal correctly.
m_selectionManager->setCurrentItem(4);
......@@ -445,7 +445,7 @@ void KItemListSelectionManagerTest::testChangeSelection()
QFETCH(QList<QVariant>, data);
QFETCH(KItemSet, finalSelection);
QSignalSpy spySelectionChanged(m_selectionManager, SIGNAL(selectionChanged(KItemSet,KItemSet)));
QSignalSpy spySelectionChanged(m_selectionManager, &KItemListSelectionManager::selectionChanged);
// Initial selection should be empty
QVERIFY(!m_selectionManager->hasSelection());
......
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