diff options
author | saturneric <[email protected]> | 2024-07-30 18:42:12 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2024-07-30 18:42:12 +0000 |
commit | dbb4a21931cd10a3caed3c446af0fe06de9873b1 (patch) | |
tree | b3eb2e6fc3e67ea274472dfacfa3451848b43c80 /src/test | |
parent | fix: solve known issues on build (diff) | |
download | GpgFrontend-dbb4a21931cd10a3caed3c446af0fe06de9873b1.tar.gz GpgFrontend-dbb4a21931cd10a3caed3c446af0fe06de9873b1.zip |
feat: simplify logging
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/test/GpgFrontendCoreExport.h | 42 | ||||
-rw-r--r-- | src/test/GpgFrontendTest.cpp | 4 | ||||
-rw-r--r-- | src/test/GpgFrontendTest.h | 20 | ||||
-rw-r--r-- | src/test/GpgFrontendTestExport.h | 42 |
5 files changed, 21 insertions, 89 deletions
diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt index 53c99f11..c9690c2a 100644 --- a/src/test/CMakeLists.txt +++ b/src/test/CMakeLists.txt @@ -36,7 +36,7 @@ set(_export_file "${CMAKE_CURRENT_SOURCE_DIR}/GpgFrontendTestExport.h") generate_export_header(gpgfrontend_test EXPORT_FILE_NAME "${_export_file}") # compile definitions -target_compile_definitions(gpgfrontend_test PUBLIC GF_TEST) +target_compile_definitions(gpgfrontend_test PRIVATE GF_TEST_PRIVATE) # link options target_link_libraries(gpgfrontend_test PRIVATE GTest::gtest) diff --git a/src/test/GpgFrontendCoreExport.h b/src/test/GpgFrontendCoreExport.h deleted file mode 100644 index 4d1b2f0b..00000000 --- a/src/test/GpgFrontendCoreExport.h +++ /dev/null @@ -1,42 +0,0 @@ - -#ifndef GPGFRONTEND_TEST_EXPORT_H -#define GPGFRONTEND_TEST_EXPORT_H - -#ifdef GPGFRONTEND_TEST_STATIC_DEFINE -# define GPGFRONTEND_TEST_EXPORT -# define GPGFRONTEND_TEST_NO_EXPORT -#else -# ifndef GPGFRONTEND_TEST_EXPORT -# ifdef gpgfrontend_test_EXPORTS - /* We are building this library */ -# define GPGFRONTEND_TEST_EXPORT __attribute__((visibility("default"))) -# else - /* We are using this library */ -# define GPGFRONTEND_TEST_EXPORT __attribute__((visibility("default"))) -# endif -# endif - -# ifndef GPGFRONTEND_TEST_NO_EXPORT -# define GPGFRONTEND_TEST_NO_EXPORT __attribute__((visibility("hidden"))) -# endif -#endif - -#ifndef GPGFRONTEND_TEST_DEPRECATED -# define GPGFRONTEND_TEST_DEPRECATED __attribute__ ((__deprecated__)) -#endif - -#ifndef GPGFRONTEND_TEST_DEPRECATED_EXPORT -# define GPGFRONTEND_TEST_DEPRECATED_EXPORT GPGFRONTEND_TEST_EXPORT GPGFRONTEND_TEST_DEPRECATED -#endif - -#ifndef GPGFRONTEND_TEST_DEPRECATED_NO_EXPORT -# define GPGFRONTEND_TEST_DEPRECATED_NO_EXPORT GPGFRONTEND_TEST_NO_EXPORT GPGFRONTEND_TEST_DEPRECATED -#endif - -#if 0 /* DEFINE_NO_DEPRECATED */ -# ifndef GPGFRONTEND_TEST_NO_DEPRECATED -# define GPGFRONTEND_TEST_NO_DEPRECATED -# endif -#endif - -#endif /* GPGFRONTEND_TEST_EXPORT_H */ diff --git a/src/test/GpgFrontendTest.cpp b/src/test/GpgFrontendTest.cpp index 6149ba04..ce026b19 100644 --- a/src/test/GpgFrontendTest.cpp +++ b/src/test/GpgFrontendTest.cpp @@ -96,8 +96,8 @@ void SetupGlobalTestEnv() { auto test_config_path = test_path + "/conf/test.ini"; auto test_data_path = test_path + "/data"; - qCInfo(test) << "test config file path: " << test_config_path; - qCInfo(test) << "test data file path: " << test_data_path; + LOG_I() << "test config file path: " << test_config_path; + LOG_I() << "test data file path: " << test_data_path; ImportPrivateKeys(test_data_path, QSettings(test_config_path, QSettings::IniFormat)); diff --git a/src/test/GpgFrontendTest.h b/src/test/GpgFrontendTest.h index ee9dc01d..d78f6636 100644 --- a/src/test/GpgFrontendTest.h +++ b/src/test/GpgFrontendTest.h @@ -28,14 +28,30 @@ #pragma once +// project base header +#include "GpgFrontend.h" + +// symbol exports header #include "GpgFrontendTestExport.h" -// declare area of test -#ifdef GF_TEST +// private declare area of test +#ifdef GF_TEST_PRIVATE // declare logging category Q_DECLARE_LOGGING_CATEGORY(test) +#define LOG_D() qCDebug(test) +#define LOG_I() qCInfo(test) +#define LOG_W() qCWarning(test) +#define LOG_E() qCCritical(test) +#define LOG_F() qCFatal(test) + +#define FLOG_D(...) qCDebug(test, __VA_ARGS__) +#define FLOG_I(...) qCInfo(test, __VA_ARGS__) +#define FLOG_W(...) qCWarning(test, __VA_ARGS__) +#define FLOG_E(...) qCCritical(test, __VA_ARGS__) +#define FLOG_F(...) qCFatal(test, __VA_ARGS__) + #endif namespace GpgFrontend::Test { diff --git a/src/test/GpgFrontendTestExport.h b/src/test/GpgFrontendTestExport.h deleted file mode 100644 index 4d1b2f0b..00000000 --- a/src/test/GpgFrontendTestExport.h +++ /dev/null @@ -1,42 +0,0 @@ - -#ifndef GPGFRONTEND_TEST_EXPORT_H -#define GPGFRONTEND_TEST_EXPORT_H - -#ifdef GPGFRONTEND_TEST_STATIC_DEFINE -# define GPGFRONTEND_TEST_EXPORT -# define GPGFRONTEND_TEST_NO_EXPORT -#else -# ifndef GPGFRONTEND_TEST_EXPORT -# ifdef gpgfrontend_test_EXPORTS - /* We are building this library */ -# define GPGFRONTEND_TEST_EXPORT __attribute__((visibility("default"))) -# else - /* We are using this library */ -# define GPGFRONTEND_TEST_EXPORT __attribute__((visibility("default"))) -# endif -# endif - -# ifndef GPGFRONTEND_TEST_NO_EXPORT -# define GPGFRONTEND_TEST_NO_EXPORT __attribute__((visibility("hidden"))) -# endif -#endif - -#ifndef GPGFRONTEND_TEST_DEPRECATED -# define GPGFRONTEND_TEST_DEPRECATED __attribute__ ((__deprecated__)) -#endif - -#ifndef GPGFRONTEND_TEST_DEPRECATED_EXPORT -# define GPGFRONTEND_TEST_DEPRECATED_EXPORT GPGFRONTEND_TEST_EXPORT GPGFRONTEND_TEST_DEPRECATED -#endif - -#ifndef GPGFRONTEND_TEST_DEPRECATED_NO_EXPORT -# define GPGFRONTEND_TEST_DEPRECATED_NO_EXPORT GPGFRONTEND_TEST_NO_EXPORT GPGFRONTEND_TEST_DEPRECATED -#endif - -#if 0 /* DEFINE_NO_DEPRECATED */ -# ifndef GPGFRONTEND_TEST_NO_DEPRECATED -# define GPGFRONTEND_TEST_NO_DEPRECATED -# endif -#endif - -#endif /* GPGFRONTEND_TEST_EXPORT_H */ |