]>
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"
11 class DolphinSearchBoxTest
: public QObject
19 void testTextClearing();
22 DolphinSearchBox
* m_searchBox
;
25 void DolphinSearchBoxTest::init()
27 m_searchBox
= new DolphinSearchBox();
30 void DolphinSearchBoxTest::cleanup()
36 * The test verifies whether the automatic clearing of the text works correctly.
37 * The text may not get cleared when the searchbox gets visible or invisible,
38 * as this would clear the text when switching between tabs.
40 void DolphinSearchBoxTest::testTextClearing()
43 QVERIFY(m_searchBox
->text().isEmpty());
45 m_searchBox
->setText("xyz");
48 QCOMPARE(m_searchBox
->text(), QString("xyz"));
50 QTest::keyClick(m_searchBox
, Qt::Key_Escape
);
51 QVERIFY(m_searchBox
->text().isEmpty());
54 QTEST_MAIN(DolphinSearchBoxTest
)
56 #include "dolphinsearchboxtest.moc"