From 8c57858a284fb31aadeb2319c1266705114fcd1c Mon Sep 17 00:00:00 2001 From: Montel Laurent Date: Sun, 23 Nov 2014 09:25:22 +0100 Subject: [PATCH] Add more unittest --- messagecomposer/tests/CMakeLists.txt | 2 ++ messagecomposer/tests/globalparttest.cpp | 42 ++++++++++++++++++++++++ messagecomposer/tests/globalparttest.h | 32 ++++++++++++++++++ messagecomposer/tests/textparttest.cpp | 39 ++++++++++++++++++++++ messagecomposer/tests/textparttest.h | 32 ++++++++++++++++++ 5 files changed, 147 insertions(+) create mode 100644 messagecomposer/tests/globalparttest.cpp create mode 100644 messagecomposer/tests/globalparttest.h create mode 100644 messagecomposer/tests/textparttest.cpp create mode 100644 messagecomposer/tests/textparttest.h diff --git a/messagecomposer/tests/CMakeLists.txt b/messagecomposer/tests/CMakeLists.txt index 69eddd6de6..f7726e35e4 100644 --- a/messagecomposer/tests/CMakeLists.txt +++ b/messagecomposer/tests/CMakeLists.txt @@ -63,6 +63,8 @@ add_messagecomposer_test( maintextjobtest.cpp ) add_messagecomposer_test( composertest.cpp ) add_messagecomposer_cryptotest( cryptocomposertest.cpp ) add_messagecomposer_test( infoparttest.cpp ) +add_messagecomposer_test( textparttest.cpp ) +add_messagecomposer_test( globalparttest.cpp ) # Crypto add_messagecomposer_cryptotest( signjobtest.cpp ) diff --git a/messagecomposer/tests/globalparttest.cpp b/messagecomposer/tests/globalparttest.cpp new file mode 100644 index 0000000000..8ddec4a590 --- /dev/null +++ b/messagecomposer/tests/globalparttest.cpp @@ -0,0 +1,42 @@ +/* + Copyright (c) 2014 Montel Laurent + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License, version 2, as + published by the Free Software Foundation. + + 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 +*/ + +#include "globalparttest.h" +#include +#include <../part/globalpart.h> +GlobalPartTest::GlobalPartTest(QObject *parent) + : QObject(parent) +{ + +} + +GlobalPartTest::~GlobalPartTest() +{ + +} + +void GlobalPartTest::shouldHaveDefaultValue() +{ + MessageComposer::GlobalPart globalpart; + QVERIFY(globalpart.isGuiEnabled()); + QVERIFY(!globalpart.parentWidgetForGui()); + QVERIFY(!globalpart.isFallbackCharsetEnabled()); + QVERIFY(!globalpart.is8BitAllowed()); + QVERIFY(!globalpart.MDNRequested()); +} + +QTEST_KDEMAIN(GlobalPartTest, NoGUI) diff --git a/messagecomposer/tests/globalparttest.h b/messagecomposer/tests/globalparttest.h new file mode 100644 index 0000000000..913efde454 --- /dev/null +++ b/messagecomposer/tests/globalparttest.h @@ -0,0 +1,32 @@ +/* + Copyright (c) 2014 Montel Laurent + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License, version 2, as + published by the Free Software Foundation. + + 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 +*/ + +#ifndef GLOBALPARTTEST_H +#define GLOBALPARTTEST_H +#include + +class GlobalPartTest : public QObject +{ + Q_OBJECT +public: + explicit GlobalPartTest(QObject *parent=0); + ~GlobalPartTest(); +private Q_SLOTS: + void shouldHaveDefaultValue(); +}; + +#endif // GLOBALPARTTEST_H diff --git a/messagecomposer/tests/textparttest.cpp b/messagecomposer/tests/textparttest.cpp new file mode 100644 index 0000000000..a54054bba3 --- /dev/null +++ b/messagecomposer/tests/textparttest.cpp @@ -0,0 +1,39 @@ +/* + Copyright (c) 2014 Montel Laurent + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License, version 2, as + published by the Free Software Foundation. + + 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 +*/ + +#include "textparttest.h" +#include +#include <../part/textpart.h> +TextPartTest::TextPartTest(QObject *parent) + : QObject(parent) +{ + +} + +TextPartTest::~TextPartTest() +{ + +} + +void TextPartTest::shouldHaveDefaultValue() +{ + MessageComposer::TextPart textpart; + QVERIFY(textpart.warnBadCharset()); + QVERIFY(textpart.isWordWrappingEnabled()); +} + +QTEST_KDEMAIN(TextPartTest, NoGUI) diff --git a/messagecomposer/tests/textparttest.h b/messagecomposer/tests/textparttest.h new file mode 100644 index 0000000000..62e7d3f55f --- /dev/null +++ b/messagecomposer/tests/textparttest.h @@ -0,0 +1,32 @@ +/* + Copyright (c) 2014 Montel Laurent + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License, version 2, as + published by the Free Software Foundation. + + 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 +*/ + +#ifndef TEXTPARTTEST_H +#define TEXTPARTTEST_H +#include + +class TextPartTest : public QObject +{ + Q_OBJECT +public: + explicit TextPartTest(QObject *parent=0); + ~TextPartTest(); +private Q_SLOTS: + void shouldHaveDefaultValue(); +}; + +#endif // TEXTPARTTEST_H -- GitLab