mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
No longer use automoc.
This commit is contained in:
parent
a428464573
commit
230d24a123
@ -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)
|
||||
|
@ -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} )
|
||||
|
@ -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"
|
||||
|
41
src/keys/CompositeKey_p.h
Normal file
41
src/keys/CompositeKey_p.h
Normal file
@ -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
|
@ -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" )
|
||||
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(_nogui)
|
||||
list(GET ${_srcList} 0 first_PARAM)
|
||||
if( ${first_PARAM} STREQUAL "NOGUI" )
|
||||
set(_nogui "NOGUI")
|
||||
endif( ${first_PARAM} STREQUAL "NOGUI" )
|
||||
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)
|
||||
|
||||
automoc4_add_executable( ${_test_NAME} ${_srcList} )
|
||||
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})
|
||||
|
@ -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"
|
||||
|
32
tests/TestCryptoHash.h
Normal file
32
tests/TestCryptoHash.h
Normal file
@ -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
|
@ -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"
|
||||
|
32
tests/TestEntryModel.h
Normal file
32
tests/TestEntryModel.h
Normal file
@ -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
|
@ -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"
|
||||
|
34
tests/TestGroup.h
Normal file
34
tests/TestGroup.h
Normal file
@ -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
|
@ -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"
|
||||
|
32
tests/TestGroupModel.h
Normal file
32
tests/TestGroupModel.h
Normal file
@ -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
|
@ -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"
|
||||
|
31
tests/TestHashedBlockStream.h
Normal file
31
tests/TestHashedBlockStream.h
Normal file
@ -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
|
@ -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"
|
||||
|
33
tests/TestKeePass2Reader.h
Normal file
33
tests/TestKeePass2Reader.h
Normal file
@ -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
|
@ -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"
|
||||
|
49
tests/TestKeePass2XmlReader.h
Normal file
49
tests/TestKeePass2XmlReader.h
Normal file
@ -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
|
@ -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"
|
||||
|
34
tests/TestSymmetricCipher.h
Normal file
34
tests/TestSymmetricCipher.h
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user