From 5f734dde7e78e49e38558d857fe8e36761147e7a Mon Sep 17 00:00:00 2001 From: Jonathan White Date: Sun, 27 Oct 2019 21:37:42 -0400 Subject: [PATCH] Fix building without features * Fix #3684 - CLI Yubikey is skipped when Yubikey feature is not enabled * Skip building testguibrowser if browser integration is disabled --- tests/TestCli.cpp | 4 ++++ tests/gui/CMakeLists.txt | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/TestCli.cpp b/tests/TestCli.cpp index 586c39be1c..e18f801040 100644 --- a/tests/TestCli.cpp +++ b/tests/TestCli.cpp @@ -1791,6 +1791,7 @@ void TestCli::testInvalidDbFiles() */ void TestCli::testYubiKeyOption() { +#ifdef WITH_XC_YUBIKEY if (!YubiKey::instance()->init()) { QSKIP("Unable to connect to YubiKey"); } @@ -1854,6 +1855,9 @@ void TestCli::testYubiKeyOption() m_stderrFile->seek(posErr); QCOMPARE(m_stdoutFile->readAll(), QByteArray("")); QCOMPARE(m_stderrFile->readAll().split(':').at(0), QByteArray("Invalid YubiKey slot 3\n")); +#else + QSKIP("Yubikey feature is disabled."); +#endif } namespace diff --git a/tests/gui/CMakeLists.txt b/tests/gui/CMakeLists.txt index 168272baca..6a8d21c4a4 100644 --- a/tests/gui/CMakeLists.txt +++ b/tests/gui/CMakeLists.txt @@ -16,5 +16,8 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..) add_unit_test(NAME testgui SOURCES TestGui.cpp ../util/TemporaryFile.cpp LIBS ${TEST_LIBRARIES}) -add_unit_test(NAME testguibrowser SOURCES TestGuiBrowser.cpp ../util/TemporaryFile.cpp LIBS ${TEST_LIBRARIES}) add_unit_test(NAME testguipixmaps SOURCES TestGuiPixmaps.cpp LIBS ${TEST_LIBRARIES}) + +if(WITH_XC_BROWSER) + add_unit_test(NAME testguibrowser SOURCES TestGuiBrowser.cpp ../util/TemporaryFile.cpp LIBS ${TEST_LIBRARIES}) +endif()