00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef LOG4QT_LOG4QTTEST_H
00026 #define LOG4QT_LOG4QTTEST_H
00027
00028
00029
00030
00031
00032
00033 #include <QtCore/QDir>
00034 #include <QtCore/QObject>
00035
00036 #include "log4qt/helpers/properties.h"
00037 #include "log4qt/logger.h"
00038 #include "log4qt/varia/listappender.h"
00039
00040
00041
00042
00043
00044
00050 class Log4QtTest : public QObject
00051 {
00052 Q_OBJECT
00053
00054 public:
00055 Log4QtTest();
00056 virtual ~Log4QtTest();
00057 private:
00058 Log4QtTest(const Log4QtTest &rOther);
00059 Log4QtTest &operator=(const Log4QtTest &rOther);
00060
00061 private slots:
00062 void initTestCase();
00063 void cleanupTestCase();
00064
00065
00066 void DateTime_compability_data();
00067 void DateTime_compability();
00068 void DateTime_week_data();
00069 void DateTime_week();
00070 void DateTime_milliseconds_data();
00071 void DateTime_milliseconds();
00072 void PatternFormatter_data();
00073 void PatternFormatter();
00074 void Properties_default_data();
00075 void Properties_default();
00076 void Properties_names();
00077 void Properties_load_device_data();
00078 void Properties_load_device();
00079 void Properties_load_settings();
00080
00081
00082 void OptionConverter_boolean_data();
00083 void OptionConverter_boolean();
00084 void OptionConverter_filesize_data();
00085 void OptionConverter_filesize();
00086 void OptionConverter_int_data();
00087 void OptionConverter_int();
00088 void OptionConverter_level_data();
00089 void OptionConverter_level();
00090 void OptionConverter_substitution_data();
00091 void OptionConverter_substitution();
00092 void OptionConverter_target_data();
00093 void OptionConverter_target();
00094
00095
00096 void Factory_createAppender_data();
00097 void Factory_createAppender();
00098 void Factory_createFilter_data();
00099 void Factory_createFilter();
00100 void Factory_createLayout_data();
00101 void Factory_createLayout();
00102 void Factory_setObjectProperty_data();
00103 void Factory_setObjectProperty();
00104
00105
00106 void ListAppender();
00107 void DenyAllFilter();
00108 void LevelMatchFilter_data();
00109 void LevelMatchFilter();
00110 void LevelRangeFilter_data();
00111 void LevelRangeFilter();
00112 void StringMatchFilter_data();
00113 void StringMatchFilter();
00114
00115
00116 void AppenderSkeleton_threshold();
00117 void AppenderSkeleton_filter_data();
00118 void AppenderSkeleton_filter();
00119 void BasicConfigurator();
00120 void FileAppender();
00121 void DailyRollingFileAppender();
00122 void LoggingEvent_stream_data();
00123 void LoggingEvent_stream();
00124 void LogManager_configureLogLogger();
00125 void PropertyConfigurator_missing_appender();
00126 void PropertyConfigurator_unknown_appender_class();
00127 void PropertyConfigurator_missing_layout();
00128 void PropertyConfigurator_unknown_layout_class();
00129 void PropertyConfigurator_reset();
00130 void PropertyConfigurator_debug();
00131 void PropertyConfigurator_threshold();
00132 void PropertyConfigurator_handleQtMessages();
00133 void PropertyConfigurator_example();
00134 void RollingFileAppender();
00135
00136 private:
00137 QString dailyRollingFileAppenderSuffix(const QDateTime &rDateTime);
00138 QString enumValueToKey(QObject *pObject,
00139 const char* pEnumeration,
00140 int value);
00141 void resetLogging();
00142 static bool compareStringLists(const QStringList &rActual,
00143 const QStringList &rExpected,
00144 const QString &rEntry,
00145 const QString &rEntries,
00146 QString &rResult);
00147 static bool deleteDirectoryTree(const QString &rName);
00148 static bool validateDirContents(const QString &rName,
00149 const QStringList &rExpected,
00150 QString &rResult);
00151 static bool validateFileContents(const QString &rName,
00152 const QStringList &rExpected,
00153 QString &rResult);
00154
00155 private:
00156 bool mSkipLongTests;
00157 QDir mTemporaryDirectory;
00158 Log4Qt::ListAppender *mpLoggingEvents;
00159 Log4Qt::Properties mDefaultProperties;
00160 Log4Qt::Properties mProperties;
00161 };
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177 #endif // LOG4QT_LOG4QTTEST_H