File indexing completed on 2024-12-22 04:10:23
0001 /* 0002 * SPDX-FileCopyrightText: 2013 Dmitry Kazakov <dimula73@gmail.com> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #include "kis_perspective_transform_worker_test.h" 0008 0009 #include <simpletest.h> 0010 0011 #include <testutil.h> 0012 0013 #define USE_DOCUMENT 0 0014 #include "qimage_based_test.h" 0015 0016 #include "kis_perspectivetransform_worker.h" 0017 #include "kis_transaction.h" 0018 0019 0020 class PerspectiveWorkerTester : public TestUtil::QImageBasedTest 0021 { 0022 public: 0023 PerspectiveWorkerTester() 0024 : QImageBasedTest("perspective_worker_test") 0025 { 0026 KisSurrogateUndoStore *undoStore = new KisSurrogateUndoStore(); 0027 image = createImage(undoStore); 0028 image->initialRefreshGraph(); 0029 0030 QVERIFY(checkLayersInitial(image)); 0031 } 0032 0033 KisPaintDeviceSP paintDevice() { 0034 return findNode(image->root(), "paint1")->paintDevice(); 0035 } 0036 0037 void checkLayer(const QString &testName) { 0038 KisNodeSP node = findNode(image->root(), "paint1"); 0039 QVERIFY(checkOneLayer(image, node, testName, 3)); 0040 } 0041 0042 0043 KisImageSP image; 0044 }; 0045 0046 0047 void KisPerspectiveTransformWorkerTest::testSimpleTransform() 0048 { 0049 PerspectiveWorkerTester t; 0050 KisPaintDeviceSP dev = t.paintDevice(); 0051 0052 QPointF dx(326, 214); 0053 qreal aX = 1.32; 0054 qreal aY = 0.8; 0055 qreal z = 1024; 0056 0057 KisPerspectiveTransformWorker worker(dev, dx, aX, aY, z, true, 0); 0058 worker.run(); 0059 0060 t.checkLayer("simple_transform"); 0061 } 0062 0063 SIMPLE_TEST_MAIN(KisPerspectiveTransformWorkerTest)