diff options
author | Liang Qi <liang.qi@qt.io> | 2016-08-02 10:14:17 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-08-02 10:14:17 +0200 |
commit | 6ebef79d390c79cd5ed792b96faa46d60737d366 (patch) | |
tree | 1e81f6069c17474a11bf20eb407e196e1e53f0f4 /tests | |
parent | 109054eb34e15341d5e59d7e9931e1e5fd3604d3 (diff) | |
parent | f24f85c718543cc51663ac2fe55eb3a3b50628ec (diff) |
Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
.qmake.conf
src/render/geometry/qattribute.cpp
Change-Id: I17d35c69f1835928930240b4fe45e565fd0dfa0f
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/core/handle/tst_handle.cpp | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/tests/auto/core/handle/tst_handle.cpp b/tests/auto/core/handle/tst_handle.cpp index 2717cb635..07155844f 100644 --- a/tests/auto/core/handle/tst_handle.cpp +++ b/tests/auto/core/handle/tst_handle.cpp @@ -27,12 +27,14 @@ ****************************************************************************/ #include <QtTest/QtTest> - -// Not really clean but as the QHandle(idx, counter) is private -// This allows to use this constructor in the tests -#define private public #include <Qt3DCore/private/qhandle_p.h> +#if Q_BYTE_ORDER == Q_BIG_ENDIAN +#define GET_EXPECTED_HANDLE(qHandle) ((qHandle.index() << (qHandle.CounterBits + 2)) + (qHandle.counter() << 2)) +#else /* Q_LITTLE_ENDIAN */ +#define GET_EXPECTED_HANDLE(qHandle) (qHandle.index() + (qHandle.counter() << qHandle.IndexBits)) +#endif + class tst_Handle : public QObject { Q_OBJECT @@ -80,14 +82,14 @@ void tst_Handle::construction() QVERIFY(h.index() == 0); QVERIFY(h.counter() == 1); qDebug() << h; - QVERIFY(h.handle() == 65536); + QVERIFY(h.handle() == GET_EXPECTED_HANDLE(h)); Handle h2(1, 1); QVERIFY(h2.isNull() == false); QVERIFY(h2.index() == 1); QVERIFY(h2.counter() == 1); qDebug() << h2; - QVERIFY(h2.handle() == 65537); + QVERIFY(h2.handle() == GET_EXPECTED_HANDLE(h2)); } void tst_Handle::copyConstruction() @@ -97,7 +99,7 @@ void tst_Handle::copyConstruction() QVERIFY(h2.isNull() == false); QVERIFY(h2.index() == 0); QVERIFY(h2.counter() == 1); - QVERIFY(h2.handle() == 65536); + QVERIFY(h2.handle() == GET_EXPECTED_HANDLE(h2)); } void tst_Handle::assignment() @@ -107,7 +109,7 @@ void tst_Handle::assignment() QVERIFY(h2.isNull() == false); QVERIFY(h2.index() == 0); QVERIFY(h2.counter() == 1); - QVERIFY(h2.handle() == 65536); + QVERIFY(h2.handle() == GET_EXPECTED_HANDLE(h2)); } void tst_Handle::equality() @@ -117,7 +119,7 @@ void tst_Handle::equality() QVERIFY(h1.isNull() == false); QVERIFY(h1.index() == 2); QVERIFY(h1.counter() == 1); - QVERIFY(h1.handle() == 65538); + QVERIFY(h1.handle() == GET_EXPECTED_HANDLE(h1)); QVERIFY(h1 == h2); } @@ -128,7 +130,7 @@ void tst_Handle::inequality() QVERIFY(h1.isNull() == false); QVERIFY(h1.index() == 2); QVERIFY(h1.counter() == 1); - QVERIFY(h1.handle() == 65538); + QVERIFY(h1.handle() == GET_EXPECTED_HANDLE(h1)); QVERIFY(h1 != h2); Handle h3(2, 2); @@ -153,13 +155,13 @@ void tst_Handle::bigHandle() QVERIFY(h1.isNull() == false); QVERIFY(h1.index() == 0); QVERIFY(h1.counter() == 1); - QVERIFY(h1.handle() == 4194304); + QVERIFY(h1.handle() == GET_EXPECTED_HANDLE(h1)); BigHandle h2(1, 1); QVERIFY(h2.isNull() == false); QVERIFY(h2.index() == 1); QVERIFY(h2.counter() == 1); - QVERIFY(h2.handle() == 4194305); + QVERIFY(h2.handle() == GET_EXPECTED_HANDLE(h2)); QVERIFY(BigHandle::maxIndex() == (1 << 22) - 1); QVERIFY(BigHandle::maxCounter() == (1 << (32 - 22 - 2)) - 1); |