diff options
author | Liang Qi <liang.qi@qt.io> | 2019-05-07 11:44:37 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2019-05-07 11:58:30 +0200 |
commit | c2b553784dfbe0ece90f79709639e27e74359a7d (patch) | |
tree | 04b0c74c7417a5f1b628d0b18a07f9dd8be1df60 /tests/auto | |
parent | 0b373c2e36a68aedf3731fcb3cd84fd010c2d67c (diff) | |
parent | 8ea0a82a6a771dd76df2d51c6ef3ed966a5b9b45 (diff) |
Merge remote-tracking branch 'origin/5.13' into dev
Conflicts:
src/corelib/kernel/qobject.cpp
src/corelib/kernel/qvariant.h
src/corelib/tools/qlist.h
Done-With: Milian Wolff <milian.wolff@kdab.com>
Done-With: Allan Sandfeld Jensen <allan.jensen@qt.io>
Change-Id: I6803f7239aa137a51a7467fab7cc7a01302a848d
Diffstat (limited to 'tests/auto')
5 files changed, 197 insertions, 37 deletions
diff --git a/tests/auto/corelib/io/qprocess/testProcessEOF/testProcessEOF.pro b/tests/auto/corelib/io/qprocess/testProcessEOF/testProcessEOF.pro index ab1394a5c9..6a23e52d95 100644 --- a/tests/auto/corelib/io/qprocess/testProcessEOF/testProcessEOF.pro +++ b/tests/auto/corelib/io/qprocess/testProcessEOF/testProcessEOF.pro @@ -1,6 +1,4 @@ SOURCES = main.cpp CONFIG -= qt CONFIG += cmdline - -win32:!mingw:!equals(TEMPLATE_PREFIX, "vc"):QMAKE_CXXFLAGS += /GS- DESTDIR = ./ diff --git a/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp b/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp index 1317489e2f..fe63cecccd 100644 --- a/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp +++ b/tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp @@ -195,6 +195,10 @@ void tst_QStorageInfo::tempFile() file.close(); QStorageInfo storage2(file.fileName()); + if (free == storage2.bytesFree() && storage2.fileSystemType() == "apfs") { + QEXPECT_FAIL("", "This test is likely to fail on APFS", Continue); + } + QVERIFY(free != storage2.bytesFree()); } @@ -221,6 +225,9 @@ void tst_QStorageInfo::caching() QCOMPARE(free, storage2.bytesFree()); storage2.refresh(); QCOMPARE(storage1, storage2); + if (free == storage2.bytesFree() && storage2.fileSystemType() == "apfs") { + QEXPECT_FAIL("", "This test is likely to fail on APFS", Continue); + } QVERIFY(free != storage2.bytesFree()); } #endif diff --git a/tests/auto/gui/util/qshadergenerator/tst_qshadergenerator.cpp b/tests/auto/gui/util/qshadergenerator/tst_qshadergenerator.cpp index f8bb0c3851..59e93d127f 100644 --- a/tests/auto/gui/util/qshadergenerator/tst_qshadergenerator.cpp +++ b/tests/auto/gui/util/qshadergenerator/tst_qshadergenerator.cpp @@ -137,7 +137,7 @@ namespace createPort(QShaderNodePort::Output, "color") }); sampleTexture.addRule(openGLES2, QShaderNode::Rule("highp vec4 $color = texture2D($sampler, $coord);")); - sampleTexture.addRule(openGL3, QShaderNode::Rule("vec4 $color = texture2D($sampler, $coord);")); + sampleTexture.addRule(openGL3, QShaderNode::Rule("vec4 $color = texture($sampler, $coord);")); auto lightFunction = createNode({ createPort(QShaderNodePort::Input, "baseColor"), @@ -197,6 +197,7 @@ private slots: void shouldProcessLanguageQualifierAndTypeEnums(); void shouldGenerateDifferentCodeDependingOnActiveLayers(); void shouldUseGlobalVariableRatherThanTemporaries(); + void shouldGenerateTemporariesWisely(); }; void tst_QShaderGenerator::shouldHaveDefaultState() @@ -237,10 +238,7 @@ void tst_QShaderGenerator::shouldGenerateShaderCode_data() << "" << "void main()" << "{" - << " highp vec4 v5 = texture2D(texture, texCoord);" - << " highp vec4 v6 = lightModel(v5, worldPosition, lightIntensity);" - << " highp vec4 v7 = v6 * pow(2.0, exposure);" - << " gl_fragColor = v7;" + << " gl_fragColor = (((((lightModel(((texture2D(texture, texCoord))), worldPosition, lightIntensity)))) * pow(2.0, exposure)));" << "}" << ""; @@ -254,10 +252,7 @@ void tst_QShaderGenerator::shouldGenerateShaderCode_data() << "" << "void main()" << "{" - << " vec4 v5 = texture2D(texture, texCoord);" - << " vec4 v6 = lightModel(v5, worldPosition, lightIntensity);" - << " vec4 v7 = v6 * pow(2.0, exposure);" - << " fragColor = v7;" + << " fragColor = (((((lightModel(((texture(texture, texCoord))), worldPosition, lightIntensity)))) * pow(2.0, exposure)));" << "}" << ""; @@ -869,8 +864,7 @@ void tst_QShaderGenerator::shouldGenerateDifferentCodeDependingOnActiveLayers() << "" << "void main()" << "{" - << " vec4 v2 = lightModel(diffuseUniform, normalUniform);" - << " fragColor = v2;" + << " fragColor = ((lightModel(diffuseUniform, normalUniform)));" << "}" << ""; QCOMPARE(code, expected.join("\n")); @@ -892,9 +886,7 @@ void tst_QShaderGenerator::shouldGenerateDifferentCodeDependingOnActiveLayers() << "" << "void main()" << "{" - << " vec3 v2 = texture2D(normalTexture, texCoord).rgb;" - << " vec4 v3 = lightModel(diffuseUniform, v2);" - << " fragColor = v3;" + << " fragColor = ((lightModel(diffuseUniform, texture2D(normalTexture, texCoord).rgb)));" << "}" << ""; QCOMPARE(code, expected.join("\n")); @@ -916,9 +908,7 @@ void tst_QShaderGenerator::shouldGenerateDifferentCodeDependingOnActiveLayers() << "" << "void main()" << "{" - << " vec4 v1 = texture2D(diffuseTexture, texCoord);" - << " vec4 v3 = lightModel(v1, normalUniform);" - << " fragColor = v3;" + << " fragColor = ((lightModel(texture2D(diffuseTexture, texCoord), normalUniform)));" << "}" << ""; QCOMPARE(code, expected.join("\n")); @@ -940,10 +930,7 @@ void tst_QShaderGenerator::shouldGenerateDifferentCodeDependingOnActiveLayers() << "" << "void main()" << "{" - << " vec3 v2 = texture2D(normalTexture, texCoord).rgb;" - << " vec4 v1 = texture2D(diffuseTexture, texCoord);" - << " vec4 v3 = lightModel(v1, v2);" - << " fragColor = v3;" + << " fragColor = ((lightModel(texture2D(diffuseTexture, texCoord), texture2D(normalTexture, texCoord).rgb)));" << "}" << ""; QCOMPARE(code, expected.join("\n")); @@ -967,13 +954,13 @@ void tst_QShaderGenerator::shouldUseGlobalVariableRatherThanTemporaries() createPort(QShaderNodePort::Input, "varName"), createPort(QShaderNodePort::Output, "out") }); - fakeMultiPlyNoSpace.addRule(gl4, QShaderNode::Rule("vec4 $out = $varName*v11;")); + fakeMultiPlyNoSpace.addRule(gl4, QShaderNode::Rule("vec4 $out = $varName*speed;")); auto fakeMultiPlySpace = createNode({ createPort(QShaderNodePort::Input, "varName"), createPort(QShaderNodePort::Output, "out") }); - fakeMultiPlySpace.addRule(gl4, QShaderNode::Rule("vec4 $out = $varName * v11;")); + fakeMultiPlySpace.addRule(gl4, QShaderNode::Rule("vec4 $out = $varName * speed;")); auto fakeJoinNoSpace = createNode({ createPort(QShaderNodePort::Input, "varName"), @@ -1063,20 +1050,185 @@ void tst_QShaderGenerator::shouldUseGlobalVariableRatherThanTemporaries() << "" << "void main()" << "{" - << " vec4 v7 = vertexPosition / vertexPosition;" - << " vec4 v6 = vertexPosition.xyzw - vertexPosition;" - << " vec4 v5 = vertexPosition.xyzw + vertexPosition;" - << " vec4 v4 = vec4(vertexPosition.xyz, vertexPosition.w);" - << " vec4 v3 = vec4(vertexPosition.xyz,vertexPosition.w);" - << " vec4 v2 = vertexPosition * v11;" - << " vec4 v1 = vertexPosition*v11;" - << " fragColor = v1 + v2 + v3 + v4 + v5 + v6 + v7;" + << " fragColor = (((((((vertexPosition*speed + vertexPosition * speed + ((vec4(vertexPosition.xyz,vertexPosition.w))) + ((vec4(vertexPosition.xyz, vertexPosition.w))) + ((vertexPosition.xyzw + vertexPosition)) + ((vertexPosition.xyzw - vertexPosition)) + ((vertexPosition / vertexPosition)))))))));" << "}" << ""; QCOMPARE(code, expected.join("\n")); } } +void tst_QShaderGenerator::shouldGenerateTemporariesWisely() +{ + // GIVEN + const auto gl4 = createFormat(QShaderFormat::OpenGLCoreProfile, 4, 0); + + { + auto attribute = createNode({ + createPort(QShaderNodePort::Output, "vertexPosition") + }); + attribute.addRule(gl4, QShaderNode::Rule("vec4 $vertexPosition = vertexPosition;", + QByteArrayList() << "in vec4 vertexPosition;")); + + auto complexFunction = createNode({ + createPort(QShaderNodePort::Input, "inputVarName"), + createPort(QShaderNodePort::Output, "out") + }); + complexFunction.addRule(gl4, QShaderNode::Rule("vec4 $out = $inputVarName * 2.0;")); + + auto complexFunction2 = createNode({ + createPort(QShaderNodePort::Input, "inputVarName"), + createPort(QShaderNodePort::Output, "out") + }); + complexFunction2.addRule(gl4, QShaderNode::Rule("vec4 $out = $inputVarName * 4.0;")); + + auto complexFunction3 = createNode({ + createPort(QShaderNodePort::Input, "a"), + createPort(QShaderNodePort::Input, "b"), + createPort(QShaderNodePort::Output, "out") + }); + complexFunction3.addRule(gl4, QShaderNode::Rule("vec4 $out = $a + $b;")); + + auto shaderOutput1 = createNode({ + createPort(QShaderNodePort::Input, "input") + }); + + shaderOutput1.addRule(gl4, QShaderNode::Rule("shaderOutput1 = $input;", + QByteArrayList() << "out vec4 shaderOutput1;")); + + auto shaderOutput2 = createNode({ + createPort(QShaderNodePort::Input, "input") + }); + + shaderOutput2.addRule(gl4, QShaderNode::Rule("shaderOutput2 = $input;", + QByteArrayList() << "out vec4 shaderOutput2;")); + + { + // WHEN + const auto graph = [=] { + auto res = QShaderGraph(); + + res.addNode(attribute); + res.addNode(complexFunction); + res.addNode(shaderOutput1); + + res.addEdge(createEdge(attribute.uuid(), "vertexPosition", complexFunction.uuid(), "inputVarName")); + res.addEdge(createEdge(complexFunction.uuid(), "out", shaderOutput1.uuid(), "input")); + + return res; + }(); + + auto generator = QShaderGenerator(); + generator.graph = graph; + generator.format = gl4; + + const auto code = generator.createShaderCode(); + + // THEN + const auto expected = QByteArrayList() + << "#version 400 core" + << "" + << "in vec4 vertexPosition;" + << "out vec4 shaderOutput1;" + << "" + << "void main()" + << "{" + << " shaderOutput1 = vertexPosition * 2.0;" + << "}" + << ""; + QCOMPARE(code, expected.join("\n")); + } + + { + // WHEN + const auto graph = [=] { + auto res = QShaderGraph(); + + res.addNode(attribute); + res.addNode(complexFunction); + res.addNode(shaderOutput1); + res.addNode(shaderOutput2); + + res.addEdge(createEdge(attribute.uuid(), "vertexPosition", complexFunction.uuid(), "inputVarName")); + res.addEdge(createEdge(complexFunction.uuid(), "out", shaderOutput1.uuid(), "input")); + res.addEdge(createEdge(complexFunction.uuid(), "out", shaderOutput2.uuid(), "input")); + + return res; + }(); + + auto generator = QShaderGenerator(); + generator.graph = graph; + generator.format = gl4; + + const auto code = generator.createShaderCode(); + + // THEN + const auto expected = QByteArrayList() + << "#version 400 core" + << "" + << "in vec4 vertexPosition;" + << "out vec4 shaderOutput1;" + << "out vec4 shaderOutput2;" + << "" + << "void main()" + << "{" + << " vec4 v1 = vertexPosition * 2.0;" + << " shaderOutput2 = v1;" + << " shaderOutput1 = v1;" + << "}" + << ""; + QCOMPARE(code, expected.join("\n")); + } + + { + // WHEN + const auto graph = [=] { + auto res = QShaderGraph(); + + res.addNode(attribute); + res.addNode(complexFunction); + res.addNode(complexFunction2); + res.addNode(complexFunction3); + res.addNode(shaderOutput1); + res.addNode(shaderOutput2); + + res.addEdge(createEdge(attribute.uuid(), "vertexPosition", complexFunction.uuid(), "inputVarName")); + res.addEdge(createEdge(attribute.uuid(), "vertexPosition", complexFunction2.uuid(), "inputVarName")); + + res.addEdge(createEdge(complexFunction.uuid(), "out", complexFunction3.uuid(), "a")); + res.addEdge(createEdge(complexFunction2.uuid(), "out", complexFunction3.uuid(), "b")); + + res.addEdge(createEdge(complexFunction3.uuid(), "out", shaderOutput1.uuid(), "input")); + res.addEdge(createEdge(complexFunction2.uuid(), "out", shaderOutput2.uuid(), "input")); + + return res; + }(); + + auto generator = QShaderGenerator(); + generator.graph = graph; + generator.format = gl4; + + const auto code = generator.createShaderCode(); + + // THEN + const auto expected = QByteArrayList() + << "#version 400 core" + << "" + << "in vec4 vertexPosition;" + << "out vec4 shaderOutput1;" + << "out vec4 shaderOutput2;" + << "" + << "void main()" + << "{" + << " vec4 v2 = vertexPosition * 4.0;" + << " shaderOutput2 = v2;" + << " shaderOutput1 = (vertexPosition * 2.0 + v2);" + << "}" + << ""; + QCOMPARE(code, expected.join("\n")); + } + } +} + QTEST_MAIN(tst_QShaderGenerator) #include "tst_qshadergenerator.moc" diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index 9e30f17fa9..89da56cd0c 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -10161,7 +10161,8 @@ void tst_QWidget::touchEventSynthesizedMouseEvent() // We should see propagation of the TouchBegin into a MouseButtonPress TouchMouseWidget parent; TouchMouseWidget child(&parent); - child.move(5, 5); + const QPoint childPos(5, 5); + child.move(childPos); child.setAcceptMouse(false); parent.show(); QVERIFY(QTest::qWaitForWindowExposed(parent.windowHandle())); @@ -10170,13 +10171,14 @@ void tst_QWidget::touchEventSynthesizedMouseEvent() QCOMPARE(child.m_touchEventCount, 0); QCOMPARE(child.m_mouseEventCount, 0); - QTest::touchEvent(parent.window(), m_touchScreen).press(0, QPoint(10, 10), &child); + const QPoint touchPos(20, 20); + QTest::touchEvent(parent.window(), m_touchScreen).press(0, touchPos, &child); QCOMPARE(parent.m_touchEventCount, 0); QCOMPARE(parent.m_mouseEventCount, 1); - QCOMPARE(parent.m_lastMouseEventPos, QPointF(15, 15)); + QCOMPARE(parent.m_lastMouseEventPos, childPos + touchPos); QCOMPARE(child.m_touchEventCount, 0); QCOMPARE(child.m_mouseEventCount, 1); // Attempt at mouse event before propagation - QCOMPARE(child.m_lastMouseEventPos, QPointF(10, 10)); + QCOMPARE(child.m_lastMouseEventPos, touchPos); } } diff --git a/tests/auto/widgets/kernel/qwidget_window/BLACKLIST b/tests/auto/widgets/kernel/qwidget_window/BLACKLIST index c980325d9a..934f2e8025 100644 --- a/tests/auto/widgets/kernel/qwidget_window/BLACKLIST +++ b/tests/auto/widgets/kernel/qwidget_window/BLACKLIST @@ -5,3 +5,4 @@ ubuntu-16.04 ubuntu-18.04 [setWindowState] ubuntu-18.04 +rhel |