diff options
author | Jędrzej Nowacki <jedrzej.nowacki@nokia.com> | 2011-11-28 15:40:35 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-12-01 14:35:42 +0100 |
commit | e650859dc9c26b3d411c534286f477d786723a74 (patch) | |
tree | d06bb9f7b6623b45834ab1abb7281f84bf7745a8 /tests/auto | |
parent | 389538c2e76698944834526a2f36284cce109afe (diff) |
Improve Q_CONSTRUCTOR_FUNCTION and Q_DESTRUCTOR_FUNCTION macros.
By adding anonymous namespace and static linkage we are reducing
visibility of implementation of these macros.
This patch also fixes warning about a declared but unused variable which
was issued by gcc 4.6 for Q_CONSTRUCTOR_FUNCTION.
Change-Id: I2cb70ad4c93f6f77e5518420abcce6fd4cadccfa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/corelib/global/qglobal/tst_qglobal.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp index b3115e036e..23ec228c68 100644 --- a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp +++ b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp @@ -53,6 +53,7 @@ private slots: void qtry(); void checkptr(); void qstaticassert(); + void qConstructorFunction(); }; void tst_QGlobal::qIsNull() @@ -353,5 +354,17 @@ void tst_QGlobal::qstaticassert() QVERIFY(true); // if the test compiles it has passed. } +static int qConstructorFunctionValue; +static void qConstructorFunctionCtor() +{ + qConstructorFunctionValue = 123; +} +Q_CONSTRUCTOR_FUNCTION(qConstructorFunctionCtor); + +void tst_QGlobal::qConstructorFunction() +{ + QCOMPARE(qConstructorFunctionValue, 123); +} + QTEST_MAIN(tst_QGlobal) #include "tst_qglobal.moc" |