diff --git a/tests/auto/gui/painting/qcolortransform/tst_qcolortransform.cpp b/tests/auto/gui/painting/qcolortransform/tst_qcolortransform.cpp index 06e8db3e..afe08dc4 100644 --- a/tests/auto/gui/painting/qcolortransform/tst_qcolortransform.cpp +++ b/tests/auto/gui/painting/qcolortransform/tst_qcolortransform.cpp @@ -182,25 +182,33 @@ void tst_QColorTransform::mapRGBAFP16x4() else QVERIFY(result != testColor); - testColor = QRgbaFloat16{0.0f, 0.0f, 0.0f, 1.0f}; + float floatValueZero = 0.0f; + qfloat16 float16ValueZero; + qFloatToFloat16(&float16ValueZero, &floatValueZero, 1); + + float floatValueOne = 1.0f; + qfloat16 float16ValueOne; + qFloatToFloat16(&float16ValueOne, &floatValueOne, 1); + + testColor = QRgbaFloat16{float16ValueZero, float16ValueZero, float16ValueZero, float16ValueOne}; result = transform.map(testColor); QCOMPARE(result, testColor); - testColor = QRgbaFloat16{1.0f, 1.0f, 1.0f, 1.0f}; + testColor = QRgbaFloat16{float16ValueOne, float16ValueOne, float16ValueOne, float16ValueOne}; result = transform.map(testColor); QCOMPARE(result, testColor); - testColor = QRgbaFloat16{1.0f, 1.0f, 0.0f, 1.0f}; + testColor = QRgbaFloat16{float16ValueOne, float16ValueOne, float16ValueZero, float16ValueOne}; result = transform.map(testColor); - QCOMPARE(result.alpha(), 1.0f); + QCOMPARE(result.alpha(), float16ValueOne); if (sharesRed) - QCOMPARE(result.red(), 1.0f); + QCOMPARE(result.red(), float16ValueOne); - testColor = QRgbaFloat16{0.0f, 1.0f, 1.0f, 1.0f}; + testColor = QRgbaFloat16{float16ValueZero, float16ValueOne, float16ValueOne, float16ValueOne}; result = transform.map(testColor); // QRgbaFloat16 might overflow blue if we convert to a smaller gamut: QCOMPARE(result.blue16(), 65535); - QCOMPARE(result.alpha(), 1.0f); + QCOMPARE(result.alpha(), float16ValueOne); } void tst_QColorTransform::mapRGBAFP32x4_data() diff --git a/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp b/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp index 942ee06f..1cc1b14b 100644 --- a/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp +++ b/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp @@ -6699,10 +6699,22 @@ void tst_QRhi::halfPrecisionAttributes() // // To avoid these errors, we pad the vertices to 8 byte stride. // + float floatValueZero = 0.0f; + qfloat16 float16ValueZero; + qFloatToFloat16(&float16ValueZero, &floatValueZero, 1); + + float floatValueOne = 1.0f; + qfloat16 float16ValueOne; + qFloatToFloat16(&float16ValueOne, &floatValueOne, 1); + + float floatValueMinusOne = -1.0f; + qfloat16 float16ValueMinusOne; + qFloatToFloat16(&float16ValueMinusOne, &floatValueMinusOne, 1); + static const qfloat16 vertices[] = { - -1.0, -1.0, 0.0, 0.0, - 1.0, -1.0, 0.0, 0.0, - 0.0, 1.0, 0.0, 0.0, + float16ValueMinusOne, float16ValueMinusOne, float16ValueZero, float16ValueZero, + float16ValueOne, float16ValueMinusOne, float16ValueZero, float16ValueZero, + float16ValueZero, float16ValueOne, float16ValueZero, float16ValueZero, }; QScopedPointer vbuf(rhi->newBuffer(QRhiBuffer::Immutable, QRhiBuffer::VertexBuffer, sizeof(vertices)));