本文整理汇总了C++中ZoomAndPanTester::view方法的典型用法代码示例。如果您正苦于以下问题:C++ ZoomAndPanTester::view方法的具体用法?C++ ZoomAndPanTester::view怎么用?C++ ZoomAndPanTester::view使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZoomAndPanTester
的用法示例。
在下文中一共展示了ZoomAndPanTester::view方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initializeViewport
void KisZoomAndPanTest::initializeViewport(ZoomAndPanTester &t, bool fullscreenMode, bool rotate, bool mirror)
{
QCOMPARE(t.image()->size(), QSize(640,441));
QCOMPARE(t.image()->xRes(), 1.0);
QCOMPARE(t.image()->yRes(), 1.0);
t.canvasController()->resize(QSize(500,500));
t.zoomController()->setZoom(KoZoomMode::ZOOM_CONSTANT, 1.0);
t.canvasController()->setPreferredCenter(QPoint(320,220));
QCOMPARE(t.canvasWidget()->size(), QSize(483,483));
QCOMPARE(t.canvasWidget()->size(), t.canvasController()->viewportSize());
QVERIFY(verifyOffset(t, QPoint(79,-21)));
if (fullscreenMode) {
QCOMPARE(t.canvasController()->preferredCenter(), QPointF(320,220));
QAction *action = t.view()->actionCollection()->action("view_show_just_the_canvas");
action->setChecked(true);
QVERIFY(verifyOffset(t, QPoint(79,-21)));
QCOMPARE(t.canvasController()->preferredCenter(), QPointF(329,220));
t.canvasController()->resize(QSize(483,483));
QCOMPARE(t.canvasWidget()->size(), QSize(483,483));
QCOMPARE(t.canvasWidget()->size(), t.canvasController()->viewportSize());
QVERIFY(verifyOffset(t, QPoint(79,-21)));
/**
* FIXME: here is a small flaw in KoCanvasControllerWidget
* We cannot set the center point explicitly, because it'll be rounded
* up by recenterPreferred function, so real center point will be
* different. Make the preferredCenter() return real center of the
* image instead of the set value
*/
QCOMPARE(t.canvasController()->preferredCenter(), QPointF(320.5,220));
}
if (rotate) {
t.canvasController()->rotateCanvas(90);
QVERIFY(verifyOffset(t, QPoint(-21,79)));
QVERIFY(compareWithRounding(QPointF(220,320), t.canvasController()->preferredCenter(), 2));
QCOMPARE(t.coordinatesConverter()->imageRectInWidgetPixels().topLeft().toPoint(), -t.coordinatesConverter()->documentOffset());
}
if (mirror) {
t.canvasController()->mirrorCanvas(true);
QVERIFY(verifyOffset(t, QPoint(78, -21)));
QVERIFY(compareWithRounding(QPointF(320,220), t.canvasController()->preferredCenter(), 2));
QCOMPARE(t.coordinatesConverter()->imageRectInWidgetPixels().topLeft().toPoint(), -t.coordinatesConverter()->documentOffset());
}
}