]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/tests/dolphinsearchboxtest.cpp
Apply 1 suggestion(s) to 1 file(s)
[dolphin.git] / src / tests / dolphinsearchboxtest.cpp
index 862a398a5b62db609e02532d1f85dc41c1c3c4e9..bda60909d8ce8daa4debe8210d1778e4af94995e 100644 (file)
@@ -1,40 +1,34 @@
-/***************************************************************************
- *   Copyright (C) 2011 by Peter Penz <peter.penz19@gmail.com>             *
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- *                                                                         *
- *   This program is distributed in the hope that it will be useful,       *
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
- *   GNU General Public License for more details.                          *
- *                                                                         *
- *   You should have received a copy of the GNU General Public License     *
- *   along with this program; if not, write to the                         *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
- ***************************************************************************/
+/*
+ * SPDX-FileCopyrightText: 2011 Peter Penz <peter.penz19@gmail.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
 
 #include "search/dolphinsearchbox.h"
 
+#include <QStandardPaths>
 #include <QTest>
 
 class DolphinSearchBoxTest : public QObject
 {
     Q_OBJECT
 
-private slots:
+private Q_SLOTS:
+    void initTestCase();
     void init();
     void cleanup();
 
     void testTextClearing();
 
 private:
-    DolphinSearchBoxm_searchBox;
+    DolphinSearchBox *m_searchBox;
 };
 
+void DolphinSearchBoxTest::initTestCase()
+{
+    QStandardPaths::setTestModeEnabled(true);
+}
+
 void DolphinSearchBoxTest::init()
 {
     m_searchBox = new DolphinSearchBox();
@@ -52,13 +46,13 @@ void DolphinSearchBoxTest::cleanup()
  */
 void DolphinSearchBoxTest::testTextClearing()
 {
-    m_searchBox->show();
+    m_searchBox->setVisible(true, WithoutAnimation);
     QVERIFY(m_searchBox->text().isEmpty());
 
     m_searchBox->setText("xyz");
-    m_searchBox->hide();
-    m_searchBox->show();
-    QCOMPARE(m_searchBox->text(), QString("xyz"));
+    m_searchBox->setVisible(false, WithoutAnimation);
+    m_searchBox->setVisible(true, WithoutAnimation);
+    QCOMPARE(m_searchBox->text(), QStringLiteral("xyz"));
 
     QTest::keyClick(m_searchBox, Qt::Key_Escape);
     QVERIFY(m_searchBox->text().isEmpty());