File indexing completed on 2024-05-19 15:26:48
0001 /* 0002 * SPDX-FileCopyrightText: 2019-2023 Mattia Basaglia <dev@dragon.best> 0003 * 0004 * SPDX-License-Identifier: GPL-3.0-or-later 0005 */ 0006 0007 #include <QtTest/QtTest> 0008 #include <filesystem> 0009 0010 #include "utils/quantize.hpp" 0011 0012 using namespace glaxnimate::utils::quantize; 0013 0014 0015 class TestTrace: public QObject 0016 { 0017 Q_OBJECT 0018 0019 private: 0020 0021 private Q_SLOTS: 0022 0023 void benchmark_eem() 0024 { 0025 auto path = std::filesystem::path(__FILE__).parent_path().parent_path() / "data" / "trace" / "images" / "flat.png"; 0026 QImage image(QString::fromStdString(path.u8string())); 0027 0028 QBENCHMARK 0029 { 0030 edge_exclusion_modes(image, 256); 0031 } 0032 } 0033 0034 void benchmark_octree() 0035 { 0036 auto path = std::filesystem::path(__FILE__).parent_path().parent_path() / "data" / "trace" / "images" / "flat.png"; 0037 QImage image(QString::fromStdString(path.u8string())); 0038 0039 QBENCHMARK 0040 { 0041 octree(image, 16); 0042 } 0043 } 0044 0045 void benchmark_kmeans() 0046 { 0047 auto path = std::filesystem::path(__FILE__).parent_path().parent_path() / "data" / "trace" / "images" / "flat.png"; 0048 QImage image(QString::fromStdString(path.u8string())); 0049 0050 QBENCHMARK 0051 { 0052 k_means(image, 16, 100, KMeansMatch::Closest); 0053 } 0054 } 0055 }; 0056 0057 QTEST_GUILESS_MAIN(TestTrace) 0058 #include "test_trace.moc" 0059 0060