Refactor: separate GUI sources from core sources

This PR splits the GUI source files from the core source files. The immediate goal is to allow the CLI to require only a minimum number of dynamic libraries. The long term goal is to create an architectural boundary around the core module, in preparation of libkdbx.
This commit is contained in:
louib 2022-09-17 21:45:43 -04:00 committed by Jonathan White
parent 854459068f
commit 166a371050
36 changed files with 173 additions and 163 deletions

View file

@ -90,7 +90,7 @@ macro(add_unit_test)
endif()
endmacro(add_unit_test)
set(TEST_LIBRARIES keepassx_core Qt5::Test)
set(TEST_LIBRARIES keepassxc_gui Qt5::Test)
set(testsupport_SOURCES
modeltest.cpp
@ -143,7 +143,7 @@ add_unit_test(NAME testkeepass1reader SOURCES TestKeePass1Reader.cpp
LIBS ${TEST_LIBRARIES})
add_unit_test(NAME testimports SOURCES TestImports.cpp
LIBS ${TEST_LIBRARIES})
LIBS ${TEST_LIBRARIES})
if(WITH_XC_NETWORKING)
add_unit_test(NAME testupdatecheck SOURCES TestUpdateCheck.cpp
@ -163,7 +163,7 @@ if(WITH_XC_SSHAGENT)
LIBS sshagent ${TEST_LIBRARIES})
if(NOT WIN32)
add_unit_test(NAME testsshagent SOURCES TestSSHAgent.cpp
LIBS ${TEST_LIBRARIES})
LIBS sshagent ${TEST_LIBRARIES})
endif()
endif()
@ -195,7 +195,7 @@ add_unit_test(NAME testcsvparser SOURCES TestCsvParser.cpp
LIBS ${TEST_LIBRARIES})
add_unit_test(NAME testrandomgenerator SOURCES TestRandomGenerator.cpp
LIBS testsupport ${TEST_LIBRARIES})
LIBS testsupport ${TEST_LIBRARIES})
add_unit_test(NAME testentrysearcher SOURCES TestEntrySearcher.cpp
LIBS ${TEST_LIBRARIES})
@ -225,22 +225,16 @@ add_unit_test(NAME testconfig SOURCES TestConfig.cpp
if(WITH_XC_FDOSECRETS)
add_unit_test(NAME testfdosecrets SOURCES TestFdoSecrets.cpp
LIBS testsupport ${TEST_LIBRARIES})
LIBS testsupport fdosecrets ${TEST_LIBRARIES})
endif()
if(WITH_XC_BROWSER)
add_unit_test(NAME testbrowser SOURCES TestBrowser.cpp
LIBS ${TEST_LIBRARIES})
LIBS browser ${TEST_LIBRARIES})
if(WITH_XC_BROWSER_PASSKEYS)
# Prevent duplicate linking with macOS
if(APPLE)
add_unit_test(NAME testpasskeys SOURCES TestPasskeys.cpp
LIBS ${TEST_LIBRARIES})
else()
add_unit_test(NAME testpasskeys SOURCES TestPasskeys.cpp
LIBS keepassxcbrowser ${TEST_LIBRARIES})
endif()
add_unit_test(NAME testpasskeys SOURCES TestPasskeys.cpp
LIBS browser ${TEST_LIBRARIES})
endif()
endif()

View file

@ -24,10 +24,6 @@
#include "format/KeePass2.h"
#include "format/KeePass2Reader.h"
#include "format/KeePass2Writer.h"
#ifdef WITH_XC_KEESHARE
#include "keeshare/KeeShare.h"
#include "keeshare/KeeShareSettings.h"
#endif
#include "keys/FileKey.h"
#include "keys/PasswordKey.h"
#include "mock/MockChallengeResponseKey.h"
@ -441,13 +437,8 @@ void TestKdbx4Format::testAttachmentIndexStability()
group2->setUuid(QUuid::createUuid());
QVERIFY(!group2->uuid().isNull());
group2->setParent(group1);
#ifdef WITH_XC_KEESHARE
KeeShareSettings::Reference ref;
ref.type = KeeShareSettings::SynchronizeWith;
ref.path = "123";
KeeShare::setReferenceTo(group2, ref);
QVERIFY(KeeShare::isShared(group2));
#endif
group2->customData()->set("KeeShare/Reference", "value doesn't matter");
QVERIFY(group2->isShared());
auto attachment1 = QByteArray("qwerty");
auto attachment2 = QByteArray("asdf");
@ -510,9 +501,9 @@ void TestKdbx4Format::testAttachmentIndexStability()
QCOMPARE(a2->value("a"), attachment1);
QCOMPARE(a2->value("b"), attachment2);
#ifdef WITH_XC_KEESHARE
QVERIFY(KeeShare::isShared(db2->rootGroup()->findEntryByUuid(uuid3)->group()));
#endif
auto sharedGroup = db2->rootGroup()->findEntryByUuid(uuid3)->group();
QVERIFY(sharedGroup->isShared());
auto a3 = db2->rootGroup()->findEntryByUuid(uuid3)->attachments();
QCOMPARE(a3->keys().size(), 4);
QCOMPARE(a3->values().size(), 3);

View file

@ -17,7 +17,7 @@
#include "TestUpdateCheck.h"
#include "crypto/Crypto.h"
#include "updatecheck/UpdateChecker.h"
#include "networking/UpdateChecker.h"
#include <QTest>

View file

@ -18,7 +18,7 @@
#ifndef KEEPASSXC_TESTURLTOOLS_H
#define KEEPASSXC_TESTURLTOOLS_H
#include "core/UrlTools.h"
#include "gui/UrlTools.h"
#include <QObject>
#include <QPointer>