OSDN Git Service

unexport private test component classes, export public classes
authorIvailo Monev <xakepa10@gmail.com>
Tue, 8 Aug 2023 08:10:40 +0000 (11:10 +0300)
committerIvailo Monev <xakepa10@gmail.com>
Tue, 8 Aug 2023 08:10:40 +0000 (11:10 +0300)
some of the test component classes really should not be public, notably
those related to logging

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
src/test/qbenchmark_p.h
src/test/qtestbasicstreamer.h
src/test/qtestcoreelement.h
src/test/qtestcorelist.h
src/test/qtestelement.h
src/test/qtestelementattribute.h
src/test/qtestfilelogger.h
src/test/qtestlogger_p.h
src/test/qtestresult_p.h
src/test/qtesttable_p.h
src/test/qtestxmlstreamer.h

index d6be7f3..361449e 100644 (file)
@@ -90,7 +90,7 @@ public:
     QBenchmarkGlobalData:current is created at the beginning of qExec()
     and cleared at the end.
 */
-class Q_TEST_EXPORT QBenchmarkGlobalData
+class QBenchmarkGlobalData
 {
 public:
     static QBenchmarkGlobalData *current;
@@ -114,7 +114,7 @@ public:
     created at the beginning of qInvokeTestMethod() and cleared at
     the end.
 */
-class Q_TEST_EXPORT QBenchmarkTestMethodData
+class QBenchmarkTestMethodData
 {
 public:
     static QBenchmarkTestMethodData *current;
index 8e30648..9401250 100644 (file)
@@ -32,7 +32,7 @@ class QTestElementAttribute;
 class QTestLogger;
 struct QTestCharBuffer;
 
-class QTestBasicStreamer
+class Q_TEST_EXPORT QTestBasicStreamer
 {
     public:
         QTestBasicStreamer();
index a82c706..28ca34b 100644 (file)
 QT_BEGIN_NAMESPACE
 
 template <class ElementType>
-class QTestCoreElement: public QTestCoreList<ElementType>
+class Q_TEST_EXPORT QTestCoreElement: public QTestCoreList<ElementType>
 {
-    public:
-        QTestCoreElement( int type = -1 );
-        virtual ~QTestCoreElement();
-
-        void addAttribute(const QTest::AttributeIndex index, const char *value);
-        QTestElementAttribute *attributes() const;
-        const char *attributeValue(QTest::AttributeIndex index) const;
-        const char *attributeName(QTest::AttributeIndex index) const;
-        const QTestElementAttribute *attribute(QTest::AttributeIndex index) const;
-
-        const char *elementName() const;
-        QTest::LogElementType elementType() const;
-
-    private:
-        QTestElementAttribute *listOfAttributes;
-        QTest::LogElementType type;
+public:
+    QTestCoreElement( int type = -1 );
+    virtual ~QTestCoreElement();
+
+    void addAttribute(const QTest::AttributeIndex index, const char *value);
+    QTestElementAttribute *attributes() const;
+    const char *attributeValue(QTest::AttributeIndex index) const;
+    const char *attributeName(QTest::AttributeIndex index) const;
+    const QTestElementAttribute *attribute(QTest::AttributeIndex index) const;
+
+    const char *elementName() const;
+    QTest::LogElementType elementType() const;
+
+private:
+    QTestElementAttribute *listOfAttributes;
+    QTest::LogElementType type;
 };
 
 template<class ElementType>
 QTestCoreElement<ElementType>::QTestCoreElement(int t)
-    :listOfAttributes(0), type(QTest::LogElementType(t))
+    : listOfAttributes(0), type(QTest::LogElementType(t))
 {
 }
 
index 5b94634..bf8f027 100644 (file)
 QT_BEGIN_NAMESPACE
 
 template <class T>
-class QTestCoreList
+class Q_TEST_EXPORT QTestCoreList
 {
-    public:
-        QTestCoreList();
-        virtual ~QTestCoreList();
-
-        void addToList(T **list);
-        T *nextElement();
-        T *previousElement();
-        int count(T *list);
-        int count();
-
-    private:
-        T *next;
-        T *prev;
+public:
+    QTestCoreList();
+    virtual ~QTestCoreList();
+
+    void addToList(T **list);
+    T *nextElement();
+    T *previousElement();
+    int count(T *list);
+    int count();
+
+private:
+    T *next;
+    T *prev;
 };
 
 template <class T>
 QTestCoreList<T>::QTestCoreList()
-:next(0)
-,prev(0)
+    : next(0),
+    prev(0)
 {
 }
 
index a71716c..19c8aa6 100644 (file)
 
 QT_BEGIN_NAMESPACE
 
-class QTestElement: public QTestCoreElement<QTestElement>
+class Q_TEST_EXPORT QTestElement: public QTestCoreElement<QTestElement>
 {
-    public:
-        QTestElement(int type = -1);
-        ~QTestElement();
+public:
+    QTestElement(int type = -1);
+    ~QTestElement();
 
-        bool addLogElement(QTestElement *element);
-        QTestElement *childElements() const;
+    bool addLogElement(QTestElement *element);
+    QTestElement *childElements() const;
 
-        const QTestElement *parentElement() const;
-        void setParent(const QTestElement *p);
-
-    private:
-        QTestElement *listOfChildren;
-        const QTestElement * parent;
+    const QTestElement *parentElement() const;
+    void setParent(const QTestElement *p);
 
+private:
+    QTestElement *listOfChildren;
+    const QTestElement * parent;
 };
 
 QT_END_NAMESPACE
index 1a2a371..c35170f 100644 (file)
@@ -64,24 +64,23 @@ namespace QTest {
     };
 }
 
-class QTestElementAttribute: public QTestCoreList<QTestElementAttribute>
+class Q_TEST_EXPORT QTestElementAttribute: public QTestCoreList<QTestElementAttribute>
 {
-    public:
-        QTestElementAttribute();
-        ~QTestElementAttribute();
+public:
+    QTestElementAttribute();
+    ~QTestElementAttribute();
 
-        const char *value() const;
-        const char *name() const;
-        QTest::AttributeIndex index() const;
-        bool isNull() const;
-        bool setPair(QTest::AttributeIndex attributeIndex, const char *value);
+    const char *value() const;
+    const char *name() const;
+    QTest::AttributeIndex index() const;
+    bool isNull() const;
+    bool setPair(QTest::AttributeIndex attributeIndex, const char *value);
 
-    private:
-        char *attributeValue;
-        QTest::AttributeIndex attributeIndex;
+private:
+    char *attributeValue;
+    QTest::AttributeIndex attributeIndex;
 };
 
 QT_END_NAMESPACE
 
-
 #endif
index cfb38b0..ece0449 100644 (file)
@@ -27,7 +27,7 @@
 
 QT_BEGIN_NAMESPACE
 
-class QTestFileLogger
+class Q_TEST_EXPORT QTestFileLogger
 {
     public:
         QTestFileLogger();
index 39736d2..857fe88 100644 (file)
@@ -43,49 +43,49 @@ class QTestFileLogger;
 
 class QTestLogger : public QAbstractTestLogger
 {
-    public:
-        enum TestLoggerFormat
-        {
-            TLF_XML = 0
-        };
+public:
+    enum TestLoggerFormat
+    {
+        TLF_XML = 0
+    };
 
 
-        QTestLogger(TestLoggerFormat fm = TestLoggerFormat::TLF_XML);
-        ~QTestLogger();
+    QTestLogger(TestLoggerFormat fm = TestLoggerFormat::TLF_XML);
+    ~QTestLogger();
 
-        void startLogging();
-        void stopLogging();
+    void startLogging();
+    void stopLogging();
 
-        void enterTestFunction(const char *function);
-        void leaveTestFunction();
+    void enterTestFunction(const char *function);
+    void leaveTestFunction();
 
-        void addIncident(IncidentTypes type, const char *description,
+    void addIncident(IncidentTypes type, const char *description,
                      const char *file = 0, int line = 0);
-        void addBenchmarkResult(const QBenchmarkResult &result);
-        void addTag(QTestElement* element);
+    void addBenchmarkResult(const QBenchmarkResult &result);
+    void addTag(QTestElement* element);
 
-        void addMessage(MessageTypes type, const char *message,
+    void addMessage(MessageTypes type, const char *message,
                     const char *file = 0, int line = 0);
 
-        void registerRandomSeed(unsigned int seed);
-        unsigned int randomSeed() const;
-        bool hasRandomSeed() const;
-
-    private:
-        QTestElement *listOfTestcases;
-        QTestElement *currentLogElement;
-        QTestElement *errorLogElement;
-        QTestBasicStreamer *logFormatter;
-        TestLoggerFormat format;
-        QTestFileLogger *filelogger;
-
-        int testCounter;
-        int passCounter;
-        int failureCounter;
-        int errorCounter;
-        int skipCounter;
-        unsigned int randomSeed_;
-        bool hasRandomSeed_;
+    void registerRandomSeed(unsigned int seed);
+    unsigned int randomSeed() const;
+    bool hasRandomSeed() const;
+
+private:
+    QTestElement *listOfTestcases;
+    QTestElement *currentLogElement;
+    QTestElement *errorLogElement;
+    QTestBasicStreamer *logFormatter;
+    TestLoggerFormat format;
+    QTestFileLogger *filelogger;
+
+    int testCounter;
+    int passCounter;
+    int failureCounter;
+    int errorCounter;
+    int skipCounter;
+    unsigned int randomSeed_;
+    bool hasRandomSeed_;
 };
 
 QT_END_NAMESPACE
index 1b30474..848af8f 100644 (file)
@@ -40,7 +40,7 @@ QT_BEGIN_NAMESPACE
 class QTestResultPrivate;
 class QTestData;
 
-class Q_TEST_EXPORT QTestResult
+class QTestResult
 {
 public:
     enum TestLocation { NoWhere = 0, DataFunc = 1, InitFunc = 2, Func = 3, CleanupFunc = 4 };
index ad64848..186d285 100644 (file)
@@ -40,7 +40,7 @@ QT_BEGIN_NAMESPACE
 class QTestData;
 class QTestTablePrivate;
 
-class Q_TEST_EXPORT QTestTable
+class QTestTable
 {
 public:
     QTestTable();
@@ -64,7 +64,6 @@ public:
 
 private:
     Q_DISABLE_COPY(QTestTable)
-
     QTestTablePrivate *d;
 };
 
index e10609f..40553b4 100644 (file)
@@ -31,16 +31,16 @@ QT_BEGIN_NAMESPACE
 class QTestElement;
 class QTestElementAttribute;
 
-class QTestXmlStreamer: public QTestBasicStreamer
+class Q_TEST_EXPORT QTestXmlStreamer: public QTestBasicStreamer
 {
-    public:
-        QTestXmlStreamer();
-        ~QTestXmlStreamer();
-
-        void formatStart(const QTestElement *element, QTestCharBuffer *formatted) const;
-        void formatEnd(const QTestElement *element, QTestCharBuffer *formatted) const;
-        void formatBeforeAttributes(const QTestElement *element, QTestCharBuffer *formatted) const;
-        void output(QTestElement *element) const;
+public:
+    QTestXmlStreamer();
+    ~QTestXmlStreamer();
+
+    void formatStart(const QTestElement *element, QTestCharBuffer *formatted) const;
+    void formatEnd(const QTestElement *element, QTestCharBuffer *formatted) const;
+    void formatBeforeAttributes(const QTestElement *element, QTestCharBuffer *formatted) const;
+    void output(QTestElement *element) const;
 };
 
 QT_END_NAMESPACE