summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-08-02 10:14:17 +0200
committerLiang Qi <liang.qi@qt.io>2016-08-02 10:14:17 +0200
commit6ebef79d390c79cd5ed792b96faa46d60737d366 (patch)
tree1e81f6069c17474a11bf20eb407e196e1e53f0f4
parent109054eb34e15341d5e59d7e9931e1e5fd3604d3 (diff)
parentf24f85c718543cc51663ac2fe55eb3a3b50628ec (diff)
Merge remote-tracking branch 'origin/5.7' into dev
Conflicts: .qmake.conf src/render/geometry/qattribute.cpp Change-Id: I17d35c69f1835928930240b4fe45e565fd0dfa0f
-rw-r--r--LICENSE.GPL2
-rw-r--r--LICENSE.GPLv32
-rw-r--r--LICENSE.LGPLv32
-rw-r--r--src/core/resources/qhandle_p.h3
-rw-r--r--src/quick3d/imports/extras/defaults/defaults.pri3
-rw-r--r--src/quick3d/imports/extras/defaults/qml/NormalDiffuseMapAlphaEffect.qml115
-rw-r--r--src/quick3d/imports/extras/defaults/qml/NormalDiffuseMapAlphaMaterial.qml9
-rw-r--r--src/quick3d/imports/extras/defaults/qml/NormalDiffuseMapMaterial.qml2
-rw-r--r--src/quick3d/imports/extras/defaults/qml/NormalDiffuseSpecularMapMaterial.qml2
-rw-r--r--src/quick3d/imports/extras/qt3dquick3dextrasplugin.cpp1
-rw-r--r--src/render/backend/rendersettings.cpp2
-rw-r--r--src/render/geometry/qattribute.cpp5
-rw-r--r--src/render/geometry/qgeometry.h4
-rw-r--r--src/render/graphicshelpers/graphicscontext.cpp45
-rw-r--r--src/render/graphicshelpers/graphicshelperes2.cpp24
-rw-r--r--src/render/graphicshelpers/graphicshelperes2_p.h1
-rw-r--r--src/render/io/objloader.cpp2
-rw-r--r--src/render/renderstates/statevariant_p.h2
-rw-r--r--src/render/texture/qtexture.cpp2
-rw-r--r--tests/auto/core/handle/tst_handle.cpp26
20 files changed, 199 insertions, 55 deletions
diff --git a/LICENSE.GPL b/LICENSE.GPL
index 6dbb032fd..a42447778 100644
--- a/LICENSE.GPL
+++ b/LICENSE.GPL
@@ -3,7 +3,7 @@
The Qt Toolkit is Copyright (C) 2015 The Qt Company Ltd.
Contact: http://www.qt.io/licensing/
- You may use, distribute and copy the Qt GUI Toolkit under the terms of
+ You may use, distribute and copy the Qt Toolkit under the terms of
GNU General Public License version 2, which is displayed below.
-------------------------------------------------------------------------
diff --git a/LICENSE.GPLv3 b/LICENSE.GPLv3
index 4e49b122a..71c4ad49c 100644
--- a/LICENSE.GPLv3
+++ b/LICENSE.GPLv3
@@ -3,7 +3,7 @@
The Qt Toolkit is Copyright (C) 2015 The Qt Company Ltd.
Contact: http://www.qt.io/licensing/
- You may use, distribute and copy the Qt GUI Toolkit under the terms of
+ You may use, distribute and copy the Qt Toolkit under the terms of
GNU Lesser General Public License version 3. That license references
the General Public License version 3, that is displayed below. Other
portions of the Qt Toolkit may be licensed directly under this license.
diff --git a/LICENSE.LGPLv3 b/LICENSE.LGPLv3
index 26d0bf16f..1f78e0508 100644
--- a/LICENSE.LGPLv3
+++ b/LICENSE.LGPLv3
@@ -3,7 +3,7 @@
The Qt Toolkit is Copyright (C) 2015 The Qt Company Ltd.
Contact: http://www.qt.io/licensing/
- You may use, distribute and copy the Qt GUI Toolkit under the terms of
+ You may use, distribute and copy the Qt Toolkit under the terms of
GNU Lesser General Public License version 3, which is displayed below.
This license makes reference to the version 3 of the GNU General
Public License, which you can find in the LICENSE.GPLv3 file.
diff --git a/src/core/resources/qhandle_p.h b/src/core/resources/qhandle_p.h
index fd36c4847..94dc7ca45 100644
--- a/src/core/resources/qhandle_p.h
+++ b/src/core/resources/qhandle_p.h
@@ -54,6 +54,8 @@
#include <Qt3DCore/qt3dcore_global.h>
#include <QtCore/QDebug>
+class tst_Handle; // needed for friend class declaration below
+
QT_BEGIN_NAMESPACE
namespace Qt3DCore {
@@ -103,6 +105,7 @@ private:
friend class QHandleManager<T, INDEXBITS>;
+ friend class ::tst_Handle;
struct Data {
quint32 m_index : IndexBits;
diff --git a/src/quick3d/imports/extras/defaults/defaults.pri b/src/quick3d/imports/extras/defaults/defaults.pri
index 46028557d..65271afeb 100644
--- a/src/quick3d/imports/extras/defaults/defaults.pri
+++ b/src/quick3d/imports/extras/defaults/defaults.pri
@@ -21,4 +21,5 @@ QML_FILES = \
$$PWD/qml/PhongAlphaMaterial.qml \
$$PWD/qml/TextureMaterial.qml \
$$PWD/qml/OrbitCameraController.qml \
- $$PWD/qml/FirstPersonCameraController.qml
+ $$PWD/qml/FirstPersonCameraController.qml \
+ $$PWD/qml/NormalDiffuseMapAlphaEffect.qml
diff --git a/src/quick3d/imports/extras/defaults/qml/NormalDiffuseMapAlphaEffect.qml b/src/quick3d/imports/extras/defaults/qml/NormalDiffuseMapAlphaEffect.qml
new file mode 100644
index 000000000..e4f038642
--- /dev/null
+++ b/src/quick3d/imports/extras/defaults/qml/NormalDiffuseMapAlphaEffect.qml
@@ -0,0 +1,115 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+
+Effect {
+ property string vertexES: "qrc:/shaders/es2/normaldiffusemap.vert"
+ property string fragmentES: "qrc:/shaders/es2/normaldiffusemapalpha.frag"
+ property string vertex: "qrc:/shaders/gl3/normaldiffusemap.vert"
+ property string fragment: "qrc:/shaders/gl3/normaldiffusemapalpha.frag"
+
+ FilterKey {
+ id: forward
+ name: "renderingStyle"
+ value: "forward"
+ }
+
+ ShaderProgram {
+ id: gl2Es2Shader
+ vertexShaderCode: loadSource(vertexES)
+ fragmentShaderCode: loadSource(fragmentES)
+ }
+
+ ShaderProgram {
+ id: gl3Shader
+ vertexShaderCode: loadSource(vertex)
+ fragmentShaderCode: loadSource(fragment)
+ }
+
+ AlphaCoverage { id: alphaCoverage }
+
+ techniques: [
+ // OpenGL 3.1
+ Technique {
+ filterKeys: [ forward ]
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGL
+ profile: GraphicsApiFilter.CoreProfile
+ majorVersion: 3
+ minorVersion: 1
+ }
+ renderPasses: RenderPass {
+ shaderProgram: gl3Shader
+ renderStates: [ alphaCoverage ]
+ }
+ },
+
+ // OpenGL 2.1
+ Technique {
+ filterKeys: [ forward ]
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGL
+ profile: GraphicsApiFilter.NoProfile
+ majorVersion: 2
+ minorVersion: 0
+ }
+ renderPasses: RenderPass {
+ shaderProgram: gl2Es2Shader
+ renderStates: [ alphaCoverage ]
+ }
+ },
+
+ // OpenGL ES 2
+ Technique {
+ filterKeys: [ forward ]
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGLES
+ profile: GraphicsApiFilter.NoProfile
+ majorVersion: 2
+ minorVersion: 0
+ }
+ renderPasses: RenderPass {
+ shaderProgram: gl2Es2Shader
+ renderStates: [ alphaCoverage ]
+ }
+ }
+ ]
+}
diff --git a/src/quick3d/imports/extras/defaults/qml/NormalDiffuseMapAlphaMaterial.qml b/src/quick3d/imports/extras/defaults/qml/NormalDiffuseMapAlphaMaterial.qml
index 4f73bc5ca..421cc3aa9 100644
--- a/src/quick3d/imports/extras/defaults/qml/NormalDiffuseMapAlphaMaterial.qml
+++ b/src/quick3d/imports/extras/defaults/qml/NormalDiffuseMapAlphaMaterial.qml
@@ -71,7 +71,7 @@ Material {
name: "normalTexture"
value: Texture2D {
id: normalTexture
- minificationFilter: Texture.Linear
+ minificationFilter: Texture.LinearMipMapLinear
magnificationFilter: Texture.Linear
wrapMode {
x: WrapMode.Repeat
@@ -87,11 +87,6 @@ Material {
Parameter { name: "texCoordScale"; value: textureScale }
]
- effect: DefaultAlphaEffect {
- vertexES: "qrc:/shaders/es2/normaldiffusemap.vert"
- fragmentES: "qrc:/shaders/es2/normaldiffusemapalpha.frag"
- vertex: "qrc:/shaders/gl3/normaldiffusemap.vert"
- fragment: "qrc:/shaders/gl3/normaldiffusemapalpha.frag"
- }
+ effect: NormalDiffuseMapAlphaEffect { }
}
diff --git a/src/quick3d/imports/extras/defaults/qml/NormalDiffuseMapMaterial.qml b/src/quick3d/imports/extras/defaults/qml/NormalDiffuseMapMaterial.qml
index 1f6ce4c5a..0724cf597 100644
--- a/src/quick3d/imports/extras/defaults/qml/NormalDiffuseMapMaterial.qml
+++ b/src/quick3d/imports/extras/defaults/qml/NormalDiffuseMapMaterial.qml
@@ -71,7 +71,7 @@ Material {
name: "normalTexture"
value: Texture2D {
id: normalTexture
- minificationFilter: Texture.Linear
+ minificationFilter: Texture.LinearMipMapLinear
magnificationFilter: Texture.Linear
wrapMode {
x: WrapMode.Repeat
diff --git a/src/quick3d/imports/extras/defaults/qml/NormalDiffuseSpecularMapMaterial.qml b/src/quick3d/imports/extras/defaults/qml/NormalDiffuseSpecularMapMaterial.qml
index d28643953..497209c32 100644
--- a/src/quick3d/imports/extras/defaults/qml/NormalDiffuseSpecularMapMaterial.qml
+++ b/src/quick3d/imports/extras/defaults/qml/NormalDiffuseSpecularMapMaterial.qml
@@ -85,7 +85,7 @@ Material {
name: "normalTexture"
value: Texture2D {
id: normalTexture
- minificationFilter: Texture.Linear
+ minificationFilter: Texture.LinearMipMapLinear
magnificationFilter: Texture.Linear
wrapMode {
x: WrapMode.Repeat
diff --git a/src/quick3d/imports/extras/qt3dquick3dextrasplugin.cpp b/src/quick3d/imports/extras/qt3dquick3dextrasplugin.cpp
index 7b5f138ae..2746c62b2 100644
--- a/src/quick3d/imports/extras/qt3dquick3dextrasplugin.cpp
+++ b/src/quick3d/imports/extras/qt3dquick3dextrasplugin.cpp
@@ -72,6 +72,7 @@ static const struct {
// Effects
{ "DefaultEffect", 2, 0 },
{ "DefaultAlphaEffect", 2, 0 },
+ { "NormalDiffuseMapAlphaEffect", 2, 0 },
// FrameGraphs
{ "ForwardRenderer", 2, 0 },
// Entities
diff --git a/src/render/backend/rendersettings.cpp b/src/render/backend/rendersettings.cpp
index 184aff37f..3df95c753 100644
--- a/src/render/backend/rendersettings.cpp
+++ b/src/render/backend/rendersettings.cpp
@@ -79,7 +79,7 @@ void RenderSettings::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
else if (propertyChange->propertyName() == QByteArrayLiteral("pickResult"))
m_pickResultMode = propertyChange->value().value<QPickingSettings::PickResultMode>();
else if (propertyChange->propertyName() == QByteArrayLiteral("activeFrameGraph"))
- m_activeFrameGraph = propertyChange->value().value<QNodePtr>()->id();
+ m_activeFrameGraph = propertyChange->value().value<QNodeId>();
else if (propertyChange->propertyName() == QByteArrayLiteral("renderPolicy"))
m_renderPolicy = propertyChange->value().value<QRenderSettings::RenderPolicy>();
markDirty(AbstractRenderer::AllDirty);
diff --git a/src/render/geometry/qattribute.cpp b/src/render/geometry/qattribute.cpp
index 7ace1ae3c..3067b0527 100644
--- a/src/render/geometry/qattribute.cpp
+++ b/src/render/geometry/qattribute.cpp
@@ -178,7 +178,8 @@ QString QAttribute::name() const
/*!
* \property QAttribute::vertexSize
*
- * Holds the data size.
+ * Holds the data size, it can only be 1 to 4 units (scalars and vectors),
+ * 9 units (3x3 matrices) or 16 units (4x4 matrices).
*/
uint QAttribute::vertexSize() const
{
@@ -304,7 +305,7 @@ void QAttribute::setVertexSize(uint size)
Q_D(QAttribute);
if (d->m_vertexSize == size)
return;
- Q_ASSERT(size >= 1 && size <= 4);
+ Q_ASSERT((size >= 1 && size <= 4) || (size == 9) || (size == 16));
d->m_vertexSize = size;
emit vertexSizeChanged(size);
emit dataSizeChanged(size);
diff --git a/src/render/geometry/qgeometry.h b/src/render/geometry/qgeometry.h
index 70fea8cd9..143d98d1e 100644
--- a/src/render/geometry/qgeometry.h
+++ b/src/render/geometry/qgeometry.h
@@ -59,8 +59,8 @@ public:
~QGeometry();
QVector<QAttribute *> attributes() const;
- void addAttribute(QAttribute *attribute);
- void removeAttribute(QAttribute *attribute);
+ Q_INVOKABLE void addAttribute(Qt3DRender::QAttribute *attribute);
+ Q_INVOKABLE void removeAttribute(Qt3DRender::QAttribute *attribute);
QAttribute *boundingVolumePositionAttribute() const;
diff --git a/src/render/graphicshelpers/graphicscontext.cpp b/src/render/graphicshelpers/graphicscontext.cpp
index 76cc17b40..05ca0a128 100644
--- a/src/render/graphicshelpers/graphicscontext.cpp
+++ b/src/render/graphicshelpers/graphicscontext.cpp
@@ -1171,21 +1171,38 @@ void GraphicsContext::specifyAttribute(const Attribute *attribute, Buffer *buffe
const HGLBuffer glBufferHandle = m_renderer->nodeManagers()->glBufferManager()->lookupHandle(buffer->peerId());
const GLBuffer::Type bufferType = bufferTypeToGLBufferType(buffer->type());
- VAOVertexAttribute attr;
- attr.bufferHandle = glBufferHandle;
- attr.bufferType = bufferType;
- attr.location = location;
- attr.dataType = attributeDataType;
- attr.byteOffset = attribute->byteOffset();
- attr.vertexSize = attribute->vertexSize();
- attr.byteStride = attribute->byteStride();
- attr.divisor = attribute->divisor();
-
- enableAttribute(attr);
+ int typeSize = 0;
+ int attrCount = 0;
+
+ if (attribute->vertexSize() >= 1 && attribute->vertexSize() <= 4) {
+ attrCount = 1;
+ } else if (attribute->vertexSize() == 9) {
+ typeSize = byteSizeFromType(attributeDataType);
+ attrCount = 3;
+ } else if (attribute->vertexSize() == 16) {
+ typeSize = byteSizeFromType(attributeDataType);
+ attrCount = 4;
+ } else {
+ Q_UNREACHABLE();
+ }
- // Save this in the current emulated VAO
- if (m_currentVAO)
- m_currentVAO->saveVertexAttribute(attr);
+ for (int i = 0; i < attrCount; i++) {
+ VAOVertexAttribute attr;
+ attr.bufferHandle = glBufferHandle;
+ attr.bufferType = bufferType;
+ attr.location = (location >= 0 ? location + i : location);
+ attr.dataType = attributeDataType;
+ attr.byteOffset = attribute->byteOffset() + (i * attrCount * typeSize);
+ attr.vertexSize = attribute->vertexSize() / attrCount;
+ attr.byteStride = attribute->byteStride() + (attrCount * attrCount * typeSize);
+ attr.divisor = attribute->divisor();
+
+ enableAttribute(attr);
+
+ // Save this in the current emulated VAO
+ if (m_currentVAO)
+ m_currentVAO->saveVertexAttribute(attr);
+ }
}
void GraphicsContext::specifyIndices(Buffer *buffer)
diff --git a/src/render/graphicshelpers/graphicshelperes2.cpp b/src/render/graphicshelpers/graphicshelperes2.cpp
index 140fcf2af..6bf287cee 100644
--- a/src/render/graphicshelpers/graphicshelperes2.cpp
+++ b/src/render/graphicshelpers/graphicshelperes2.cpp
@@ -81,6 +81,8 @@ void GraphicsHelperES2::initializeHelper(QOpenGLContext *context,
m_funcs = context->functions();
Q_ASSERT(m_funcs);
m_isES3 = context->format().majorVersion() >= 3;
+ if (m_isES3)
+ m_extraFuncs = QOpenGLContext::currentContext()->extraFunctions();
}
void GraphicsHelperES2::drawElementsInstancedBaseVertexBaseInstance(GLenum primitiveType,
@@ -97,11 +99,19 @@ void GraphicsHelperES2::drawElementsInstancedBaseVertexBaseInstance(GLenum primi
if (baseVertex != 0)
qWarning() << "glDrawElementsInstancedBaseVertex is not supported with OpenGL ES 2";
- for (GLint i = 0; i < instances; i++)
- drawElements(primitiveType,
- primitiveCount,
- indexType,
- indices);
+ if (m_isES3 && m_extraFuncs) {
+ m_extraFuncs->glDrawElementsInstanced(primitiveType,
+ primitiveCount,
+ indexType,
+ indices,
+ instances);
+ } else {
+ for (GLint i = 0; i < instances; i++)
+ drawElements(primitiveType,
+ primitiveCount,
+ indexType,
+ indices);
+ }
}
void GraphicsHelperES2::drawArraysInstanced(GLenum primitiveType,
@@ -231,8 +241,8 @@ QVector<ShaderStorageBlock> GraphicsHelperES2::programShaderStorageBlocks(GLuint
void GraphicsHelperES2::vertexAttribDivisor(GLuint index, GLuint divisor)
{
- Q_UNUSED(index);
- Q_UNUSED(divisor);
+ if (m_isES3 && m_extraFuncs)
+ m_extraFuncs->glVertexAttribDivisor(index, divisor);
}
void GraphicsHelperES2::blendEquation(GLenum mode)
diff --git a/src/render/graphicshelpers/graphicshelperes2_p.h b/src/render/graphicshelpers/graphicshelperes2_p.h
index 896008dc8..5f4413e09 100644
--- a/src/render/graphicshelpers/graphicshelperes2_p.h
+++ b/src/render/graphicshelpers/graphicshelperes2_p.h
@@ -120,6 +120,7 @@ public:
void vertexAttribDivisor(GLuint index, GLuint divisor) Q_DECL_OVERRIDE;
private:
QOpenGLFunctions *m_funcs;
+ QOpenGLExtraFunctions *m_extraFuncs = nullptr;
bool m_isES3;
};
diff --git a/src/render/io/objloader.cpp b/src/render/io/objloader.cpp
index b15e84de8..d9610172f 100644
--- a/src/render/io/objloader.cpp
+++ b/src/render/io/objloader.cpp
@@ -241,8 +241,6 @@ bool ObjLoader::load(::QIODevice *ioDev, const QString &subMesh)
// Process texture coordinate
float s = tokens.floatAt(1);
float t = tokens.floatAt(2);
- //FlipUVs
- t = 1.0f - t;
texCoords.append(QVector2D( s, t ));
} else {
texCoordsOffset++;
diff --git a/src/render/renderstates/statevariant_p.h b/src/render/renderstates/statevariant_p.h
index ff1f9e175..f2a631d2e 100644
--- a/src/render/renderstates/statevariant_p.h
+++ b/src/render/renderstates/statevariant_p.h
@@ -125,7 +125,7 @@ struct StateVariant
#else
v.m_impl.reset(new GenericState(state));
#endif
- return std::move(v);
+ return v;
}
RenderStateImpl *state();
diff --git a/src/render/texture/qtexture.cpp b/src/render/texture/qtexture.cpp
index e5e3293a4..09ace37d0 100644
--- a/src/render/texture/qtexture.cpp
+++ b/src/render/texture/qtexture.cpp
@@ -640,7 +640,7 @@ QTextureImageDataPtr TextureLoadingHelper::loadTextureData(const QUrl &url, bool
QImage img;
if (img.load(source)) {
textureData = QTextureImageDataPtr::create();
- textureData->setImage(img);
+ textureData->setImage(img.mirrored());
}
break;
}
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);