diff --git a/plugins/filters/tests/CMakeLists.txt b/plugins/filters/tests/CMakeLists.txt index 80eaef3e4a..be82286b66 100644 --- a/plugins/filters/tests/CMakeLists.txt +++ b/plugins/filters/tests/CMakeLists.txt @@ -1,12 +1,13 @@ set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} ) -include_directories( ) +include_directories(${CMAKE_SOURCE_DIR}/sdk/tests) macro_add_unittest_definitions() ########### next target ############### ecm_add_tests( kis_all_filter_test.cpp kis_crash_filter_test.cpp + kis_canny_filter_test.cc NAME_PREFIX "krita-filters-" LINK_LIBRARIES kritaimage Qt5::Test) diff --git a/plugins/filters/tests/kis_canny_filter_test.cc b/plugins/filters/tests/kis_canny_filter_test.cc new file mode 100644 index 0000000000..e8671b9586 --- /dev/null +++ b/plugins/filters/tests/kis_canny_filter_test.cc @@ -0,0 +1,27 @@ +#include "kis_canny_filter_test.h" + +#include "kis_edge_detection_kernel.h" + +#include +#include +#include + + +inline KisPaintDeviceSP loadTestImage(const QString &name) +{ + QImage image(TestUtil::fetchDataFileLazy(name)); + KisPaintDeviceSP dev = new KisPaintDevice(KoColorSpaceRegistry::instance()->rgb8()); + dev->convertFromQImage(image, nullptr); + return dev; +} + +void KisCannyFilterTest::testCannyFilter() +{ + KisPaintDeviceSP dev = loadTestImage("carrot.png"); + const QRect rect = dev->exactBounds(); + //KisEdgeDetectionKernel::applyCannyEdgeDetection() + QImage img = dev->convertToQImage(nullptr, rect); + img.save("canny_filter_tested.png"); +} + +QTEST_MAIN(KisCannyFilterTest) diff --git a/plugins/filters/tests/kis_canny_filter_test.h b/plugins/filters/tests/kis_canny_filter_test.h new file mode 100644 index 0000000000..748cf72b57 --- /dev/null +++ b/plugins/filters/tests/kis_canny_filter_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2020 Kuntal Majumder + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef KIS_ALL_FILTER_TEST_H +#define KIS_ALL_FILTER_TEST_H + +#include + +class KisCannyFilterTest : public QObject +{ + Q_OBJECT + +private Q_SLOTS: + + void testCannyFilter(); +}; + +#endif