import QtQuick 2.3 import QtTest 1.0 Item { id: root width: 200 height: 100 Rectangle { width: 100 height: 100 color: "red" } Rectangle { x: 100 width: 100 height: 100 color: "green" } TestCase { when: windowShown function test_grabImageOnRetinaDisplay() { if (Qt.colorEqual(grabImage(root).pixel(150, 50), "red")) { verify(grabImage(root).pixel(300, 50) !== undefined, "retina display, but image not big enough"); } else { warn("not a retina display"); } } } }