]>
cloud.milkyroute.net Git - dolphin.git/blob - src/tests/dolphinsearchboxtest.cpp
2 * SPDX-FileCopyrightText: 2011 Peter Penz <peter.penz19@gmail.com>
4 * SPDX-License-Identifier: GPL-2.0-or-later
7 #include "search/dolphinsearchbox.h"
9 #include <QStandardPaths>
12 class DolphinSearchBoxTest
: public QObject
21 void testTextClearing();
24 DolphinSearchBox
*m_searchBox
;
27 void DolphinSearchBoxTest::initTestCase()
29 QStandardPaths::setTestModeEnabled(true);
32 void DolphinSearchBoxTest::init()
34 m_searchBox
= new DolphinSearchBox();
37 void DolphinSearchBoxTest::cleanup()
43 * The test verifies whether the automatic clearing of the text works correctly.
44 * The text may not get cleared when the searchbox gets visible or invisible,
45 * as this would clear the text when switching between tabs.
47 void DolphinSearchBoxTest::testTextClearing()
50 QVERIFY(m_searchBox
->text().isEmpty());
52 m_searchBox
->setText("xyz");
55 QCOMPARE(m_searchBox
->text(), QString("xyz"));
57 QTest::keyClick(m_searchBox
, Qt::Key_Escape
);
58 QVERIFY(m_searchBox
->text().isEmpty());
61 QTEST_MAIN(DolphinSearchBoxTest
)
63 #include "dolphinsearchboxtest.moc"