Warning, file /education/kstars/Tests/ekos/auxiliary/darkprocessor/testsubtraction.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 SPDX-FileCopyrightText: 2021 Jasem Mutlaq 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #include <QTest> 0008 #include <memory> 0009 0010 #include <QObject> 0011 #include "fitsviewer/fitsdata.h" 0012 #include "ekos/auxiliary/darkprocessor.h" 0013 0014 class TestSubtraction : public QObject 0015 { 0016 Q_OBJECT 0017 0018 public: 0019 TestSubtraction(); 0020 ~TestSubtraction() override = default; 0021 0022 private slots: 0023 void basicTest(); 0024 }; 0025 0026 #include "testsubtraction.moc" 0027 0028 TestSubtraction::TestSubtraction() : QObject() 0029 { 0030 } 0031 0032 void TestSubtraction::basicTest() 0033 { 0034 const QString filename = "../Tests/ekos/auxiliary/darkprocessor/hotpixels.fits"; 0035 if (!QFileInfo::exists(filename)) 0036 QSKIP(QString("Failed to locate file %1, skipping test.").arg(filename).toLatin1()); 0037 0038 // Load FITS Data 0039 QSharedPointer<FITSData> defectiveData; 0040 defectiveData.reset(new FITSData()); 0041 QFuture<bool> result = defectiveData->loadFromFile(filename); 0042 result.waitForFinished(); 0043 0044 if (result.result() == false) 0045 QSKIP("Failed to load image, skipping test."); 0046 0047 // Get Image Buffer 0048 uint8_t const *buffer = defectiveData->getImageBuffer(); 0049 0050 // Subtract from self 0051 QPointer<Ekos::DarkProcessor> processor = new Ekos::DarkProcessor(); 0052 processor->subtractDarkData(defectiveData, defectiveData, 0, 0); 0053 0054 // Verify that the buffer was indeed updated and zeroed, only check every 1000 pixels. 0055 for (uint32_t i = 0; i < defectiveData->samplesPerChannel(); i += 1000) 0056 QCOMPARE(buffer[i], 0); 0057 } 0058 0059 0060 QTEST_GUILESS_MAIN(TestSubtraction)