/** @SYMTestCaseID GRAPHICS-WSERV-0021 @SYMDEF DEF081259 @SYMTestCaseDesc General PointerCursor Tests @SYMTestPriority High @SYMTestStatus Implemented @SYMTestActions Exercise the different pointercursor methods of a Window Server Session @SYMTestExpectedResults The methods are called without error */ void CTTSprite::GeneralPointerCursor() { if (!TestBase()->ConfigurationSupportsPointerEventTesting()) { INFO_PRINTF1(_L("Test skipped because config does not support pointer event testing")); return; } TInt currentSMode=TheClient->iScreen->CurrentScreenMode(); TInt altSMode=-1; if (TheClient->iScreen->NumScreenModes()>1) altSMode=(currentSMode==1?0:1); RWsSession &ws=TheClient->iWs; TRect rect=ws.PointerCursorArea(); TRect testRect1(TPoint(rect.iBr.iX/4,rect.iBr.iY/4),TSize(rect.Width()/2,rect.Height()/2)); TRect testRect2(TPoint(rect.iBr.iX/3,rect.iBr.iY/3),TSize(2*rect.Width()/3,2*rect.Height()/3)); ws.SetPointerCursorArea(testRect1); TEST(ws.PointerCursorArea()==testRect1); TEST(ws.PointerCursorArea(currentSMode)==testRect1); ws.SetPointerCursorArea(currentSMode,testRect2); TEST(ws.PointerCursorArea()==testRect2); TEST(ws.PointerCursorArea(currentSMode)==testRect2); ws.SetPointerCursorArea(rect); TEST(ws.PointerCursorArea()==rect); if (altSMode>=0) { rect=ws.PointerCursorArea(altSMode); testRect1.iTl.iX=rect.iBr.iX/4; testRect1.iTl.iY=rect.iBr.iY/4; testRect1.SetWidth(rect.Width()/2); testRect1.SetHeight(rect.Height()/2); ws.SetPointerCursorArea(altSMode,testRect1); TEST(ws.PointerCursorArea(altSMode)==testRect1); ws.SetPointerCursorArea(altSMode,rect); TEST(ws.PointerCursorArea(altSMode)==rect); } TPointerCursorMode currentMode=ws.PointerCursorMode(); TInt ii; TInt err1; for(ii=EPointerCursorFirstMode;ii<=EPointerCursorLastMode;ii++) { ws.SetPointerCursorMode(STATIC_CAST(TPointerCursorMode,ii)); err1 = ws.PointerCursorMode(); TEST(ii==err1); if (ii!=err1) INFO_PRINTF3(_L("ws.PointerCursorMode() return value - Expected: %d, Actual: %d"), ii, err1); } ws.SetPointerCursorMode(currentMode); TEST(currentMode==ws.PointerCursorMode()); TPoint point1(10,12); TPoint point2(24,20); ws.PointerCursorPosition(); ws.SetPointerCursorPosition(point1); TEST(ws.PointerCursorPosition()==point1); ws.SetPointerCursorPosition(point2); TEST(ws.PointerCursorPosition()==point2); }
MikeDrumTrackBuilder::MikeDrumTrackBuilder(void):m_pMouseHandlerNext(NULL), m_pRayPicker(NULL),m_nSelectedRect(-1) { mdsVector<3, double> p3Xlate; p3Xlate[0] = -30; CollisionRect testRect(10.0, 40.0, 90.0); testRect.TranslateBy(p3Xlate); m_arrRectsCopyFrom[0] = testRect; p3Xlate[1] = 120; CollisionRect testRect2(10.0, 40.0, 120.0); testRect2.TranslateBy(p3Xlate); m_arrRectsCopyFrom[1] = testRect2; }
void KisAsyncMergerTest::testMerger() { const KoColorSpace * colorSpace = KoColorSpaceRegistry::instance()->rgb8(); KisImageSP image = new KisImage(0, 640, 441, colorSpace, "merger test"); QImage sourceImage1(QString(FILES_DATA_DIR) + QDir::separator() + "hakonepa.png"); QImage sourceImage2(QString(FILES_DATA_DIR) + QDir::separator() + "inverted_hakonepa.png"); QImage referenceProjection(QString(FILES_DATA_DIR) + QDir::separator() + "merged_hakonepa.png"); KisPaintDeviceSP device1 = new KisPaintDevice(colorSpace); KisPaintDeviceSP device2 = new KisPaintDevice(colorSpace); device1->convertFromQImage(sourceImage1, 0, 0, 0); device2->convertFromQImage(sourceImage2, 0, 0, 0); KisFilterSP filter = KisFilterRegistry::instance()->value("blur"); Q_ASSERT(filter); KisFilterConfiguration *configuration = filter->defaultConfiguration(0); Q_ASSERT(configuration); KisLayerSP paintLayer1 = new KisPaintLayer(image, "paint1", OPACITY_OPAQUE_U8, device1); KisLayerSP paintLayer2 = new KisPaintLayer(image, "paint2", OPACITY_OPAQUE_U8, device2); KisLayerSP groupLayer = new KisGroupLayer(image, "group", 200/*OPACITY_OPAQUE*/); KisLayerSP blur1 = new KisAdjustmentLayer(image, "blur1", configuration, 0); image->addNode(paintLayer1, image->rootLayer()); image->addNode(groupLayer, image->rootLayer()); image->addNode(paintLayer2, groupLayer); image->addNode(blur1, groupLayer); QRect testRect1(0,0,100,441); QRect testRect2(100,0,400,441); QRect testRect3(500,0,140,441); QRect testRect4(580,381,40,40); QRect cropRect(image->bounds()); KisMergeWalker walker(cropRect); KisAsyncMerger merger; walker.collectRects(paintLayer2, testRect1); merger.startMerge(walker); walker.collectRects(paintLayer2, testRect2); merger.startMerge(walker); walker.collectRects(paintLayer2, testRect3); merger.startMerge(walker); walker.collectRects(paintLayer2, testRect4); merger.startMerge(walker); // Old style merging: has artefacts at x=100 and x=500 // And should be turned on inside KisLayer /* paintLayer2->setDirty(testRect1); QTest::qSleep(3000); paintLayer2->setDirty(testRect2); QTest::qSleep(3000); paintLayer2->setDirty(testRect3); QTest::qSleep(3000); paintLayer2->setDirty(testRect4); QTest::qSleep(3000); */ KisLayerSP rootLayer = image->rootLayer(); QVERIFY(rootLayer->exactBounds() == image->bounds()); QImage resultProjection = rootLayer->projection()->convertToQImage(0); resultProjection.save(QString(FILES_OUTPUT_DIR) + QDir::separator() + "actual_merge_result.png"); QPoint pt; QVERIFY(TestUtil::compareQImages(pt, resultProjection, referenceProjection, 1)); }