278 QVERIFY(QColor(childSubImage.pixel(0, 0)) == QColor(Qt::red)); |
281 QVERIFY(QColor(childSubImage.pixel(0, 0)) == QColor(Qt::red)); |
279 |
282 |
280 QVERIFY(QColor(childInvalidSubImage.pixel(0, 0)) == QColor(Qt::white)); |
283 QVERIFY(QColor(childInvalidSubImage.pixel(0, 0)) == QColor(Qt::white)); |
281 } |
284 } |
282 |
285 |
|
286 void tst_QWindowSurface::staticContentsAndPartialUpdateSupport() |
|
287 { |
|
288 QWidget widget; |
|
289 MyWindowSurface surface(&widget); |
|
290 |
|
291 // Default values. |
|
292 QVERIFY(surface.hasPartialUpdateSupport()); |
|
293 QVERIFY(!surface.hasStaticContentsSupport()); |
|
294 |
|
295 // Partial: YES, Static: YES |
|
296 surface.setStaticContentsSupport(true); |
|
297 QVERIFY(surface.hasPartialUpdateSupport()); |
|
298 QVERIFY(surface.hasStaticContentsSupport()); |
|
299 |
|
300 // Static contents requires support for partial updates. |
|
301 // We simply ingore bad combinations and spit out a warning. |
|
302 |
|
303 // CONFLICT: Partial: NO, Static: YES |
|
304 QTest::ignoreMessage(QtWarningMsg, "QWindowSurface::setPartialUpdateSupport: static contents support requires partial update support"); |
|
305 surface.setPartialUpdateSupport(false); |
|
306 QVERIFY(surface.hasPartialUpdateSupport()); |
|
307 QVERIFY(surface.hasStaticContentsSupport()); |
|
308 |
|
309 // Partial: YES, Static: NO |
|
310 surface.setStaticContentsSupport(false); |
|
311 QVERIFY(surface.hasPartialUpdateSupport()); |
|
312 QVERIFY(!surface.hasStaticContentsSupport()); |
|
313 |
|
314 // Partial: NO, Static: NO |
|
315 surface.setPartialUpdateSupport(false); |
|
316 QVERIFY(!surface.hasPartialUpdateSupport()); |
|
317 QVERIFY(!surface.hasStaticContentsSupport()); |
|
318 |
|
319 // CONFLICT: Partial: NO, Static: YES |
|
320 QTest::ignoreMessage(QtWarningMsg, "QWindowSurface::setStaticContentsSupport: static contents support requires partial update support"); |
|
321 surface.setStaticContentsSupport(true); |
|
322 QVERIFY(!surface.hasPartialUpdateSupport()); |
|
323 QVERIFY(!surface.hasStaticContentsSupport()); |
|
324 |
|
325 // Partial: YES, Static: NO |
|
326 surface.setPartialUpdateSupport(true); |
|
327 QVERIFY(surface.hasPartialUpdateSupport()); |
|
328 QVERIFY(!surface.hasStaticContentsSupport()); |
|
329 } |
|
330 |
283 QTEST_MAIN(tst_QWindowSurface) |
331 QTEST_MAIN(tst_QWindowSurface) |
284 |
332 |
285 #else // Q_WS_MAC |
333 #else // Q_WS_MAC |
286 |
334 |
287 QTEST_NOOP_MAIN |
335 QTEST_NOOP_MAIN |