Debian Codegraph @

tests/auto/render/shadergraph/qshadernodes/tst_qshadernodes.cpp

raw symbols SCIP
1 // Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
2 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4
5 #include <QtTest/QTest>
6
7 #include <Qt3DRender/private/qshaderformat_p.h>
8 #include <Qt3DRender/private/qshadernode_p.h>
9 #include <Qt3DRender/private/qshadernodeport_p.h>
10
11 using namespace Qt3DRender;
12 namespace
13 {
14 QShaderFormat createFormat(QShaderFormat::Api api, int majorVersion, int minorVersion,
15 const QStringList &extensions = QStringList(),
16 const QString &vendor = QString())
17 {
18 auto format = QShaderFormat();
19 format.setApi(api);
20 format.setVersion(QVersionNumber(majorVersion, minorVersion));
21 format.setExtensions(extensions);
22 format.setVendor(vendor);
23 return format;
24 }
25
26 QShaderNodePort createPort(QShaderNodePort::Direction direction, const QString &name)
27 {
28 auto port = QShaderNodePort();
29 port.direction = direction;
30 port.name = name;
31 return port;
32 }
33 }
34
35 class tst_QShaderNodes : public QObject
36 {
37 Q_OBJECT
38 private slots:
39 void shouldManipulateFormatMembers();
40 void shouldVerifyFormatsEquality_data();
41 void shouldVerifyFormatsEquality();
42 void shouldVerifyFormatsCompatibilities_data();
43 void shouldVerifyFormatsCompatibilities();
44
45 void shouldHaveDefaultPortState();
46 void shouldVerifyPortsEquality_data();
47 void shouldVerifyPortsEquality();
48
49 void shouldManipulateNodeMembers();
50 void shouldHandleNodeRulesSupportAndOrder();
51 };
52
53 void tst_QShaderNodes::shouldManipulateFormatMembers()
54 {
55 // GIVEN
56 auto format = QShaderFormat();
57
58 // THEN (default state)
59 QCOMPARE(format.api(), QShaderFormat::NoApi);
60 QCOMPARE(format.version().majorVersion(), 0);
61 QCOMPARE(format.version().minorVersion(), 0);
62 QCOMPARE(format.extensions(), QStringList());
63 QCOMPARE(format.vendor(), QString());
64 QVERIFY(!format.isValid());
65
66 // WHEN
67 format.setApi(QShaderFormat::OpenGLES);
68
69 // THEN
70 QCOMPARE(format.api(), QShaderFormat::OpenGLES);
71 QCOMPARE(format.version().majorVersion(), 0);
72 QCOMPARE(format.version().minorVersion(), 0);
73 QCOMPARE(format.extensions(), QStringList());
74 QCOMPARE(format.vendor(), QString());
75 QVERIFY(!format.isValid());
76
77 // WHEN
78 format.setVersion(QVersionNumber(3));
79
80 // THEN
81 QCOMPARE(format.api(), QShaderFormat::OpenGLES);
82 QCOMPARE(format.version().majorVersion(), 3);
83 QCOMPARE(format.version().minorVersion(), 0);
84 QCOMPARE(format.extensions(), QStringList());
85 QCOMPARE(format.vendor(), QString());
86 QVERIFY(format.isValid());
87
88 // WHEN
89 format.setVersion(QVersionNumber(3, 2));
90
91 // THEN
92 QCOMPARE(format.api(), QShaderFormat::OpenGLES);
93 QCOMPARE(format.version().majorVersion(), 3);
94 QCOMPARE(format.version().minorVersion(), 2);
95 QCOMPARE(format.extensions(), QStringList());
96 QCOMPARE(format.vendor(), QString());
97 QVERIFY(format.isValid());
98
99 // WHEN
100 format.setExtensions({"foo", "bar"});
101
102 // THEN
103 QCOMPARE(format.api(), QShaderFormat::OpenGLES);
104 QCOMPARE(format.version().majorVersion(), 3);
105 QCOMPARE(format.version().minorVersion(), 2);
106 QCOMPARE(format.extensions(), QStringList({"bar", "foo"}));
107 QCOMPARE(format.vendor(), QString());
108 QVERIFY(format.isValid());
109
110 // WHEN
111 format.setVendor(QStringLiteral("KDAB"));
112
113 // THEN
114 QCOMPARE(format.api(), QShaderFormat::OpenGLES);
115 QCOMPARE(format.version().majorVersion(), 3);
116 QCOMPARE(format.version().minorVersion(), 2);
117 QCOMPARE(format.extensions(), QStringList({"bar", "foo"}));
118 QCOMPARE(format.vendor(), QStringLiteral("KDAB"));
119 QVERIFY(format.isValid());
120 }
121
122 void tst_QShaderNodes::shouldVerifyFormatsEquality_data()
123 {
124 QTest::addColumn<QShaderFormat>("left");
125 QTest::addColumn<QShaderFormat>("right");
126 QTest::addColumn<bool>("expected");
127
128 QTest::newRow("Equals") << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0, {"foo", "bar"}, "KDAB")
129 << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0, {"foo", "bar"}, "KDAB")
130 << true;
131 QTest::newRow("Apis") << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0, {"foo", "bar"}, "KDAB")
132 << createFormat(QShaderFormat::OpenGLNoProfile, 3, 0, {"foo", "bar"}, "KDAB")
133 << false;
134 QTest::newRow("Major") << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0, {"foo", "bar"}, "KDAB")
135 << createFormat(QShaderFormat::OpenGLCoreProfile, 2, 0, {"foo", "bar"}, "KDAB")
136 << false;
137 QTest::newRow("Minor") << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0, {"foo", "bar"}, "KDAB")
138 << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 1, {"foo", "bar"}, "KDAB")
139 << false;
140 QTest::newRow("Extensions") << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0, {"foo", "bar"}, "KDAB")
141 << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0, {"foo"}, "KDAB")
142 << false;
143 QTest::newRow("Vendor") << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0, {"foo", "bar"}, "KDAB")
144 << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0, {"foo", "bar"})
145 << false;
146 }
147
148 void tst_QShaderNodes::shouldVerifyFormatsEquality()
149 {
150 // GIVEN
151 QFETCH(QShaderFormat, left);
152 QFETCH(QShaderFormat, right);
153
154 // WHEN
155 const auto equal = (left == right);
156 const auto notEqual = (left != right);
157
158 // THEN
159 QFETCH(bool, expected);
160 QCOMPARE(equal, expected);
161 QCOMPARE(notEqual, !expected);
162 }
163
164 void tst_QShaderNodes::shouldVerifyFormatsCompatibilities_data()
165 {
166 QTest::addColumn<QShaderFormat>("reference");
167 QTest::addColumn<QShaderFormat>("tested");
168 QTest::addColumn<bool>("expected");
169
170 QTest::newRow("NoProfileVsES") << createFormat(QShaderFormat::OpenGLNoProfile, 2, 0)
171 << createFormat(QShaderFormat::OpenGLES, 2, 0)
172 << true;
173 QTest::newRow("CoreProfileVsES") << createFormat(QShaderFormat::OpenGLCoreProfile, 2, 0)
174 << createFormat(QShaderFormat::OpenGLES, 2, 0)
175 << false;
176 QTest::newRow("CompatProfileVsES") << createFormat(QShaderFormat::OpenGLCompatibilityProfile, 2, 0)
177 << createFormat(QShaderFormat::OpenGLES, 2, 0)
178 << true;
179
180 QTest::newRow("ESVsNoProfile") << createFormat(QShaderFormat::OpenGLES, 2, 0)
181 << createFormat(QShaderFormat::OpenGLNoProfile, 2, 0)
182 << false;
183 QTest::newRow("ESVsCoreProfile") << createFormat(QShaderFormat::OpenGLES, 2, 0)
184 << createFormat(QShaderFormat::OpenGLCoreProfile, 2, 0)
185 << false;
186 QTest::newRow("ESVsCompatProfile") << createFormat(QShaderFormat::OpenGLES, 2, 0)
187 << createFormat(QShaderFormat::OpenGLCompatibilityProfile, 2, 0)
188 << false;
189
190 QTest::newRow("CoreVsNoProfile") << createFormat(QShaderFormat::OpenGLCoreProfile, 2, 0)
191 << createFormat(QShaderFormat::OpenGLNoProfile, 2, 0)
192 << false;
193 QTest::newRow("CoreVsCompat") << createFormat(QShaderFormat::OpenGLCoreProfile, 2, 0)
194 << createFormat(QShaderFormat::OpenGLCompatibilityProfile, 2, 0)
195 << false;
196 QTest::newRow("CoreVsCore") << createFormat(QShaderFormat::OpenGLCoreProfile, 2, 0)
197 << createFormat(QShaderFormat::OpenGLCoreProfile, 2, 0)
198 << true;
199
200 QTest::newRow("NoProfileVsCore") << createFormat(QShaderFormat::OpenGLNoProfile, 2, 0)
201 << createFormat(QShaderFormat::OpenGLCoreProfile, 2, 0)
202 << true;
203 QTest::newRow("NoProvileVsCompat") << createFormat(QShaderFormat::OpenGLNoProfile, 2, 0)
204 << createFormat(QShaderFormat::OpenGLCompatibilityProfile, 2, 0)
205 << true;
206 QTest::newRow("NoProfileVsNoProfile") << createFormat(QShaderFormat::OpenGLNoProfile, 2, 0)
207 << createFormat(QShaderFormat::OpenGLNoProfile, 2, 0)
208 << true;
209
210 QTest::newRow("CompatVsCore") << createFormat(QShaderFormat::OpenGLCompatibilityProfile, 2, 0)
211 << createFormat(QShaderFormat::OpenGLCoreProfile, 2, 0)
212 << true;
213 QTest::newRow("CompatVsCompat") << createFormat(QShaderFormat::OpenGLCompatibilityProfile, 2, 0)
214 << createFormat(QShaderFormat::OpenGLCompatibilityProfile, 2, 0)
215 << true;
216 QTest::newRow("CompatVsNoProfile") << createFormat(QShaderFormat::OpenGLCompatibilityProfile, 2, 0)
217 << createFormat(QShaderFormat::OpenGLNoProfile, 2, 0)
218 << true;
219
220 QTest::newRow("MajorForwardCompat_1") << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0)
221 << createFormat(QShaderFormat::OpenGLCoreProfile, 2, 0)
222 << true;
223 QTest::newRow("MajorForwardCompat_2") << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0)
224 << createFormat(QShaderFormat::OpenGLCoreProfile, 2, 4)
225 << true;
226 QTest::newRow("MajorForwardCompat_3") << createFormat(QShaderFormat::OpenGLCoreProfile, 2, 0)
227 << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0)
228 << false;
229 QTest::newRow("MajorForwardCompat_4") << createFormat(QShaderFormat::OpenGLCoreProfile, 2, 4)
230 << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0)
231 << false;
232
233 QTest::newRow("MinorForwardCompat_1") << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 1)
234 << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0)
235 << true;
236 QTest::newRow("MinorForwardCompat_2") << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0)
237 << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 1)
238 << false;
239
240 QTest::newRow("Extensions_1") << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0, {"foo", "bar"})
241 << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0, {"foo"})
242 << true;
243 QTest::newRow("Extensions_2") << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0, {"foo"})
244 << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0, {"foo", "bar"})
245 << false;
246
247 QTest::newRow("Vendor_1") << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0, {}, "KDAB")
248 << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0, {})
249 << true;
250 QTest::newRow("Vendor_2") << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0, {})
251 << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0, {}, "KDAB")
252 << false;
253 QTest::newRow("Vendor_2") << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0, {}, "KDAB")
254 << createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0, {}, "KDAB")
255 << true;
256 }
257
258 void tst_QShaderNodes::shouldVerifyFormatsCompatibilities()
259 {
260 // GIVEN
261 QFETCH(QShaderFormat, reference);
262 QFETCH(QShaderFormat, tested);
263
264 // WHEN
265 const auto supported = reference.supports(tested);
266
267 // THEN
268 QFETCH(bool, expected);
269 QCOMPARE(supported, expected);
270 }
271
272 void tst_QShaderNodes::shouldHaveDefaultPortState()
273 {
274 // GIVEN
275 auto port = QShaderNodePort();
276
277 // THEN
278 QCOMPARE(port.direction, QShaderNodePort::Output);
279 QVERIFY(port.name.isEmpty());
280 }
281
282 void tst_QShaderNodes::shouldVerifyPortsEquality_data()
283 {
284 QTest::addColumn<QShaderNodePort>("left");
285 QTest::addColumn<QShaderNodePort>("right");
286 QTest::addColumn<bool>("expected");
287
288 QTest::newRow("Equals") << createPort(QShaderNodePort::Input, "foo")
289 << createPort(QShaderNodePort::Input, "foo")
290 << true;
291 QTest::newRow("Direction") << createPort(QShaderNodePort::Input, "foo")
292 << createPort(QShaderNodePort::Output, "foo")
293 << false;
294 QTest::newRow("Name") << createPort(QShaderNodePort::Input, "foo")
295 << createPort(QShaderNodePort::Input, "bar")
296 << false;
297 }
298
299 void tst_QShaderNodes::shouldVerifyPortsEquality()
300 {
301 // GIVEN
302 QFETCH(QShaderNodePort, left);
303 QFETCH(QShaderNodePort, right);
304
305 // WHEN
306 const auto equal = (left == right);
307 const auto notEqual = (left != right);
308
309 // THEN
310 QFETCH(bool, expected);
311 QCOMPARE(equal, expected);
312 QCOMPARE(notEqual, !expected);
313 }
314
315 void tst_QShaderNodes::shouldManipulateNodeMembers()
316 {
317 // GIVEN
318 const auto openGLES2 = createFormat(QShaderFormat::OpenGLES, 2, 0);
319 const auto openGL3 = createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0);
320
321 const auto es2Rule = QShaderNode::Rule(QByteArrayLiteral("gles2"), {"#pragma include es2/foo.inc", "#pragma include es2/bar.inc"});
322 const auto gl3Rule = QShaderNode::Rule(QByteArrayLiteral("gl3"), {"#pragma include gl3/foo.inc", "#pragma include gl3/bar.inc"});
323 const auto gl3bisRule = QShaderNode::Rule(QByteArrayLiteral("gl3bis"), {"#pragma include gl3/foo.inc", "#pragma include gl3/bar.inc"});
324
325 auto node = QShaderNode();
326
327 // THEN (default state)
328 QCOMPARE(node.type(), QShaderNode::Invalid);
329 QVERIFY(node.uuid().isNull());
330 QVERIFY(node.layers().isEmpty());
331 QVERIFY(node.ports().isEmpty());
332 QVERIFY(node.parameterNames().isEmpty());
333 QVERIFY(node.availableFormats().isEmpty());
334
335 // WHEN
336 const auto uuid = QUuid::createUuid();
337 node.setUuid(uuid);
338
339 // THEN
340 QCOMPARE(node.uuid(), uuid);
341
342 // WHEN
343 node.setLayers({"foo", "bar"});
344
345 // THEN
346 QCOMPARE(node.layers(), QStringList({"foo", "bar"}));
347
348 // WHEN
349 auto firstPort = QShaderNodePort();
350 firstPort.direction = QShaderNodePort::Input;
351 firstPort.name = QStringLiteral("foo");
352 node.addPort(firstPort);
353
354 // THEN
355 QCOMPARE(node.type(), QShaderNode::Output);
356 QCOMPARE(node.ports().size(), 1);
357 QCOMPARE(node.ports().at(0), firstPort);
358 QVERIFY(node.availableFormats().isEmpty());
359
360 // WHEN
361 auto secondPort = QShaderNodePort();
362 secondPort.direction = QShaderNodePort::Output;
363 secondPort.name = QStringLiteral("bar");
364 node.addPort(secondPort);
365
366 // THEN
367 QCOMPARE(node.type(), QShaderNode::Function);
368 QCOMPARE(node.ports().size(), 2);
369 QCOMPARE(node.ports().at(0), firstPort);
370 QCOMPARE(node.ports().at(1), secondPort);
371 QVERIFY(node.availableFormats().isEmpty());
372
373 // WHEN
374 node.removePort(firstPort);
375
376 // THEN
377 QCOMPARE(node.type(), QShaderNode::Input);
378 QCOMPARE(node.ports().size(), 1);
379 QCOMPARE(node.ports().at(0), secondPort);
380 QVERIFY(node.availableFormats().isEmpty());
381
382 // WHEN
383 node.setParameter(QStringLiteral("baz"), 42);
384
385 // THEN
386 QCOMPARE(node.type(), QShaderNode::Input);
387 QCOMPARE(node.ports().size(), 1);
388 QCOMPARE(node.ports().at(0), secondPort);
389 auto parameterNames = node.parameterNames();
390 parameterNames.sort();
391 QCOMPARE(parameterNames.size(), 1);
392 QCOMPARE(parameterNames.at(0), QStringLiteral("baz"));
393 QCOMPARE(node.parameter(QStringLiteral("baz")), QVariant(42));
394 QVERIFY(node.availableFormats().isEmpty());
395
396 // WHEN
397 node.setParameter(QStringLiteral("bleh"), QStringLiteral("value"));
398
399 // THEN
400 QCOMPARE(node.type(), QShaderNode::Input);
401 QCOMPARE(node.ports().size(), 1);
402 QCOMPARE(node.ports().at(0), secondPort);
403 parameterNames = node.parameterNames();
404 parameterNames.sort();
405 QCOMPARE(parameterNames.size(), 2);
406 QCOMPARE(parameterNames.at(0), QStringLiteral("baz"));
407 QCOMPARE(parameterNames.at(1), QStringLiteral("bleh"));
408 QCOMPARE(node.parameter(QStringLiteral("baz")), QVariant(42));
409 QCOMPARE(node.parameter(QStringLiteral("bleh")), QVariant(QStringLiteral("value")));
410 QVERIFY(node.availableFormats().isEmpty());
411
412 // WHEN
413 node.clearParameter(QStringLiteral("baz"));
414
415 // THEN
416 QCOMPARE(node.type(), QShaderNode::Input);
417 QCOMPARE(node.ports().size(), 1);
418 QCOMPARE(node.ports().at(0), secondPort);
419 parameterNames = node.parameterNames();
420 parameterNames.sort();
421 QCOMPARE(parameterNames.size(), 1);
422 QCOMPARE(parameterNames.at(0), QStringLiteral("bleh"));
423 QCOMPARE(node.parameter(QStringLiteral("baz")), QVariant());
424 QCOMPARE(node.parameter(QStringLiteral("bleh")), QVariant(QStringLiteral("value")));
425 QVERIFY(node.availableFormats().isEmpty());
426
427 // WHEN
428 node.addRule(openGLES2, es2Rule);
429 node.addRule(openGL3, gl3Rule);
430
431 // THEN
432 QCOMPARE(node.availableFormats().size(), 2);
433 QCOMPARE(node.availableFormats().at(0), openGLES2);
434 QCOMPARE(node.availableFormats().at(1), openGL3);
435 QCOMPARE(node.rule(openGLES2), es2Rule);
436 QCOMPARE(node.rule(openGL3), gl3Rule);
437
438 // WHEN
439 node.removeRule(openGLES2);
440
441 // THEN
442 QCOMPARE(node.availableFormats().size(), 1);
443 QCOMPARE(node.availableFormats().at(0), openGL3);
444 QCOMPARE(node.rule(openGL3), gl3Rule);
445
446 // WHEN
447 node.addRule(openGLES2, es2Rule);
448
449 // THEN
450 QCOMPARE(node.availableFormats().size(), 2);
451 QCOMPARE(node.availableFormats().at(0), openGL3);
452 QCOMPARE(node.availableFormats().at(1), openGLES2);
453 QCOMPARE(node.rule(openGLES2), es2Rule);
454 QCOMPARE(node.rule(openGL3), gl3Rule);
455
456 // WHEN
457 node.addRule(openGL3, gl3bisRule);
458
459 // THEN
460 QCOMPARE(node.availableFormats().size(), 2);
461 QCOMPARE(node.availableFormats().at(0), openGLES2);
462 QCOMPARE(node.availableFormats().at(1), openGL3);
463 QCOMPARE(node.rule(openGLES2), es2Rule);
464 QCOMPARE(node.rule(openGL3), gl3bisRule);
465 }
466
467 void tst_QShaderNodes::shouldHandleNodeRulesSupportAndOrder()
468 {
469 // GIVEN
470 const auto openGLES2 = createFormat(QShaderFormat::OpenGLES, 2, 0);
471 const auto openGL3 = createFormat(QShaderFormat::OpenGLCoreProfile, 3, 0);
472 const auto openGL32 = createFormat(QShaderFormat::OpenGLCoreProfile, 3, 2);
473 const auto openGL4 = createFormat(QShaderFormat::OpenGLCoreProfile, 4, 0);
474
475 const auto es2Rule = QShaderNode::Rule(QByteArrayLiteral("gles2"), {"#pragma include es2/foo.inc", "#pragma include es2/bar.inc"});
476 const auto gl3Rule = QShaderNode::Rule(QByteArrayLiteral("gl3"), {"#pragma include gl3/foo.inc", "#pragma include gl3/bar.inc"});
477 const auto gl32Rule = QShaderNode::Rule(QByteArrayLiteral("gl32"), {"#pragma include gl32/foo.inc", "#pragma include gl32/bar.inc"});
478 const auto gl3bisRule = QShaderNode::Rule(QByteArrayLiteral("gl3bis"), {"#pragma include gl3/foo.inc", "#pragma include gl3/bar.inc"});
479
480 auto node = QShaderNode();
481
482 // WHEN
483 node.addRule(openGLES2, es2Rule);
484 node.addRule(openGL3, gl3Rule);
485
486 // THEN
487 QCOMPARE(node.availableFormats().size(), 2);
488 QCOMPARE(node.availableFormats().at(0), openGLES2);
489 QCOMPARE(node.availableFormats().at(1), openGL3);
490 QCOMPARE(node.rule(openGLES2), es2Rule);
491 QCOMPARE(node.rule(openGL3), gl3Rule);
492 QCOMPARE(node.rule(openGL32), gl3Rule);
493 QCOMPARE(node.rule(openGL4), gl3Rule);
494
495 // WHEN
496 node.addRule(openGL32, gl32Rule);
497
498 // THEN
499 QCOMPARE(node.availableFormats().size(), 3);
500 QCOMPARE(node.availableFormats().at(0), openGLES2);
501 QCOMPARE(node.availableFormats().at(1), openGL3);
502 QCOMPARE(node.availableFormats().at(2), openGL32);
503 QCOMPARE(node.rule(openGLES2), es2Rule);
504 QCOMPARE(node.rule(openGL3), gl3Rule);
505 QCOMPARE(node.rule(openGL32), gl32Rule);
506 QCOMPARE(node.rule(openGL4), gl32Rule);
507
508 // WHEN
509 node.addRule(openGL3, gl3bisRule);
510
511 // THEN
512 QCOMPARE(node.availableFormats().size(), 3);
513 QCOMPARE(node.availableFormats().at(0), openGLES2);
514 QCOMPARE(node.availableFormats().at(1), openGL32);
515 QCOMPARE(node.availableFormats().at(2), openGL3);
516 QCOMPARE(node.rule(openGLES2), es2Rule);
517 QCOMPARE(node.rule(openGL3), gl3bisRule);
518 QCOMPARE(node.rule(openGL32), gl32Rule);
519 QCOMPARE(node.rule(openGL4), gl32Rule);
520 }
521
522 QTEST_MAIN(tst_QShaderNodes)
523
524 #include "tst_qshadernodes.moc"