diff --git a/autotests/CMakeLists.txt b/autotests/CMakeLists.txt index 4e7accb..7c7e13a 100644 --- a/autotests/CMakeLists.txt +++ b/autotests/CMakeLists.txt @@ -1,8 +1,8 @@ include(ECMAddTests) -ecm_add_tests( textutilstest.cpp editorutiltest.cpp emoticonlistwidgetselectortest.cpp NAME_PREFIX "kpimtextedit-" LINK_LIBRARIES Qt5::Test Qt5::Widgets KF5::Codecs KF5PimTextEdit KF5::IconThemes KF5::TextWidgets KF5::XmlGui) +ecm_add_tests( textutilstest.cpp editorutiltest.cpp emoticonlistwidgetselectortest.cpp emoticonunicodetabtest.cpp NAME_PREFIX "kpimtextedit-" LINK_LIBRARIES Qt5::Test Qt5::Widgets KF5::Codecs KF5PimTextEdit KF5::IconThemes KF5::TextWidgets KF5::XmlGui) ecm_add_test(slidecontainertest.cpp TEST_NAME slidecontainertest NAME_PREFIX kpimtextedit-widget LINK_LIBRARIES Qt5::Test Qt5::Gui KF5::PimTextEdit Qt5::Widgets ) diff --git a/src/emoticon/emoticonunicodetab.h b/autotests/emoticonunicodetabtest.cpp similarity index 62% copy from src/emoticon/emoticonunicodetab.h copy to autotests/emoticonunicodetabtest.cpp index cb9106d..c31553c 100644 --- a/src/emoticon/emoticonunicodetab.h +++ b/autotests/emoticonunicodetabtest.cpp @@ -1,44 +1,35 @@ /* Copyright (c) 2019 Montel Laurent This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef EMOTICONUNICODETAB_H -#define EMOTICONUNICODETAB_H +#include "emoticonunicodetabtest.h" +#include "emoticon/emoticonunicodetab.h" +#include -#include - -#include "kpimtextedit_export.h" - -namespace KPIMTextEdit { -class KPIMTEXTEDIT_EXPORT EmoticonUnicodeTab : public QTabWidget +QTEST_MAIN(EmoticonUnicodeTabTest) +EmoticonUnicodeTabTest::EmoticonUnicodeTabTest(QObject *parent) + : QObject(parent) { - Q_OBJECT -public: - explicit EmoticonUnicodeTab(QWidget *parent); - ~EmoticonUnicodeTab(); - -Q_SIGNALS: - void itemSelected(const QString &); -private: - void loadEmoticons(); - void createTab(const QString &str, const QList &emoticons); -}; } -#endif // EMOTICONUNICODETAB_H +void EmoticonUnicodeTabTest::shouldHaveDefaultValues() +{ + KPIMTextEdit::EmoticonUnicodeTab w; + QVERIFY(w.count() > 0); +} diff --git a/src/emoticon/emoticonunicodetab.h b/autotests/emoticonunicodetabtest.h similarity index 64% copy from src/emoticon/emoticonunicodetab.h copy to autotests/emoticonunicodetabtest.h index cb9106d..01766b9 100644 --- a/src/emoticon/emoticonunicodetab.h +++ b/autotests/emoticonunicodetabtest.h @@ -1,44 +1,35 @@ /* Copyright (c) 2019 Montel Laurent This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef EMOTICONUNICODETAB_H -#define EMOTICONUNICODETAB_H +#ifndef EMOTICONUNICODETABTEST_H +#define EMOTICONUNICODETABTEST_H -#include +#include -#include "kpimtextedit_export.h" - -namespace KPIMTextEdit { -class KPIMTEXTEDIT_EXPORT EmoticonUnicodeTab : public QTabWidget +class EmoticonUnicodeTabTest : public QObject { Q_OBJECT public: - explicit EmoticonUnicodeTab(QWidget *parent); - ~EmoticonUnicodeTab(); - -Q_SIGNALS: - void itemSelected(const QString &); - -private: - void loadEmoticons(); - void createTab(const QString &str, const QList &emoticons); + explicit EmoticonUnicodeTabTest(QObject *parent = nullptr); + ~EmoticonUnicodeTabTest() = default; +private Q_SLOTS: + void shouldHaveDefaultValues(); }; -} -#endif // EMOTICONUNICODETAB_H +#endif // EMOTICONUNICODETABTEST_H diff --git a/src/emoticon/emoticonunicodetab.h b/src/emoticon/emoticonunicodetab.h index cb9106d..34cb03d 100644 --- a/src/emoticon/emoticonunicodetab.h +++ b/src/emoticon/emoticonunicodetab.h @@ -1,44 +1,44 @@ /* Copyright (c) 2019 Montel Laurent This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef EMOTICONUNICODETAB_H #define EMOTICONUNICODETAB_H #include #include "kpimtextedit_export.h" namespace KPIMTextEdit { class KPIMTEXTEDIT_EXPORT EmoticonUnicodeTab : public QTabWidget { Q_OBJECT public: - explicit EmoticonUnicodeTab(QWidget *parent); + explicit EmoticonUnicodeTab(QWidget *parent = nullptr); ~EmoticonUnicodeTab(); Q_SIGNALS: void itemSelected(const QString &); private: void loadEmoticons(); void createTab(const QString &str, const QList &emoticons); }; } #endif // EMOTICONUNICODETAB_H