Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/keepassxreboot/keepassxc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Geyer <debfx@fobos.de>2010-11-22 01:06:30 +0300
committerFelix Geyer <debfx@fobos.de>2010-11-22 01:06:30 +0300
commit230d24a123a04c08bfe8a209dd12f2e5b8a52379 (patch)
treeff19fd8704c40f50098954ddaa47cd1e7fab610b
parenta428464573b0d99e07e2752bbd89b650889af2e8 (diff)
No longer use automoc.
-rw-r--r--CMakeLists.txt2
-rw-r--r--src/CMakeLists.txt25
-rw-r--r--src/keys/CompositeKey.cpp23
-rw-r--r--src/keys/CompositeKey_p.h41
-rw-r--r--tests/CMakeLists.txt94
-rw-r--r--tests/TestCryptoHash.cpp13
-rw-r--r--tests/TestCryptoHash.h32
-rw-r--r--tests/TestEntryModel.cpp13
-rw-r--r--tests/TestEntryModel.h32
-rw-r--r--tests/TestGroup.cpp15
-rw-r--r--tests/TestGroup.h34
-rw-r--r--tests/TestGroupModel.cpp13
-rw-r--r--tests/TestGroupModel.h32
-rw-r--r--tests/TestHashedBlockStream.cpp12
-rw-r--r--tests/TestHashedBlockStream.h31
-rw-r--r--tests/TestKeePass2Reader.cpp14
-rw-r--r--tests/TestKeePass2Reader.h33
-rw-r--r--tests/TestKeePass2XmlReader.cpp27
-rw-r--r--tests/TestKeePass2XmlReader.h49
-rw-r--r--tests/TestSymmetricCipher.cpp15
-rw-r--r--tests/TestSymmetricCipher.h34
21 files changed, 418 insertions, 166 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f3c662518..9da75c8b9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -47,8 +47,6 @@ set(QT_USE_QTMAIN TRUE)
find_package(Qt4 REQUIRED)
include(${QT_USE_FILE})
-find_package(Automoc4 REQUIRED)
-
find_package(Libgcrypt REQUIRED)
find_package(ZLIB REQUIRED)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index fbd7ebe97..93a799f4f 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -51,6 +51,7 @@ set(keepassx_SOURCES
gui/GroupView.cpp
gui/MainWindow.cpp
keys/CompositeKey.cpp
+ keys/CompositeKey_p.h
keys/Key.h
keys/PasswordKey.cpp
streams/HashedBlockStream.cpp
@@ -59,6 +60,25 @@ set(keepassx_SOURCES
streams/SymmetricCipherStream.cpp
)
+set(keepassx_MOC
+ core/Database.h
+ core/Entry.h
+ core/Group.h
+ core/Metadata.h
+ gui/DatabaseWidget.h
+ gui/EditEntryWidget.h
+ gui/EntryModel.h
+ gui/EntryView.h
+ gui/GroupModel.h
+ gui/GroupView.h
+ gui/MainWindow.h
+ keys/CompositeKey_p.h
+ streams/HashedBlockStream.h
+ streams/LayeredStream.h
+ streams/qtiocompressor.h
+ streams/SymmetricCipherStream.h
+)
+
set(keepassx_FORMS
gui/EditEntryWidget.ui
gui/EditEntryWidgetMain.ui
@@ -67,8 +87,9 @@ set(keepassx_FORMS
)
qt4_wrap_ui(keepassx_SOURCES ${keepassx_FORMS})
+qt4_wrap_cpp(keepassx_SOURCES ${keepassx_MOC})
-automoc4_add_library( keepassx_core STATIC ${keepassx_SOURCES} )
+add_library( keepassx_core STATIC ${keepassx_SOURCES} )
-automoc4_add_executable( ${PROGNAME} WIN32 MACOSX_BUNDLE main.cpp )
+add_executable( ${PROGNAME} WIN32 MACOSX_BUNDLE main.cpp )
target_link_libraries( ${PROGNAME} keepassx_core ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${LIBGCRYPT_LIBS} ${ZLIB_LIBRARIES} )
diff --git a/src/keys/CompositeKey.cpp b/src/keys/CompositeKey.cpp
index 1fd5249f8..a039a2da5 100644
--- a/src/keys/CompositeKey.cpp
+++ b/src/keys/CompositeKey.cpp
@@ -16,30 +16,11 @@
*/
#include "CompositeKey.h"
-
-#include <QtCore/QThread>
+#include "CompositeKey_p.h"
#include "crypto/CryptoHash.h"
#include "crypto/SymmetricCipher.h"
-class KeyTransformation : public QThread
-{
- Q_OBJECT
-
-public:
- KeyTransformation(const QByteArray& key, const QByteArray& seed, int rounds);
- QByteArray result();
-
-protected:
- void run();
-
-private:
- QByteArray m_key;
- QByteArray m_seed;
- int m_rounds;
- QByteArray m_result;
-};
-
CompositeKey::~CompositeKey()
{
qDeleteAll(m_keys);
@@ -109,5 +90,3 @@ QByteArray KeyTransformation::result()
{
return m_result;
}
-
-#include "KeyTransformation.moc"
diff --git a/src/keys/CompositeKey_p.h b/src/keys/CompositeKey_p.h
new file mode 100644
index 000000000..c259bf526
--- /dev/null
+++ b/src/keys/CompositeKey_p.h
@@ -0,0 +1,41 @@
+/*
+* Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
+*
+* 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 or (at your option)
+* version 3 of the License.
+*
+* 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, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef KEEPASSX_COMPOSITEKEY_P_H
+#define KEEPASSX_COMPOSITEKEY_P_H
+
+#include <QtCore/QThread>
+
+class KeyTransformation : public QThread
+{
+ Q_OBJECT
+
+public:
+ KeyTransformation(const QByteArray& key, const QByteArray& seed, int rounds);
+ QByteArray result();
+
+protected:
+ void run();
+
+private:
+ QByteArray m_key;
+ QByteArray m_seed;
+ int m_rounds;
+ QByteArray m_result;
+};
+
+#endif // KEEPASSX_COMPOSITEKEY_P_H
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 8afcade99..f35637e29 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -19,21 +19,44 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/src)
set( KEEPASSX_TEST_TREE ${CMAKE_SOURCE_DIR}/tests )
configure_file( config-keepassx-tests.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-keepassx-tests.h )
-macro (ADD_UNIT_TEST _test_NAME)
- set(_srcList ${ARGN})
- set(_targetName ${_test_NAME})
- if( ${ARGV1} STREQUAL "TESTNAME" )
- set(_targetName ${ARGV2})
- list(REMOVE_AT _srcList 0 1)
- endif( ${ARGV1} STREQUAL "TESTNAME" )
-
- set(_nogui)
- list(GET ${_srcList} 0 first_PARAM)
- if( ${first_PARAM} STREQUAL "NOGUI" )
- set(_nogui "NOGUI")
- endif( ${first_PARAM} STREQUAL "NOGUI" )
-
- automoc4_add_executable( ${_test_NAME} ${_srcList} )
+MACRO(PARSE_ARGUMENTS prefix arg_names option_names)
+ SET(DEFAULT_ARGS)
+ FOREACH(arg_name ${arg_names})
+ SET(${prefix}_${arg_name})
+ ENDFOREACH(arg_name)
+ FOREACH(option ${option_names})
+ SET(${prefix}_${option} FALSE)
+ ENDFOREACH(option)
+
+ SET(current_arg_name DEFAULT_ARGS)
+ SET(current_arg_list)
+ FOREACH(arg ${ARGN})
+ SET(larg_names ${arg_names})
+ LIST(FIND larg_names "${arg}" is_arg_name)
+ IF (is_arg_name GREATER -1)
+ SET(${prefix}_${current_arg_name} ${current_arg_list})
+ SET(current_arg_name ${arg})
+ SET(current_arg_list)
+ ELSE (is_arg_name GREATER -1)
+ SET(loption_names ${option_names})
+ LIST(FIND loption_names "${arg}" is_option)
+ IF (is_option GREATER -1)
+ SET(${prefix}_${arg} TRUE)
+ ELSE (is_option GREATER -1)
+ SET(current_arg_list ${current_arg_list} ${arg})
+ ENDIF (is_option GREATER -1)
+ ENDIF (is_arg_name GREATER -1)
+ ENDFOREACH(arg)
+ SET(${prefix}_${current_arg_name} ${current_arg_list})
+ENDMACRO(PARSE_ARGUMENTS)
+
+macro (ADD_UNIT_TEST)
+ parse_arguments( TEST "NAME;SOURCES;MOCS;LIBS" "" ${ARGN} )
+ set(_test_NAME ${TEST_NAME})
+ set(_srcList ${TEST_SOURCES})
+ qt4_wrap_cpp( _srcList ${TEST_MOCS} )
+ add_executable( ${_test_NAME} ${_srcList} )
+ target_link_libraries( ${_test_NAME} ${TEST_LIBS} )
if(NOT TEST_OUTPUT)
set(TEST_OUTPUT plaintext)
@@ -43,9 +66,9 @@ macro (ADD_UNIT_TEST _test_NAME)
get_target_property( loc ${_test_NAME} LOCATION )
if (KDE4_TEST_OUTPUT STREQUAL "xml")
- add_test( ${_targetName} ${loc} -xml -o ${_targetName}.tml)
+ add_test( ${_test_NAME} ${loc} -xml -o ${_test_NAME}.tml)
else (KDE4_TEST_OUTPUT STREQUAL "xml")
- add_test( ${_targetName} ${loc} )
+ add_test( ${_test_NAME} ${loc} )
endif (KDE4_TEST_OUTPUT STREQUAL "xml")
if (NOT MSVC_IDE) #not needed for the ide
@@ -63,28 +86,31 @@ macro (ADD_UNIT_TEST _test_NAME)
endmacro (ADD_UNIT_TEST)
-# TODO automocify?
+set(TEST_LIBRARIES
+ keepassx_core
+ ${QT_QTCORE_LIBRARY}
+ ${QT_QTGUI_LIBRARY}
+ ${QT_QTTEST_LIBRARY}
+ ${LIBGCRYPT_LIBS}
+ ${ZLIB_LIBRARIES}
+)
-add_unit_test( testgroup TestGroup.cpp )
-target_link_libraries( testgroup keepassx_core ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTTEST_LIBRARY} ${LIBGCRYPT_LIBS} ${ZLIB_LIBRARIES} )
+set(modeltest_SOURCRS modeltest.cpp)
+qt4_wrap_cpp( modeltest_SOURCRS modeltest.h )
+add_library( modeltest STATIC ${modeltest_SOURCRS} )
-add_unit_test( testkeepass2xmlreader TestKeePass2XmlReader.cpp )
-target_link_libraries( testkeepass2xmlreader keepassx_core ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTTEST_LIBRARY} ${LIBGCRYPT_LIBS} ${ZLIB_LIBRARIES} )
+add_unit_test(NAME testgroup SOURCES TestGroup.cpp MOCS TestGroup.h LIBS ${TEST_LIBRARIES} )
-add_unit_test( testkeepass2reader TestKeePass2Reader.cpp )
-target_link_libraries( testkeepass2reader keepassx_core ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTTEST_LIBRARY} ${LIBGCRYPT_LIBS} ${ZLIB_LIBRARIES} )
+add_unit_test(NAME testkeepass2xmlreader SOURCES TestKeePass2XmlReader.cpp MOCS TestKeePass2XmlReader.h LIBS ${TEST_LIBRARIES})
-add_unit_test( testgroupmodel TestGroupModel.cpp modeltest.cpp )
-target_link_libraries( testgroupmodel keepassx_core ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTTEST_LIBRARY} ${LIBGCRYPT_LIBS} ${ZLIB_LIBRARIES} )
+add_unit_test(NAME testkeepass2reader SOURCES TestKeePass2Reader.cpp MOCS TestKeePass2Reader.h LIBS ${TEST_LIBRARIES})
-add_unit_test( testentrymodel TestEntryModel.cpp modeltest.cpp )
-target_link_libraries( testentrymodel keepassx_core ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTTEST_LIBRARY} ${LIBGCRYPT_LIBS} ${ZLIB_LIBRARIES} )
+add_unit_test(NAME testgroupmodel SOURCES TestGroupModel.cpp MOCS TestGroupModel.h LIBS ${TEST_LIBRARIES} modeltest)
-add_unit_test( testcryptohash TestCryptoHash.cpp )
-target_link_libraries( testcryptohash keepassx_core ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTTEST_LIBRARY} ${LIBGCRYPT_LIBS} ${ZLIB_LIBRARIES} )
+add_unit_test(NAME testentrymodel SOURCES TestEntryModel.cpp MOCS TestEntryModel.h LIBS ${TEST_LIBRARIES} modeltest)
-add_unit_test( testsymmetriccipher TestSymmetricCipher.cpp )
-target_link_libraries( testsymmetriccipher keepassx_core ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTTEST_LIBRARY} ${LIBGCRYPT_LIBS} ${ZLIB_LIBRARIES} )
+add_unit_test(NAME testcryptohash SOURCES TestCryptoHash.cpp MOCS TestCryptoHash.h LIBS ${TEST_LIBRARIES})
-add_unit_test( testhashedblockstream TestHashedBlockStream.cpp )
-target_link_libraries( testhashedblockstream keepassx_core ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTTEST_LIBRARY} ${LIBGCRYPT_LIBS} ${ZLIB_LIBRARIES} )
+add_unit_test(NAME testsymmetriccipher SOURCES TestSymmetricCipher.cpp MOCS TestSymmetricCipher.h LIBS ${TEST_LIBRARIES})
+
+add_unit_test(NAME testhashedblockstream SOURCES TestHashedBlockStream.cpp MOCS TestHashedBlockStream.h LIBS ${TEST_LIBRARIES})
diff --git a/tests/TestCryptoHash.cpp b/tests/TestCryptoHash.cpp
index 11f2ccca5..ea99d7fe4 100644
--- a/tests/TestCryptoHash.cpp
+++ b/tests/TestCryptoHash.cpp
@@ -15,20 +15,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "TestCryptoHash.h"
+
#include <QtTest/QTest>
#include "crypto/Crypto.h"
#include "crypto/CryptoHash.h"
-class TestCryptoHash : public QObject
-{
- Q_OBJECT
-
-private Q_SLOTS:
- void initTestCase();
- void test();
-};
-
void TestCryptoHash::initTestCase()
{
Crypto::init();
@@ -55,5 +48,3 @@ void TestCryptoHash::test()
}
QTEST_MAIN(TestCryptoHash);
-
-#include "TestCryptoHash.moc"
diff --git a/tests/TestCryptoHash.h b/tests/TestCryptoHash.h
new file mode 100644
index 000000000..1abcd5e1c
--- /dev/null
+++ b/tests/TestCryptoHash.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
+ *
+ * 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 or (at your option)
+ * version 3 of the License.
+ *
+ * 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef KEEPASSX_TESTCRYPTOHASH_H
+#define KEEPASSX_TESTCRYPTOHASH_H
+
+#include <QtCore/QObject>
+
+class TestCryptoHash : public QObject
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+ void initTestCase();
+ void test();
+};
+
+#endif // KEEPASSX_TESTCRYPTOHASH_H
diff --git a/tests/TestEntryModel.cpp b/tests/TestEntryModel.cpp
index c8d7371e6..c1bedf415 100644
--- a/tests/TestEntryModel.cpp
+++ b/tests/TestEntryModel.cpp
@@ -15,6 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "TestEntryModel.h"
+
#include <QtTest/QSignalSpy>
#include <QtTest/QTest>
@@ -23,15 +25,6 @@
#include "core/Group.h"
#include "gui/EntryModel.h"
-class TestEntryModel : public QObject
-{
- Q_OBJECT
-
-private Q_SLOTS:
- void initTestCase();
- void test();
-};
-
void TestEntryModel::initTestCase()
{
qRegisterMetaType<QModelIndex>("QModelIndex");
@@ -97,5 +90,3 @@ void TestEntryModel::test()
}
QTEST_MAIN(TestEntryModel);
-
-#include "TestEntryModel.moc"
diff --git a/tests/TestEntryModel.h b/tests/TestEntryModel.h
new file mode 100644
index 000000000..bd77f5ba9
--- /dev/null
+++ b/tests/TestEntryModel.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
+ *
+ * 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 or (at your option)
+ * version 3 of the License.
+ *
+ * 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef KEEPASSX_TESTENTRYMODEL_H
+#define KEEPASSX_TESTENTRYMODEL_H
+
+#include <QtCore/QObject>
+
+class TestEntryModel : public QObject
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+ void initTestCase();
+ void test();
+};
+
+#endif // KEEPASSX_TESTENTRYMODEL_H
diff --git a/tests/TestGroup.cpp b/tests/TestGroup.cpp
index 262dd73ae..8c71cd05f 100644
--- a/tests/TestGroup.cpp
+++ b/tests/TestGroup.cpp
@@ -15,22 +15,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "TestGroup.h"
+
#include <QtTest/QSignalSpy>
#include <QtTest/QTest>
#include "core/Database.h"
-class TestGroup : public QObject
-{
- Q_OBJECT
-
-private Q_SLOTS:
- void initTestCase();
- void testParenting();
- void testSignals();
- void testEntries();
-};
-
void TestGroup::initTestCase()
{
qRegisterMetaType<Group*>("Group*");
@@ -129,5 +120,3 @@ void TestGroup::testEntries()
}
QTEST_MAIN(TestGroup);
-
-#include "TestGroup.moc"
diff --git a/tests/TestGroup.h b/tests/TestGroup.h
new file mode 100644
index 000000000..4f0995088
--- /dev/null
+++ b/tests/TestGroup.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
+ *
+ * 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 or (at your option)
+ * version 3 of the License.
+ *
+ * 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef KEEPASSX_TESTGROUP_H
+#define KEEPASSX_TESTGROUP_H
+
+#include <QtCore/QObject>
+
+class TestGroup : public QObject
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+ void initTestCase();
+ void testParenting();
+ void testSignals();
+ void testEntries();
+};
+
+#endif // KEEPASSX_TESTGROUP_H
diff --git a/tests/TestGroupModel.cpp b/tests/TestGroupModel.cpp
index 2d7a15d5f..042a6164b 100644
--- a/tests/TestGroupModel.cpp
+++ b/tests/TestGroupModel.cpp
@@ -15,6 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "TestGroupModel.h"
+
#include <QtTest/QSignalSpy>
#include <QtTest/QTest>
@@ -23,15 +25,6 @@
#include "core/Group.h"
#include "gui/GroupModel.h"
-class TestGroupModel : public QObject
-{
- Q_OBJECT
-
-private Q_SLOTS:
- void initTestCase();
- void test();
-};
-
void TestGroupModel::initTestCase()
{
qRegisterMetaType<QModelIndex>("QModelIndex");
@@ -105,5 +98,3 @@ void TestGroupModel::test()
}
QTEST_MAIN(TestGroupModel);
-
-#include "TestGroupModel.moc"
diff --git a/tests/TestGroupModel.h b/tests/TestGroupModel.h
new file mode 100644
index 000000000..4711d9faf
--- /dev/null
+++ b/tests/TestGroupModel.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
+ *
+ * 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 or (at your option)
+ * version 3 of the License.
+ *
+ * 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef KEEPASSX_TESTGROUPMODEL_H
+#define KEEPASSX_TESTGROUPMODEL_H
+
+#include <QtCore/QObject>
+
+class TestGroupModel : public QObject
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+ void initTestCase();
+ void test();
+};
+
+#endif // KEEPASSX_TESTGROUPMODEL_H
diff --git a/tests/TestHashedBlockStream.cpp b/tests/TestHashedBlockStream.cpp
index 662578ac9..a8aedc883 100644
--- a/tests/TestHashedBlockStream.cpp
+++ b/tests/TestHashedBlockStream.cpp
@@ -15,19 +15,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "TestHashedBlockStream.h"
+
#include <QtCore/QBuffer>
#include <QtTest/QTest>
#include "streams/HashedBlockStream.h"
-class TestHashedBlockStream : public QObject
-{
- Q_OBJECT
-
-private Q_SLOTS:
- void testWriteRead();
-};
-
void TestHashedBlockStream::testWriteRead()
{
QByteArray data = QByteArray::fromHex("603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4");
@@ -70,5 +64,3 @@ void TestHashedBlockStream::testWriteRead()
}
QTEST_MAIN(TestHashedBlockStream);
-
-#include "TestHashedBlockStream.moc"
diff --git a/tests/TestHashedBlockStream.h b/tests/TestHashedBlockStream.h
new file mode 100644
index 000000000..b952908bf
--- /dev/null
+++ b/tests/TestHashedBlockStream.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
+ *
+ * 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 or (at your option)
+ * version 3 of the License.
+ *
+ * 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef KEEPASSX_TESTHASHEDBLOCKSTREAM_H
+#define KEEPASSX_TESTHASHEDBLOCKSTREAM_H
+
+#include <QtCore/QObject>
+
+class TestHashedBlockStream : public QObject
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+ void testWriteRead();
+};
+
+#endif // KEEPASSX_TESTHASHEDBLOCKSTREAM_H
diff --git a/tests/TestKeePass2Reader.cpp b/tests/TestKeePass2Reader.cpp
index 2fba35c00..a2f0f32d6 100644
--- a/tests/TestKeePass2Reader.cpp
+++ b/tests/TestKeePass2Reader.cpp
@@ -15,6 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "TestKeePass2Reader.h"
+
#include <QtTest/QTest>
#include "config-keepassx-tests.h"
@@ -24,16 +26,6 @@
#include "format/KeePass2Reader.h"
#include "keys/PasswordKey.h"
-class TestKeePass2Reader : public QObject
-{
- Q_OBJECT
-
-private Q_SLOTS:
- void initTestCase();
- void testNonAscii();
- void testCompressed();
-};
-
void TestKeePass2Reader::initTestCase()
{
Crypto::init();
@@ -64,5 +56,3 @@ void TestKeePass2Reader::testCompressed()
}
QTEST_MAIN(TestKeePass2Reader);
-
-#include "TestKeePass2Reader.moc"
diff --git a/tests/TestKeePass2Reader.h b/tests/TestKeePass2Reader.h
new file mode 100644
index 000000000..cccaf9171
--- /dev/null
+++ b/tests/TestKeePass2Reader.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
+ *
+ * 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 or (at your option)
+ * version 3 of the License.
+ *
+ * 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef KEEPASSX_TESTKEEPASS2READER_H
+#define KEEPASSX_TESTKEEPASS2READER_H
+
+#include <QtCore/QObject>
+
+class TestKeePass2Reader : public QObject
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+ void initTestCase();
+ void testNonAscii();
+ void testCompressed();
+};
+
+#endif // KEEPASSX_TESTKEEPASS2READER_H
diff --git a/tests/TestKeePass2XmlReader.cpp b/tests/TestKeePass2XmlReader.cpp
index cdbc76f60..38988c5df 100644
--- a/tests/TestKeePass2XmlReader.cpp
+++ b/tests/TestKeePass2XmlReader.cpp
@@ -15,6 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "TestKeePass2XmlReader.h"
+
#include <QtTest/QTest>
#include "core/Database.h"
@@ -33,29 +35,6 @@ namespace QTest {
}
}
-class TestKeePass2XmlReader : public QObject
-{
- Q_OBJECT
-
-private Q_SLOTS:
- void initTestCase();
- void testMetadata();
- void testCustomIcons();
- void testCustomData();
- void testGroupRoot();
- void testGroup1();
- void testGroup2();
- void testEntry1();
- void testEntry2();
- void testEntryHistory();
- void testDeletedObjects();
-
-private:
- QDateTime genDT(int year, int month, int day, int hour, int min, int second);
-
- Database* m_db;
-};
-
QDateTime TestKeePass2XmlReader::genDT(int year, int month, int day, int hour, int min, int second)
{
QDate date(year, month, day);
@@ -319,5 +298,3 @@ void TestKeePass2XmlReader::testDeletedObjects()
}
QTEST_MAIN(TestKeePass2XmlReader);
-
-#include "TestKeePass2XmlReader.moc"
diff --git a/tests/TestKeePass2XmlReader.h b/tests/TestKeePass2XmlReader.h
new file mode 100644
index 000000000..43dce003a
--- /dev/null
+++ b/tests/TestKeePass2XmlReader.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
+ *
+ * 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 or (at your option)
+ * version 3 of the License.
+ *
+ * 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef KEEPASSX_TESTKEEPASS2XMLREADER_H
+#define KEEPASSX_TESTKEEPASS2XMLREADER_H
+
+#include <QtCore/QDateTime>
+#include <QtCore/QObject>
+
+class Database;
+
+class TestKeePass2XmlReader : public QObject
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+ void initTestCase();
+ void testMetadata();
+ void testCustomIcons();
+ void testCustomData();
+ void testGroupRoot();
+ void testGroup1();
+ void testGroup2();
+ void testEntry1();
+ void testEntry2();
+ void testEntryHistory();
+ void testDeletedObjects();
+
+private:
+ QDateTime genDT(int year, int month, int day, int hour, int min, int second);
+
+ Database* m_db;
+};
+
+#endif // KEEPASSX_TESTKEEPASS2XMLREADER_H
diff --git a/tests/TestSymmetricCipher.cpp b/tests/TestSymmetricCipher.cpp
index 923e0c550..669a58049 100644
--- a/tests/TestSymmetricCipher.cpp
+++ b/tests/TestSymmetricCipher.cpp
@@ -15,6 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "TestSymmetricCipher.h"
+
#include <QtCore/QBuffer>
#include <QtTest/QTest>
@@ -22,17 +24,6 @@
#include "crypto/SymmetricCipher.h"
#include "streams/SymmetricCipherStream.h"
-class TestSymmetricCipher : public QObject
-{
- Q_OBJECT
-
-private Q_SLOTS:
- void initTestCase();
- void testAes256CbcEncryption();
- void testAes256CbcDecryption();
- void testSalsa20();
-};
-
void TestSymmetricCipher::initTestCase()
{
Crypto::init();
@@ -170,5 +161,3 @@ void TestSymmetricCipher::testSalsa20()
}
QTEST_MAIN(TestSymmetricCipher);
-
-#include "TestSymmetricCipher.moc"
diff --git a/tests/TestSymmetricCipher.h b/tests/TestSymmetricCipher.h
new file mode 100644
index 000000000..081010d82
--- /dev/null
+++ b/tests/TestSymmetricCipher.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
+ *
+ * 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 or (at your option)
+ * version 3 of the License.
+ *
+ * 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef KEEPASSX_TESTSYMMETRICCIPHER_H
+#define KEEPASSX_TESTSYMMETRICCIPHER_H
+
+#include <QtCore/QObject>
+
+class TestSymmetricCipher : public QObject
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+ void initTestCase();
+ void testAes256CbcEncryption();
+ void testAes256CbcDecryption();
+ void testSalsa20();
+};
+
+#endif // KEEPASSX_TESTSYMMETRICCIPHER_H