From 17850cad105aefca8c63d08004bb044f1715ab45 Mon Sep 17 00:00:00 2001 From: Jesse Mapel Date: Mon, 18 Jul 2022 11:58:57 -0700 Subject: [PATCH] Split Fixtures up and cleaned test headers --- isis/tests/AutoseedTests.cpp | 2 +- isis/tests/CSMCameraTests.cpp | 5 +- isis/tests/Cam2mapTests.cpp | 2 +- isis/tests/CameraFixtures.cpp | 963 +++++++++ isis/tests/CameraFixtures.h | 171 ++ isis/tests/CameraTests.cpp | 2 +- .../ClipperNacRollingShutterCameraTests.cpp | 2 +- isis/tests/ClipperPushBroomCameraTests.cpp | 2 +- isis/tests/ClipperWacFcCameraTests.cpp | 2 +- isis/tests/CnetWinnowTests.cpp | 2 +- isis/tests/CsmBundleObservationTests.cpp | 2 +- isis/tests/CsmFixtures.cpp | 206 ++ isis/tests/CsmFixtures.h | 77 + isis/tests/CubeFixtures.cpp | 360 ++++ isis/tests/CubeFixtures.h | 83 + isis/tests/CubeStretchTest.cpp | 34 +- isis/tests/CubeTests.cpp | 2 +- isis/tests/Fixtures.cpp | 1812 +---------------- isis/tests/Fixtures.h | 432 +--- isis/tests/FunctionalTestsApollocal.cpp | 2 +- isis/tests/FunctionalTestsApollofindrx.cpp | 2 +- .../FunctionalTestsApollopanstitcher.cpp | 2 +- isis/tests/FunctionalTestsApolloremrx.cpp | 3 +- isis/tests/FunctionalTestsAutomos.cpp | 3 +- isis/tests/FunctionalTestsBandnorm.cpp | 2 +- isis/tests/FunctionalTestsCam2cam.cpp | 2 +- isis/tests/FunctionalTestsCamdev.cpp | 2 +- isis/tests/FunctionalTestsCaminfo.cpp | 5 +- isis/tests/FunctionalTestsCampt.cpp | 3 +- isis/tests/FunctionalTestsCamrange.cpp | 2 +- isis/tests/FunctionalTestsCamstats.cpp | 2 +- isis/tests/FunctionalTestsChan1m32isis.cpp | 1 - isis/tests/FunctionalTestsCiss2isis.cpp | 1 - isis/tests/FunctionalTestsCkwriter.cpp | 6 +- isis/tests/FunctionalTestsCnetbin2pvl.cpp | 2 +- isis/tests/FunctionalTestsCnetcheck.cpp | 2 +- isis/tests/FunctionalTestsCnetcombinept.cpp | 2 +- isis/tests/FunctionalTestsCnetextract.cpp | 2 +- isis/tests/FunctionalTestsCnetpvl2bin.cpp | 2 +- isis/tests/FunctionalTestsCnetstats.cpp | 16 +- isis/tests/FunctionalTestsCrism2isis.cpp | 1 - isis/tests/FunctionalTestsCrop.cpp | 3 +- isis/tests/FunctionalTestsCsminit.cpp | 3 +- isis/tests/FunctionalTestsCtxcal.cpp | 30 +- isis/tests/FunctionalTestsCubeatt.cpp | 10 +- isis/tests/FunctionalTestsDemprep.cpp | 2 - isis/tests/FunctionalTestsEis2isis.cpp | 1 - isis/tests/FunctionalTestsEnlarge.cpp | 2 +- isis/tests/FunctionalTestsFillGap.cpp | 8 +- isis/tests/FunctionalTestsFindGaps.cpp | 4 +- isis/tests/FunctionalTestsFindfeatures.cpp | 2 +- .../FunctionalTestsFindimageoverlaps.cpp | 6 +- isis/tests/FunctionalTestsFits2isis.cpp | 1 - isis/tests/FunctionalTestsFootprintinit.cpp | 6 +- isis/tests/FunctionalTestsFrameStitch.cpp | 2 +- isis/tests/FunctionalTestsGetsn.cpp | 4 +- isis/tests/FunctionalTestsGllssical.cpp | 12 +- isis/tests/FunctionalTestsGrid.cpp | 23 +- isis/tests/FunctionalTestsHi2isis.cpp | 1 - isis/tests/FunctionalTestsHical.cpp | 1 - isis/tests/FunctionalTestsHicolormos.cpp | 2 +- isis/tests/FunctionalTestsHicrop.cpp | 238 +-- isis/tests/FunctionalTestsHicubeit.cpp | 3 +- isis/tests/FunctionalTestsHicubenorm.cpp | 2 +- isis/tests/FunctionalTestsHidtmgen.cpp | 3 +- isis/tests/FunctionalTestsHimos.cpp | 3 +- isis/tests/FunctionalTestsHist.cpp | 2 +- isis/tests/FunctionalTestsHrsc2isis.cpp | 5 +- isis/tests/FunctionalTestsIsis2Std.cpp | 2 +- isis/tests/FunctionalTestsIsis2ascii.cpp | 2 +- isis/tests/FunctionalTestsIsis2pds.cpp | 2 +- isis/tests/FunctionalTestsIsisImport.cpp | 2 +- .../FunctionalTestsIsisImportCassiniISS.cpp | 2 +- isis/tests/FunctionalTestsIsisImportEis.cpp | 54 +- .../FunctionalTestsIsisImportKaguyaMI.cpp | 2 +- .../FunctionalTestsIsisImportKaguyaTC.cpp | 5 +- isis/tests/FunctionalTestsIsisImportLo.cpp | 2 +- .../tests/FunctionalTestsIsisImportLroNac.cpp | 2 +- isis/tests/FunctionalTestsIsisImportMerMI.cpp | 9 +- isis/tests/FunctionalTestsIsisexport.cpp | 2 +- isis/tests/FunctionalTestsJigsaw.cpp | 4 +- isis/tests/FunctionalTestsJitterfit.cpp | 2 +- isis/tests/FunctionalTestsKaguyami2isis.cpp | 1 - isis/tests/FunctionalTestsKaguyatc2isis.cpp | 1 - isis/tests/FunctionalTestsLeisa2isis.cpp | 1 - isis/tests/FunctionalTestsLo2isis.cpp | 1 - isis/tests/FunctionalTestsLorri2isis.cpp | 3 +- isis/tests/FunctionalTestsLronac2isis.cpp | 1 - isis/tests/FunctionalTestsLronac2pds.cpp | 2 +- isis/tests/FunctionalTestsLronaccal.cpp | 27 +- isis/tests/FunctionalTestsLronacpho.cpp | 25 +- isis/tests/FunctionalTestsLrowac2isis.cpp | 1 - isis/tests/FunctionalTestsLrowac2pds.cpp | 2 +- isis/tests/FunctionalTestsLrowaccal.cpp | 19 +- isis/tests/FunctionalTestsLrowacphomap.cpp | 17 +- isis/tests/FunctionalTestsMap2map.cpp | 2 +- isis/tests/FunctionalTestsMapmos.cpp | 8 +- isis/tests/FunctionalTestsMappt.cpp | 72 +- isis/tests/FunctionalTestsMaptrim.cpp | 2 +- isis/tests/FunctionalTestsMarci2isis.cpp | 11 +- isis/tests/FunctionalTestsMarcical.cpp | 5 +- isis/tests/FunctionalTestsMarciflip.cpp | 1 - isis/tests/FunctionalTestsMimap2isis.cpp | 1 - isis/tests/FunctionalTestsMoccal.cpp | 2 +- isis/tests/FunctionalTestsMsi2isis.cpp | 2 +- isis/tests/FunctionalTestsMvic2isis.cpp | 4 +- isis/tests/FunctionalTestsNocam2map.cpp | 3 +- isis/tests/FunctionalTestsNoproj.cpp | 6 +- isis/tests/FunctionalTestsOverlapstats.cpp | 4 +- isis/tests/FunctionalTestsPds2isis.cpp | 1 - isis/tests/FunctionalTestsPhocube.cpp | 2 +- isis/tests/FunctionalTestsPointreg.cpp | 22 +- isis/tests/FunctionalTestsReduce.cpp | 2 +- isis/tests/FunctionalTestsRingsautomos.cpp | 2 +- isis/tests/FunctionalTestsSegment.cpp | 2 +- isis/tests/FunctionalTestsShadow.cpp | 7 +- .../FunctionalTestsSocetlinescankeywords.cpp | 2 +- isis/tests/FunctionalTestsSpiceinit.cpp | 3 +- isis/tests/FunctionalTestsSpiceserver.cpp | 63 +- isis/tests/FunctionalTestsSpkwriter.cpp | 8 +- isis/tests/FunctionalTestsStd2isis.cpp | 2 +- isis/tests/FunctionalTestsStretch.cpp | 2 +- isis/tests/FunctionalTestsSumspice.cpp | 2 +- isis/tests/FunctionalTestsTgocassis2isis.cpp | 1 - isis/tests/FunctionalTestsTgocassisstitch.cpp | 72 +- .../FunctionalTestsTgocassisunstitch.cpp | 137 +- isis/tests/FunctionalTestsThm2isis.cpp | 16 +- isis/tests/FunctionalTestsVikcal.cpp | 14 +- isis/tests/ImageImporterTests.cpp | 32 +- isis/tests/Map2camTests.cpp | 2 +- isis/tests/NearMsiCameraTests.cpp | 2 +- isis/tests/NetworkFixtures.cpp | 311 +++ isis/tests/NetworkFixtures.h | 120 ++ isis/tests/OsirisRexOCamsCameraTests.cpp | 2 +- isis/tests/SensorUtilWrappersTests.cpp | 2 +- isis/tests/TableTests.cpp | 3 +- isis/tests/TempFixtures.cpp | 9 + isis/tests/TempFixtures.h | 19 + isis/tests/TestUtilities.cpp | 19 - isis/tests/TestUtilities.h | 3 - isis/tests/UnitTestImagePolygon.cpp | 3 +- isis/tests/UnitTestMarciCam.cpp | 18 +- 142 files changed, 2995 insertions(+), 2831 deletions(-) create mode 100644 isis/tests/CameraFixtures.cpp create mode 100644 isis/tests/CameraFixtures.h create mode 100644 isis/tests/CsmFixtures.cpp create mode 100644 isis/tests/CsmFixtures.h create mode 100644 isis/tests/CubeFixtures.cpp create mode 100644 isis/tests/CubeFixtures.h create mode 100644 isis/tests/NetworkFixtures.cpp create mode 100644 isis/tests/NetworkFixtures.h create mode 100644 isis/tests/TempFixtures.cpp create mode 100644 isis/tests/TempFixtures.h diff --git a/isis/tests/AutoseedTests.cpp b/isis/tests/AutoseedTests.cpp index 5f316354e1..8fbcc3fc9a 100644 --- a/isis/tests/AutoseedTests.cpp +++ b/isis/tests/AutoseedTests.cpp @@ -26,7 +26,7 @@ #include "SerialNumberList.h" #include "TestUtilities.h" -#include "Fixtures.h" +#include "NetworkFixtures.h" #include "gmock/gmock.h" diff --git a/isis/tests/CSMCameraTests.cpp b/isis/tests/CSMCameraTests.cpp index 1d57ef6025..e840b80f62 100644 --- a/isis/tests/CSMCameraTests.cpp +++ b/isis/tests/CSMCameraTests.cpp @@ -5,7 +5,7 @@ #include "csm/Ellipsoid.h" #include "CSMCamera.h" -#include "Fixtures.h" +#include "CsmFixtures.h" #include "iTime.h" #include "Latitude.h" #include "Longitude.h" @@ -13,15 +13,12 @@ #include "Mocks.h" #include "TestUtilities.h" #include "FileName.h" -#include "Fixtures.h" #include "SerialNumber.h" #include "SerialNumberList.h" #include using json = nlohmann::json; -#include "gmock/gmock.h" - using namespace Isis; TEST_F(CSMCameraFixture, SetImage) { diff --git a/isis/tests/Cam2mapTests.cpp b/isis/tests/Cam2mapTests.cpp index a55938ff8e..04174dba17 100644 --- a/isis/tests/Cam2mapTests.cpp +++ b/isis/tests/Cam2mapTests.cpp @@ -13,7 +13,7 @@ #include "TestUtilities.h" #include "FileName.h" #include "ProjectionFactory.h" -#include "Fixtures.h" +#include "CameraFixtures.h" #include "Mocks.h" using namespace Isis; diff --git a/isis/tests/CameraFixtures.cpp b/isis/tests/CameraFixtures.cpp new file mode 100644 index 0000000000..7c0f605a2a --- /dev/null +++ b/isis/tests/CameraFixtures.cpp @@ -0,0 +1,963 @@ +#include "CameraFixtures.h" + +#include +#include + +#include +#include +#include + +#include "AlphaCube.h" +#include "Brick.h" +#include "Cube.h" +#include "FileName.h" +#include "LineManager.h" +#include "Pvl.h" +#include "PvlGroup.h" +#include "PvlKeyword.h" +#include "PvlObject.h" +#include "Table.h" +#include "TableField.h" +#include "TableRecord.h" + +using json = nlohmann::json; + +namespace Isis { + + void PushFramePair::SetUp() { + numSamps = 16; + numBands = 3; + frameHeight = 12; + numFrames = 10; + + evenCube.reset(new Cube()); + evenCube->setDimensions(numSamps, frameHeight * numFrames, numBands); + evenCube->create(tempDir.path() + "/even.cub"); + + oddCube.reset(new Cube()); + oddCube->setDimensions(numSamps, frameHeight * numFrames, numBands); + oddCube->create(tempDir.path() + "/odd.cub"); + + Brick frameBrick(numSamps, frameHeight, numBands, evenCube->pixelType()); + + for (int frameIndex = 0; frameIndex < numFrames; frameIndex++) { + for (int brickIndex = 0; brickIndex < frameBrick.size(); brickIndex++) { + frameBrick[brickIndex] = frameIndex + 1; + } + frameBrick.SetBasePosition(1,frameIndex * frameHeight + 1,1); + if (frameIndex % 2 == 0) { + oddCube->write(frameBrick); + } + else { + evenCube->write(frameBrick); + } + } + + PvlGroup intGroup("Instrument"); + intGroup += PvlKeyword("StartTime", "2008-06-14T13:32:10.933207"); + evenCube->putGroup(intGroup); + oddCube->putGroup(intGroup); + + evenCube->reopen("rw"); + oddCube->reopen("rw"); + + } + + + void FlippedPushFramePair::SetUp() { + numSamps = 16; + numBands = 3; + frameHeight = 12; + numFrames = 10; + + evenCube.reset(new Cube()); + evenCube->setDimensions(numSamps, frameHeight * numFrames, numBands); + evenCube->create(tempDir.path() + "/even.cub"); + + oddCube.reset(new Cube()); + oddCube->setDimensions(numSamps, frameHeight * numFrames, numBands); + oddCube->create(tempDir.path() + "/odd.cub"); + + Brick frameBrick(numSamps, frameHeight, numBands, evenCube->pixelType()); + + for (int frameIndex = 0; frameIndex < numFrames; frameIndex++) { + for (int brickIndex = 0; brickIndex < frameBrick.size(); brickIndex++) { + frameBrick[brickIndex] = numFrames - frameIndex; + } + frameBrick.SetBasePosition(1,frameIndex * frameHeight + 1,1); + if (frameIndex % 2 == 0) { + evenCube->write(frameBrick); + } + else { + oddCube->write(frameBrick); + } + } + + PvlGroup intGroup("Instrument"); + intGroup += PvlKeyword("DataFlipped", "True"); + intGroup += PvlKeyword("StartTime", "2008-06-14T13:32:10.933207"); + evenCube->putGroup(intGroup); + oddCube->putGroup(intGroup); + + evenCube->reopen("rw"); + oddCube->reopen("rw"); + + } + + + void DemCube::SetUp() { + DefaultCube::SetUp(); + testCube->label()->object(4)["SolarLongitude"] = "294.73518831328"; + testCube->reopen("rw"); + + std::ifstream cubeLabel("data/defaultImage/demCube.pvl"); + + Pvl demLabel; + cubeLabel >> demLabel; + demLabel.findObject("IsisCube").findObject("Core").findGroup("Pixels")["Type"] = "Real"; + + demCube = new Cube(); + demCube->fromLabel(tempDir.path() + "/demCube.cub", demLabel, "rw"); + + TableField minRadius("MinimumRadius", TableField::Double); + TableField maxRadius("MaximumRadius", TableField::Double); + + TableRecord record; + record += minRadius; + record += maxRadius; + + Table shapeModelStatistics("ShapeModelStatistics", record); + + record[0] = 3376.2; + record[1] = 3396.19; + shapeModelStatistics += record; + + demCube->write(shapeModelStatistics); + + int xCenter = int(demCube->lineCount()/2); + int yCenter = int(demCube->sampleCount()/2); + double radius = std::min(xCenter, yCenter); + double depth = 30; + double pointRadius; + + LineManager line(*demCube); + double pixelValue; + double base = demCube->label()->findObject("IsisCube").findObject("Core").findGroup("Pixels")["Base"]; + double xPos = 0.0; + + for(line.begin(); !line.end(); line++) { + for(int yPos = 0; yPos < line.size(); yPos++) { + pointRadius = pow(pow((xPos - xCenter), 2) + pow((yPos - yCenter), 2), 0.5); + if (pointRadius < radius) { + pixelValue = ((sin(((M_PI*pointRadius)/(2*radius))) * depth) + depth) + base; + } + else { + pixelValue = base + (depth * 2); + } + line[yPos] = (double) pixelValue; + } + xPos++; + demCube->write(line); + } + + demCube->reopen("rw"); + } + + + void DemCube::TearDown() { + if (demCube->isOpen()) { + demCube->close(); + } + + delete demCube; + } + + + void DefaultCube::SetUp() { + TempTestingFiles::SetUp(); + + std::ifstream isdFile("data/defaultImage/defaultCube.isd"); + std::ifstream cubeLabel("data/defaultImage/defaultCube.pvl"); + std::ifstream projCubeLabel("data/defaultImage/projDefaultCube.pvl"); + + isdFile >> isd; + cubeLabel >> label; + projCubeLabel >> projLabel; + + testCube = new Cube(); + testCube->fromIsd(tempDir.path() + "/default.cub", label, isd, "rw"); + + LineManager line(*testCube); + int pixelValue = 1; + for(line.begin(); !line.end(); line++) { + for(int i = 0; i < line.size(); i++) { + line[i] = (double) (pixelValue % 255); + pixelValue++; + } + testCube->write(line); + } + + projTestCube = new Cube(); + projTestCube->fromIsd(tempDir.path() + "/default.level2.cub", projLabel, isd, "rw"); + + line = LineManager(*projTestCube); + pixelValue = 1; + for(line.begin(); !line.end(); line++) { + for(int i = 0; i < line.size(); i++) { + line[i] = (double) (pixelValue % 255); + pixelValue++; + } + projTestCube->write(line); + } + projTestCube->reopen("rw"); + } + + + void DefaultCube::resizeCube(int samples, int lines, int bands) { + label = Pvl(); + PvlObject &isisCube = testCube->label()->findObject("IsisCube"); + label.addObject(isisCube); + + PvlGroup &dim = label.findObject("IsisCube").findObject("Core").findGroup("Dimensions"); + dim.findKeyword("Samples").setValue(QString::number(samples)); + dim.findKeyword("Lines").setValue(QString::number(lines)); + dim.findKeyword("Bands").setValue(QString::number(bands)); + + delete testCube; + testCube = new Cube(); + testCube->fromIsd(tempDir.path() + "/default.cub", label, isd, "rw"); + + LineManager line(*testCube); + int pixelValue = 1; + for(int band = 1; band <= bands; band++) { + for (int i = 1; i <= testCube->lineCount(); i++) { + line.SetLine(i, band); + for (int j = 0; j < line.size(); j++) { + line[j] = (double) (pixelValue % 255); + pixelValue++; + } + testCube->write(line); + } + } + + projLabel = Pvl(); + PvlObject &isisProjCube= projTestCube->label()->findObject("IsisCube"); + projLabel.addObject(isisProjCube); + + PvlGroup &projDim = projLabel.findObject("IsisCube").findObject("Core").findGroup("Dimensions"); + projDim.findKeyword("Samples").setValue(QString::number(samples)); + projDim.findKeyword("Lines").setValue(QString::number(lines)); + projDim.findKeyword("Bands").setValue(QString::number(bands)); + + delete projTestCube; + projTestCube = new Cube(); + projTestCube->fromIsd(tempDir.path() + "/default.level2.cub", projLabel, isd, "rw"); + + line = LineManager(*projTestCube); + pixelValue = 1; + for(int band = 1; band <= bands; band++) { + for (int i = 1; i <= projTestCube->lineCount(); i++) { + line.SetLine(i, band); + for (int j = 0; j < line.size(); j++) { + line[j] = (double) (pixelValue % 255); + pixelValue++; + } + projTestCube->write(line); + } + } + } + + + void DefaultCube::TearDown() { + if (testCube->isOpen()) { + testCube->close(); + } + + if (projTestCube->isOpen()) { + projTestCube->close(); + } + + delete testCube; + delete projTestCube; + } + + + void LineScannerCube::SetUp() { + TempTestingFiles::SetUp(); + + std::ifstream isdFile("data/LineScannerImage/defaultLineScanner.isd"); + std::ifstream cubeLabel("data/LineScannerImage/defaultLineScanner.pvl"); + std::ifstream projCubeLabel("data/LineScannerImage/projDefaultLineScanner.pvl"); + + isdFile >> isd; + cubeLabel >> label; + projCubeLabel >> projLabel; + + testCube = new Cube(); + testCube->fromIsd(tempDir.path() + "/default.cub", label, isd, "rw"); + LineManager line(*testCube); + int pixelValue = 1; + for(line.begin(); !line.end(); line++) { + for(int i = 0; i < line.size(); i++) { + line[i] = (double) (pixelValue % 255); + pixelValue++; + } + testCube->write(line); + } + + projTestCube = new Cube(); + projTestCube->fromIsd(tempDir.path() + "/default.level2.cub", projLabel, isd, "rw"); + line = LineManager(*projTestCube); + pixelValue = 1; + for(line.begin(); !line.end(); line++) { + for(int i = 0; i < line.size(); i++) { + line[i] = (double) (pixelValue % 255); + pixelValue++; + } + projTestCube->write(line); + } + } + + + void LineScannerCube::TearDown() { + if (testCube->isOpen()) { + testCube->close(); + } + + if (projTestCube->isOpen()) { + projTestCube->close(); + } + + delete testCube; + delete projTestCube; + } + + + void OffBodyCube::SetUp() { + TempTestingFiles::SetUp(); + testCube = new Cube("data/offBodyImage/EW0131773041G.cal.crop.cub"); + } + + + void OffBodyCube::TearDown() { + if (testCube->isOpen()) { + testCube->close(); + } + + delete testCube; + } + + + void MiniRFCube::SetUp() { + TempTestingFiles::SetUp(); + testCube = new Cube("data/miniRFImage/LSZ_04866_1CD_XKU_89N109_V1_lev1.crop.cub"); + } + + + void MiniRFCube::TearDown() { + if (testCube->isOpen()) { + testCube->close(); + } + + delete testCube; + } + + + void MroCtxCube::SetUp() { + TempTestingFiles::SetUp(); + + QString testPath = tempDir.path() + "/test.cub"; + QFile::copy("data/mroCtxImage/ctxTestImage.cub", testPath); + testCube.reset(new Cube(testPath)); + } + + + void MroCtxCube::TearDown() { + testCube.reset(); + } + + + void GalileoSsiCube::SetUp() { + DefaultCube::SetUp(); + + // Change default dims + PvlGroup &dim = label.findObject("IsisCube").findObject("Core").findGroup("Dimensions"); + dim.findKeyword("Samples").setValue("800"); + dim.findKeyword("Lines").setValue("800"); + dim.findKeyword("Bands").setValue("1"); + + delete testCube; + testCube = new Cube(); + + FileName newCube(tempDir.path() + "/testing.cub"); + + testCube->fromIsd(newCube, label, isd, "rw"); + PvlGroup &kernels = testCube->label()->findObject("IsisCube").findGroup("Kernels"); + kernels.findKeyword("NaifFrameCode").setValue("-77001"); + PvlGroup &inst = testCube->label()->findObject("IsisCube").findGroup("Instrument"); + + std::istringstream iss(R"( + Group = Instrument + SpacecraftName = "Galileo Orbiter" + InstrumentId = "SOLID STATE IMAGING SYSTEM" + TargetName = IO + SpacecraftClockStartCount = 05208734.39 + StartTime = 1999-10-11T18:05:15.815 + ExposureDuration = 0.04583 + GainModeId = 100000 + TelemetryFormat = IM4 + LightFloodStateFlag = ON + InvertedClockStateFlag = "NOT INVERTED" + BlemishProtectionFlag = OFF + ExposureType = NORMAL + ReadoutMode = Contiguous + FrameDuration = 8.667 + Summing = 1 + FrameModeId = FULL + End_Group + )"); + + PvlGroup newInstGroup; + iss >> newInstGroup; + inst = newInstGroup; + + PvlGroup &bandBin = testCube->label()->findObject("IsisCube").findGroup("BandBin"); + std::istringstream bss(R"( + Group = BandBin + FilterName = RED + FilterNumber = 2 + Center = 0.671 + Width = .06 + End_Group + )"); + + PvlGroup newBandBin; + bss >> newBandBin; + bandBin = newBandBin; + + PvlObject &naifKeywords = testCube->label()->findObject("NaifKeywords"); + + std::istringstream nk(R"( + Object = NaifKeywords + BODY_CODE = 501 + BODY501_RADII = (1829.4, 1819.3, 1815.7) + BODY_FRAME_CODE = 10023 + INS-77001_FOCAL_LENGTH = 1500.46655964 + INS-77001_K1 = -2.4976983626e-05 + INS-77001_PIXEL_PITCH = 0.01524 + INS-77001_TRANSX = (0.0, 0.01524, 0.0) + INS-77001_TRANSY = (0.0, 0.0, 0.01524) + INS-77001_ITRANSS = (0.0, 65.6167979, 0.0) + INS-77001_ITRANSL = (0.0, 0.0, 65.6167979) + INS-77001_BORESIGHT_SAMPLE = 400.0 + INS-77001_BORESIGHT_LINE = 400.0 + End_Object + )"); + + PvlObject newNaifKeywords; + nk >> newNaifKeywords; + naifKeywords = newNaifKeywords; + + std::istringstream ar(R"( + Group = Archive + DataSetId = GO-J/JSA-SSI-2-REDR-V1.0 + ProductId = 24I0146 + ObservationId = 24ISGLOCOL01 + DataType = RADIANCE + CalTargetCode = 24 + End_Group + )"); + + PvlGroup &archive = testCube->label()->findObject("IsisCube").findGroup("Archive"); + PvlGroup newArchive; + ar >> newArchive; + archive = newArchive; + + LineManager line(*testCube); + for(line.begin(); !line.end(); line++) { + for(int i = 0; i < line.size(); i++) { + line[i] = (double)(i+1); + } + testCube->write(line); + } + + // need to remove old camera pointer + delete testCube; + testCube = new Cube(newCube, "rw"); + } + + + void GalileoSsiCube::TearDown() { + if (testCube) { + delete testCube; + } + } + + + void MroHiriseCube::SetUp() { + DefaultCube::SetUp(); + dejitteredCube.open("data/mroKernels/mroHiriseProj.cub"); + + // force real DNs + QString fname = testCube->fileName(); + + PvlObject &core = label.findObject("IsisCube").findObject("Core"); + PvlGroup &pixels = core.findGroup("Pixels"); + pixels.findKeyword("Type").setValue("Real"); + + delete testCube; + testCube = new Cube(); + + FileName newCube(tempDir.path() + "/testing.cub"); + + testCube->fromIsd(newCube, label, isd, "rw"); + PvlGroup &kernels = testCube->label()->findObject("IsisCube").findGroup("Kernels"); + kernels.findKeyword("NaifFrameCode").setValue("-74999"); + PvlGroup &inst = testCube->label()->findObject("IsisCube").findGroup("Instrument"); + std::istringstream iss(R"( + Group = Instrument + SpacecraftName = "MARS RECONNAISSANCE ORBITER" + InstrumentId = HIRISE + TargetName = Mars + StartTime = 2008-05-17T09:37:24.7300819 + StopTime = 2008-05-17T09:37:31.0666673 + ObservationStartCount = 895484264:44383 + SpacecraftClockStartCount = 895484264:57342 + SpacecraftClockStopCount = 895484272:12777 + ReadoutStartCount = 895484659:31935 + CalibrationStartTime = 2006-11-08T04:49:13.952 + CalibrationStartCount = 847428572:51413 + AnalogPowerStartTime = 2006-11-08T04:48:34.478 + AnalogPowerStartCount = 847428533:20297 + MissionPhaseName = "PRIMARY SCIENCE PHASE" + LineExposureDuration = 95.0625 + ScanExposureDuration = 95.0625 + DeltaLineTimerCount = 337 + Summing = 1 + Tdi = 128 + FocusPositionCount = 2020 + PoweredCpmmFlag = (On, On, On, On, On, On, On, On, On, On, On, + On, On, On) + CpmmNumber = 8 + CcdId = RED5 + ChannelNumber = 0 + LookupTableType = Stored + LookupTableNumber = 19 + LookupTableMinimum = -9998 + LookupTableMaximum = -9998 + LookupTableMedian = -9998 + LookupTableKValue = -9998 + StimulationLampFlag = (Off, Off, Off) + HeaterControlFlag = (On, On, On, On, On, On, On, On, On, On, On, + On, On, On) + OptBnchFlexureTemperature = 19.5881 + OptBnchMirrorTemperature = 19.6748 + OptBnchFoldFlatTemperature = 19.9348 + OptBnchFpaTemperature = 19.5015 + OptBnchFpeTemperature = 19.2415 + OptBnchLivingRmTemperature = 19.4148 + OptBnchBoxBeamTemperature = 19.5881 + OptBnchCoverTemperature = 19.6748 + FieldStopTemperature = 17.9418 + FpaPositiveYTemperature = 18.8082 + FpaNegativeYTemperature = 18.6349 + FpeTemperature = 18.0284 + PrimaryMirrorMntTemperature = 19.5015 + PrimaryMirrorTemperature = 19.6748 + PrimaryMirrorBafTemperature = 2.39402 + MsTrussLeg0ATemperature = 19.6748 + MsTrussLeg0BTemperature = 19.8482 + MsTrussLeg120ATemperature = 19.3281 + MsTrussLeg120BTemperature = 20.1949 + MsTrussLeg240ATemperature = 20.2816 + MsTrussLeg240BTemperature = 20.7151 + BarrelBaffleTemperature = -13.8299 + SunShadeTemperature = -33.9377 + SpiderLeg30Temperature = 17.5087 + SpiderLeg120Temperature = -9999 + SpiderLeg240Temperature = -9999 + SecMirrorMtrRngTemperature = 20.6284 + SecMirrorTemperature = 20.455 + SecMirrorBaffleTemperature = -11.1761 + IeaTemperature = 25.4878 + FocusMotorTemperature = 21.4088 + IePwsBoardTemperature = 16.3696 + CpmmPwsBoardTemperature = 17.6224 + MechTlmBoardTemperature = 34.7792 + InstContBoardTemperature = 34.4121 + DllLockedFlag = (YES, YES) + DllResetCount = 0 + DllLockedOnceFlag = (YES, YES) + DllFrequenceCorrectCount = 4 + ADCTimingSetting = -9999 + Unlutted = TRUE + End_Group + )"); + + PvlGroup newInstGroup; + iss >> newInstGroup; + + newInstGroup.findKeyword("InstrumentId").setValue("HIRISE"); + newInstGroup.findKeyword("SpacecraftName").setValue("MARS RECONNAISSANCE ORBITER"); + + inst = newInstGroup; + PvlObject &naifKeywords = testCube->label()->findObject("NaifKeywords"); + + PvlKeyword startcc("SpacecraftClockStartCount", "33322515"); + PvlKeyword stopcc("SpaceCraftClockStopCount", "33322516"); + inst += startcc; + inst += stopcc; + + json nk; + nk["INS-74999_FOCAL_LENGTH"] = 11994.9988; + nk["INS-74999_PIXEL_PITCH"] = 0.012; + nk["INS-74605_TRANSX"] = {-89.496, -1.0e-06, 0.012}; + nk["INS-74605_TRANSY"] = {-12.001, -0.012, -1.0e-06}; + nk["INS-74605_ITRANSS"] = {-1000.86, -0.0087, -83.333}; + nk["INS-74605_ITRANSL"] = {7457.9, 83.3333, -0.0087}; + nk["INS-74999_OD_K"] = {-0.0048509, 2.41312e-07, -1.62369e-13}; + nk["BODY499_RADII"] = {3396.19, 3396.19, 3376.2}; + nk["CLOCK_ET_-74999_895484264:57342_COMPUTED"] = "8ed6ae8930f3bd41"; + + nk["BODY_CODE"] = 499; + nk["BODY_FRAME_CODE"] = 10014; + PvlObject newNaifKeywords("NaifKeywords", nk); + naifKeywords = newNaifKeywords; + + QString fileName = testCube->fileName(); + + LineManager line(*testCube); + for(line.begin(); !line.end(); line++) { + for(int i = 0; i < line.size(); i++) { + line[i] = (double)(i+1); + } + testCube->write(line); + } + testCube->reopen("rw"); + + // need to remove old camera pointer + delete testCube; + // This is now a MRO cube + + testCube = new Cube(fileName, "rw"); + + // create a jitter file + QString jitter = R"(# Sample Line ET +-0.18 -0.07 264289109.96933 +-0.11 -0.04 264289109.97 +-0.05 -0.02 264289109.98 +1.5 0.6 264289110.06 + )"; + + jitterPath = tempDir.path() + "/jitter.txt"; + QFile jitterFile(jitterPath); + + if (jitterFile.open(QIODevice::WriteOnly)) { + QTextStream out(&jitterFile); + out << jitter; + jitterFile.close(); + } + else { + FAIL() << "Failed to create Jitter file" << std::endl; + } + } + + + void NewHorizonsCube::setInstrument(QString ikid, QString instrumentId, QString spacecraftName) { + PvlObject &isisCube = testCube->label()->findObject("IsisCube"); + + label = Pvl(); + label.addObject(isisCube); + + PvlGroup &kernels = label.findObject("IsisCube").findGroup("Kernels"); + kernels.findKeyword("NaifFrameCode").setValue(ikid); + kernels["ShapeModel"] = "Null"; + + PvlGroup &dim = label.findObject("IsisCube").findObject("Core").findGroup("Dimensions"); + dim.findKeyword("Samples").setValue("10"); + dim.findKeyword("Lines").setValue("10"); + dim.findKeyword("Bands").setValue("2"); + + PvlGroup &pixels = label.findObject("IsisCube").findObject("Core").findGroup("Pixels"); + pixels.findKeyword("Type").setValue("Real"); + + PvlGroup &inst = label.findObject("IsisCube").findGroup("Instrument"); + std::istringstream iss(R"( + Group = Instrument + SpacecraftName = "NEW HORIZONS" + InstrumentId = LEISA + TargetName = Jupiter + SpacecraftClockStartCount = 1/0034933739:00000 + ExposureDuration = 0.349 + StartTime = 2007-02-28T01:57:01.3882862 + StopTime = 2007-02-28T02:04:53.3882861 + FrameRate = 2.86533 + End_Group + )"); + + PvlGroup newInstGroup; + iss >> newInstGroup; + + newInstGroup.findKeyword("InstrumentId").setValue(instrumentId); + newInstGroup.findKeyword("SpacecraftName").setValue(spacecraftName); + + inst = newInstGroup; + + PvlGroup &bandBin = label.findObject("IsisCube").findGroup("BandBin"); + std::istringstream bss(R"( + Group = BandBin + Center = (2.4892, 1.2204) + Width = (0.011228, 0.005505) + OriginalBand = (1, 200) + End_Group + )"); + + PvlGroup newBandBin; + bss >> newBandBin; + bandBin = newBandBin; + + std::istringstream alphaSS(R"( + Group = AlphaCube + AlphaSamples = 256 + AlphaLines = 1354 + AlphaStartingSample = 0.5 + AlphaStartingLine = 229.5 + AlphaEndingSample = 100.5 + AlphaEndingLine = 329.5 + BetaSamples = 100 + BetaLines = 100 + End_Group + )"); + + PvlGroup alphaGroup; + alphaSS >> alphaGroup; + label.findObject("IsisCube").addGroup(alphaGroup); + + std::ifstream isdFile("data/leisa/nh_leisa.isd"); + isdFile >> isd; + + QString fileName = tempDir.path() + "/leisa.cub"; + delete testCube; + testCube = new Cube(); + testCube->fromIsd(fileName, label, isd, "rw"); + + LineManager line(*testCube); + double pixelValue = 0.0; + for(line.begin(); !line.end(); line++) { + for(int i = 0; i < line.size(); i++) { + line[i] = (double) pixelValue++; + } + testCube->write(line); + } + } + + + void OsirisRexCube::setInstrument(QString ikid, QString instrumentId) { + delete testCube; + testCube = new Cube(); + + FileName newCube(tempDir.path() + "/testing.cub"); + + testCube->fromIsd(newCube, label, isd, "rw"); + + PvlGroup &kernels = testCube->label()->findObject("IsisCube").findGroup("Kernels"); + kernels.findKeyword("NaifFrameCode").setValue(ikid); + kernels["ShapeModel"] = "Null"; + + PvlGroup &inst = testCube->label()->findObject("IsisCube").findGroup("Instrument"); + std::istringstream iss(R"( + Group = Instrument + MissionName = OSIRIS-REx + SpacecraftName = OSIRIS-REX + InstrumentId = PolyCam + TargetName = Bennu + StartTime = 2019-01-13T23:36:05.000 + ExposureDuration = 100 + SpacecraftClockStartCount = 1/0600694569.00000 + FocusPosition = 21510 + End_Group + )"); + + PvlGroup newInstGroup; + iss >> newInstGroup; + + newInstGroup.findKeyword("InstrumentId").setValue(instrumentId); + + inst = newInstGroup; + + PvlGroup &bandBin = label.findObject("IsisCube").findGroup("BandBin"); + std::istringstream bss(R"( + Group = BandBin + FilterName = Unknown + End_Group + )"); + + PvlGroup newBandBin; + bss >> newBandBin; + bandBin = newBandBin; + + json nk; + nk["BODY2101955_RADII"] = {2825, 2675, 254}; + nk["INS"+ikid.toStdString()+"_FOCAL_LENGTH"] = 630.0; + nk["INS"+ikid.toStdString()+"_PIXEL_SIZE"] = 8.5; + nk["CLOCK_ET_-64_1/0600694569.00000_COMPUTED"] = "8ed6ae8930f3bd41"; + nk["INS"+ikid.toStdString()+"_TRANSX"] = {0.0, 0.0085, 0.0}; + nk["INS"+ikid.toStdString()+"_TRANSY"] = {0.0, 0.0, -0.0085}; + nk["INS"+ikid.toStdString()+"_ITRANSS"] = {0.0, 117.64705882353, 0.0}; + nk["INS"+ikid.toStdString()+"_ITRANSL"] = {0.0, 0.0, -117.64705882353}; + nk["INS"+ikid.toStdString()+"_CCD_CENTER"] = {511.5, 511.5}; + nk["BODY_FRAME_CODE"] = 2101955; + + PvlObject &naifKeywords = testCube->label()->findObject("NaifKeywords"); + PvlObject newNaifKeywords("NaifKeywords", nk); + naifKeywords = newNaifKeywords; + + QString fileName = testCube->fileName(); + delete testCube; + testCube = new Cube(fileName, "rw"); + } + + + void MgsMocCube::SetUp() { + TempTestingFiles::SetUp(); + + QString testPath = tempDir.path() + "/test.cub"; + QFile::copy("data/mgsImages/mocImage.cub", testPath); + testCube.reset(new Cube(testPath)); + } + + + void MgsMocCube::TearDown() { + testCube.reset(); + } + + void ClipperWacFcCube::SetUp() { + TempTestingFiles::SetUp(); + + QString testPath = tempDir.path() + "/test.cub"; + QFile::copy("data/clipper/ClipperWacFc.cub", testPath); + wacFcCube = new Cube(testPath); + + PvlGroup &wacKernels = wacFcCube->label()->findObject("IsisCube").findGroup("Kernels"); + wacKernels.findKeyword("NaifFrameCode").setValue("-159102"); + + double offset = 10; + AlphaCube aCube(wacFcCube->sampleCount(), wacFcCube->lineCount(), + wacFcCube->sampleCount()-offset, wacFcCube->lineCount() - offset, + 0, offset, wacFcCube->sampleCount(), wacFcCube->lineCount()); + + aCube.UpdateGroup(*wacFcCube); + + wacFcCube->reopen("rw"); + } + + void ClipperWacFcCube::TearDown() { + if (wacFcCube) { + delete wacFcCube; + } + } + + void ClipperNacRsCube::SetUp() { + DefaultCube::SetUp(); + + delete testCube; + testCube = new Cube(); + + FileName newCube(tempDir.path() + "/testing.cub"); + + testCube->fromIsd(newCube, label, isd, "rw"); + + PvlGroup &kernels = testCube->label()->findObject("IsisCube").findGroup("Kernels"); + kernels.findKeyword("NaifFrameCode").setValue("-159101"); + + PvlGroup &inst = testCube->label()->findObject("IsisCube").findGroup("Instrument"); + std::istringstream iss(R"( + Group = Instrument + SpacecraftName = Clipper + InstrumentId = EIS-NAC-RS + TargetName = Europa + StartTime = 2025-01-01T00:00:00.000 + JitterSampleCoefficients = (0.0, 0.0, 0.0) + JitterLineCoefficients = (0.0, 0.0, 0.0) + End_Group + )"); + + PvlGroup newInstGroup; + iss >> newInstGroup; + inst = newInstGroup; + + PvlObject &naifKeywords = testCube->label()->findObject("NaifKeywords"); + std::istringstream nk(R"( + Object = NaifKeywords + BODY_CODE = 502 + BODY502_RADII = (1562.6, 1560.3, 1559.5) + BODY_FRAME_CODE = 10024 + INS-159101_FOCAL_LENGTH = 150.40199 + INS-159101_PIXEL_PITCH = 0.014 + INS-159101_TRANSX = (0.0, 0.014004651, 0.0) + INS-159101_TRANSY = (0.0, 0.0, 0.01399535) + INS-159101_ITRANSS = (0.0, 71.404849, 0.0) + INS-159101_ITRANSL = (0.0, 0.0, 71.4523) + INS-159101_OD_K = (0.0, 0.0, 0.0) + End_Object + )"); + + PvlObject newNaifKeywords; + nk >> newNaifKeywords; + naifKeywords = newNaifKeywords; + + QString fileName = testCube->fileName(); + delete testCube; + testCube = new Cube(fileName, "rw"); + + double offset = 10; + AlphaCube aCube(testCube->sampleCount(), testCube->lineCount(), + testCube->sampleCount()-offset, testCube->lineCount() - offset, + 0, offset, testCube->sampleCount(), testCube->lineCount()); + + aCube.UpdateGroup(*testCube); + testCube->reopen("rw"); + } + + void ClipperNacRsCube::TearDown() { + if (testCube) { + delete testCube; + } + } + + void ClipperPbCube::setInstrument(QString instrumentId) { + TempTestingFiles::SetUp(); + + if (instrumentId == "EIS-NAC-PB") { + QString testPath = tempDir.path() + "/nacTest.cub"; + QFile::copy("data/clipper/ClipperNacPb.cub", testPath); + testCube = new Cube(testPath, "rw"); + } + else if (instrumentId == "EIS-WAC-PB") { + QString testPath = tempDir.path() + "/wacTest.cub"; + QFile::copy("data/clipper/ClipperWacPb.cub", testPath); + testCube = new Cube(testPath, "rw"); + } + } + + void NearMsiCameraCube::SetUp() { + TempTestingFiles::SetUp(); + + json isd; + Pvl label; + + std::ifstream isdFile("data/near/msicamera/m0155881376f3_2p_cif_dbl.isd"); + std::ifstream cubeLabel("data/near/msicamera/m0155881376f3_2p_cif_dbl.pvl"); + + isdFile >> isd; + cubeLabel >> label; + + testCube.reset( new Cube() ) ; + testCube->fromIsd(tempDir.path() + "/m0155881376f3_2p_cif_dbl.cub", label, isd, "rw"); + } + + void NearMsiCameraCube::TearDown() { + testCube.reset(); + } + +} \ No newline at end of file diff --git a/isis/tests/CameraFixtures.h b/isis/tests/CameraFixtures.h new file mode 100644 index 0000000000..040da24ab8 --- /dev/null +++ b/isis/tests/CameraFixtures.h @@ -0,0 +1,171 @@ +#ifndef CameraFixtures_h +#define CameraFixtures_h + +#include "gtest/gtest.h" + +#include + +#include + +#include + +#include "Cube.h" +#include "Pvl.h" +#include "TempFixtures.h" + +namespace Isis { + + class PushFramePair : public TempTestingFiles { + protected: + std::shared_ptr evenCube; + std::shared_ptr oddCube; + int numSamps; + int numBands; + int frameHeight; + int numFrames; + + void SetUp() override; + }; + + class FlippedPushFramePair : public TempTestingFiles { + protected: + std::shared_ptr evenCube; + std::shared_ptr oddCube; + int numSamps; + int numBands; + int frameHeight; + int numFrames; + + void SetUp() override; + }; + + class DefaultCube : public TempTestingFiles { + protected: + Cube *testCube; + Cube *projTestCube; + + Pvl label; + Pvl projLabel; + nlohmann::json isd; + + void SetUp() override; + void TearDown() override; + void resizeCube(int samples, int lines, int bands); + }; + + class LineScannerCube : public TempTestingFiles { + protected: + Cube *testCube; + Cube *projTestCube; + + Pvl label; + Pvl projLabel; + nlohmann::json isd; + + void SetUp() override; + void TearDown() override; + }; + + class OffBodyCube : public TempTestingFiles { + protected: + Cube *testCube; + + void SetUp() override; + void TearDown() override; + }; + + class MiniRFCube : public TempTestingFiles { + protected: + Cube *testCube; + + void SetUp() override; + void TearDown() override; + }; + + class DemCube : public DefaultCube { + protected: + Cube *demCube; + + void SetUp() override; + void TearDown() override; + }; + + + class MroCtxCube : public DefaultCube { + protected: + std::unique_ptr testCube; + + void SetUp() override; + void TearDown() override; + }; + + class GalileoSsiCube : public DefaultCube { + protected: + void SetUp() override; + void TearDown() override; + }; + + class MgsMocCube : public DefaultCube { + protected: + std::unique_ptr testCube; + + void SetUp() override; + void TearDown() override; + }; + + + class MroHiriseCube : public DefaultCube { + protected: + QString ckPath = "data/mroKernels/mroCK.bc"; + QString sclkPath = "data/mroKernels/mroSCLK.tsc"; + QString lskPath = "data/mroKernels/mroLSK.tls"; + Cube dejitteredCube; + QString jitterPath; + + void SetUp() override; + void setInstrument(QString ikid, QString instrumentId, QString spacecraftName); + }; + + class NewHorizonsCube : public DefaultCube { + protected: + void setInstrument(QString ikid, QString instrumentId, QString spacecraftName); + }; + + + class OsirisRexCube : public DefaultCube { + protected: + void setInstrument(QString ikid, QString instrumentId); + }; + + class ClipperWacFcCube : public DefaultCube { + protected: + Cube *wacFcCube; + Pvl label; + nlohmann::json isd; + void SetUp() override; + void TearDown() override; + }; + + class ClipperNacRsCube : public DefaultCube { + protected: + void SetUp() override; + void TearDown() override; + }; + + class ClipperPbCube : public TempTestingFiles { + protected: + Cube *testCube; + void setInstrument(QString instrumentId); + }; + + class NearMsiCameraCube : public TempTestingFiles { + protected: + // Cube *testCube; + std::unique_ptr testCube; + void SetUp() override; + void TearDown() override; + }; + +} + +#endif \ No newline at end of file diff --git a/isis/tests/CameraTests.cpp b/isis/tests/CameraTests.cpp index 2d7e93279e..0afba0fce5 100644 --- a/isis/tests/CameraTests.cpp +++ b/isis/tests/CameraTests.cpp @@ -12,7 +12,7 @@ #include "TestUtilities.h" #include "FileName.h" #include "Camera.h" -#include "Fixtures.h" +#include "CameraFixtures.h" using namespace Isis; diff --git a/isis/tests/ClipperNacRollingShutterCameraTests.cpp b/isis/tests/ClipperNacRollingShutterCameraTests.cpp index 56e74a8808..0a7f8047dc 100644 --- a/isis/tests/ClipperNacRollingShutterCameraTests.cpp +++ b/isis/tests/ClipperNacRollingShutterCameraTests.cpp @@ -1,5 +1,5 @@ #include "ClipperNacRollingShutterCamera.h" -#include "Fixtures.h" +#include "CameraFixtures.h" #include "TestUtilities.h" #include diff --git a/isis/tests/ClipperPushBroomCameraTests.cpp b/isis/tests/ClipperPushBroomCameraTests.cpp index c9a0bb33db..3e05e3bfcd 100644 --- a/isis/tests/ClipperPushBroomCameraTests.cpp +++ b/isis/tests/ClipperPushBroomCameraTests.cpp @@ -1,5 +1,5 @@ #include "ClipperPushBroomCamera.h" -#include "Fixtures.h" +#include "CameraFixtures.h" #include "TestUtilities.h" #include diff --git a/isis/tests/ClipperWacFcCameraTests.cpp b/isis/tests/ClipperWacFcCameraTests.cpp index c4f451443f..5cd2136d28 100644 --- a/isis/tests/ClipperWacFcCameraTests.cpp +++ b/isis/tests/ClipperWacFcCameraTests.cpp @@ -1,5 +1,5 @@ #include -#include "Fixtures.h" +#include "CameraFixtures.h" #include "Camera.h" #include "CameraFactory.h" #include "Cube.h" diff --git a/isis/tests/CnetWinnowTests.cpp b/isis/tests/CnetWinnowTests.cpp index 7672a9d432..087f6c4ef5 100644 --- a/isis/tests/CnetWinnowTests.cpp +++ b/isis/tests/CnetWinnowTests.cpp @@ -10,7 +10,7 @@ #include "FileName.h" #include "SerialNumber.h" -#include "Fixtures.h" +#include "NetworkFixtures.h" #include "gmock/gmock.h" diff --git a/isis/tests/CsmBundleObservationTests.cpp b/isis/tests/CsmBundleObservationTests.cpp index 7c4468730b..8c09aea33f 100644 --- a/isis/tests/CsmBundleObservationTests.cpp +++ b/isis/tests/CsmBundleObservationTests.cpp @@ -4,7 +4,7 @@ #include "CsmBundleObservation.h" #include "CSMCamera.h" -#include "Fixtures.h" +#include "CsmFixtures.h" #include "MockCsmPlugin.h" #include "Mocks.h" #include "TestUtilities.h" diff --git a/isis/tests/CsmFixtures.cpp b/isis/tests/CsmFixtures.cpp new file mode 100644 index 0000000000..17f864e8d7 --- /dev/null +++ b/isis/tests/CsmFixtures.cpp @@ -0,0 +1,206 @@ +#include "CsmFixtures.h" + +#include "csm/csm.h" + +#include +#include +#include + +#include "csminit.h" + +#include "Blob.h" +#include "FileName.h" +#include "MockCsmPlugin.h" +#include "PvlGroup.h" +#include "PvlKeyword.h" + +namespace Isis { + + // Matches a CSM Image Coord for gMock + ::testing::Matcher MatchImageCoord(const csm::ImageCoord &expected) { + return ::testing::AllOf( + ::testing::Field(&csm::ImageCoord::line, ::testing::DoubleNear(expected.line, 0.0001)), + ::testing::Field(&csm::ImageCoord::samp, ::testing::DoubleNear(expected.samp, 0.0001)) + ); +} + + + // Matches a CSM ECEF Coord for gMock + ::testing::Matcher MatchEcefCoord(const csm::EcefCoord &expected) { + return ::testing::AllOf( + ::testing::Field(&csm::EcefCoord::x, ::testing::DoubleNear(expected.x, 0.0001)), + ::testing::Field(&csm::EcefCoord::y, ::testing::DoubleNear(expected.y, 0.0001)), + ::testing::Field(&csm::EcefCoord::z, ::testing::DoubleNear(expected.z, 0.0001)) + ); + } + + void CSMCubeFixture::SetUp() { + SmallCube::SetUp(); + + // Instrument group + // Just need a target name + PvlGroup instGroup("Instrument"); + instGroup += PvlKeyword("TargetName", "TestTarget"); + instGroup += PvlKeyword("InstrumentId", "TestId"); + testCube->putGroup(instGroup); + + // Kernels group + // Just need a shapemodel specified + PvlGroup kernGroup("Kernels"); + kernGroup += PvlKeyword("ShapeModel", "Null"); + testCube->putGroup(kernGroup); + + // CSMInfo group + // This just has to exist, but fill it out for completeness and incase it + // ever does matter + PvlGroup infoGroup("CsmInfo"); + infoGroup += PvlKeyword("CSMPlatformID", "TestPlatform"); + infoGroup += PvlKeyword("CSMInstrumentId", "TestInstrument"); + infoGroup += PvlKeyword("ReferenceTime", "2000-01-01T11:58:55.816"); // J2000 epoch + + PvlKeyword paramNames("ModelParameterNames"); + paramNames += "TestNoneParam"; + paramNames += "TestFictitiousParam"; + paramNames += "TestRealParam"; + paramNames += "TestFixedParam"; + PvlKeyword paramUnits("ModelParameterUnits"); + paramUnits += "unitless"; + paramUnits += "m"; + paramUnits += "rad"; + paramUnits += "lines/sec"; + PvlKeyword paramTypes("ModelParameterTypes"); + paramTypes += "NONE"; + paramTypes += "FICTITIOUS"; + paramTypes += "REAL"; + paramTypes += "FIXED"; + + infoGroup += paramNames; + infoGroup += paramUnits; + infoGroup += paramTypes; + + testCube->putGroup(infoGroup); + + // Register the mock with our plugin + std::string mockModelName = QUuid().toString().toStdString(); + MockCsmPlugin loadablePlugin; + loadablePlugin.registerModel(mockModelName, &mockModel); + + // CSMState BLOB + Blob csmStateBlob("CSMState", "String"); + csmStateBlob.setData(mockModelName.c_str(), mockModelName.size()); + csmStateBlob.Label() += PvlKeyword("ModelName", QString::fromStdString(mockModelName)); + csmStateBlob.Label() += PvlKeyword("PluginName", QString::fromStdString(loadablePlugin.getPluginName())); + testCube->write(csmStateBlob); + filename = testCube->fileName(); + testCube->close(); + testCube->open(filename, "rw"); + } + + void CSMCameraFixture::SetUp() { + CSMCubeFixture::SetUp(); + + // Account for calls that happen while making a CSMCamera + EXPECT_CALL(mockModel, getSensorIdentifier()) + .Times(2) + .WillRepeatedly(::testing::Return("MockSensorID")); + EXPECT_CALL(mockModel, getPlatformIdentifier()) + .Times(2) + .WillRepeatedly(::testing::Return("MockPlatformID")); + EXPECT_CALL(mockModel, getReferenceDateAndTime()) + .Times(1) + .WillRepeatedly(::testing::Return("2000-01-01T11:58:55.816")); + + testCam = testCube->camera(); + } + + void CSMCameraSetFixture::SetUp() { + CSMCameraFixture::SetUp(); + + imagePt = csm::ImageCoord(4.5, 4.5); + groundPt = csm::EcefCoord(wgs84.getSemiMajorRadius(), 0, 0); + imageLocus = csm::EcefLocus(wgs84.getSemiMajorRadius() + 50000, 0, 0, -1, 0, 0); + + // Setup the mock for setImage and ensure it succeeds + EXPECT_CALL(mockModel, imageToRemoteImagingLocus(MatchImageCoord(imagePt), ::testing::_, ::testing::_, ::testing::_)) + .Times(1) + .WillOnce(::testing::Return(imageLocus)); + EXPECT_CALL(mockModel, getImageTime) + .Times(1) + .WillOnce(::testing::Return(10.0)); + + ASSERT_TRUE(testCam->SetImage(5, 5)); // Assert here so that the test code doesn't run if the camera isn't set + } + + void CSMCameraDemFixture::SetUp() { + CSMCubeFixture::SetUp(); + + // Record the demRadius at 0 lat, 0 lon + demRadius = 3394200.43980104; + + // Update the shapemodel on the cube + PvlGroup &kernGroup = testCube->group("Kernels"); + kernGroup.addKeyword(PvlKeyword("ShapeModel", "data/CSMCamera/mola_compressed_prep.cub"), Pvl::Replace); + + // Close and re-open the cube, then save off the new camera + testCube->close(); + testCube->open(filename, "rw"); + + // Account for calls that happen while making a CSMCamera + EXPECT_CALL(mockModel, getSensorIdentifier()) + .Times(2) + .WillRepeatedly(::testing::Return("MockSensorID")); + EXPECT_CALL(mockModel, getPlatformIdentifier()) + .Times(2) + .WillRepeatedly(::testing::Return("MockPlatformID")); + EXPECT_CALL(mockModel, getReferenceDateAndTime()) + .Times(1) + .WillRepeatedly(::testing::Return("2000-01-01T11:58:55.816")); + + testCam = testCube->camera(); + } + + void CSMNetwork::SetUp(){ + QString APP_XML = FileName("$ISISROOT/bin/xml/csminit.xml").expanded(); + QVector fNames = {"/Test_A", "/Test_B", + "/Test_C", "/Test_D", + "/Test_E", "/Test_F", + "/Test_G", "/Test_H", + "/Test_I", "/Test_J" + }; + + cubes.fill(nullptr, 10); + + cubeList = new FileList(); + cubeListFile = tempDir.path() + "/cubes.lis"; + // Create CSMInit-ed cubes + for (int i = 0; i < cubes.size() ; i++){ + cubes[i] = new Cube(); + cubes[i]->setDimensions(1024,1024,1); + FileName cubName = FileName(tempDir.path()+fNames[i]+".cub"); + cubes[i]->create(cubName.expanded()); + cubeList->append(cubes[i]->fileName()); + QVector args = {"from="+cubName.expanded(), + "state=data/CSMNetwork/"+fNames[i]+".json", + "modelname=TestCsmModel", + "pluginname=TestCsmPlugin" + }; + UserInterface ui(APP_XML, args); + csminit(ui); + } + cubeList->write(cubeListFile); + } + + void CSMNetwork::TearDown() { + for(int i = 0; i < cubes.size(); i++) { + if(cubes[i] && cubes[i]->isOpen()) { + delete cubes[i]; + } + } + + if (cubeList) { + delete cubeList; + } + } + + +} \ No newline at end of file diff --git a/isis/tests/CsmFixtures.h b/isis/tests/CsmFixtures.h new file mode 100644 index 0000000000..0eda4bcb24 --- /dev/null +++ b/isis/tests/CsmFixtures.h @@ -0,0 +1,77 @@ +#ifndef CsmFixtures_h +#define CsmFixtures_h + +#include "gmock/gmock.h" + +#include +#include + +#include "csm/csm.h" +#include "csm/Ellipsoid.h" + +#include "Camera.h" +#include "CubeFixtures.h" +#include "FileList.h" +#include "FileName.h" +#include "Mocks.h" + +namespace Isis { + + + ::testing::Matcher MatchImageCoord(const csm::ImageCoord &expected); + ::testing::Matcher MatchEcefCoord(const csm::EcefCoord &expected); + + class CSMCubeFixture : public SmallCube { + protected: + QString filename; + MockRasterGM mockModel; + + void SetUp() override; + }; + + + class CSMCameraFixture : public CSMCubeFixture { + protected: + Camera *testCam; + + void SetUp() override; + }; + + + class CSMCameraSetFixture : public CSMCameraFixture { + protected: + csm::Ellipsoid wgs84; + csm::ImageCoord imagePt; + csm::EcefCoord groundPt; + csm::EcefLocus imageLocus; + + void SetUp() override; + }; + + + class CSMCameraDemFixture : public CSMCubeFixture { + protected: + Camera *testCam; + double demRadius; + + void SetUp() override; + }; + + + class CSMNetwork : public TempTestingFiles { + protected: + + QVector stateStringFiles; + QVector labelFiles; + QVector cubes; + + FileList *cubeList; + QString cubeListFile; + + void SetUp() override; + void TearDown() override; + }; + +} + +#endif \ No newline at end of file diff --git a/isis/tests/CubeFixtures.cpp b/isis/tests/CubeFixtures.cpp new file mode 100644 index 0000000000..18612e1eee --- /dev/null +++ b/isis/tests/CubeFixtures.cpp @@ -0,0 +1,360 @@ +#include "CubeFixtures.h" + +#include "Brick.h" +#include "LineManager.h" +#include "Pvl.h" +#include "PvlObject.h" +#include "PvlGroup.h" +#include "PvlKeyword.h" +#include "SpecialPixel.h" + +namespace Isis { + + void SmallCube::SetUp() { + TempTestingFiles::SetUp(); + + testCube = new Cube(); + testCube->setDimensions(10, 10, 10); + QString path = tempDir.path() + "/small.cub"; + testCube->create(path); + + LineManager line(*testCube); + double pixelValue = 0.0; + for(line.begin(); !line.end(); line++) { + for(int i = 0; i < line.size(); i++) { + line[i] = (double) pixelValue++; + } + testCube->write(line); + } + + // Add a BandBin group to the cube label + Pvl *label = testCube->label(); + PvlObject& cubeLabel = label->findObject("IsisCube"); + PvlGroup bandBin("BandBin"); + PvlKeyword originalBand("OriginalBand", "1"); + originalBand += "2"; + originalBand += "3"; + originalBand += "4"; + originalBand += "5"; + originalBand += "6"; + originalBand += "7"; + originalBand += "8"; + originalBand += "9"; + originalBand += "10"; + bandBin += originalBand; + cubeLabel.addGroup(bandBin); + testCube->close(); + testCube->open(path, "rw"); + } + + void SmallCube::TearDown() { + if (testCube->isOpen()) { + testCube->close(); + } + + if (testCube) { + delete testCube; + } + } + + + void LargeCube::SetUp() { + TempTestingFiles::SetUp(); + + testCube = new Cube(); + testCube->setDimensions(1000, 1000, 10); + testCube->create(tempDir.path() + "/large.cub"); + + LineManager line(*testCube); + double pixelValue = 0.0; + for(line.begin(); !line.end(); line++) { + for(int i = 0; i < line.size(); i++) { + line[i] = pixelValue; + } + + pixelValue++; + testCube->write(line); + } + } + + void LargeCube::TearDown() { + if (testCube->isOpen()) { + testCube->close(); + } + + if (testCube) { + delete testCube; + } + } + + + void SpecialSmallCube::SetUp() { + TempTestingFiles::SetUp(); + + testCube = new Cube(); + testCube->setDimensions(10, 10, 10); + testCube->create(tempDir.path() + "/small.cub"); + + // Use a line manager to update select lines with ISIS special pixel values + LineManager line(*testCube); + double pixelValue = 0.0; + int lineNum = 0; + for(line.begin(); !line.end(); line++) { + for(int i = 0; i < line.size(); i++) { + if (lineNum == 2) { + line[i] = NULL8; + } + else if (lineNum == 3) { + line[i] = LOW_REPR_SAT8; + } + else if (lineNum == 4) { + line[i] = HIGH_REPR_SAT8; + } + else if (lineNum == 5) { + line[i] = LOW_INSTR_SAT8; + } + else if (lineNum == 6) { + line[i] = HIGH_INSTR_SAT8; + } + else { + line[i] = (double) pixelValue++; + } + } + lineNum++; + testCube->write(line); + } + + } + + void SpecialSmallCube::TearDown() { + if (testCube->isOpen()) { + testCube->close(); + } + + if (testCube) { + delete testCube; + } + } + + + void SmallGapCube::SetUp() { + TempTestingFiles::SetUp(); + + // Initialize horzCube + horzCube = new Cube(); + horzCube->setDimensions(9, 9, 9); + horzCube->create(tempDir.path() + "/horzgap.cub"); + + // horizontal line of nulls through all bands + LineManager h_line(*horzCube); + double h_pixelValue = 0.0; + int h_lineNum = 0; + for(h_line.begin(); !h_line.end(); h_line++) { + for(int i = 0; i < h_line.size(); i++) { + if(h_lineNum == 4 || h_lineNum % 9 == 4) { + h_line[i] = NULL8; + } + else { + h_pixelValue = sin(h_lineNum * 180 / M_PI) + cos(i * 180 / M_PI); + h_line[i] = (double) h_pixelValue; + } + } + h_lineNum++; + horzCube->write(h_line); + } + horzCube->reopen("rw"); + + + // Initialize vertCube + vertCube = new Cube(); + vertCube->setDimensions(9, 9, 9); + vertCube->create(tempDir.path() + "/vertgap.cub"); + + // vertical line of nulls through all bands + LineManager v_line(*vertCube); + double v_pixelValue = 0.0; + int v_lineNum = 0; + for(v_line.begin(); !v_line.end(); v_line++) { + for(int i = 0; i < v_line.size(); i++) { + if(i == 4) { + v_line[i] = NULL8; + } + else { + v_pixelValue = sin(v_lineNum * 180 / M_PI) + cos(i * 180 / M_PI); + v_line[i] = (double) v_pixelValue; + } + } + v_lineNum++; + vertCube->write(v_line); + } + vertCube->reopen("rw"); + + + // Initialize bandCube + bandCube = new Cube(); + bandCube->setDimensions(9, 9, 9); + bandCube->create(tempDir.path() + "/bandgap.cub"); + + // vertical line of nulls on just one band + LineManager b_line(*bandCube); + double b_pixelValue = 0.0; + int b_lineNum = 0; + for(b_line.begin(); !b_line.end(); b_line++) { + for(int i = 0; i < b_line.size(); i++) { + if( b_lineNum == 22 ) { + b_line[i] = NULL8; + } + else { + b_pixelValue = sin(b_lineNum * 180 / M_PI) + cos(i * 180 / M_PI); + b_line[i] = (double) b_pixelValue; + } + } + b_lineNum++; + bandCube->write(b_line); + } + bandCube->reopen("rw"); + + } + + + void SmallGapCube::TearDown() { + if (horzCube->isOpen()) { + horzCube->close(); + } + if (vertCube->isOpen()) { + vertCube->close(); + } + if (bandCube->isOpen()) { + bandCube->close(); + } + + if (horzCube) { + delete horzCube; + } + if (vertCube) { + delete vertCube; + } + if (bandCube) { + delete bandCube; + } + } + + + void NullPixelCube::SetUp() { + TempTestingFiles::SetUp(); + + testCube = new Cube(); + testCube->setDimensions(10, 10, 10); + QString path = tempDir.path() + "/null.cub"; + testCube->create(path); + + LineManager line(*testCube); + for(line.begin(); !line.end(); line++) { + for(int i = 0; i < line.size(); i++) { + line[i] = NULL8; + } + testCube->write(line); + } + } + + + void NullPixelCube::TearDown() { + if (testCube->isOpen()) { + testCube->close(); + } + + if (testCube) { + delete testCube; + } + } + + + void ApolloCube::SetUp() { + TempTestingFiles::SetUp(); + + testCube = new Cube(); + testCube->setDimensions(22900, 22900, 1); + testCube->create(tempDir.path() + "/large.cub"); + + // Reseau centers as {sample, line} pairs + reseaus = {{200, 200}, {400, 400}, {600, 600}}; + reseauSize = 103; + int reseauValue = 100; + + Brick brick(reseauSize,reseauSize,1,testCube->pixelType()); + for (size_t res=0; resread(brick); + // Fill the surrounding area with a base number + for (int i = 0; i < reseauSize; i++) { + for (int j = 0; j < reseauSize; j++) { + brick[reseauSize*i + j] = res; + } + } + + // Create reseau + for (int i = 0; i < reseauSize; i++) { + for (int j = -2; j < 3; j++) { + // Vertical line + brick[reseauSize * i + reseauSize/2 + j] = reseauValue; + + // Horizontal line + brick[reseauSize * (reseauSize/2 + j) + i] = reseauValue; + } + } + testCube->write(brick); + } + + PvlGroup reseausGroup("Reseaus"); + PvlKeyword samples = PvlKeyword("Sample", QString::number(reseaus[0].first)); + PvlKeyword lines = PvlKeyword("Line", QString::number(reseaus[0].second)); + PvlKeyword types = PvlKeyword("Type", "5"); + PvlKeyword valid = PvlKeyword("Valid", "1"); + for (size_t i = 1; i < reseaus.size(); i++) { + samples += QString::number(reseaus[i].first); + lines += QString::number(reseaus[i].second); + types += "5"; + valid += "1"; + } + + reseausGroup += lines; + reseausGroup += samples; + reseausGroup += types; + reseausGroup += valid; + reseausGroup += PvlKeyword("Status", "Nominal"); + + std::istringstream instStr (R"( + Group = Instrument + SpacecraftName = "APOLLO 15" + InstrumentId = METRIC + TargetName = MOON + StartTime = 1971-08-01T14:58:03.78 + End_Group + )"); + + PvlGroup instGroup; + instStr >> instGroup; + + Pvl *lab = testCube->label(); + lab->findObject("IsisCube").addGroup(reseausGroup); + lab->findObject("IsisCube").addGroup(instGroup); + + testCube->reopen("r"); + } + + + void RingsCube::SetUp() { + TempTestingFiles::SetUp(); + + ring1 = new Cube("data/rings/rings1proj.cub", "r"); + ring2 = new Cube("data/rings/rings2proj.cub", "r"); + + cubeListPath = tempDir.path() + "/filelist.txt"; + cubeFileList.append("data/rings/rings1proj.cub"); + cubeFileList.append("data/rings/rings2proj.cub"); + cubeFileList.write(cubeListPath); + } + +} \ No newline at end of file diff --git a/isis/tests/CubeFixtures.h b/isis/tests/CubeFixtures.h new file mode 100644 index 0000000000..b35983d41e --- /dev/null +++ b/isis/tests/CubeFixtures.h @@ -0,0 +1,83 @@ +#ifndef CubeFixtures_h +#define CubeFixtures_h + +#include "gtest/gtest.h" + +#include +#include +#include + +#include "Cube.h" +#include "FileList.h" +#include "TempFixtures.h" + +namespace Isis { + + class SmallCube : public TempTestingFiles { + protected: + Cube *testCube; + + void SetUp() override; + void TearDown() override; + }; + + + class LargeCube : public TempTestingFiles { + protected: + Cube *testCube; + + void SetUp() override; + void TearDown() override; + }; + + + class SpecialSmallCube : public TempTestingFiles { + protected: + Cube *testCube; + + void SetUp() override; + void TearDown() override; + }; + + class SmallGapCube : public TempTestingFiles { + protected: + Cube *horzCube; + Cube *vertCube; + Cube *bandCube; + + void SetUp() override; + void TearDown() override; + }; + + + class NullPixelCube : public TempTestingFiles { + protected: + Cube *testCube; + void SetUp() override; + void TearDown() override; + }; + + + class ApolloCube : public LargeCube { + protected: + std::vector> reseaus; + int reseauSize; + + void SetUp() override; + }; + + class RingsCube : public TempTestingFiles { + protected: + + // pixtures of Saturn's rings + Cube *ring1; + Cube *ring2; + FileList cubeFileList; + QString cubeListPath; + + void SetUp() override; + }; + +} + +#endif \ No newline at end of file diff --git a/isis/tests/CubeStretchTest.cpp b/isis/tests/CubeStretchTest.cpp index d5d6eb5bd9..04e570e687 100644 --- a/isis/tests/CubeStretchTest.cpp +++ b/isis/tests/CubeStretchTest.cpp @@ -1,5 +1,5 @@ #include "CubeStretch.h" -#include "Fixtures.h" +#include "CubeFixtures.h" #include "IException.h" #include "Stretch.h" @@ -8,15 +8,17 @@ #include +using namespace Isis; + TEST(CubeStretch, DefaultConstructor) { - Isis::CubeStretch cubeStretch; + CubeStretch cubeStretch; EXPECT_STREQ(cubeStretch.getName().toLatin1().data(), "DefaultStretch"); EXPECT_STREQ(cubeStretch.getType().toLatin1().data(), "Default"); EXPECT_EQ(cubeStretch.getBandNumber(), 1); } TEST(CubeStretch, ConstructorWithName) { - Isis::CubeStretch cubeStretch("name"); + CubeStretch cubeStretch("name"); EXPECT_STREQ(cubeStretch.getName().toLatin1().data(), "name"); EXPECT_STREQ(cubeStretch.getType().toLatin1().data(), "Default"); EXPECT_EQ(cubeStretch.getBandNumber(), 1); @@ -24,15 +26,15 @@ TEST(CubeStretch, ConstructorWithName) { TEST(CubeStretch, ConstructorAllArge) { - Isis::CubeStretch cubeStretch("name", "type", 99); + CubeStretch cubeStretch("name", "type", 99); EXPECT_STREQ(cubeStretch.getName().toLatin1().data(), "name"); EXPECT_STREQ(cubeStretch.getType().toLatin1().data(), "type"); EXPECT_EQ(cubeStretch.getBandNumber(), 99); } TEST(CubeStretch, CopyConstructor) { - Isis::CubeStretch cubeStretch("name", "type", 99); - Isis::CubeStretch copyStretch(cubeStretch); + CubeStretch cubeStretch("name", "type", 99); + CubeStretch copyStretch(cubeStretch); EXPECT_STREQ(cubeStretch.getName().toLatin1().data(), copyStretch.getName().toLatin1().data()); EXPECT_STREQ(cubeStretch.getType().toLatin1().data(), copyStretch.getType().toLatin1().data()); EXPECT_EQ(cubeStretch.getBandNumber(), copyStretch.getBandNumber()); @@ -40,8 +42,8 @@ TEST(CubeStretch, CopyConstructor) { TEST(CubeStretch, BlobConstructor) { // Set Stretch - Isis::CubeStretch cubeStretch("TestStretch", "testType", 2); - Isis::CubeStretch cubeStretchFromBlob(cubeStretch); + CubeStretch cubeStretch("TestStretch", "testType", 2); + CubeStretch cubeStretchFromBlob(cubeStretch); EXPECT_STREQ(cubeStretchFromBlob.getName().toLatin1().data(), cubeStretch.getName().toLatin1().data()); @@ -54,7 +56,7 @@ TEST(CubeStretch, BlobConstructor) { TEST_F(SmallCube, CubeStretchWriteRead) { // Set up Stretch to write QString stretchName = "TestStretch"; - Isis::CubeStretch cubeStretch(stretchName, "testType", 2); + CubeStretch cubeStretch(stretchName, "testType", 2); // add pair(s) cubeStretch.AddPair(0.0, 1.0); @@ -66,34 +68,34 @@ TEST_F(SmallCube, CubeStretchWriteRead) { testCube->reopen("rw"); // Set up stretch and blob to restore to - Isis::CubeStretch restoredStretch = testCube->readCubeStretch(stretchName); + CubeStretch restoredStretch = testCube->readCubeStretch(stretchName); EXPECT_TRUE(restoredStretch == cubeStretch); }; TEST(CubeStretch, Equality) { - Isis::CubeStretch cubeStretch99("name", "type", 99); - Isis::CubeStretch cubeStretch9("name", "type", 9); - Isis::CubeStretch cubeStretchOtherName("othername", "type", 9); + CubeStretch cubeStretch99("name", "type", 99); + CubeStretch cubeStretch9("name", "type", 9); + CubeStretch cubeStretchOtherName("othername", "type", 9); EXPECT_FALSE(cubeStretch99 == cubeStretch9); EXPECT_FALSE(cubeStretch9 == cubeStretchOtherName); } TEST(CubeStretch, GetSetType) { - Isis::CubeStretch cubeStretch("name", "type", 99); + CubeStretch cubeStretch("name", "type", 99); cubeStretch.setType("NewType"); EXPECT_STREQ(cubeStretch.getType().toLatin1().data(), "NewType"); } TEST(CubeStretch, GetSetName) { - Isis::CubeStretch cubeStretch("name", "type", 99); + CubeStretch cubeStretch("name", "type", 99); cubeStretch.setName("NewName"); EXPECT_STREQ(cubeStretch.getName().toLatin1().data(), "NewName"); } TEST(CubeStretch, GetSetBandNumber) { - Isis::CubeStretch cubeStretch("name", "type", 99); + CubeStretch cubeStretch("name", "type", 99); cubeStretch.setBandNumber(50); EXPECT_EQ(cubeStretch.getBandNumber(), 50); } diff --git a/isis/tests/CubeTests.cpp b/isis/tests/CubeTests.cpp index 5d2fb3aaca..91348eb305 100644 --- a/isis/tests/CubeTests.cpp +++ b/isis/tests/CubeTests.cpp @@ -9,7 +9,7 @@ using json = nlohmann::json; #include "Cube.h" #include "Camera.h" -#include "Fixtures.h" +#include "CubeFixtures.h" #include "TestUtilities.h" #include "gmock/gmock.h" diff --git a/isis/tests/Fixtures.cpp b/isis/tests/Fixtures.cpp index f38339b586..600054524c 100644 --- a/isis/tests/Fixtures.cpp +++ b/isis/tests/Fixtures.cpp @@ -6,7 +6,6 @@ #include "Blob.h" #include "Brick.h" -#include "csminit.h" #include "Fixtures.h" #include "Portal.h" #include "LineManager.h" @@ -16,1784 +15,6 @@ namespace Isis { - void TempTestingFiles::SetUp() { - ASSERT_TRUE(tempDir.isValid()); - } - - - void SmallCube::SetUp() { - TempTestingFiles::SetUp(); - - testCube = new Cube(); - testCube->setDimensions(10, 10, 10); - QString path = tempDir.path() + "/small.cub"; - testCube->create(path); - - LineManager line(*testCube); - double pixelValue = 0.0; - for(line.begin(); !line.end(); line++) { - for(int i = 0; i < line.size(); i++) { - line[i] = (double) pixelValue++; - } - testCube->write(line); - } - - // Add a BandBin group to the cube label - Pvl *label = testCube->label(); - PvlObject& cubeLabel = label->findObject("IsisCube"); - PvlGroup bandBin("BandBin"); - PvlKeyword originalBand("OriginalBand", "1"); - originalBand += "2"; - originalBand += "3"; - originalBand += "4"; - originalBand += "5"; - originalBand += "6"; - originalBand += "7"; - originalBand += "8"; - originalBand += "9"; - originalBand += "10"; - bandBin += originalBand; - cubeLabel.addGroup(bandBin); - testCube->close(); - testCube->open(path, "rw"); - } - - void SmallCube::TearDown() { - if (testCube->isOpen()) { - testCube->close(); - } - - if (testCube) { - delete testCube; - } - } - - - void LargeCube::SetUp() { - TempTestingFiles::SetUp(); - - testCube = new Cube(); - testCube->setDimensions(1000, 1000, 10); - testCube->create(tempDir.path() + "/large.cub"); - - LineManager line(*testCube); - double pixelValue = 0.0; - for(line.begin(); !line.end(); line++) { - for(int i = 0; i < line.size(); i++) { - line[i] = pixelValue; - } - - pixelValue++; - testCube->write(line); - } - } - - void LargeCube::TearDown() { - if (testCube->isOpen()) { - testCube->close(); - } - - if (testCube) { - delete testCube; - } - } - - - void SpecialSmallCube::SetUp() { - TempTestingFiles::SetUp(); - - testCube = new Cube(); - testCube->setDimensions(10, 10, 10); - testCube->create(tempDir.path() + "/small.cub"); - - // Use a line manager to update select lines with ISIS special pixel values - LineManager line(*testCube); - double pixelValue = 0.0; - int lineNum = 0; - for(line.begin(); !line.end(); line++) { - for(int i = 0; i < line.size(); i++) { - if (lineNum == 2) { - line[i] = NULL8; - } - else if (lineNum == 3) { - line[i] = LOW_REPR_SAT8; - } - else if (lineNum == 4) { - line[i] = HIGH_REPR_SAT8; - } - else if (lineNum == 5) { - line[i] = LOW_INSTR_SAT8; - } - else if (lineNum == 6) { - line[i] = HIGH_INSTR_SAT8; - } - else { - line[i] = (double) pixelValue++; - } - } - lineNum++; - testCube->write(line); - } - - } - - void SpecialSmallCube::TearDown() { - if (testCube->isOpen()) { - testCube->close(); - } - - if (testCube) { - delete testCube; - } - } - - - void SmallGapCube::SetUp() { - TempTestingFiles::SetUp(); - - // Initialize horzCube - horzCube = new Cube(); - horzCube->setDimensions(9, 9, 9); - horzCube->create(tempDir.path() + "/horzgap.cub"); - - // horizontal line of nulls through all bands - LineManager h_line(*horzCube); - double h_pixelValue = 0.0; - int h_lineNum = 0; - for(h_line.begin(); !h_line.end(); h_line++) { - for(int i = 0; i < h_line.size(); i++) { - if(h_lineNum == 4 || h_lineNum % 9 == 4) { - h_line[i] = NULL8; - } - else { - h_pixelValue = sin(h_lineNum * 180 / M_PI) + cos(i * 180 / M_PI); - h_line[i] = (double) h_pixelValue; - } - } - h_lineNum++; - horzCube->write(h_line); - } - horzCube->reopen("rw"); - - - // Initialize vertCube - vertCube = new Cube(); - vertCube->setDimensions(9, 9, 9); - vertCube->create(tempDir.path() + "/vertgap.cub"); - - // vertical line of nulls through all bands - LineManager v_line(*vertCube); - double v_pixelValue = 0.0; - int v_lineNum = 0; - for(v_line.begin(); !v_line.end(); v_line++) { - for(int i = 0; i < v_line.size(); i++) { - if(i == 4) { - v_line[i] = NULL8; - } - else { - v_pixelValue = sin(v_lineNum * 180 / M_PI) + cos(i * 180 / M_PI); - v_line[i] = (double) v_pixelValue; - } - } - v_lineNum++; - vertCube->write(v_line); - } - vertCube->reopen("rw"); - - - // Initialize bandCube - bandCube = new Cube(); - bandCube->setDimensions(9, 9, 9); - bandCube->create(tempDir.path() + "/bandgap.cub"); - - // vertical line of nulls on just one band - LineManager b_line(*bandCube); - double b_pixelValue = 0.0; - int b_lineNum = 0; - for(b_line.begin(); !b_line.end(); b_line++) { - for(int i = 0; i < b_line.size(); i++) { - if( b_lineNum == 22 ) { - b_line[i] = NULL8; - } - else { - b_pixelValue = sin(b_lineNum * 180 / M_PI) + cos(i * 180 / M_PI); - b_line[i] = (double) b_pixelValue; - } - } - b_lineNum++; - bandCube->write(b_line); - } - bandCube->reopen("rw"); - - } - - - void SmallGapCube::TearDown() { - if (horzCube->isOpen()) { - horzCube->close(); - } - if (vertCube->isOpen()) { - vertCube->close(); - } - if (bandCube->isOpen()) { - bandCube->close(); - } - - if (horzCube) { - delete horzCube; - } - if (vertCube) { - delete vertCube; - } - if (bandCube) { - delete bandCube; - } - } - - - void PushFramePair::SetUp() { - numSamps = 16; - numBands = 3; - frameHeight = 12; - numFrames = 10; - - evenCube.reset(new Cube()); - evenCube->setDimensions(numSamps, frameHeight * numFrames, numBands); - evenCube->create(tempDir.path() + "/even.cub"); - - oddCube.reset(new Cube()); - oddCube->setDimensions(numSamps, frameHeight * numFrames, numBands); - oddCube->create(tempDir.path() + "/odd.cub"); - - Brick frameBrick(numSamps, frameHeight, numBands, evenCube->pixelType()); - - for (int frameIndex = 0; frameIndex < numFrames; frameIndex++) { - for (int brickIndex = 0; brickIndex < frameBrick.size(); brickIndex++) { - frameBrick[brickIndex] = frameIndex + 1; - } - frameBrick.SetBasePosition(1,frameIndex * frameHeight + 1,1); - if (frameIndex % 2 == 0) { - oddCube->write(frameBrick); - } - else { - evenCube->write(frameBrick); - } - } - - PvlGroup intGroup("Instrument"); - intGroup += PvlKeyword("StartTime", "2008-06-14T13:32:10.933207"); - evenCube->putGroup(intGroup); - oddCube->putGroup(intGroup); - - evenCube->reopen("rw"); - oddCube->reopen("rw"); - - } - - - void FlippedPushFramePair::SetUp() { - numSamps = 16; - numBands = 3; - frameHeight = 12; - numFrames = 10; - - evenCube.reset(new Cube()); - evenCube->setDimensions(numSamps, frameHeight * numFrames, numBands); - evenCube->create(tempDir.path() + "/even.cub"); - - oddCube.reset(new Cube()); - oddCube->setDimensions(numSamps, frameHeight * numFrames, numBands); - oddCube->create(tempDir.path() + "/odd.cub"); - - Brick frameBrick(numSamps, frameHeight, numBands, evenCube->pixelType()); - - for (int frameIndex = 0; frameIndex < numFrames; frameIndex++) { - for (int brickIndex = 0; brickIndex < frameBrick.size(); brickIndex++) { - frameBrick[brickIndex] = numFrames - frameIndex; - } - frameBrick.SetBasePosition(1,frameIndex * frameHeight + 1,1); - if (frameIndex % 2 == 0) { - evenCube->write(frameBrick); - } - else { - oddCube->write(frameBrick); - } - } - - PvlGroup intGroup("Instrument"); - intGroup += PvlKeyword("DataFlipped", "True"); - intGroup += PvlKeyword("StartTime", "2008-06-14T13:32:10.933207"); - evenCube->putGroup(intGroup); - oddCube->putGroup(intGroup); - - evenCube->reopen("rw"); - oddCube->reopen("rw"); - - } - - - void DemCube::SetUp() { - DefaultCube::SetUp(); - testCube->label()->object(4)["SolarLongitude"] = "294.73518831328"; - testCube->reopen("rw"); - - std::ifstream cubeLabel("data/defaultImage/demCube.pvl"); - - Pvl demLabel; - cubeLabel >> demLabel; - demLabel.findObject("IsisCube").findObject("Core").findGroup("Pixels")["Type"] = "Real"; - - demCube = new Cube(); - demCube->fromLabel(tempDir.path() + "/demCube.cub", demLabel, "rw"); - - TableField minRadius("MinimumRadius", TableField::Double); - TableField maxRadius("MaximumRadius", TableField::Double); - - TableRecord record; - record += minRadius; - record += maxRadius; - - Table shapeModelStatistics("ShapeModelStatistics", record); - - record[0] = 3376.2; - record[1] = 3396.19; - shapeModelStatistics += record; - - demCube->write(shapeModelStatistics); - - int xCenter = int(demCube->lineCount()/2); - int yCenter = int(demCube->sampleCount()/2); - double radius = std::min(xCenter, yCenter); - double depth = 30; - double pointRadius; - - LineManager line(*demCube); - double pixelValue; - double base = demCube->label()->findObject("IsisCube").findObject("Core").findGroup("Pixels")["Base"]; - double xPos = 0.0; - - for(line.begin(); !line.end(); line++) { - for(int yPos = 0; yPos < line.size(); yPos++) { - pointRadius = pow(pow((xPos - xCenter), 2) + pow((yPos - yCenter), 2), 0.5); - if (pointRadius < radius) { - pixelValue = ((sin(((M_PI*pointRadius)/(2*radius))) * depth) + depth) + base; - } - else { - pixelValue = base + (depth * 2); - } - line[yPos] = (double) pixelValue; - } - xPos++; - demCube->write(line); - } - - demCube->reopen("rw"); - } - - void DemCube::TearDown() { - if (demCube->isOpen()) { - demCube->close(); - } - - delete demCube; - } - - - void DefaultCube::SetUp() { - TempTestingFiles::SetUp(); - - std::ifstream isdFile("data/defaultImage/defaultCube.isd"); - std::ifstream cubeLabel("data/defaultImage/defaultCube.pvl"); - std::ifstream projCubeLabel("data/defaultImage/projDefaultCube.pvl"); - - isdFile >> isd; - cubeLabel >> label; - projCubeLabel >> projLabel; - - testCube = new Cube(); - testCube->fromIsd(tempDir.path() + "/default.cub", label, isd, "rw"); - - LineManager line(*testCube); - int pixelValue = 1; - for(line.begin(); !line.end(); line++) { - for(int i = 0; i < line.size(); i++) { - line[i] = (double) (pixelValue % 255); - pixelValue++; - } - testCube->write(line); - } - - projTestCube = new Cube(); - projTestCube->fromIsd(tempDir.path() + "/default.level2.cub", projLabel, isd, "rw"); - - line = LineManager(*projTestCube); - pixelValue = 1; - for(line.begin(); !line.end(); line++) { - for(int i = 0; i < line.size(); i++) { - line[i] = (double) (pixelValue % 255); - pixelValue++; - } - projTestCube->write(line); - } - projTestCube->reopen("rw"); - } - - void DefaultCube::resizeCube(int samples, int lines, int bands) { - label = Pvl(); - PvlObject &isisCube = testCube->label()->findObject("IsisCube"); - label.addObject(isisCube); - - PvlGroup &dim = label.findObject("IsisCube").findObject("Core").findGroup("Dimensions"); - dim.findKeyword("Samples").setValue(QString::number(samples)); - dim.findKeyword("Lines").setValue(QString::number(lines)); - dim.findKeyword("Bands").setValue(QString::number(bands)); - - delete testCube; - testCube = new Cube(); - testCube->fromIsd(tempDir.path() + "/default.cub", label, isd, "rw"); - - LineManager line(*testCube); - int pixelValue = 1; - for(int band = 1; band <= bands; band++) { - for (int i = 1; i <= testCube->lineCount(); i++) { - line.SetLine(i, band); - for (int j = 0; j < line.size(); j++) { - line[j] = (double) (pixelValue % 255); - pixelValue++; - } - testCube->write(line); - } - } - - projLabel = Pvl(); - PvlObject &isisProjCube= projTestCube->label()->findObject("IsisCube"); - projLabel.addObject(isisProjCube); - - PvlGroup &projDim = projLabel.findObject("IsisCube").findObject("Core").findGroup("Dimensions"); - projDim.findKeyword("Samples").setValue(QString::number(samples)); - projDim.findKeyword("Lines").setValue(QString::number(lines)); - projDim.findKeyword("Bands").setValue(QString::number(bands)); - - delete projTestCube; - projTestCube = new Cube(); - projTestCube->fromIsd(tempDir.path() + "/default.level2.cub", projLabel, isd, "rw"); - - line = LineManager(*projTestCube); - pixelValue = 1; - for(int band = 1; band <= bands; band++) { - for (int i = 1; i <= projTestCube->lineCount(); i++) { - line.SetLine(i, band); - for (int j = 0; j < line.size(); j++) { - line[j] = (double) (pixelValue % 255); - pixelValue++; - } - projTestCube->write(line); - } - } - } - - void DefaultCube::TearDown() { - if (testCube->isOpen()) { - testCube->close(); - } - - if (projTestCube->isOpen()) { - projTestCube->close(); - } - - delete testCube; - delete projTestCube; - } - - void LineScannerCube::SetUp() { - TempTestingFiles::SetUp(); - - std::ifstream isdFile("data/LineScannerImage/defaultLineScanner.isd"); - std::ifstream cubeLabel("data/LineScannerImage/defaultLineScanner.pvl"); - std::ifstream projCubeLabel("data/LineScannerImage/projDefaultLineScanner.pvl"); - - isdFile >> isd; - cubeLabel >> label; - projCubeLabel >> projLabel; - - testCube = new Cube(); - testCube->fromIsd(tempDir.path() + "/default.cub", label, isd, "rw"); - LineManager line(*testCube); - int pixelValue = 1; - for(line.begin(); !line.end(); line++) { - for(int i = 0; i < line.size(); i++) { - line[i] = (double) (pixelValue % 255); - pixelValue++; - } - testCube->write(line); - } - - projTestCube = new Cube(); - projTestCube->fromIsd(tempDir.path() + "/default.level2.cub", projLabel, isd, "rw"); - line = LineManager(*projTestCube); - pixelValue = 1; - for(line.begin(); !line.end(); line++) { - for(int i = 0; i < line.size(); i++) { - line[i] = (double) (pixelValue % 255); - pixelValue++; - } - projTestCube->write(line); - } - } - - - void LineScannerCube::TearDown() { - if (testCube->isOpen()) { - testCube->close(); - } - - if (projTestCube->isOpen()) { - projTestCube->close(); - } - - delete testCube; - delete projTestCube; - } - - void OffBodyCube::SetUp() { - TempTestingFiles::SetUp(); - testCube = new Cube("data/offBodyImage/EW0131773041G.cal.crop.cub"); - } - - - void OffBodyCube::TearDown() { - if (testCube->isOpen()) { - testCube->close(); - } - - delete testCube; - } - - - void MiniRFCube::SetUp() { - TempTestingFiles::SetUp(); - testCube = new Cube("data/miniRFImage/LSZ_04866_1CD_XKU_89N109_V1_lev1.crop.cub"); - } - - - void MiniRFCube::TearDown() { - if (testCube->isOpen()) { - testCube->close(); - } - - delete testCube; - } - - - void ThreeImageNetwork::SetUp() { - TempTestingFiles::SetUp(); - - FileName labelPath1("data/threeImageNetwork/cube1.pvl"); - FileName labelPath2("data/threeImageNetwork/cube2.pvl"); - FileName labelPath3("data/threeImageNetwork/cube3.pvl"); - - FileName mappedLabelPath1("data/threeImageNetwork/cube1map.pvl"); - FileName mappedLabelPath2("data/threeImageNetwork/cube2map.pvl"); - FileName mappedLabelPath3("data/threeImageNetwork/cube3map.pvl"); - - isdPath1 = new FileName("data/threeImageNetwork/cube1.isd"); - isdPath2 = new FileName("data/threeImageNetwork/cube2.isd"); - isdPath3 = new FileName("data/threeImageNetwork/cube3.isd"); - - threeImageOverlapFile = new FileName("data/threeImageNetwork/threeImageOverlaps.lis"); - twoImageOverlapFile = new FileName("data/threeImageNetwork/twoImageOverlaps.lis"); - - cube1 = new Cube(); - cube1->fromIsd(tempDir.path() + "/cube1.cub", labelPath1, *isdPath1, "rw"); - - ImagePolygon poly; - coords = {{30, 0}, - {30, 10}, - {35, 10}, - {35, 0}, - {30, 0}}; - poly.Create(coords); - cube1->write(poly); - - cube2 = new Cube(); - cube2->fromIsd(tempDir.path() + "/cube2.cub", labelPath2, *isdPath2, "rw"); - - coords = {{31, 1}, - {31, 11}, - {36, 11}, - {36, 1}, - {31, 1}}; - poly.Create(coords); - cube2->write(poly); - - cube3 = new Cube(); - cube3->fromIsd(tempDir.path() + "/cube3.cub", labelPath3, *isdPath3, "rw"); - - LineManager line(*cube1); - LineManager line2(*cube2); - LineManager line3(*cube3); - int pixelValue = 1; - for(line.begin(); !line.end(); line++) { - for(int i = 0; i < line.size(); i++) { - line[i] = (double) (pixelValue %255); - pixelValue++; - } - cube1->write(line); - } - - for(line2.begin(); !line2.end(); line2++) { - for(int i = 0; i < line.size(); i++) { - line2[i] = (double) (pixelValue %255); - pixelValue++; - } - cube2->write(line2); - } - - for(line3.begin(); !line3.end(); line3++) { - for(int i = 0; i < line3.size(); i++) { - line3[i] = (double) (pixelValue %255); - pixelValue++; - } - cube3->write(line3); - } - - cube1->reopen("rw"); - cube2->reopen("rw"); - cube3->reopen("rw"); - - cubeList = new FileList(); - cubeList->append(cube1->fileName()); - cubeList->append(cube2->fileName()); - - twoCubeListFile = tempDir.path() + "/2cubes.lis"; - cubeList->write(twoCubeListFile); - cubeList->append(cube3->fileName()); - - cubeListFile = tempDir.path() + "/cubes.lis"; - cubeList->write(cubeListFile); - - networkFile = "data/threeImageNetwork/controlnetwork.net"; - - network = new ControlNet(); - network->ReadControl(networkFile); - - cube1map = new Cube(); - cube2map = new Cube(); - cube3map = new Cube(); - cube1map->fromIsd(tempDir.path() + "/cube1map.cub", mappedLabelPath1, *isdPath1, "rw"); - cube2map->fromIsd(tempDir.path() + "/cube2map.cub", mappedLabelPath2, *isdPath2, "rw"); - cube3map->fromIsd(tempDir.path() + "/cube3map.cub", mappedLabelPath3, *isdPath3, "rw"); - } - - void ThreeImageNetwork::TearDown() { - delete cubeList; - delete network; - - delete cube1; - delete cube2; - delete cube3; - - delete cube1map; - delete cube2map; - delete cube3map; - - delete isdPath1; - delete isdPath2; - delete isdPath3; - - delete threeImageOverlapFile; - delete twoImageOverlapFile; - } - - - void ApolloNetwork::SetUp() { - TempTestingFiles::SetUp(); - - cubes.fill(nullptr, 7); - - cubeList = new FileList(); - - for(int i = 0; i < cubes.size(); i++) { - int n = i+1; // filenames use 1 based indexing - isdFiles.push_back(FileName("data/apolloNetwork/apolloImage"+QString::number(n)+".isd")); - labelFiles.push_back(FileName("data/apolloNetwork/apolloImage"+QString::number(n)+".pvl")); - cubes[i] = new Cube(); - cubes[i]->fromIsd(tempDir.path() + "/cube"+QString::number(n)+".cub", labelFiles[i], isdFiles[i], "rw"); - cubeList->append(cubes[i]->fileName()); - } - - cubeListFile = tempDir.path() + "/cubes.lis"; - cubeList->write(cubeListFile); - - network = new ControlNet("data/apolloNetwork/apolloNet.pvl"); - controlNetPath = tempDir.path() + "/apolloNet.net"; - network->Write(controlNetPath); - } - - void ApolloNetwork::TearDown() { - for(int i = 0; i < cubes.size(); i++) { - if(cubes[i] && cubes[i]->isOpen()) { - delete cubes[i]; - } - } - - if (cubeList) { - delete cubeList; - } - } - - void ObservationPair::SetUp() { - FileName labelPathL = FileName("data/observationPair/observationImageL.pvl"); - FileName labelPathR = FileName("data/observationPair/observationImageR.pvl"); - - isdPathL = new FileName("data/observationPair/observationImageL.isd"); - isdPathR = new FileName("data/observationPair/observationImageR.isd"); - - cubeL = new Cube(); - cubeR = new Cube(); - - cubeLPath = tempDir.path() + "/observationPairL.cub"; - cubeRPath = tempDir.path() + "/observationPairR.cub"; - - cubeL->fromIsd(cubeLPath, labelPathL, *isdPathL, "rw"); - Pvl originalPdsLabL("data/observationPair/observationImageLOriginalLabel.pvl"); - OriginalLabel origLabel(originalPdsLabL); - cubeL->write(origLabel); - cubeL->reopen("rw"); - - cubeR->fromIsd(cubeRPath, labelPathR, *isdPathR, "rw"); - - cubeList = new FileList(); - cubeList->append(cubeL->fileName()); - cubeList->append(cubeR->fileName()); - - cubeListFile = tempDir.path() + "/cubes.lis"; - cubeList->write(cubeListFile); - - cnetPath = "data/observationPair/observationPair.net"; - network = new ControlNet(); - network->ReadControl(cnetPath); - } - - - void ObservationPair::TearDown() { - delete cubeList; - delete network; - - if (cubeL) { - delete cubeL; - } - - if (cubeR) { - delete cubeR; - } - - delete isdPathL; - delete isdPathR; - } - - - void MroCtxCube::SetUp() { - TempTestingFiles::SetUp(); - - QString testPath = tempDir.path() + "/test.cub"; - QFile::copy("data/mroCtxImage/ctxTestImage.cub", testPath); - testCube.reset(new Cube(testPath)); - } - - - void MroCtxCube::TearDown() { - testCube.reset(); - } - - - void GalileoSsiCube::SetUp() { - DefaultCube::SetUp(); - - // Change default dims - PvlGroup &dim = label.findObject("IsisCube").findObject("Core").findGroup("Dimensions"); - dim.findKeyword("Samples").setValue("800"); - dim.findKeyword("Lines").setValue("800"); - dim.findKeyword("Bands").setValue("1"); - - delete testCube; - testCube = new Cube(); - - FileName newCube(tempDir.path() + "/testing.cub"); - - testCube->fromIsd(newCube, label, isd, "rw"); - PvlGroup &kernels = testCube->label()->findObject("IsisCube").findGroup("Kernels"); - kernels.findKeyword("NaifFrameCode").setValue("-77001"); - PvlGroup &inst = testCube->label()->findObject("IsisCube").findGroup("Instrument"); - - std::istringstream iss(R"( - Group = Instrument - SpacecraftName = "Galileo Orbiter" - InstrumentId = "SOLID STATE IMAGING SYSTEM" - TargetName = IO - SpacecraftClockStartCount = 05208734.39 - StartTime = 1999-10-11T18:05:15.815 - ExposureDuration = 0.04583 - GainModeId = 100000 - TelemetryFormat = IM4 - LightFloodStateFlag = ON - InvertedClockStateFlag = "NOT INVERTED" - BlemishProtectionFlag = OFF - ExposureType = NORMAL - ReadoutMode = Contiguous - FrameDuration = 8.667 - Summing = 1 - FrameModeId = FULL - End_Group - )"); - - PvlGroup newInstGroup; - iss >> newInstGroup; - inst = newInstGroup; - - PvlGroup &bandBin = testCube->label()->findObject("IsisCube").findGroup("BandBin"); - std::istringstream bss(R"( - Group = BandBin - FilterName = RED - FilterNumber = 2 - Center = 0.671 - Width = .06 - End_Group - )"); - - PvlGroup newBandBin; - bss >> newBandBin; - bandBin = newBandBin; - - PvlObject &naifKeywords = testCube->label()->findObject("NaifKeywords"); - - std::istringstream nk(R"( - Object = NaifKeywords - BODY_CODE = 501 - BODY501_RADII = (1829.4, 1819.3, 1815.7) - BODY_FRAME_CODE = 10023 - INS-77001_FOCAL_LENGTH = 1500.46655964 - INS-77001_K1 = -2.4976983626e-05 - INS-77001_PIXEL_PITCH = 0.01524 - INS-77001_TRANSX = (0.0, 0.01524, 0.0) - INS-77001_TRANSY = (0.0, 0.0, 0.01524) - INS-77001_ITRANSS = (0.0, 65.6167979, 0.0) - INS-77001_ITRANSL = (0.0, 0.0, 65.6167979) - INS-77001_BORESIGHT_SAMPLE = 400.0 - INS-77001_BORESIGHT_LINE = 400.0 - End_Object - )"); - - PvlObject newNaifKeywords; - nk >> newNaifKeywords; - naifKeywords = newNaifKeywords; - - std::istringstream ar(R"( - Group = Archive - DataSetId = GO-J/JSA-SSI-2-REDR-V1.0 - ProductId = 24I0146 - ObservationId = 24ISGLOCOL01 - DataType = RADIANCE - CalTargetCode = 24 - End_Group - )"); - - PvlGroup &archive = testCube->label()->findObject("IsisCube").findGroup("Archive"); - PvlGroup newArchive; - ar >> newArchive; - archive = newArchive; - - LineManager line(*testCube); - for(line.begin(); !line.end(); line++) { - for(int i = 0; i < line.size(); i++) { - line[i] = (double)(i+1); - } - testCube->write(line); - } - - // need to remove old camera pointer - delete testCube; - testCube = new Cube(newCube, "rw"); - } - - - void GalileoSsiCube::TearDown() { - if (testCube) { - delete testCube; - } - } - - - void MroHiriseCube::SetUp() { - DefaultCube::SetUp(); - dejitteredCube.open("data/mroKernels/mroHiriseProj.cub"); - - // force real DNs - QString fname = testCube->fileName(); - - PvlObject &core = label.findObject("IsisCube").findObject("Core"); - PvlGroup &pixels = core.findGroup("Pixels"); - pixels.findKeyword("Type").setValue("Real"); - - delete testCube; - testCube = new Cube(); - - FileName newCube(tempDir.path() + "/testing.cub"); - - testCube->fromIsd(newCube, label, isd, "rw"); - PvlGroup &kernels = testCube->label()->findObject("IsisCube").findGroup("Kernels"); - kernels.findKeyword("NaifFrameCode").setValue("-74999"); - PvlGroup &inst = testCube->label()->findObject("IsisCube").findGroup("Instrument"); - std::istringstream iss(R"( - Group = Instrument - SpacecraftName = "MARS RECONNAISSANCE ORBITER" - InstrumentId = HIRISE - TargetName = Mars - StartTime = 2008-05-17T09:37:24.7300819 - StopTime = 2008-05-17T09:37:31.0666673 - ObservationStartCount = 895484264:44383 - SpacecraftClockStartCount = 895484264:57342 - SpacecraftClockStopCount = 895484272:12777 - ReadoutStartCount = 895484659:31935 - CalibrationStartTime = 2006-11-08T04:49:13.952 - CalibrationStartCount = 847428572:51413 - AnalogPowerStartTime = 2006-11-08T04:48:34.478 - AnalogPowerStartCount = 847428533:20297 - MissionPhaseName = "PRIMARY SCIENCE PHASE" - LineExposureDuration = 95.0625 - ScanExposureDuration = 95.0625 - DeltaLineTimerCount = 337 - Summing = 1 - Tdi = 128 - FocusPositionCount = 2020 - PoweredCpmmFlag = (On, On, On, On, On, On, On, On, On, On, On, - On, On, On) - CpmmNumber = 8 - CcdId = RED5 - ChannelNumber = 0 - LookupTableType = Stored - LookupTableNumber = 19 - LookupTableMinimum = -9998 - LookupTableMaximum = -9998 - LookupTableMedian = -9998 - LookupTableKValue = -9998 - StimulationLampFlag = (Off, Off, Off) - HeaterControlFlag = (On, On, On, On, On, On, On, On, On, On, On, - On, On, On) - OptBnchFlexureTemperature = 19.5881 - OptBnchMirrorTemperature = 19.6748 - OptBnchFoldFlatTemperature = 19.9348 - OptBnchFpaTemperature = 19.5015 - OptBnchFpeTemperature = 19.2415 - OptBnchLivingRmTemperature = 19.4148 - OptBnchBoxBeamTemperature = 19.5881 - OptBnchCoverTemperature = 19.6748 - FieldStopTemperature = 17.9418 - FpaPositiveYTemperature = 18.8082 - FpaNegativeYTemperature = 18.6349 - FpeTemperature = 18.0284 - PrimaryMirrorMntTemperature = 19.5015 - PrimaryMirrorTemperature = 19.6748 - PrimaryMirrorBafTemperature = 2.39402 - MsTrussLeg0ATemperature = 19.6748 - MsTrussLeg0BTemperature = 19.8482 - MsTrussLeg120ATemperature = 19.3281 - MsTrussLeg120BTemperature = 20.1949 - MsTrussLeg240ATemperature = 20.2816 - MsTrussLeg240BTemperature = 20.7151 - BarrelBaffleTemperature = -13.8299 - SunShadeTemperature = -33.9377 - SpiderLeg30Temperature = 17.5087 - SpiderLeg120Temperature = -9999 - SpiderLeg240Temperature = -9999 - SecMirrorMtrRngTemperature = 20.6284 - SecMirrorTemperature = 20.455 - SecMirrorBaffleTemperature = -11.1761 - IeaTemperature = 25.4878 - FocusMotorTemperature = 21.4088 - IePwsBoardTemperature = 16.3696 - CpmmPwsBoardTemperature = 17.6224 - MechTlmBoardTemperature = 34.7792 - InstContBoardTemperature = 34.4121 - DllLockedFlag = (YES, YES) - DllResetCount = 0 - DllLockedOnceFlag = (YES, YES) - DllFrequenceCorrectCount = 4 - ADCTimingSetting = -9999 - Unlutted = TRUE - End_Group - )"); - - PvlGroup newInstGroup; - iss >> newInstGroup; - - newInstGroup.findKeyword("InstrumentId").setValue("HIRISE"); - newInstGroup.findKeyword("SpacecraftName").setValue("MARS RECONNAISSANCE ORBITER"); - - inst = newInstGroup; - PvlObject &naifKeywords = testCube->label()->findObject("NaifKeywords"); - - PvlKeyword startcc("SpacecraftClockStartCount", "33322515"); - PvlKeyword stopcc("SpaceCraftClockStopCount", "33322516"); - inst += startcc; - inst += stopcc; - - json nk; - nk["INS-74999_FOCAL_LENGTH"] = 11994.9988; - nk["INS-74999_PIXEL_PITCH"] = 0.012; - nk["INS-74605_TRANSX"] = {-89.496, -1.0e-06, 0.012}; - nk["INS-74605_TRANSY"] = {-12.001, -0.012, -1.0e-06}; - nk["INS-74605_ITRANSS"] = {-1000.86, -0.0087, -83.333}; - nk["INS-74605_ITRANSL"] = {7457.9, 83.3333, -0.0087}; - nk["INS-74999_OD_K"] = {-0.0048509, 2.41312e-07, -1.62369e-13}; - nk["BODY499_RADII"] = {3396.19, 3396.19, 3376.2}; - nk["CLOCK_ET_-74999_895484264:57342_COMPUTED"] = "8ed6ae8930f3bd41"; - - nk["BODY_CODE"] = 499; - nk["BODY_FRAME_CODE"] = 10014; - PvlObject newNaifKeywords("NaifKeywords", nk); - naifKeywords = newNaifKeywords; - - QString fileName = testCube->fileName(); - - LineManager line(*testCube); - for(line.begin(); !line.end(); line++) { - for(int i = 0; i < line.size(); i++) { - line[i] = (double)(i+1); - } - testCube->write(line); - } - testCube->reopen("rw"); - - // need to remove old camera pointer - delete testCube; - // This is now a MRO cube - - testCube = new Cube(fileName, "rw"); - - // create a jitter file - QString jitter = R"(# Sample Line ET --0.18 -0.07 264289109.96933 --0.11 -0.04 264289109.97 --0.05 -0.02 264289109.98 -1.5 0.6 264289110.06 - )"; - - jitterPath = tempDir.path() + "/jitter.txt"; - QFile jitterFile(jitterPath); - - if (jitterFile.open(QIODevice::WriteOnly)) { - QTextStream out(&jitterFile); - out << jitter; - jitterFile.close(); - } - else { - FAIL() << "Failed to create Jitter file" << std::endl; - } - } - - - void NewHorizonsCube::setInstrument(QString ikid, QString instrumentId, QString spacecraftName) { - PvlObject &isisCube = testCube->label()->findObject("IsisCube"); - - label = Pvl(); - label.addObject(isisCube); - - PvlGroup &kernels = label.findObject("IsisCube").findGroup("Kernels"); - kernels.findKeyword("NaifFrameCode").setValue(ikid); - kernels["ShapeModel"] = "Null"; - - PvlGroup &dim = label.findObject("IsisCube").findObject("Core").findGroup("Dimensions"); - dim.findKeyword("Samples").setValue("10"); - dim.findKeyword("Lines").setValue("10"); - dim.findKeyword("Bands").setValue("2"); - - PvlGroup &pixels = label.findObject("IsisCube").findObject("Core").findGroup("Pixels"); - pixels.findKeyword("Type").setValue("Real"); - - PvlGroup &inst = label.findObject("IsisCube").findGroup("Instrument"); - std::istringstream iss(R"( - Group = Instrument - SpacecraftName = "NEW HORIZONS" - InstrumentId = LEISA - TargetName = Jupiter - SpacecraftClockStartCount = 1/0034933739:00000 - ExposureDuration = 0.349 - StartTime = 2007-02-28T01:57:01.3882862 - StopTime = 2007-02-28T02:04:53.3882861 - FrameRate = 2.86533 - End_Group - )"); - - PvlGroup newInstGroup; - iss >> newInstGroup; - - newInstGroup.findKeyword("InstrumentId").setValue(instrumentId); - newInstGroup.findKeyword("SpacecraftName").setValue(spacecraftName); - - inst = newInstGroup; - - PvlGroup &bandBin = label.findObject("IsisCube").findGroup("BandBin"); - std::istringstream bss(R"( - Group = BandBin - Center = (2.4892, 1.2204) - Width = (0.011228, 0.005505) - OriginalBand = (1, 200) - End_Group - )"); - - PvlGroup newBandBin; - bss >> newBandBin; - bandBin = newBandBin; - - std::istringstream alphaSS(R"( - Group = AlphaCube - AlphaSamples = 256 - AlphaLines = 1354 - AlphaStartingSample = 0.5 - AlphaStartingLine = 229.5 - AlphaEndingSample = 100.5 - AlphaEndingLine = 329.5 - BetaSamples = 100 - BetaLines = 100 - End_Group - )"); - - PvlGroup alphaGroup; - alphaSS >> alphaGroup; - label.findObject("IsisCube").addGroup(alphaGroup); - - std::ifstream isdFile("data/leisa/nh_leisa.isd"); - isdFile >> isd; - - QString fileName = tempDir.path() + "/leisa.cub"; - delete testCube; - testCube = new Cube(); - testCube->fromIsd(fileName, label, isd, "rw"); - - LineManager line(*testCube); - double pixelValue = 0.0; - for(line.begin(); !line.end(); line++) { - for(int i = 0; i < line.size(); i++) { - line[i] = (double) pixelValue++; - } - testCube->write(line); - } - } - - - void ApolloCube::SetUp() { - TempTestingFiles::SetUp(); - - testCube = new Cube(); - testCube->setDimensions(22900, 22900, 1); - testCube->create(tempDir.path() + "/large.cub"); - - // Reseau centers as {sample, line} pairs - reseaus = {{200, 200}, {400, 400}, {600, 600}}; - reseauSize = 103; - int reseauValue = 100; - - Brick brick(reseauSize,reseauSize,1,testCube->pixelType()); - for (size_t res=0; resread(brick); - // Fill the surrounding area with a base number - for (int i = 0; i < reseauSize; i++) { - for (int j = 0; j < reseauSize; j++) { - brick[reseauSize*i + j] = res; - } - } - - // Create reseau - for (int i = 0; i < reseauSize; i++) { - for (int j = -2; j < 3; j++) { - // Vertical line - brick[reseauSize * i + reseauSize/2 + j] = reseauValue; - - // Horizontal line - brick[reseauSize * (reseauSize/2 + j) + i] = reseauValue; - } - } - testCube->write(brick); - } - - PvlGroup reseausGroup("Reseaus"); - PvlKeyword samples = PvlKeyword("Sample", QString::number(reseaus[0].first)); - PvlKeyword lines = PvlKeyword("Line", QString::number(reseaus[0].second)); - PvlKeyword types = PvlKeyword("Type", "5"); - PvlKeyword valid = PvlKeyword("Valid", "1"); - for (size_t i = 1; i < reseaus.size(); i++) { - samples += QString::number(reseaus[i].first); - lines += QString::number(reseaus[i].second); - types += "5"; - valid += "1"; - } - - reseausGroup += lines; - reseausGroup += samples; - reseausGroup += types; - reseausGroup += valid; - reseausGroup += PvlKeyword("Status", "Nominal"); - - std::istringstream instStr (R"( - Group = Instrument - SpacecraftName = "APOLLO 15" - InstrumentId = METRIC - TargetName = MOON - StartTime = 1971-08-01T14:58:03.78 - End_Group - )"); - - PvlGroup instGroup; - instStr >> instGroup; - - Pvl *lab = testCube->label(); - lab->findObject("IsisCube").addGroup(reseausGroup); - lab->findObject("IsisCube").addGroup(instGroup); - - testCube->reopen("r"); - } - - void RingsCube::SetUp() { - TempTestingFiles::SetUp(); - - ring1 = new Cube("data/rings/rings1proj.cub", "r"); - ring2 = new Cube("data/rings/rings2proj.cub", "r"); - - cubeListPath = tempDir.path() + "/filelist.txt"; - cubeFileList.append("data/rings/rings1proj.cub"); - cubeFileList.append("data/rings/rings2proj.cub"); - cubeFileList.write(cubeListPath); - } - - - void OsirisRexCube::setInstrument(QString ikid, QString instrumentId) { - delete testCube; - testCube = new Cube(); - - FileName newCube(tempDir.path() + "/testing.cub"); - - testCube->fromIsd(newCube, label, isd, "rw"); - - PvlGroup &kernels = testCube->label()->findObject("IsisCube").findGroup("Kernels"); - kernels.findKeyword("NaifFrameCode").setValue(ikid); - kernels["ShapeModel"] = "Null"; - - PvlGroup &inst = testCube->label()->findObject("IsisCube").findGroup("Instrument"); - std::istringstream iss(R"( - Group = Instrument - MissionName = OSIRIS-REx - SpacecraftName = OSIRIS-REX - InstrumentId = PolyCam - TargetName = Bennu - StartTime = 2019-01-13T23:36:05.000 - ExposureDuration = 100 - SpacecraftClockStartCount = 1/0600694569.00000 - FocusPosition = 21510 - End_Group - )"); - - PvlGroup newInstGroup; - iss >> newInstGroup; - - newInstGroup.findKeyword("InstrumentId").setValue(instrumentId); - - inst = newInstGroup; - - PvlGroup &bandBin = label.findObject("IsisCube").findGroup("BandBin"); - std::istringstream bss(R"( - Group = BandBin - FilterName = Unknown - End_Group - )"); - - PvlGroup newBandBin; - bss >> newBandBin; - bandBin = newBandBin; - - json nk; - nk["BODY2101955_RADII"] = {2825, 2675, 254}; - nk["INS"+ikid.toStdString()+"_FOCAL_LENGTH"] = 630.0; - nk["INS"+ikid.toStdString()+"_PIXEL_SIZE"] = 8.5; - nk["CLOCK_ET_-64_1/0600694569.00000_COMPUTED"] = "8ed6ae8930f3bd41"; - nk["INS"+ikid.toStdString()+"_TRANSX"] = {0.0, 0.0085, 0.0}; - nk["INS"+ikid.toStdString()+"_TRANSY"] = {0.0, 0.0, -0.0085}; - nk["INS"+ikid.toStdString()+"_ITRANSS"] = {0.0, 117.64705882353, 0.0}; - nk["INS"+ikid.toStdString()+"_ITRANSL"] = {0.0, 0.0, -117.64705882353}; - nk["INS"+ikid.toStdString()+"_CCD_CENTER"] = {511.5, 511.5}; - nk["BODY_FRAME_CODE"] = 2101955; - - PvlObject &naifKeywords = testCube->label()->findObject("NaifKeywords"); - PvlObject newNaifKeywords("NaifKeywords", nk); - naifKeywords = newNaifKeywords; - - QString fileName = testCube->fileName(); - delete testCube; - testCube = new Cube(fileName, "rw"); - } - - void CSMCubeFixture::SetUp() { - SmallCube::SetUp(); - - // Instrument group - // Just need a target name - PvlGroup instGroup("Instrument"); - instGroup += PvlKeyword("TargetName", "TestTarget"); - instGroup += PvlKeyword("InstrumentId", "TestId"); - testCube->putGroup(instGroup); - - // Kernels group - // Just need a shapemodel specified - PvlGroup kernGroup("Kernels"); - kernGroup += PvlKeyword("ShapeModel", "Null"); - testCube->putGroup(kernGroup); - - // CSMInfo group - // This just has to exist, but fill it out for completeness and incase it - // ever does matter - PvlGroup infoGroup("CsmInfo"); - infoGroup += PvlKeyword("CSMPlatformID", "TestPlatform"); - infoGroup += PvlKeyword("CSMInstrumentId", "TestInstrument"); - infoGroup += PvlKeyword("ReferenceTime", "2000-01-01T11:58:55.816"); // J2000 epoch - - PvlKeyword paramNames("ModelParameterNames"); - paramNames += "TestNoneParam"; - paramNames += "TestFictitiousParam"; - paramNames += "TestRealParam"; - paramNames += "TestFixedParam"; - PvlKeyword paramUnits("ModelParameterUnits"); - paramUnits += "unitless"; - paramUnits += "m"; - paramUnits += "rad"; - paramUnits += "lines/sec"; - PvlKeyword paramTypes("ModelParameterTypes"); - paramTypes += "NONE"; - paramTypes += "FICTITIOUS"; - paramTypes += "REAL"; - paramTypes += "FIXED"; - - infoGroup += paramNames; - infoGroup += paramUnits; - infoGroup += paramTypes; - - testCube->putGroup(infoGroup); - - // Register the mock with our plugin - std::string mockModelName = QUuid().toString().toStdString(); - MockCsmPlugin loadablePlugin; - loadablePlugin.registerModel(mockModelName, &mockModel); - - // CSMState BLOB - Blob csmStateBlob("CSMState", "String"); - csmStateBlob.setData(mockModelName.c_str(), mockModelName.size()); - csmStateBlob.Label() += PvlKeyword("ModelName", QString::fromStdString(mockModelName)); - csmStateBlob.Label() += PvlKeyword("PluginName", QString::fromStdString(loadablePlugin.getPluginName())); - testCube->write(csmStateBlob); - filename = testCube->fileName(); - testCube->close(); - testCube->open(filename, "rw"); - } - - void CSMCameraFixture::SetUp() { - CSMCubeFixture::SetUp(); - - // Account for calls that happen while making a CSMCamera - EXPECT_CALL(mockModel, getSensorIdentifier()) - .Times(2) - .WillRepeatedly(::testing::Return("MockSensorID")); - EXPECT_CALL(mockModel, getPlatformIdentifier()) - .Times(2) - .WillRepeatedly(::testing::Return("MockPlatformID")); - EXPECT_CALL(mockModel, getReferenceDateAndTime()) - .Times(1) - .WillRepeatedly(::testing::Return("2000-01-01T11:58:55.816")); - - testCam = testCube->camera(); - } - - void CSMCameraSetFixture::SetUp() { - CSMCameraFixture::SetUp(); - - imagePt = csm::ImageCoord(4.5, 4.5); - groundPt = csm::EcefCoord(wgs84.getSemiMajorRadius(), 0, 0); - imageLocus = csm::EcefLocus(wgs84.getSemiMajorRadius() + 50000, 0, 0, -1, 0, 0); - - // Setup the mock for setImage and ensure it succeeds - EXPECT_CALL(mockModel, imageToRemoteImagingLocus(MatchImageCoord(imagePt), ::testing::_, ::testing::_, ::testing::_)) - .Times(1) - .WillOnce(::testing::Return(imageLocus)); - EXPECT_CALL(mockModel, getImageTime) - .Times(1) - .WillOnce(::testing::Return(10.0)); - - ASSERT_TRUE(testCam->SetImage(5, 5)); // Assert here so that the test code doesn't run if the camera isn't set - } - - void CSMCameraDemFixture::SetUp() { - CSMCubeFixture::SetUp(); - - // Record the demRadius at 0 lat, 0 lon - demRadius = 3394200.43980104; - - // Update the shapemodel on the cube - PvlGroup &kernGroup = testCube->group("Kernels"); - kernGroup.addKeyword(PvlKeyword("ShapeModel", "data/CSMCamera/mola_compressed_prep.cub"), Pvl::Replace); - - // Close and re-open the cube, then save off the new camera - testCube->close(); - testCube->open(filename, "rw"); - - // Account for calls that happen while making a CSMCamera - EXPECT_CALL(mockModel, getSensorIdentifier()) - .Times(2) - .WillRepeatedly(::testing::Return("MockSensorID")); - EXPECT_CALL(mockModel, getPlatformIdentifier()) - .Times(2) - .WillRepeatedly(::testing::Return("MockPlatformID")); - EXPECT_CALL(mockModel, getReferenceDateAndTime()) - .Times(1) - .WillRepeatedly(::testing::Return("2000-01-01T11:58:55.816")); - - testCam = testCube->camera(); - } - - void HistoryBlob::SetUp() { - TempTestingFiles::SetUp(); - - std::istringstream hss(R"( - Object = mroctx2isis - IsisVersion = "4.1.0 | 2020-07-01" - ProgramVersion = 2016-06-10 - ProgramPath = /Users/acpaquette/repos/ISIS3/build/bin - ExecutionDateTime = 2020-07-01T16:48:40 - HostName = Unknown - UserName = acpaquette - Description = "Import an MRO CTX image as an Isis cube" - - Group = UserParameters - FROM = /Users/acpaquette/Desktop/J03_045994_1986_XN_18N282W.IMG - TO = /Users/acpaquette/Desktop/J03_045994_1986_XN_18N282W_isis.cub - SUFFIX = 18 - FILLGAP = true - End_Group - End_Object)"); - - hss >> historyPvl; - - std::ostringstream ostr; - ostr << historyPvl; - std::string histStr = ostr.str(); - - historyBlob = Blob("IsisCube", "History"); - historyBlob.setData(histStr.c_str(), histStr.size()); - } - - - void MgsMocCube::SetUp() { - TempTestingFiles::SetUp(); - - QString testPath = tempDir.path() + "/test.cub"; - QFile::copy("data/mgsImages/mocImage.cub", testPath); - testCube.reset(new Cube(testPath)); - } - - - void MgsMocCube::TearDown() { - testCube.reset(); - } - - - void NullPixelCube::SetUp() { - TempTestingFiles::SetUp(); - - testCube = new Cube(); - testCube->setDimensions(10, 10, 10); - QString path = tempDir.path() + "/null.cub"; - testCube->create(path); - - LineManager line(*testCube); - for(line.begin(); !line.end(); line++) { - for(int i = 0; i < line.size(); i++) { - line[i] = NULL8; - } - testCube->write(line); - } - } - - - void NullPixelCube::TearDown() { - if (testCube->isOpen()) { - testCube->close(); - } - - if (testCube) { - delete testCube; - } - } - - - void MiniRFNetwork::SetUp() { - TempTestingFiles::SetUp(); - - testCube1 = new Cube("data/miniRFImage/LSZ_00455_1CD_XKU_87S324_V1_S1_Null.crop.cub"); - testCube2 = new Cube("data/miniRFImage/LSZ_00457_1CD_XKU_87S321_V1_S1_Null.crop.cub"); - testCube3 = new Cube("data/miniRFImage/LSZ_00459_1CD_XKU_88S327_V1_S1_Null.crop.cub"); - - cubeList = new FileList(); - - cubeList->append(testCube1->fileName()); - cubeList->append(testCube2->fileName()); - cubeList->append(testCube3->fileName()); - - - cubeListFile = tempDir.path() + "/cubes.lis"; - cubeList->write(cubeListFile); - - network = new ControlNet("data/miniRFImage/Cabeus_Orbit400_withSS_AprioriPts.net"); - controlNetPath = tempDir.path() + "/miniRFNet.net"; - network->Write(controlNetPath); - } - - void MiniRFNetwork::TearDown() { - if (testCube1->isOpen()) { - testCube1->close(); - } - delete testCube1; - if (testCube2->isOpen()) { - testCube2->close(); - } - delete testCube2; - if (testCube3->isOpen()) { - testCube3->close(); - } - delete testCube3; - - if (cubeList) { - delete cubeList; - } - } - - void VikThmNetwork::SetUp() { - TempTestingFiles::SetUp(); - - testCube1 = new Cube("data/vikingThemisNetwork/F704b51.lev1_slo_crop.cub"); - testCube2 = new Cube("data/vikingThemisNetwork/F857a32.lev1_slo_crop.cub"); - testCube3 = new Cube("data/vikingThemisNetwork/I28234014RDR_crop.cub"); - testCube4 = new Cube("data/vikingThemisNetwork/I52634011RDR_crop.cub"); - - cubeList = new FileList(); - - cubeList->append(testCube1->fileName()); - cubeList->append(testCube2->fileName()); - cubeList->append(testCube3->fileName()); - cubeList->append(testCube4->fileName()); - - - cubeListFile = tempDir.path() + "/cubes.lis"; - cubeList->write(cubeListFile); - - network = new ControlNet("data/vikingThemisNetwork/themis_dayir_VO_arcadia_extract_hand.net"); - controlNetPath = tempDir.path() + "/vikThmNet.net"; - network->Write(controlNetPath); - } - - void VikThmNetwork::TearDown() { - if (testCube1->isOpen()) { - testCube1->close(); - } - delete testCube1; - if (testCube2->isOpen()) { - testCube2->close(); - } - delete testCube2; - if (testCube3->isOpen()) { - testCube3->close(); - } - delete testCube3; - if (testCube4->isOpen()) { - testCube4->close(); - } - delete testCube4; - - if (cubeList) { - delete cubeList; - } - } - - void CSMNetwork::SetUp(){ - QString APP_XML = FileName("$ISISROOT/bin/xml/csminit.xml").expanded(); - QVector fNames = {"/Test_A", "/Test_B", - "/Test_C", "/Test_D", - "/Test_E", "/Test_F", - "/Test_G", "/Test_H", - "/Test_I", "/Test_J" - }; - - cubes.fill(nullptr, 10); - - cubeList = new FileList(); - cubeListFile = tempDir.path() + "/cubes.lis"; - // Create CSMInit-ed cubes - for (int i = 0; i < cubes.size() ; i++){ - cubes[i] = new Cube(); - cubes[i]->setDimensions(1024,1024,1); - FileName cubName = FileName(tempDir.path()+fNames[i]+".cub"); - cubes[i]->create(cubName.expanded()); - cubeList->append(cubes[i]->fileName()); - QVector args = {"from="+cubName.expanded(), - "state=data/CSMNetwork/"+fNames[i]+".json", - "modelname=TestCsmModel", - "pluginname=TestCsmPlugin" - }; - UserInterface ui(APP_XML, args); - csminit(ui); - } - cubeList->write(cubeListFile); - } - - void CSMNetwork::TearDown() { - for(int i = 0; i < cubes.size(); i++) { - if(cubes[i] && cubes[i]->isOpen()) { - delete cubes[i]; - } - } - - if (cubeList) { - delete cubeList; - } - } - - void ClipperWacFcCube::SetUp() { - TempTestingFiles::SetUp(); - - QString testPath = tempDir.path() + "/test.cub"; - QFile::copy("data/clipper/ClipperWacFc.cub", testPath); - wacFcCube = new Cube(testPath); - - PvlGroup &wacKernels = wacFcCube->label()->findObject("IsisCube").findGroup("Kernels"); - wacKernels.findKeyword("NaifFrameCode").setValue("-159102"); - - double offset = 10; - AlphaCube aCube(wacFcCube->sampleCount(), wacFcCube->lineCount(), - wacFcCube->sampleCount()-offset, wacFcCube->lineCount() - offset, - 0, offset, wacFcCube->sampleCount(), wacFcCube->lineCount()); - - aCube.UpdateGroup(*wacFcCube); - - wacFcCube->reopen("rw"); - } - - void ClipperWacFcCube::TearDown() { - if (wacFcCube) { - delete wacFcCube; - } - } - - void ClipperNacRsCube::SetUp() { - DefaultCube::SetUp(); - - delete testCube; - testCube = new Cube(); - - FileName newCube(tempDir.path() + "/testing.cub"); - - testCube->fromIsd(newCube, label, isd, "rw"); - - PvlGroup &kernels = testCube->label()->findObject("IsisCube").findGroup("Kernels"); - kernels.findKeyword("NaifFrameCode").setValue("-159101"); - - PvlGroup &inst = testCube->label()->findObject("IsisCube").findGroup("Instrument"); - std::istringstream iss(R"( - Group = Instrument - SpacecraftName = Clipper - InstrumentId = EIS-NAC-RS - TargetName = Europa - StartTime = 2025-01-01T00:00:00.000 - JitterSampleCoefficients = (0.0, 0.0, 0.0) - JitterLineCoefficients = (0.0, 0.0, 0.0) - End_Group - )"); - - PvlGroup newInstGroup; - iss >> newInstGroup; - inst = newInstGroup; - - PvlObject &naifKeywords = testCube->label()->findObject("NaifKeywords"); - std::istringstream nk(R"( - Object = NaifKeywords - BODY_CODE = 502 - BODY502_RADII = (1562.6, 1560.3, 1559.5) - BODY_FRAME_CODE = 10024 - INS-159101_FOCAL_LENGTH = 150.40199 - INS-159101_PIXEL_PITCH = 0.014 - INS-159101_TRANSX = (0.0, 0.014004651, 0.0) - INS-159101_TRANSY = (0.0, 0.0, 0.01399535) - INS-159101_ITRANSS = (0.0, 71.404849, 0.0) - INS-159101_ITRANSL = (0.0, 0.0, 71.4523) - INS-159101_OD_K = (0.0, 0.0, 0.0) - End_Object - )"); - - PvlObject newNaifKeywords; - nk >> newNaifKeywords; - naifKeywords = newNaifKeywords; - - QString fileName = testCube->fileName(); - delete testCube; - testCube = new Cube(fileName, "rw"); - - double offset = 10; - AlphaCube aCube(testCube->sampleCount(), testCube->lineCount(), - testCube->sampleCount()-offset, testCube->lineCount() - offset, - 0, offset, testCube->sampleCount(), testCube->lineCount()); - - aCube.UpdateGroup(*testCube); - testCube->reopen("rw"); - } - - void ClipperNacRsCube::TearDown() { - if (testCube) { - delete testCube; - } - } - - void ClipperPbCube::setInstrument(QString instrumentId) { - TempTestingFiles::SetUp(); - - if (instrumentId == "EIS-NAC-PB") { - QString testPath = tempDir.path() + "/nacTest.cub"; - QFile::copy("data/clipper/ClipperNacPb.cub", testPath); - testCube = new Cube(testPath, "rw"); - } - else if (instrumentId == "EIS-WAC-PB") { - QString testPath = tempDir.path() + "/wacTest.cub"; - QFile::copy("data/clipper/ClipperWacPb.cub", testPath); - testCube = new Cube(testPath, "rw"); - } - } - - void NearMsiCameraCube::SetUp() { - TempTestingFiles::SetUp(); - - json isd; - Pvl label; - - std::ifstream isdFile("data/near/msicamera/m0155881376f3_2p_cif_dbl.isd"); - std::ifstream cubeLabel("data/near/msicamera/m0155881376f3_2p_cif_dbl.pvl"); - - isdFile >> isd; - cubeLabel >> label; - - testCube.reset( new Cube() ) ; - testCube->fromIsd(tempDir.path() + "/m0155881376f3_2p_cif_dbl.cub", label, isd, "rw"); - } - - void NearMsiCameraCube::TearDown() { - testCube.reset(); - } void TgoCassisModuleKernels::SetUp() { QVector ckKernels = {QString("data/tgoCassis/mapProjectedReingested/em16_tgo_cassis_tel_20160407_20221231_s20220316_v01_0_sliced_-143410.xc"), @@ -1843,10 +64,43 @@ namespace Isis { } } + void TgoCassisModuleKernels::TearDown() { binaryCkKernels = {}; binarySpkKernels = {}; binaryCkKernelsAsString = ""; binarySpkKernelsAsString = ""; } + + + void HistoryBlob::SetUp() { + TempTestingFiles::SetUp(); + + std::istringstream hss(R"( + Object = mroctx2isis + IsisVersion = "4.1.0 | 2020-07-01" + ProgramVersion = 2016-06-10 + ProgramPath = /Users/acpaquette/repos/ISIS3/build/bin + ExecutionDateTime = 2020-07-01T16:48:40 + HostName = Unknown + UserName = acpaquette + Description = "Import an MRO CTX image as an Isis cube" + + Group = UserParameters + FROM = /Users/acpaquette/Desktop/J03_045994_1986_XN_18N282W.IMG + TO = /Users/acpaquette/Desktop/J03_045994_1986_XN_18N282W_isis.cub + SUFFIX = 18 + FILLGAP = true + End_Group + End_Object)"); + + hss >> historyPvl; + + std::ostringstream ostr; + ostr << historyPvl; + std::string histStr = ostr.str(); + + historyBlob = Blob("IsisCube", "History"); + historyBlob.setData(histStr.c_str(), histStr.size()); + } } diff --git a/isis/tests/Fixtures.h b/isis/tests/Fixtures.h index a94560d7ce..df5f02d18f 100644 --- a/isis/tests/Fixtures.h +++ b/isis/tests/Fixtures.h @@ -3,430 +3,21 @@ #include "gtest/gtest.h" -#include -#include - #include #include -#include - -#include - -#include "csm/csm.h" -#include "csm/Ellipsoid.h" +#include -#include "Cube.h" -#include "IException.h" -#include "OriginalLabel.h" -#include "Pvl.h" -#include "PvlGroup.h" -#include "PvlObject.h" -#include "ImagePolygon.h" -#include "PolygonTools.h" #include "Blob.h" -#include "MockCsmPlugin.h" -#include "Mocks.h" -#include "ControlNet.h" -#include "FileList.h" -#include "FileName.h" - -#include -#include -#include "geos/geom/CoordinateArraySequence.h" -#include "geos/geom/CoordinateSequence.h" -#include "geos/geom/LinearRing.h" -#include "geos/geom/Polygon.h" +#include "Pvl.h" -using json = nlohmann::json; +#include "TempFixtures.h" +#include "CameraFixtures.h" +#include "CsmFixtures.h" +#include "CubeFixtures.h" +#include "NetworkFixtures.h" namespace Isis { - class TempTestingFiles : public ::testing::Test { - protected: - QTemporaryDir tempDir; - - void SetUp() override; - }; - - - - class SmallCube : public TempTestingFiles { - protected: - Cube *testCube; - - void SetUp() override; - void TearDown() override; - }; - - - class LargeCube : public TempTestingFiles { - protected: - Cube *testCube; - - void SetUp() override; - void TearDown() override; - }; - - - class SpecialSmallCube : public TempTestingFiles { - protected: - Cube *testCube; - - void SetUp() override; - void TearDown() override; - }; - - class SmallGapCube : public TempTestingFiles { - protected: - Cube *horzCube; - Cube *vertCube; - Cube *bandCube; - - void SetUp() override; - void TearDown() override; - }; - - class PushFramePair : public TempTestingFiles { - protected: - std::shared_ptr evenCube; - std::shared_ptr oddCube; - int numSamps; - int numBands; - int frameHeight; - int numFrames; - - void SetUp() override; - }; - - class FlippedPushFramePair : public TempTestingFiles { - protected: - std::shared_ptr evenCube; - std::shared_ptr oddCube; - int numSamps; - int numBands; - int frameHeight; - int numFrames; - - void SetUp() override; - }; - - class DefaultCube : public TempTestingFiles { - protected: - Cube *testCube; - Cube *projTestCube; - - Pvl label; - Pvl projLabel; - json isd; - - void SetUp() override; - void TearDown() override; - void resizeCube(int samples, int lines, int bands); - }; - - class LineScannerCube : public TempTestingFiles { - protected: - Cube *testCube; - Cube *projTestCube; - - Pvl label; - Pvl projLabel; - json isd; - - void SetUp() override; - void TearDown() override; - }; - - class OffBodyCube : public TempTestingFiles { - protected: - Cube *testCube; - - void SetUp() override; - void TearDown() override; - }; - - class MiniRFCube : public TempTestingFiles { - protected: - Cube *testCube; - - void SetUp() override; - void TearDown() override; - }; - - class ThreeImageNetwork : public TempTestingFiles { - protected: - - ControlNet *network; - QString networkFile; - - Cube *cube1; - Cube *cube2; - Cube *cube3; - - Cube *cube1map; - Cube *cube2map; - Cube *cube3map; - - FileName *isdPath1; - FileName *isdPath2; - FileName *isdPath3; - - FileName *threeImageOverlapFile; - FileName *twoImageOverlapFile; - - FileList *cubeList; - QString cubeListFile; - QString twoCubeListFile; - - std::vector> coords; - - void SetUp() override; - void AddFeatures(); - void TearDown() override; - }; - - class ObservationPair : public TempTestingFiles { - protected: - - Cube *cubeL; - Cube *cubeR; - - QString cubeLPath; - QString cubeRPath; - - FileName *isdPathL; - FileName *isdPathR; - - FileList *cubeList; - QString cubeListFile; - - ControlNet *network; - QString cnetPath; - - void SetUp() override; - void TearDown() override; - }; - - class ApolloNetwork : public TempTestingFiles { - protected: - QVector isdFiles; - QVector labelFiles; - QVector cubes; - - FileList *cubeList; - QString cubeListFile; - - ControlNet *network; - QString controlNetPath; - - void SetUp() override; - void TearDown() override; - }; - - class DemCube : public DefaultCube { - protected: - Cube *demCube; - - void SetUp() override; - void TearDown() override; - }; - - - class MroCtxCube : public DefaultCube { - protected: - std::unique_ptr testCube; - - void SetUp() override; - void TearDown() override; - }; - - class GalileoSsiCube : public DefaultCube { - protected: - void SetUp() override; - void TearDown() override; - }; - - class MgsMocCube : public DefaultCube { - protected: - std::unique_ptr testCube; - - void SetUp() override; - void TearDown() override; - }; - - - class MroHiriseCube : public DefaultCube { - protected: - QString ckPath = "data/mroKernels/mroCK.bc"; - QString sclkPath = "data/mroKernels/mroSCLK.tsc"; - QString lskPath = "data/mroKernels/mroLSK.tls"; - Cube dejitteredCube; - QString jitterPath; - - void SetUp() override; - void setInstrument(QString ikid, QString instrumentId, QString spacecraftName); - }; - - class NewHorizonsCube : public DefaultCube { - protected: - void setInstrument(QString ikid, QString instrumentId, QString spacecraftName); - }; - - - class OsirisRexCube : public DefaultCube { - protected: - void setInstrument(QString ikid, QString instrumentId); - }; - - - class ApolloCube : public LargeCube { - protected: - std::vector> reseaus; - int reseauSize; - - void SetUp() override; - }; - - class RingsCube : public TempTestingFiles { - protected: - - // pixtures of Saturn's rings - Cube *ring1; - Cube *ring2; - FileList cubeFileList; - QString cubeListPath; - - void SetUp() override; - }; - - class CSMCubeFixture : public SmallCube { - protected: - QString filename; - MockRasterGM mockModel; - - void SetUp() override; -}; - - -class CSMCameraFixture : public CSMCubeFixture { - protected: - Camera *testCam; - - void SetUp() override; -}; - - -class CSMCameraSetFixture : public CSMCameraFixture { - protected: - csm::Ellipsoid wgs84; - csm::ImageCoord imagePt; - csm::EcefCoord groundPt; - csm::EcefLocus imageLocus; - - void SetUp() override; -}; - - -class CSMCameraDemFixture : public CSMCubeFixture { - protected: - Camera *testCam; - double demRadius; - - void SetUp() override; -}; - -class HistoryBlob : public TempTestingFiles { - protected: - Blob historyBlob; - PvlObject historyPvl; - - void SetUp() override; -}; - - -class NullPixelCube : public TempTestingFiles { - protected: - Cube *testCube; - void SetUp() override; - void TearDown() override; -}; - - -class MiniRFNetwork : public TempTestingFiles { - protected: - Cube *testCube1; - Cube *testCube2; - Cube *testCube3; - - FileList *cubeList; - QString cubeListFile; - - ControlNet *network; - QString controlNetPath; - - void SetUp() override; - void TearDown() override; -}; - -class VikThmNetwork : public TempTestingFiles { - protected: - Cube *testCube1; - Cube *testCube2; - Cube *testCube3; - Cube *testCube4; - - FileList *cubeList; - QString cubeListFile; - - ControlNet *network; - QString controlNetPath; - - void SetUp() override; - void TearDown() override; -}; - -class CSMNetwork : public TempTestingFiles { - protected: - - QVector stateStringFiles; - QVector labelFiles; - QVector cubes; - - FileList *cubeList; - QString cubeListFile; - - void SetUp() override; - void TearDown() override; -}; - -class ClipperWacFcCube : public DefaultCube { - protected: - Cube *wacFcCube; - Pvl label; - json isd; - void SetUp() override; - void TearDown() override; -}; - -class ClipperNacRsCube : public DefaultCube { - protected: - void SetUp() override; - void TearDown() override; -}; - -class ClipperPbCube : public TempTestingFiles { - protected: - Cube *testCube; - void setInstrument(QString instrumentId); -}; - -class NearMsiCameraCube : public TempTestingFiles { - protected: - // Cube *testCube; - std::unique_ptr testCube; - void SetUp() override; - void TearDown() override; -}; class TgoCassisModuleKernels : public ::testing::Test { @@ -446,6 +37,15 @@ class TgoCassisModuleKernels : public ::testing::Test { QString binarySpkKernelsAsString; }; + +class HistoryBlob : public TempTestingFiles { + protected: + Blob historyBlob; + PvlObject historyPvl; + + void SetUp() override; +}; + } #endif diff --git a/isis/tests/FunctionalTestsApollocal.cpp b/isis/tests/FunctionalTestsApollocal.cpp index 8deaf02b6b..9c6c1cdd22 100644 --- a/isis/tests/FunctionalTestsApollocal.cpp +++ b/isis/tests/FunctionalTestsApollocal.cpp @@ -1,5 +1,5 @@ #include "Brick.h" -#include "Fixtures.h" +#include "CubeFixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" diff --git a/isis/tests/FunctionalTestsApollofindrx.cpp b/isis/tests/FunctionalTestsApollofindrx.cpp index fef6d8619b..8b673cd9d5 100644 --- a/isis/tests/FunctionalTestsApollofindrx.cpp +++ b/isis/tests/FunctionalTestsApollofindrx.cpp @@ -1,4 +1,4 @@ -#include "Fixtures.h" +#include "CubeFixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" diff --git a/isis/tests/FunctionalTestsApollopanstitcher.cpp b/isis/tests/FunctionalTestsApollopanstitcher.cpp index 38ad6a069e..1c8579d2da 100644 --- a/isis/tests/FunctionalTestsApollopanstitcher.cpp +++ b/isis/tests/FunctionalTestsApollopanstitcher.cpp @@ -13,7 +13,7 @@ #include "gtest/gtest.h" #include "gmock/gmock.h" -#include "Fixtures.h" +#include "TempFixtures.h" using namespace Isis; diff --git a/isis/tests/FunctionalTestsApolloremrx.cpp b/isis/tests/FunctionalTestsApolloremrx.cpp index 8c5a753a39..0e4988ee96 100644 --- a/isis/tests/FunctionalTestsApolloremrx.cpp +++ b/isis/tests/FunctionalTestsApolloremrx.cpp @@ -1,4 +1,5 @@ -#include "Fixtures.h" +#include "Brick.h" +#include "CubeFixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" diff --git a/isis/tests/FunctionalTestsAutomos.cpp b/isis/tests/FunctionalTestsAutomos.cpp index 3c3f8b4a5a..0d0c00ae6d 100644 --- a/isis/tests/FunctionalTestsAutomos.cpp +++ b/isis/tests/FunctionalTestsAutomos.cpp @@ -1,6 +1,7 @@ #include "automos.h" -#include "Fixtures.h" +#include "CameraFixtures.h" +#include "FileList.h" #include "TestUtilities.h" #include "UserInterface.h" #include "Histogram.h" diff --git a/isis/tests/FunctionalTestsBandnorm.cpp b/isis/tests/FunctionalTestsBandnorm.cpp index 4bc618961e..73d790a594 100644 --- a/isis/tests/FunctionalTestsBandnorm.cpp +++ b/isis/tests/FunctionalTestsBandnorm.cpp @@ -1,4 +1,4 @@ -#include "Fixtures.h" +#include "CubeFixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" diff --git a/isis/tests/FunctionalTestsCam2cam.cpp b/isis/tests/FunctionalTestsCam2cam.cpp index 13800c731a..b4f38c6dff 100644 --- a/isis/tests/FunctionalTestsCam2cam.cpp +++ b/isis/tests/FunctionalTestsCam2cam.cpp @@ -13,7 +13,7 @@ #include "TestUtilities.h" #include "FileName.h" #include "ProjectionFactory.h" -#include "Fixtures.h" +#include "CameraFixtures.h" #include "Mocks.h" using namespace Isis; diff --git a/isis/tests/FunctionalTestsCamdev.cpp b/isis/tests/FunctionalTestsCamdev.cpp index 9e3a580dc0..79be25992b 100644 --- a/isis/tests/FunctionalTestsCamdev.cpp +++ b/isis/tests/FunctionalTestsCamdev.cpp @@ -1,4 +1,4 @@ -#include "Fixtures.h" +#include "CameraFixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" diff --git a/isis/tests/FunctionalTestsCaminfo.cpp b/isis/tests/FunctionalTestsCaminfo.cpp index 41fddc52fc..1fc425fefc 100644 --- a/isis/tests/FunctionalTestsCaminfo.cpp +++ b/isis/tests/FunctionalTestsCaminfo.cpp @@ -1,7 +1,10 @@ #include "Cube.h" -#include "Fixtures.h" +#include "CameraFixtures.h" #include "Pvl.h" #include "PvlGroup.h" +#include "Table.h" +#include "TableField.h" +#include "TableRecord.h" #include "TestUtilities.h" #include "CameraStatistics.h" diff --git a/isis/tests/FunctionalTestsCampt.cpp b/isis/tests/FunctionalTestsCampt.cpp index 53cc056b46..494477fc8a 100644 --- a/isis/tests/FunctionalTestsCampt.cpp +++ b/isis/tests/FunctionalTestsCampt.cpp @@ -6,7 +6,8 @@ #include "csm/Ellipsoid.h" #include "campt.h" -#include "Fixtures.h" +#include "CameraFixtures.h" +#include "CsmFixtures.h" #include "Mocks.h" #include "Pvl.h" #include "PvlGroup.h" diff --git a/isis/tests/FunctionalTestsCamrange.cpp b/isis/tests/FunctionalTestsCamrange.cpp index 82d4dcd0cc..99504c05da 100644 --- a/isis/tests/FunctionalTestsCamrange.cpp +++ b/isis/tests/FunctionalTestsCamrange.cpp @@ -3,7 +3,7 @@ #include #include "camrange.h" -#include "Fixtures.h" +#include "CameraFixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" diff --git a/isis/tests/FunctionalTestsCamstats.cpp b/isis/tests/FunctionalTestsCamstats.cpp index fa154682fd..db50bfe41f 100644 --- a/isis/tests/FunctionalTestsCamstats.cpp +++ b/isis/tests/FunctionalTestsCamstats.cpp @@ -3,7 +3,7 @@ #include #include "camstats.h" -#include "Fixtures.h" +#include "CameraFixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" diff --git a/isis/tests/FunctionalTestsChan1m32isis.cpp b/isis/tests/FunctionalTestsChan1m32isis.cpp index 3856714bf3..81d4c22022 100644 --- a/isis/tests/FunctionalTestsChan1m32isis.cpp +++ b/isis/tests/FunctionalTestsChan1m32isis.cpp @@ -2,7 +2,6 @@ #include #include "chan1m32isis.h" -#include "Fixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" diff --git a/isis/tests/FunctionalTestsCiss2isis.cpp b/isis/tests/FunctionalTestsCiss2isis.cpp index 4d6f3e4073..92bb9165c5 100644 --- a/isis/tests/FunctionalTestsCiss2isis.cpp +++ b/isis/tests/FunctionalTestsCiss2isis.cpp @@ -1,7 +1,6 @@ #include #include "ciss2isis.h" -#include "Fixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" diff --git a/isis/tests/FunctionalTestsCkwriter.cpp b/isis/tests/FunctionalTestsCkwriter.cpp index cbc66d44c2..dea94624a3 100644 --- a/isis/tests/FunctionalTestsCkwriter.cpp +++ b/isis/tests/FunctionalTestsCkwriter.cpp @@ -1,7 +1,11 @@ #include "ckwriter.h" -#include "Fixtures.h" +#include "Camera.h" +#include "CameraFixtures.h" +#include "NetworkFixtures.h" #include "Pvl.h" +#include "SpiceRotation.h" +#include "Table.h" #include "TextFile.h" #include "TestUtilities.h" diff --git a/isis/tests/FunctionalTestsCnetbin2pvl.cpp b/isis/tests/FunctionalTestsCnetbin2pvl.cpp index 21319caa48..cb25bcf414 100644 --- a/isis/tests/FunctionalTestsCnetbin2pvl.cpp +++ b/isis/tests/FunctionalTestsCnetbin2pvl.cpp @@ -2,7 +2,7 @@ #include "Pvl.h" #include "cnetbin2pvl.h" -#include "Fixtures.h" +#include "NetworkFixtures.h" #include "Progress.h" #include "gmock/gmock.h" #include "FileName.h" diff --git a/isis/tests/FunctionalTestsCnetcheck.cpp b/isis/tests/FunctionalTestsCnetcheck.cpp index 25769741a7..17941d7207 100644 --- a/isis/tests/FunctionalTestsCnetcheck.cpp +++ b/isis/tests/FunctionalTestsCnetcheck.cpp @@ -15,7 +15,7 @@ #include "ControlMeasure.h" #include "ControlPoint.h" -#include "Fixtures.h" +#include "NetworkFixtures.h" #include "gmock/gmock.h" using namespace Isis; diff --git a/isis/tests/FunctionalTestsCnetcombinept.cpp b/isis/tests/FunctionalTestsCnetcombinept.cpp index 0cc3dba702..03b5b2aeb9 100644 --- a/isis/tests/FunctionalTestsCnetcombinept.cpp +++ b/isis/tests/FunctionalTestsCnetcombinept.cpp @@ -14,7 +14,7 @@ #include "ControlMeasure.h" #include "Distance.h" #include "FileName.h" -#include "Fixtures.h" +#include "TempFixtures.h" #include "Latitude.h" #include "Longitude.h" #include "SurfacePoint.h" diff --git a/isis/tests/FunctionalTestsCnetextract.cpp b/isis/tests/FunctionalTestsCnetextract.cpp index 465a5cc41c..08416472fd 100644 --- a/isis/tests/FunctionalTestsCnetextract.cpp +++ b/isis/tests/FunctionalTestsCnetextract.cpp @@ -3,7 +3,7 @@ #include #include "cnetextract.h" -#include "Fixtures.h" +#include "NetworkFixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" diff --git a/isis/tests/FunctionalTestsCnetpvl2bin.cpp b/isis/tests/FunctionalTestsCnetpvl2bin.cpp index da22c00abd..22919a7ef4 100644 --- a/isis/tests/FunctionalTestsCnetpvl2bin.cpp +++ b/isis/tests/FunctionalTestsCnetpvl2bin.cpp @@ -1,7 +1,7 @@ #include #include "cnetpvl2bin.h" -#include "Fixtures.h" +#include "NetworkFixtures.h" #include "Progress.h" #include "gmock/gmock.h" #include "FileName.h" diff --git a/isis/tests/FunctionalTestsCnetstats.cpp b/isis/tests/FunctionalTestsCnetstats.cpp index 14ecf318f5..d308cb7109 100644 --- a/isis/tests/FunctionalTestsCnetstats.cpp +++ b/isis/tests/FunctionalTestsCnetstats.cpp @@ -4,7 +4,7 @@ #include #include -#include "Fixtures.h" +#include "NetworkFixtures.h" #include "PvlGroup.h" #include "TestUtilities.h" @@ -132,8 +132,8 @@ TEST_F(ThreeImageNetwork, FunctionalTestCnetstatsCubeFilter) { QTemporaryFile flatFile; ASSERT_TRUE(flatFile.open()); - QVector args = {"filter=yes", - "deffile=" + defFile.fileName(), + QVector args = {"filter=yes", + "deffile=" + defFile.fileName(), "flatfile=" + flatFile.fileName()}; UserInterface options(APP_XML, args); Pvl log; @@ -174,8 +174,8 @@ TEST_F(ThreeImageNetwork, FunctionalTestCnetstatsPointFilter) { QTemporaryFile flatFile; ASSERT_TRUE(flatFile.open()); - QVector args = {"filter=yes", - "deffile=" + defFile.fileName(), + QVector args = {"filter=yes", + "deffile=" + defFile.fileName(), "flatfile=" + flatFile.fileName()}; UserInterface options(APP_XML, args); Pvl log; @@ -189,7 +189,7 @@ TEST_F(ThreeImageNetwork, FunctionalTestCnetstatsPointFilter) { while(!stream.atEnd()) { QString line = stream.readLine(); QStringList values = line.split(","); - + ASSERT_DOUBLE_EQ(values.size(), 13); lineNumber++; } @@ -211,8 +211,8 @@ TEST_F(ThreeImageNetwork, FunctionalTestCnetstatsInvalidDefFile) { QTemporaryFile flatFile; ASSERT_TRUE(flatFile.open()); - QVector args = {"filter=yes", - "deffile=" + defFile.fileName(), + QVector args = {"filter=yes", + "deffile=" + defFile.fileName(), "flatfile=" + flatFile.fileName()}; UserInterface options(APP_XML, args); Pvl log; diff --git a/isis/tests/FunctionalTestsCrism2isis.cpp b/isis/tests/FunctionalTestsCrism2isis.cpp index 15928eb783..828bd09fbb 100644 --- a/isis/tests/FunctionalTestsCrism2isis.cpp +++ b/isis/tests/FunctionalTestsCrism2isis.cpp @@ -3,7 +3,6 @@ #include #include "crism2isis.h" -#include "Fixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" diff --git a/isis/tests/FunctionalTestsCrop.cpp b/isis/tests/FunctionalTestsCrop.cpp index 2c6d0c24ae..719df2d4d9 100644 --- a/isis/tests/FunctionalTestsCrop.cpp +++ b/isis/tests/FunctionalTestsCrop.cpp @@ -1,4 +1,5 @@ -#include "Fixtures.h" +#include "CameraFixtures.h" +#include "CubeFixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" diff --git a/isis/tests/FunctionalTestsCsminit.cpp b/isis/tests/FunctionalTestsCsminit.cpp index c0caa763fe..feee61084e 100644 --- a/isis/tests/FunctionalTestsCsminit.cpp +++ b/isis/tests/FunctionalTestsCsminit.cpp @@ -6,7 +6,8 @@ #include "AlternativeTestCsmModel.h" #include "Blob.h" #include "TestCsmPlugin.h" -#include "Fixtures.h" +#include "TempFixtures.h" +#include "CameraFixtures.h" #include "TestUtilities.h" #include "TestCsmModel.h" #include "FileName.h" diff --git a/isis/tests/FunctionalTestsCtxcal.cpp b/isis/tests/FunctionalTestsCtxcal.cpp index f7aae90848..e1902aa8af 100644 --- a/isis/tests/FunctionalTestsCtxcal.cpp +++ b/isis/tests/FunctionalTestsCtxcal.cpp @@ -1,4 +1,4 @@ -#include "Fixtures.h" +#include "CameraFixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" @@ -18,7 +18,7 @@ TEST_F(MroCtxCube, FunctionalTestCtxcalDefault) { QVector args = {"to="+outCubeFileName}; UserInterface options(APP_XML, args); - + try { ctxcal(testCube.get(), options); } @@ -30,7 +30,7 @@ TEST_F(MroCtxCube, FunctionalTestCtxcalDefault) { PvlGroup radGroup = oCube.label()->findObject("IsisCube").findGroup("Radiometry"); EXPECT_DOUBLE_EQ((double)radGroup.findKeyword("iof"), 1.86764430855461e-04); - + Histogram *oCubeStats = oCube.histogram(); EXPECT_DOUBLE_EQ(oCubeStats->Average(), 0.077640061192214491); @@ -45,7 +45,7 @@ TEST_F(MroCtxCube, FunctionalTestCtxcalFlatfile) { QVector args = {"to="+outCubeFileName, "flatfile=$ISISDATA/mro/calibration/ctxFlat_0001.cub"}; UserInterface options(APP_XML, args); - + try { ctxcal(testCube.get(), options); } @@ -69,7 +69,7 @@ TEST_F(MroCtxCube, FunctionalTestCtxcalIofFalse) { QVector args = {"to="+outCubeFileName, "iof=false"}; UserInterface options(APP_XML, args); - + try { ctxcal(testCube.get(), options); } @@ -78,10 +78,10 @@ TEST_F(MroCtxCube, FunctionalTestCtxcalIofFalse) { } Cube oCube(outCubeFileName, "r"); - + PvlGroup radGroup = oCube.label()->findObject("IsisCube").findGroup("Radiometry"); - EXPECT_DOUBLE_EQ((double)radGroup.findKeyword("iof"), 1); - + EXPECT_DOUBLE_EQ((double)radGroup.findKeyword("iof"), 1); + Histogram *oCubeStats = oCube.histogram(); EXPECT_DOUBLE_EQ(oCubeStats->Average(), 221.12296661376953); @@ -96,35 +96,35 @@ TEST_F(MroCtxCube, FunctionalTestCtxcalCameraComparison) { QVector args = {"to="+outCubeFileNameCam}; UserInterface options(APP_XML, args); - + try { ctxcal(testCube.get(), options); } catch (IException &e) { FAIL() << "Unable to open image: " << e.what() << std::endl; } - + // force camera to not construct - Pvl *lab = testCube->label(); + Pvl *lab = testCube->label(); lab->deleteObject("NaifKeywords"); QString outCubeFileNameNoCam = tempDir.path() + "/outTempNoCam.cub"; args = {"to="+outCubeFileNameNoCam}; - + try { ctxcal(testCube.get(), options); } catch (IException &e) { FAIL() << "Unable to open image: " << e.what() << std::endl; } - + Cube oNoCamCube(outCubeFileNameCam, "r"); Cube oCamCube(outCubeFileNameCam, "r"); - Pvl *noCamLab = oNoCamCube.label(); + Pvl *noCamLab = oNoCamCube.label(); Pvl *camLab = oCamCube.label(); - EXPECT_DOUBLE_EQ((double)noCamLab->findObject("IsisCube").findGroup("Radiometry").findKeyword("iof"), + EXPECT_DOUBLE_EQ((double)noCamLab->findObject("IsisCube").findGroup("Radiometry").findKeyword("iof"), (double)camLab->findObject("IsisCube").findGroup("Radiometry").findKeyword("iof")); EXPECT_DOUBLE_EQ((double)noCamLab->findObject("IsisCube").findGroup("Radiometry").findKeyword("iof"), 1.86764430855461e-04); diff --git a/isis/tests/FunctionalTestsCubeatt.cpp b/isis/tests/FunctionalTestsCubeatt.cpp index 8263454da3..174474920c 100644 --- a/isis/tests/FunctionalTestsCubeatt.cpp +++ b/isis/tests/FunctionalTestsCubeatt.cpp @@ -1,7 +1,7 @@ #include #include "Cube.h" -#include "Fixtures.h" +#include "CubeFixtures.h" #include "Statistics.h" #include "cubeatt.h" @@ -51,8 +51,8 @@ TEST_F(SmallCube, FunctionalTestCubeattNoChange) { // Setting the pixel range modifies the base/multiplier, so check those. EXPECT_EQ(outputCube.base(), 0); EXPECT_EQ(outputCube.multiplier(), 1); - EXPECT_EQ(outputCube.bandCount(), 10); - + EXPECT_EQ(outputCube.bandCount(), 10); + // Test that DNs match in the input and output cubes Statistics *outputStats = outputCube.statistics(); Statistics *inputStats = testCube->statistics(); @@ -68,7 +68,7 @@ TEST_F(SmallCube, FunctionalTestCubeattVirtualBands) { UserInterface options(APP_XML, args); cubeatt(options); Cube outputCube(cubePath); - EXPECT_EQ(outputCube.bandCount(), 9); + EXPECT_EQ(outputCube.bandCount(), 9); // Do need to check the label for this one, since outputCube.physicalBand() will not work // in this context: @@ -151,7 +151,7 @@ TEST_F(SmallCube, FunctionalTestCubeattInputAndOutputAttributes) { Statistics *outputStats = outputCube.statistics(); EXPECT_GE(outputStats->Minimum(), 200); EXPECT_LE(outputStats->Maximum(), 300); - EXPECT_EQ(outputCube.bandCount(), 3); + EXPECT_EQ(outputCube.bandCount(), 3); Pvl *label = outputCube.label(); PvlGroup bandBin = label->findObject("IsisCube").findGroup("BandBin"); diff --git a/isis/tests/FunctionalTestsDemprep.cpp b/isis/tests/FunctionalTestsDemprep.cpp index c7c7b9ca18..ea35816155 100644 --- a/isis/tests/FunctionalTestsDemprep.cpp +++ b/isis/tests/FunctionalTestsDemprep.cpp @@ -12,8 +12,6 @@ #include "Table.h" #include "Histogram.h" -#include "Fixtures.h" - #include "gmock/gmock.h" using namespace Isis; diff --git a/isis/tests/FunctionalTestsEis2isis.cpp b/isis/tests/FunctionalTestsEis2isis.cpp index b91b289111..dd2bf228d5 100644 --- a/isis/tests/FunctionalTestsEis2isis.cpp +++ b/isis/tests/FunctionalTestsEis2isis.cpp @@ -2,7 +2,6 @@ #include #include "eis2isis.h" -#include "Fixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" diff --git a/isis/tests/FunctionalTestsEnlarge.cpp b/isis/tests/FunctionalTestsEnlarge.cpp index 1a7df982e4..a1d50b7499 100644 --- a/isis/tests/FunctionalTestsEnlarge.cpp +++ b/isis/tests/FunctionalTestsEnlarge.cpp @@ -4,7 +4,7 @@ #include #include -#include "Fixtures.h" +#include "CubeFixtures.h" #include "PvlGroup.h" #include "TestUtilities.h" diff --git a/isis/tests/FunctionalTestsFillGap.cpp b/isis/tests/FunctionalTestsFillGap.cpp index 6178254942..eae4da1366 100644 --- a/isis/tests/FunctionalTestsFillGap.cpp +++ b/isis/tests/FunctionalTestsFillGap.cpp @@ -1,7 +1,7 @@ #include #include "fillgap.h" -#include "Fixtures.h" +#include "CubeFixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" @@ -34,7 +34,7 @@ TEST_F( SmallGapCube, FillGapTestBandAkima ) catch (IException &e) { FAIL() << e.toString().toStdString().c_str() << std::endl; } - + Cube outCube(cubeFileName); Pvl *label = outCube.label(); @@ -387,7 +387,7 @@ TEST_F( SmallGapCube, FillGapTestGapsOnEdge ) int lineNum = 0; for(line.begin(); !line.end(); line++) { for(int i = 0; i < line.size(); i++) { - if( lineNum == 0 ) { + if( lineNum == 0 ) { line[i] = NULL8; } } @@ -407,5 +407,5 @@ TEST_F( SmallGapCube, FillGapTestGapsOnEdge ) } PvlGroup &mess = log.findGroup("Messages", Pvl::Traverse); - EXPECT_EQ(mess["Warning"][0].toStdString(), "Unable to fill 9 special pixels." ); + EXPECT_EQ(mess["Warning"][0].toStdString(), "Unable to fill 9 special pixels." ); } diff --git a/isis/tests/FunctionalTestsFindGaps.cpp b/isis/tests/FunctionalTestsFindGaps.cpp index 3e98ad3066..0d56b1dca6 100644 --- a/isis/tests/FunctionalTestsFindGaps.cpp +++ b/isis/tests/FunctionalTestsFindGaps.cpp @@ -1,7 +1,7 @@ #include #include "findgaps.h" -#include "Fixtures.h" +#include "CubeFixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" @@ -152,7 +152,7 @@ TEST_F( SmallCube, FindGapsCorTol ) testCube->write(line); } - + pixelValue++; } } diff --git a/isis/tests/FunctionalTestsFindfeatures.cpp b/isis/tests/FunctionalTestsFindfeatures.cpp index a419aaf027..cdaa5808b7 100644 --- a/isis/tests/FunctionalTestsFindfeatures.cpp +++ b/isis/tests/FunctionalTestsFindfeatures.cpp @@ -4,7 +4,7 @@ #include #include -#include "Fixtures.h" +#include "NetworkFixtures.h" #include "PvlGroup.h" #include "TestUtilities.h" #include "SurfacePoint.h" diff --git a/isis/tests/FunctionalTestsFindimageoverlaps.cpp b/isis/tests/FunctionalTestsFindimageoverlaps.cpp index da0a273fba..9ee38e54db 100644 --- a/isis/tests/FunctionalTestsFindimageoverlaps.cpp +++ b/isis/tests/FunctionalTestsFindimageoverlaps.cpp @@ -2,7 +2,7 @@ #include #include "findimageoverlaps.h" -#include "Fixtures.h" +#include "NetworkFixtures.h" #include "TestUtilities.h" #include "IException.h" #include "FileList.h" @@ -20,10 +20,10 @@ #include "geos/geom/LinearRing.h" #include "geos/geom/Polygon.h" -#include "Fixtures.h" - #include "gmock/gmock.h" +using json = nlohmann::json; + using namespace Isis; static QString APP_XML = FileName("$ISISROOT/bin/xml/findimageoverlaps.xml").expanded(); diff --git a/isis/tests/FunctionalTestsFits2isis.cpp b/isis/tests/FunctionalTestsFits2isis.cpp index 6a03d35c40..a3f2b41221 100644 --- a/isis/tests/FunctionalTestsFits2isis.cpp +++ b/isis/tests/FunctionalTestsFits2isis.cpp @@ -1,7 +1,6 @@ #include #include "fits2isis.h" -#include "Fixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" diff --git a/isis/tests/FunctionalTestsFootprintinit.cpp b/isis/tests/FunctionalTestsFootprintinit.cpp index 9db27862b7..1c23a050b7 100644 --- a/isis/tests/FunctionalTestsFootprintinit.cpp +++ b/isis/tests/FunctionalTestsFootprintinit.cpp @@ -2,15 +2,19 @@ #include #include +#include +#include + #include "footprintinit.h" #include "Cube.h" +#include "ImagePolygon.h" #include "Pvl.h" #include "TestUtilities.h" #include "FileName.h" #include "LineManager.h" -#include "Fixtures.h" +#include "CameraFixtures.h" #include "gmock/gmock.h" diff --git a/isis/tests/FunctionalTestsFrameStitch.cpp b/isis/tests/FunctionalTestsFrameStitch.cpp index 54239c132c..a1270a7896 100644 --- a/isis/tests/FunctionalTestsFrameStitch.cpp +++ b/isis/tests/FunctionalTestsFrameStitch.cpp @@ -10,7 +10,7 @@ #include "Table.h" #include "TestUtilities.h" -#include "Fixtures.h" +#include "CameraFixtures.h" #include "gmock/gmock.h" #include "gmock/gmock.h" diff --git a/isis/tests/FunctionalTestsGetsn.cpp b/isis/tests/FunctionalTestsGetsn.cpp index 8b7d985e11..74abd477e7 100644 --- a/isis/tests/FunctionalTestsGetsn.cpp +++ b/isis/tests/FunctionalTestsGetsn.cpp @@ -7,7 +7,7 @@ #include #include "getsn.h" -#include "Fixtures.h" +#include "CameraFixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" @@ -22,7 +22,7 @@ TEST_F(DefaultCube, FunctionalTestGetsnAllTrue) { QString APP_XML = FileName("$ISISROOT/bin/xml/getsn.xml").expanded(); QString expectedSN = "Viking1/VISB/33322515"; QString expectedON = "Viking1/VISB/33322515"; - + QVector args = { "FILE=TRUE", "SN=TRUE", "OBSERVATION=TRUE"}; diff --git a/isis/tests/FunctionalTestsGllssical.cpp b/isis/tests/FunctionalTestsGllssical.cpp index 2ff4e19260..9b92e53a06 100644 --- a/isis/tests/FunctionalTestsGllssical.cpp +++ b/isis/tests/FunctionalTestsGllssical.cpp @@ -1,4 +1,4 @@ -#include "Fixtures.h" +#include "CameraFixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" @@ -28,7 +28,7 @@ TEST_F(GalileoSsiCube, FunctionalTestGllssicalDefault) { Cube oCube(outCubeFileName, "r"); PvlGroup radGroup = oCube.label()->findObject("IsisCube").findGroup("RadiometricCalibration"); - + EXPECT_EQ(radGroup.findKeyword("DarkCurrentFile")[0].toStdString(), "$galileo/calibration/darkcurrent/2f8.dc04.cub"); EXPECT_EQ(radGroup.findKeyword("GainFile")[0].toStdString(), "$galileo/calibration/gain/redf.cal04.cub"); EXPECT_EQ(radGroup.findKeyword("ShutterFile")[0].toStdString(), "$galileo/calibration/shutter/calibration.so02F.cub"); @@ -69,7 +69,7 @@ TEST_F(GalileoSsiCube, FunctionalTestGllssicalClear) { // tempDir exists if the fixture subclasses TempTestingFiles, which most do QString outCubeFileName = tempDir.path() + "/outTemp.cub"; QVector args = {"from="+ testCube->fileName(), "to="+outCubeFileName}; - + UserInterface options(APP_XML, args); try { gllssical(options); @@ -81,7 +81,7 @@ TEST_F(GalileoSsiCube, FunctionalTestGllssicalClear) { Cube oCube(outCubeFileName, "r"); PvlGroup radGroup = oCube.label()->findObject("IsisCube").findGroup("RadiometricCalibration"); - + EXPECT_EQ(radGroup.findKeyword("DarkCurrentFile")[0].toStdString(), "$galileo/calibration/darkcurrent/2f8.dc04.cub"); EXPECT_EQ(radGroup.findKeyword("GainFile")[0].toStdString(), "$galileo/calibration/gain/clrf.cal04.cub"); EXPECT_EQ(radGroup.findKeyword("ShutterFile")[0].toStdString(), "$galileo/calibration/shutter/calibration.so02F.cub"); @@ -106,7 +106,7 @@ TEST_F(GalileoSsiCube, FunctionalTestGllssicalClear) { TEST_F(GalileoSsiCube, FunctionalTestGllssicalRadiance) { // tempDir exists if the fixture subclasses TempTestingFiles, which most do QString outCubeFileName = tempDir.path() + "/outTemp.cub"; - QVector args = {"from="+ testCube->fileName(), "to="+outCubeFileName, + QVector args = {"from="+ testCube->fileName(), "to="+outCubeFileName, "UNITS=RADIANCE", "SCALE=0.0001", "BITWEIGHTING=true"}; UserInterface options(APP_XML, args); @@ -120,7 +120,7 @@ TEST_F(GalileoSsiCube, FunctionalTestGllssicalRadiance) { Cube oCube(outCubeFileName, "r"); PvlGroup radGroup = oCube.label()->findObject("IsisCube").findGroup("RadiometricCalibration"); - + EXPECT_EQ(radGroup.findKeyword("DarkCurrentFile")[0].toStdString(), "$galileo/calibration/darkcurrent/2f8.dc04.cub"); EXPECT_EQ(radGroup.findKeyword("GainFile")[0].toStdString(), "$galileo/calibration/gain/redf.cal04.cub"); EXPECT_EQ(radGroup.findKeyword("ShutterFile")[0].toStdString(), "$galileo/calibration/shutter/calibration.so02F.cub"); diff --git a/isis/tests/FunctionalTestsGrid.cpp b/isis/tests/FunctionalTestsGrid.cpp index 7955ec49e3..315bdf6475 100644 --- a/isis/tests/FunctionalTestsGrid.cpp +++ b/isis/tests/FunctionalTestsGrid.cpp @@ -4,9 +4,12 @@ #include #include -#include "Fixtures.h" +#include "CubeFixtures.h" +#include "CameraFixtures.h" +#include "CubeFixtures.h" #include "LineManager.h" #include "PvlGroup.h" +#include "SpecialPixel.h" #include "TestUtilities.h" #include "gmock/gmock.h" @@ -89,11 +92,11 @@ TEST_F(SmallCube, FunctionalTestGridHrsLrs) { } LineManager line(outputCube); - for (int i = 1; i <= outputCube.lineCount(); i++) { + for (int i = 1; i <= outputCube.lineCount(); i++) { line.SetLine(i); outputCube.read(line); - for (int j = 0; j < line.size(); j++) { + for (int j = 0; j < line.size(); j++) { if (i % 5 == 1 || j % 5 == 0 ) { EXPECT_EQ(line[j], Isis::Lrs); } @@ -119,11 +122,11 @@ TEST_F(SmallCube, FunctionalTestGridLrsNull) { } LineManager line(outputCube); - for (int i = 1; i <= outputCube.lineCount(); i++) { + for (int i = 1; i <= outputCube.lineCount(); i++) { line.SetLine(i); outputCube.read(line); - for (int j = 0; j < line.size(); j++) { + for (int j = 0; j < line.size(); j++) { if (i % 5 == 1 || j % 5 == 0) { EXPECT_EQ(line[j], Isis::Null); } @@ -149,11 +152,11 @@ TEST_F(SmallCube, FunctionalTestGridNullDn) { } LineManager line(outputCube); - for (int i = 1; i <= outputCube.lineCount(); i++) { + for (int i = 1; i <= outputCube.lineCount(); i++) { line.SetLine(i); outputCube.read(line); - for (int j = 0; j < line.size(); j++) { + for (int j = 0; j < line.size(); j++) { if (i % 5 == 1 || j % 5 == 0) { EXPECT_DOUBLE_EQ(line[j], 0.0); } @@ -179,11 +182,11 @@ TEST_F(SmallCube, FunctionalTestGridDnHrs) { } LineManager line(outputCube); - for (int i = 1; i <= outputCube.lineCount(); i++) { + for (int i = 1; i <= outputCube.lineCount(); i++) { line.SetLine(i); outputCube.read(line); - for (int j = 0; j < line.size(); j++) { + for (int j = 0; j < line.size(); j++) { if (i % 5 == 1 || j % 5 == 0) { EXPECT_EQ(line[j], Isis::Hrs); } @@ -339,7 +342,7 @@ TEST_F(DefaultCube, FunctionalTestGridWorld) { } projTestCube->reopen("rw"); - // need to remove old camera pointer + // need to remove old camera pointer delete projTestCube; // Cube now has new mapping group diff --git a/isis/tests/FunctionalTestsHi2isis.cpp b/isis/tests/FunctionalTestsHi2isis.cpp index da8b4bc3ed..76a495a665 100644 --- a/isis/tests/FunctionalTestsHi2isis.cpp +++ b/isis/tests/FunctionalTestsHi2isis.cpp @@ -1,6 +1,5 @@ #include -#include "Fixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" diff --git a/isis/tests/FunctionalTestsHical.cpp b/isis/tests/FunctionalTestsHical.cpp index 6e6c9e453e..7597fc1fd4 100644 --- a/isis/tests/FunctionalTestsHical.cpp +++ b/isis/tests/FunctionalTestsHical.cpp @@ -6,7 +6,6 @@ #include #include "hical.h" -#include "Fixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" diff --git a/isis/tests/FunctionalTestsHicolormos.cpp b/isis/tests/FunctionalTestsHicolormos.cpp index 55a2a07d30..afa14cd823 100644 --- a/isis/tests/FunctionalTestsHicolormos.cpp +++ b/isis/tests/FunctionalTestsHicolormos.cpp @@ -1,4 +1,4 @@ -#include "Fixtures.h" +#include "CameraFixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" diff --git a/isis/tests/FunctionalTestsHicrop.cpp b/isis/tests/FunctionalTestsHicrop.cpp index 2efff7abaf..2aa2ef1429 100644 --- a/isis/tests/FunctionalTestsHicrop.cpp +++ b/isis/tests/FunctionalTestsHicrop.cpp @@ -1,29 +1,29 @@ -#include "Fixtures.h" +#include "CameraFixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "hicrop.h" #include "TestUtilities.h" -#include "Fixtures.h" +#include "CameraFixtures.h" #include "gmock/gmock.h" using namespace Isis; -using namespace testing; +using namespace testing; static QString APP_XML = FileName("$ISISROOT/bin/xml/hicrop.xml").expanded(); TEST_F(MroHiriseCube, FunctionalTestHicropCropByCk) { - // make the image stretch outside of the CK time ranges + // make the image stretch outside of the CK time ranges PvlGroup &inst = testCube->label()->findObject("IsisCube").findGroup("Instrument"); - inst.findKeyword("DeltaLineTimerCount").setValue("99999"); + inst.findKeyword("DeltaLineTimerCount").setValue("99999"); QTemporaryDir prefix; QString outCubeFileName = prefix.path() + "/outTemp.cub"; - + QVector args = {"from=eh", "to="+outCubeFileName, "source=CK", "CK="+ckPath, "SCLK="+sclkPath, "LSK="+lskPath}; - + UserInterface options(APP_XML, args); Pvl *logs = new Pvl(); try { @@ -34,20 +34,20 @@ TEST_F(MroHiriseCube, FunctionalTestHicropCropByCk) { } PvlGroup results = logs->findGroup("Results"); - + EXPECT_EQ((int)results.findKeyword("InputLines"), 1056); EXPECT_EQ((int)results.findKeyword("NumberOfLinesCropped"), 54); EXPECT_EQ((int)results.findKeyword("OututStartingLine"), 55); - EXPECT_EQ((int)results.findKeyword("OututEndingLine"), 1056); - EXPECT_EQ((int)results.findKeyword("OututLineCount"), 1002); + EXPECT_EQ((int)results.findKeyword("OututEndingLine"), 1056); + EXPECT_EQ((int)results.findKeyword("OututLineCount"), 1002); EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)results.findKeyword("OututStartTime"), "2008-05-17T09:37:24.7300819"); EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)results.findKeyword("OututStopTime"), "2008-05-17T09:37:31.0666673"); - EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)results.findKeyword("OututStartClock"), "4/0895484265.14186"); - EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)results.findKeyword("OututStopClock"), "4/0895484271.36245"); - - Cube oCube(outCubeFileName); + EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)results.findKeyword("OututStartClock"), "4/0895484265.14186"); + EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)results.findKeyword("OututStopClock"), "4/0895484271.36245"); + + Cube oCube(outCubeFileName); PvlGroup oCubeInstrument = testCube->label()->findObject("IsisCube").findGroup("Instrument"); - + EXPECT_EQ(oCube.lineCount(), 1002); EXPECT_EQ(oCube.sampleCount(), 1204); EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)oCubeInstrument.findKeyword("StartTime"), "2008-05-17T09:37:24.7300819"); @@ -60,10 +60,10 @@ TEST_F(MroHiriseCube, FunctionalTestHicropCropByCk) { TEST_F(MroHiriseCube, FunctionalTestHicropCropByLine) { QTemporaryDir prefix; QString outCubeFileName = prefix.path() + "/outTemp.cub"; - + QVector args = {"to="+outCubeFileName, "source=LINE", "LINE=55", "NLINES=1002", "CK="+ckPath, "SCLK="+sclkPath, "LSK="+lskPath}; - + UserInterface options(APP_XML, args); Pvl *logs = new Pvl(); try { @@ -74,20 +74,20 @@ TEST_F(MroHiriseCube, FunctionalTestHicropCropByLine) { } PvlGroup results = logs->findGroup("Results"); - + EXPECT_EQ((int)results.findKeyword("InputLines"), 1056); EXPECT_EQ((int)results.findKeyword("NumberOfLinesCropped"), 54); EXPECT_EQ((int)results.findKeyword("OututStartingLine"), 55); - EXPECT_EQ((int)results.findKeyword("OututEndingLine"), 1056); - EXPECT_EQ((int)results.findKeyword("OututLineCount"), 1002); + EXPECT_EQ((int)results.findKeyword("OututEndingLine"), 1056); + EXPECT_EQ((int)results.findKeyword("OututLineCount"), 1002); EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)results.findKeyword("OututStartTime"), "2008-05-17T09:37:24.7892562"); EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)results.findKeyword("OututStopTime"), "2008-05-17T09:37:24.8845088"); - EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)results.findKeyword("OututStartClock"), "4/0895484264.57678"); - EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)results.findKeyword("OututStopClock"), "4/0895484264.63921"); - - Cube oCube(outCubeFileName); + EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)results.findKeyword("OututStartClock"), "4/0895484264.57678"); + EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)results.findKeyword("OututStopClock"), "4/0895484264.63921"); + + Cube oCube(outCubeFileName); PvlGroup oCubeInstrument = testCube->label()->findObject("IsisCube").findGroup("Instrument"); - + EXPECT_EQ(oCube.lineCount(), 1002); EXPECT_EQ(oCube.sampleCount(), 1204); EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)oCubeInstrument.findKeyword("StartTime"), "2008-05-17T09:37:24.7300819"); @@ -98,13 +98,13 @@ TEST_F(MroHiriseCube, FunctionalTestHicropCropByLine) { TEST_F(MroHiriseCube, FunctionalTestHicropCropByTimes) { - + QTemporaryDir prefix; QString outCubeFileName = prefix.path() + "/outTemp.cub"; - + QVector args = {"to="+outCubeFileName, "source=TIME", "STARTTIME=264289109.96933", "STOPTIME=264289110.06", "CK="+ckPath, "SCLK="+sclkPath, "LSK="+lskPath}; - + UserInterface options(APP_XML, args); Pvl *logs = new Pvl(); try { @@ -113,22 +113,22 @@ TEST_F(MroHiriseCube, FunctionalTestHicropCropByTimes) { catch (IException &e) { FAIL() << "Unable to open image: " << e.what() << std::endl; } - + PvlGroup results = logs->findGroup("Results"); - + EXPECT_EQ((int)results.findKeyword("InputLines"), 1056); EXPECT_EQ((int)results.findKeyword("NumberOfLinesCropped"), 103); EXPECT_EQ((int)results.findKeyword("OututStartingLine"), 1); - EXPECT_EQ((int)results.findKeyword("OututEndingLine"), 953); - EXPECT_EQ((int)results.findKeyword("OututLineCount"), 953); + EXPECT_EQ((int)results.findKeyword("OututEndingLine"), 953); + EXPECT_EQ((int)results.findKeyword("OututLineCount"), 953); EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)results.findKeyword("OututStartTime"), "2008-05-17T09:37:24.7841228"); EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)results.findKeyword("OututStopTime"), "2008-05-17T09:37:24.8747174"); - EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)results.findKeyword("OututStartClock"), "4/0895484264.57342"); - EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)results.findKeyword("OututStopClock"), "4/0895484264.63279"); - - Cube oCube(outCubeFileName); + EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)results.findKeyword("OututStartClock"), "4/0895484264.57342"); + EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)results.findKeyword("OututStopClock"), "4/0895484264.63279"); + + Cube oCube(outCubeFileName); PvlGroup oCubeInstrument = testCube->label()->findObject("IsisCube").findGroup("Instrument"); - + EXPECT_EQ(oCube.lineCount(), 953); EXPECT_EQ(oCube.sampleCount(), 1204); EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)oCubeInstrument.findKeyword("StartTime"), "2008-05-17T09:37:24.7300819"); @@ -139,13 +139,13 @@ TEST_F(MroHiriseCube, FunctionalTestHicropCropByTimes) { TEST_F(MroHiriseCube, FunctionalTestHicropCropByJitterDefault) { - + QTemporaryDir prefix; QString outCubeFileName = prefix.path() + "/outTemp.cub"; - + QVector args = {"to="+outCubeFileName, "source=Jitter", "jitter="+jitterPath, "CK="+ckPath, "SCLK="+sclkPath, "LSK="+lskPath}; - + UserInterface options(APP_XML, args); Pvl *logs = new Pvl(); try { @@ -154,22 +154,22 @@ TEST_F(MroHiriseCube, FunctionalTestHicropCropByJitterDefault) { catch (IException &e) { FAIL() << "Unable to open image: " << e.what() << std::endl; } - + PvlGroup results = logs->findGroup("Results"); - + EXPECT_EQ((int)results.findKeyword("InputLines"), 1056); EXPECT_EQ((int)results.findKeyword("NumberOfLinesCropped"), 103); EXPECT_EQ((int)results.findKeyword("OututStartingLine"), 1); - EXPECT_EQ((int)results.findKeyword("OututEndingLine"), 953); - EXPECT_EQ((int)results.findKeyword("OututLineCount"), 953); + EXPECT_EQ((int)results.findKeyword("OututEndingLine"), 953); + EXPECT_EQ((int)results.findKeyword("OututLineCount"), 953); EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)results.findKeyword("OututStartTime"), "2008-05-17T09:37:24.7841228"); EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)results.findKeyword("OututStopTime"), "2008-05-17T09:37:24.8747174"); - EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)results.findKeyword("OututStartClock"), "4/0895484264.57342"); - EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)results.findKeyword("OututStopClock"), "4/0895484264.63279"); - - Cube oCube(outCubeFileName); + EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)results.findKeyword("OututStartClock"), "4/0895484264.57342"); + EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)results.findKeyword("OututStopClock"), "4/0895484264.63279"); + + Cube oCube(outCubeFileName); PvlGroup oCubeInstrument = testCube->label()->findObject("IsisCube").findGroup("Instrument"); - + EXPECT_EQ(oCube.lineCount(), 953); EXPECT_EQ(oCube.sampleCount(), 1204); EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)oCubeInstrument.findKeyword("StartTime"), "2008-05-17T09:37:24.7300819"); @@ -180,34 +180,34 @@ TEST_F(MroHiriseCube, FunctionalTestHicropCropByJitterDefault) { TEST_F(MroHiriseCube, FunctionalTestHicropCropByJitterZero) { - + QTemporaryDir prefix; - // create a jitter file + // create a jitter file QString jitter = R"(# Sample Line ET 0 0 264289109.96933 -0.11 -0.04 264289109.98 -0.05 -0.02 264289109.99 1.5 0.6 264289110.06 - )"; - - jitterPath = prefix.path() + "/jitter.txt"; - QFile jitterFile(jitterPath); - + )"; + + jitterPath = prefix.path() + "/jitter.txt"; + QFile jitterFile(jitterPath); + if (jitterFile.open(QIODevice::WriteOnly)) { - QTextStream out(&jitterFile); + QTextStream out(&jitterFile); out << jitter; - jitterFile.close(); + jitterFile.close(); } - else { + else { FAIL() << "Failed to create Jitter file" << std::endl; } QString outCubeFileName = prefix.path() + "/outTemp.cub"; - + QVector args = {"to="+outCubeFileName, "source=Jitter", "jitter="+jitterPath, "CK="+ckPath, "SCLK="+sclkPath, "LSK="+lskPath}; - + UserInterface options(APP_XML, args); Pvl *logs = new Pvl(); try { @@ -216,22 +216,22 @@ TEST_F(MroHiriseCube, FunctionalTestHicropCropByJitterZero) { catch (IException &e) { FAIL() << "Unable to open image: " << e.what() << std::endl; } - + PvlGroup results = logs->findGroup("Results"); EXPECT_EQ((int)results.findKeyword("InputLines"), 1056); EXPECT_EQ((int)results.findKeyword("NumberOfLinesCropped"), 216); EXPECT_EQ((int)results.findKeyword("OututStartingLine"), 114); - EXPECT_EQ((int)results.findKeyword("OututEndingLine"), 953); - EXPECT_EQ((int)results.findKeyword("OututLineCount"), 840); + EXPECT_EQ((int)results.findKeyword("OututEndingLine"), 953); + EXPECT_EQ((int)results.findKeyword("OututLineCount"), 840); EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)results.findKeyword("OututStartTime"), "2008-05-17T09:37:24.7948649"); EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)results.findKeyword("OututStopTime"), "2008-05-17T09:37:24.8747174"); - EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)results.findKeyword("OututStartClock"), "4/0895484264.58046"); - EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)results.findKeyword("OututStopClock"), "4/0895484264.63279"); - - Cube oCube(outCubeFileName); + EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)results.findKeyword("OututStartClock"), "4/0895484264.58046"); + EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)results.findKeyword("OututStopClock"), "4/0895484264.63279"); + + Cube oCube(outCubeFileName); PvlGroup oCubeInstrument = testCube->label()->findObject("IsisCube").findGroup("Instrument"); - + EXPECT_EQ(oCube.lineCount(), 840); EXPECT_EQ(oCube.sampleCount(), 1204); EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)oCubeInstrument.findKeyword("StartTime"), "2008-05-17T09:37:24.7300819"); @@ -242,34 +242,34 @@ TEST_F(MroHiriseCube, FunctionalTestHicropCropByJitterZero) { TEST_F(MroHiriseCube, FunctionalTestHicropCropByJitterZeroSample) { - + QTemporaryDir prefix; - // create a jitter file + // create a jitter file QString jitter = R"(# Sample Line ET 0 -0.07 264289109.96933 -0.11 -0.04 264289109.98 -0.05 -0.02 264289109.99 1.5 0.6 264289110.06 - )"; - - jitterPath = prefix.path() + "/jitter.txt"; - QFile jitterFile(jitterPath); - + )"; + + jitterPath = prefix.path() + "/jitter.txt"; + QFile jitterFile(jitterPath); + if (jitterFile.open(QIODevice::WriteOnly)) { - QTextStream out(&jitterFile); + QTextStream out(&jitterFile); out << jitter; - jitterFile.close(); + jitterFile.close(); } - else { + else { FAIL() << "Failed to create Jitter file" << std::endl; } QString outCubeFileName = prefix.path() + "/outTemp.cub"; - + QVector args = {"to="+outCubeFileName, "source=Jitter", "jitter="+jitterPath, "CK="+ckPath, "SCLK="+sclkPath, "LSK="+lskPath}; - + UserInterface options(APP_XML, args); Pvl *logs = new Pvl(); try { @@ -278,22 +278,22 @@ TEST_F(MroHiriseCube, FunctionalTestHicropCropByJitterZeroSample) { catch (IException &e) { FAIL() << "Unable to open image: " << e.what() << std::endl; } - + PvlGroup results = logs->findGroup("Results"); - + EXPECT_EQ((int)results.findKeyword("InputLines"), 1056); EXPECT_EQ((int)results.findKeyword("NumberOfLinesCropped"), 103); EXPECT_EQ((int)results.findKeyword("OututStartingLine"), 1); - EXPECT_EQ((int)results.findKeyword("OututEndingLine"), 953); - EXPECT_EQ((int)results.findKeyword("OututLineCount"), 953); + EXPECT_EQ((int)results.findKeyword("OututEndingLine"), 953); + EXPECT_EQ((int)results.findKeyword("OututLineCount"), 953); EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)results.findKeyword("OututStartTime"), "2008-05-17T09:37:24.7841228"); EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)results.findKeyword("OututStopTime"), "2008-05-17T09:37:24.8747174"); - EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)results.findKeyword("OututStartClock"), "4/0895484264.57342"); - EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)results.findKeyword("OututStopClock"), "4/0895484264.63279"); - - Cube oCube(outCubeFileName); + EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)results.findKeyword("OututStartClock"), "4/0895484264.57342"); + EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)results.findKeyword("OututStopClock"), "4/0895484264.63279"); + + Cube oCube(outCubeFileName); PvlGroup oCubeInstrument = testCube->label()->findObject("IsisCube").findGroup("Instrument"); - + EXPECT_EQ(oCube.lineCount(), 953); EXPECT_EQ(oCube.sampleCount(), 1204); EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)oCubeInstrument.findKeyword("StartTime"), "2008-05-17T09:37:24.7300819"); @@ -304,34 +304,34 @@ TEST_F(MroHiriseCube, FunctionalTestHicropCropByJitterZeroSample) { TEST_F(MroHiriseCube, FunctionalTestHicropCropByJitterZeroLine) { - + QTemporaryDir prefix; - // create a jitter file + // create a jitter file QString jitter = R"(# Sample Line ET -0.18 0 264289109.96933 -0.11 -0.04 264289109.98 -0.05 -0.02 264289109.99 1.5 0.6 264289110.06 - )"; - + )"; + jitterPath = prefix.path() + "/jitter.txt"; - QFile jitterFile(jitterPath); - + QFile jitterFile(jitterPath); + if (jitterFile.open(QIODevice::WriteOnly)) { - QTextStream out(&jitterFile); + QTextStream out(&jitterFile); out << jitter; - jitterFile.close(); + jitterFile.close(); } - else { + else { FAIL() << "Failed to create Jitter file" << std::endl; } QString outCubeFileName = prefix.path() + "/outTemp.cub"; - + QVector args = {"to="+outCubeFileName, "source=Jitter", "jitter="+jitterPath, "CK="+ckPath, "SCLK="+sclkPath, "LSK="+lskPath}; - + UserInterface options(APP_XML, args); Pvl *logs = new Pvl(); try { @@ -340,22 +340,22 @@ TEST_F(MroHiriseCube, FunctionalTestHicropCropByJitterZeroLine) { catch (IException &e) { FAIL() << "Unable to open image: " << e.what() << std::endl; } - + PvlGroup results = logs->findGroup("Results"); - + EXPECT_EQ((int)results.findKeyword("InputLines"), 1056); EXPECT_EQ((int)results.findKeyword("NumberOfLinesCropped"), 103); EXPECT_EQ((int)results.findKeyword("OututStartingLine"), 1); - EXPECT_EQ((int)results.findKeyword("OututEndingLine"), 953); - EXPECT_EQ((int)results.findKeyword("OututLineCount"), 953); + EXPECT_EQ((int)results.findKeyword("OututEndingLine"), 953); + EXPECT_EQ((int)results.findKeyword("OututLineCount"), 953); EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)results.findKeyword("OututStartTime"), "2008-05-17T09:37:24.7841228"); EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)results.findKeyword("OututStopTime"), "2008-05-17T09:37:24.8747174"); - EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)results.findKeyword("OututStartClock"), "4/0895484264.57342"); - EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)results.findKeyword("OututStopClock"), "4/0895484264.63279"); - - Cube oCube(outCubeFileName); + EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)results.findKeyword("OututStartClock"), "4/0895484264.57342"); + EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)results.findKeyword("OututStopClock"), "4/0895484264.63279"); + + Cube oCube(outCubeFileName); PvlGroup oCubeInstrument = testCube->label()->findObject("IsisCube").findGroup("Instrument"); - + EXPECT_EQ(oCube.lineCount(), 953); EXPECT_EQ(oCube.sampleCount(), 1204); EXPECT_PRED_FORMAT2(AssertQStringsEqual, (QString)oCubeInstrument.findKeyword("StartTime"), "2008-05-17T09:37:24.7300819"); @@ -366,16 +366,16 @@ TEST_F(MroHiriseCube, FunctionalTestHicropCropByJitterZeroLine) { TEST_F(MroHiriseCube, FunctionalTestHicropInstrumentError) { - PvlGroup &inst = testCube->label()->findObject("IsisCube").findGroup("Instrument"); + PvlGroup &inst = testCube->label()->findObject("IsisCube").findGroup("Instrument"); PvlKeyword &instrumentName = inst.findKeyword("InstrumentId"); instrumentName.setValue("NoHiriseLmao"); QTemporaryDir prefix; QString outCubeFileName = prefix.path() + "/outTemp.cub"; - + QVector args = {"to="+outCubeFileName, "source=Jitter", "jitter="+jitterPath, "CK="+ckPath, "SCLK="+sclkPath, "LSK="+lskPath}; - + UserInterface options(APP_XML, args); Pvl *logs = new Pvl(); @@ -390,13 +390,13 @@ TEST_F(MroHiriseCube, FunctionalTestHicropInstrumentError) { TEST_F(MroHiriseCube, FunctionalTestHicropStartStopTimeError) { - + QTemporaryDir prefix; QString outCubeFileName = prefix.path() + "/outTemp.cub"; - + QVector args = {"to="+outCubeFileName, "source=TIME", "STOPTIME=264289109.96933", "STARTTIME=264289110.06", "jitter="+jitterPath, "CK="+ckPath, "SCLK="+sclkPath, "LSK="+lskPath}; - + UserInterface options(APP_XML, args); Pvl *logs = new Pvl(); @@ -411,13 +411,13 @@ TEST_F(MroHiriseCube, FunctionalTestHicropStartStopTimeError) { TEST_F(MroHiriseCube, FunctionalTestHicropCkRangeError) { - + QTemporaryDir prefix; QString outCubeFileName = prefix.path() + "/outTemp.cub"; - + QVector args = {"to="+outCubeFileName, "source=TIME", "STARTTIME=1", "STOPTIME=2", "jitter="+jitterPath, "CK="+ckPath, "SCLK="+sclkPath, "LSK="+lskPath}; - + UserInterface options(APP_XML, args); Pvl *logs = new Pvl(); diff --git a/isis/tests/FunctionalTestsHicubeit.cpp b/isis/tests/FunctionalTestsHicubeit.cpp index 2180f26dbb..8c2174a05e 100644 --- a/isis/tests/FunctionalTestsHicubeit.cpp +++ b/isis/tests/FunctionalTestsHicubeit.cpp @@ -1,7 +1,6 @@ #include #include "hicubeit.h" -#include "Fixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" @@ -28,7 +27,7 @@ TEST(Hicubeit, Default) { } catch (IException &e) { FAIL() << e.toString().toStdString().c_str() << std::endl; - } + } Cube outCube(outFileName); Pvl *outLabel = outCube.label(); diff --git a/isis/tests/FunctionalTestsHicubenorm.cpp b/isis/tests/FunctionalTestsHicubenorm.cpp index 726b163c71..660d8e19ba 100644 --- a/isis/tests/FunctionalTestsHicubenorm.cpp +++ b/isis/tests/FunctionalTestsHicubenorm.cpp @@ -1,4 +1,4 @@ -#include "Fixtures.h" +#include "CameraFixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" diff --git a/isis/tests/FunctionalTestsHidtmgen.cpp b/isis/tests/FunctionalTestsHidtmgen.cpp index c2785f5dd8..cce0661ad0 100644 --- a/isis/tests/FunctionalTestsHidtmgen.cpp +++ b/isis/tests/FunctionalTestsHidtmgen.cpp @@ -1,5 +1,6 @@ #include -#include "Fixtures.h" +#include + #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" diff --git a/isis/tests/FunctionalTestsHimos.cpp b/isis/tests/FunctionalTestsHimos.cpp index e1a7b27322..30a9366f69 100644 --- a/isis/tests/FunctionalTestsHimos.cpp +++ b/isis/tests/FunctionalTestsHimos.cpp @@ -1,7 +1,8 @@ #include #include "himos.h" -#include "Fixtures.h" +#include "CameraFixtures.h" +#include "FileList.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" diff --git a/isis/tests/FunctionalTestsHist.cpp b/isis/tests/FunctionalTestsHist.cpp index 80e1f7456b..c1e3aa87ea 100644 --- a/isis/tests/FunctionalTestsHist.cpp +++ b/isis/tests/FunctionalTestsHist.cpp @@ -4,7 +4,7 @@ #include #include -#include "Fixtures.h" +#include "CubeFixtures.h" #include "PvlGroup.h" #include "TestUtilities.h" #include "CSVReader.h" diff --git a/isis/tests/FunctionalTestsHrsc2isis.cpp b/isis/tests/FunctionalTestsHrsc2isis.cpp index 1c6ce513f6..6a91b94e29 100644 --- a/isis/tests/FunctionalTestsHrsc2isis.cpp +++ b/isis/tests/FunctionalTestsHrsc2isis.cpp @@ -2,7 +2,6 @@ #include #include "hrsc2isis.h" -#include "Fixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" @@ -83,7 +82,7 @@ TEST(Hrsc2isis, Hrsc2IsisTestDefault) { ASSERT_EQ(hist->ValidPixels(), 6440); ASSERT_NEAR(hist->StandardDeviation(), 6.36599, .00001); - // check original label exists + // check original label exists Pvl ogLab = cube.readOriginalLabel().ReturnLabels(); ASSERT_EQ(archive["DETECTOR_ID"][0].toStdString(), "MEX_HRSC_RED" ); @@ -141,7 +140,7 @@ TEST(Hrsc2isis, Hrsc2IsisTestPhobos) { ASSERT_EQ(hist->ValidPixels(), 25920); ASSERT_NEAR(hist->StandardDeviation(), 0.52835, .00001); - // check original label exists + // check original label exists Pvl ogLab = cube.readOriginalLabel().ReturnLabels(); ASSERT_EQ(archive["DETECTOR_ID"][0].toStdString(), "MEX_HRSC_S2" ); } diff --git a/isis/tests/FunctionalTestsIsis2Std.cpp b/isis/tests/FunctionalTestsIsis2Std.cpp index c80dcc72d5..9e0bbd59ef 100644 --- a/isis/tests/FunctionalTestsIsis2Std.cpp +++ b/isis/tests/FunctionalTestsIsis2Std.cpp @@ -10,7 +10,7 @@ #include "Cube.h" #include "std2isis.h" -#include "Fixtures.h" +#include "TempFixtures.h" #include "Histogram.h" #include "LineManager.h" #include "Portal.h" diff --git a/isis/tests/FunctionalTestsIsis2ascii.cpp b/isis/tests/FunctionalTestsIsis2ascii.cpp index 1a351959bb..8c318541aa 100644 --- a/isis/tests/FunctionalTestsIsis2ascii.cpp +++ b/isis/tests/FunctionalTestsIsis2ascii.cpp @@ -4,7 +4,7 @@ #include #include -#include "Fixtures.h" +#include "CubeFixtures.h" #include "PvlGroup.h" #include "TestUtilities.h" #include "CSVReader.h" diff --git a/isis/tests/FunctionalTestsIsis2pds.cpp b/isis/tests/FunctionalTestsIsis2pds.cpp index dbbd4c2b3a..a8556766f3 100644 --- a/isis/tests/FunctionalTestsIsis2pds.cpp +++ b/isis/tests/FunctionalTestsIsis2pds.cpp @@ -1,4 +1,4 @@ -#include "Fixtures.h" +#include "CameraFixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" diff --git a/isis/tests/FunctionalTestsIsisImport.cpp b/isis/tests/FunctionalTestsIsisImport.cpp index 757a75c5cd..e9f6a64b1f 100644 --- a/isis/tests/FunctionalTestsIsisImport.cpp +++ b/isis/tests/FunctionalTestsIsisImport.cpp @@ -5,7 +5,7 @@ #include #include -#include "Fixtures.h" +#include "TempFixtures.h" #include "Histogram.h" #include "md5wrapper.h" #include "Pvl.h" diff --git a/isis/tests/FunctionalTestsIsisImportCassiniISS.cpp b/isis/tests/FunctionalTestsIsisImportCassiniISS.cpp index a40d4c3d2a..6d136a63f5 100644 --- a/isis/tests/FunctionalTestsIsisImportCassiniISS.cpp +++ b/isis/tests/FunctionalTestsIsisImportCassiniISS.cpp @@ -5,7 +5,7 @@ #include #include -#include "Fixtures.h" +#include "TempFixtures.h" #include "Histogram.h" #include "md5wrapper.h" #include "Pvl.h" diff --git a/isis/tests/FunctionalTestsIsisImportEis.cpp b/isis/tests/FunctionalTestsIsisImportEis.cpp index 8a2961b1d6..514808b5c6 100644 --- a/isis/tests/FunctionalTestsIsisImportEis.cpp +++ b/isis/tests/FunctionalTestsIsisImportEis.cpp @@ -12,7 +12,7 @@ #include #include -#include "Fixtures.h" +#include "TempFixtures.h" #include "Histogram.h" #include "md5wrapper.h" #include "Pvl.h" @@ -106,14 +106,14 @@ TEST_F(TempTestingFiles, FunctionalTestIsisImportEisNacFrame){ } QDataStream out(&tempImgFile); - // generate lines + // generate lines QByteArray writeToFile = QByteArray(); short int fill = 0; for(int i=-1; i<(samples * bytes); i++){ writeToFile.append(fill); } - // write the lines to the temp file + // write the lines to the temp file for(int i=0; ifindGroup("BandBin", Pvl::Traverse); EXPECT_PRED_FORMAT2(AssertPvlGroupEqual, outGroup, truthGroup); - + truthGroup = truthLabel.findGroup("Kernels", Pvl::Traverse); outGroup = outLabel->findGroup("Kernels", Pvl::Traverse); EXPECT_PRED_FORMAT2(AssertPvlGroupEqual, outGroup, truthGroup); @@ -197,7 +197,7 @@ TEST_F(TempTestingFiles, FunctionalTestIsisImportEisNacFrame){ truthGroup = truthLabel.findGroup("BandBin", Pvl::Traverse); outGroup = outLabelNoTemp->findGroup("BandBin", Pvl::Traverse); EXPECT_PRED_FORMAT2(AssertPvlGroupEqual, outGroup, truthGroup); - + truthGroup = truthLabel.findGroup("Kernels", Pvl::Traverse); outGroup = outLabelNoTemp->findGroup("Kernels", Pvl::Traverse); EXPECT_PRED_FORMAT2(AssertPvlGroupEqual, outGroup, truthGroup); @@ -282,14 +282,14 @@ TEST_F(TempTestingFiles, FunctionalTestIsisImportEisNacPb){ } QDataStream out(&tempImgFile); - // generate lines + // generate lines QByteArray writeToFile = QByteArray(); short int fill = 0; for(int i=-1; i<(samples * bytes); i++){ writeToFile.append(fill); } - // write the lines to the temp file + // write the lines to the temp file for(int i=0; ifindGroup("BandBin", Pvl::Traverse); EXPECT_PRED_FORMAT2(AssertPvlGroupEqual, outGroup, truthGroup); - + truthGroup = truthLabel.findGroup("Kernels", Pvl::Traverse); outGroup = outLabel->findGroup("Kernels", Pvl::Traverse); EXPECT_PRED_FORMAT2(AssertPvlGroupEqual, outGroup, truthGroup); @@ -373,7 +373,7 @@ TEST_F(TempTestingFiles, FunctionalTestIsisImportEisNacPb){ truthGroup = truthLabel.findGroup("BandBin", Pvl::Traverse); outGroup = outLabelNoTemp->findGroup("BandBin", Pvl::Traverse); EXPECT_PRED_FORMAT2(AssertPvlGroupEqual, outGroup, truthGroup); - + truthGroup = truthLabel.findGroup("Kernels", Pvl::Traverse); outGroup = outLabelNoTemp->findGroup("Kernels", Pvl::Traverse); EXPECT_PRED_FORMAT2(AssertPvlGroupEqual, outGroup, truthGroup); @@ -444,7 +444,7 @@ TEST_F(TempTestingFiles, FunctionalTestIsisImportEisWacFrame){ QString imageFileName = "wac000xxx_2022126t000000_000000001_frame_raw02.img"; QString templateFile = "../appdata/import/PDS4/ClipperEIS.tpl"; QString cubeFileName = tempDir.path() + "/wacFrame.cub"; - + int samples = 1335; int lines = 3832; int bytes = 2; @@ -457,14 +457,14 @@ TEST_F(TempTestingFiles, FunctionalTestIsisImportEisWacFrame){ } QDataStream out(&tempImgFile); - // generate lines + // generate lines QByteArray writeToFile = QByteArray(); short int fill = 0; for(int i=-1; i<(samples * bytes); i++){ writeToFile.append(fill); } - // write the lines to the temp file + // write the lines to the temp file for(int i=0; ifindGroup("BandBin", Pvl::Traverse); EXPECT_PRED_FORMAT2(AssertPvlGroupEqual, outGroup, truthGroup); - + truthGroup = truthLabel.findGroup("Kernels", Pvl::Traverse); outGroup = outLabel->findGroup("Kernels", Pvl::Traverse); EXPECT_PRED_FORMAT2(AssertPvlGroupEqual, outGroup, truthGroup); @@ -548,7 +548,7 @@ TEST_F(TempTestingFiles, FunctionalTestIsisImportEisWacFrame){ truthGroup = truthLabel.findGroup("BandBin", Pvl::Traverse); outGroup = outLabelNoTemp->findGroup("BandBin", Pvl::Traverse); EXPECT_PRED_FORMAT2(AssertPvlGroupEqual, outGroup, truthGroup); - + truthGroup = truthLabel.findGroup("Kernels", Pvl::Traverse); outGroup = outLabelNoTemp->findGroup("Kernels", Pvl::Traverse); EXPECT_PRED_FORMAT2(AssertPvlGroupEqual, outGroup, truthGroup); @@ -620,7 +620,7 @@ TEST_F(TempTestingFiles, FunctionalTestIsisImportEisWacPb){ QString imageFileName = "wac000xxx_2022126t000000_000000002_pushb_raw02.img"; QString templateFile = "../appdata/import/PDS4/ClipperEIS.tpl"; QString cubeFileName = tempDir.path() + "/WacPb.cub"; - + int samples = 4096; int lines = 4096; @@ -634,14 +634,14 @@ TEST_F(TempTestingFiles, FunctionalTestIsisImportEisWacPb){ } QDataStream out(&tempImgFile); - // generate lines + // generate lines QByteArray writeToFile = QByteArray(); short int fill = 0; for(int i=-1; i<(samples * bytes); i++){ writeToFile.append(fill); } - // write the lines to the temp file + // write the lines to the temp file for(int i=0; ifindGroup("BandBin", Pvl::Traverse); EXPECT_PRED_FORMAT2(AssertPvlGroupEqual, outGroup, truthGroup); - + truthGroup = truthLabel.findGroup("Kernels", Pvl::Traverse); outGroup = outLabel->findGroup("Kernels", Pvl::Traverse); EXPECT_PRED_FORMAT2(AssertPvlGroupEqual, outGroup, truthGroup); @@ -725,7 +725,7 @@ TEST_F(TempTestingFiles, FunctionalTestIsisImportEisWacPb){ truthGroup = truthLabel.findGroup("BandBin", Pvl::Traverse); outGroup = outLabelNoTemp->findGroup("BandBin", Pvl::Traverse); EXPECT_PRED_FORMAT2(AssertPvlGroupEqual, outGroup, truthGroup); - + truthGroup = truthLabel.findGroup("Kernels", Pvl::Traverse); outGroup = outLabelNoTemp->findGroup("Kernels", Pvl::Traverse); EXPECT_PRED_FORMAT2(AssertPvlGroupEqual, outGroup, truthGroup); diff --git a/isis/tests/FunctionalTestsIsisImportKaguyaMI.cpp b/isis/tests/FunctionalTestsIsisImportKaguyaMI.cpp index 1a262dc60c..f8fe6ac5c1 100644 --- a/isis/tests/FunctionalTestsIsisImportKaguyaMI.cpp +++ b/isis/tests/FunctionalTestsIsisImportKaguyaMI.cpp @@ -5,7 +5,7 @@ #include #include -#include "Fixtures.h" +#include "TempFixtures.h" #include "Histogram.h" #include "md5wrapper.h" #include "Pvl.h" diff --git a/isis/tests/FunctionalTestsIsisImportKaguyaTC.cpp b/isis/tests/FunctionalTestsIsisImportKaguyaTC.cpp index f4fa79d53e..4d55bc3090 100644 --- a/isis/tests/FunctionalTestsIsisImportKaguyaTC.cpp +++ b/isis/tests/FunctionalTestsIsisImportKaguyaTC.cpp @@ -5,8 +5,9 @@ #include #include -#include "Fixtures.h" +#include "TempFixtures.h" #include "md5wrapper.h" +#include "Plugin.h" #include "Pvl.h" #include "PvlGroup.h" #include "PvlKeyword.h" @@ -254,7 +255,7 @@ TEST_F(TempTestingFiles, FunctionalTestIsisImportKaguyaTC) { PvlGroup truthDimensions = truth.findGroup("Dimensions", Isis::Plugin::Traverse); PvlGroup truthInstrument = truth.findGroup("Instrument", Isis::Plugin::Traverse); - + PvlGroup outputDimensions = output.findGroup("Dimensions", Isis::Plugin::Traverse); PvlGroup outputInstrument = output.findGroup("Instrument", Isis::Plugin::Traverse); diff --git a/isis/tests/FunctionalTestsIsisImportLo.cpp b/isis/tests/FunctionalTestsIsisImportLo.cpp index 3c4229cda6..1f23491f2e 100644 --- a/isis/tests/FunctionalTestsIsisImportLo.cpp +++ b/isis/tests/FunctionalTestsIsisImportLo.cpp @@ -3,9 +3,9 @@ #include #include +#include #include -#include "Fixtures.h" #include "Histogram.h" #include "md5wrapper.h" #include "Pvl.h" diff --git a/isis/tests/FunctionalTestsIsisImportLroNac.cpp b/isis/tests/FunctionalTestsIsisImportLroNac.cpp index b83af00da4..c5ec2050ef 100644 --- a/isis/tests/FunctionalTestsIsisImportLroNac.cpp +++ b/isis/tests/FunctionalTestsIsisImportLroNac.cpp @@ -5,7 +5,7 @@ #include #include -#include "Fixtures.h" +#include "TempFixtures.h" #include "Histogram.h" #include "md5wrapper.h" #include "Pvl.h" diff --git a/isis/tests/FunctionalTestsIsisImportMerMI.cpp b/isis/tests/FunctionalTestsIsisImportMerMI.cpp index c70ed89a2f..fea30f02da 100644 --- a/isis/tests/FunctionalTestsIsisImportMerMI.cpp +++ b/isis/tests/FunctionalTestsIsisImportMerMI.cpp @@ -5,8 +5,9 @@ #include #include -#include "Fixtures.h" +#include "TempFixtures.h" #include "md5wrapper.h" +#include "Plugin.h" #include "Pvl.h" #include "PvlGroup.h" #include "PvlKeyword.h" @@ -112,7 +113,7 @@ TEST_F(TempTestingFiles, FunctionalTestIsisImportMerMICaseOne){ StartByte = 2163162 Bytes = 19191 End_Object - End + End )"); QVector args = {"from=data/isisimport/1M189529263EFF64KCP2977M2F1_cropped.IMG", "to=" + tempDir.path() + "/MerMI1.cub" }; UserInterface options(APP_XML, args); @@ -129,7 +130,7 @@ TEST_F(TempTestingFiles, FunctionalTestIsisImportMerMICaseOne){ PvlGroup truthInstrument = truth.findGroup("Instrument", Isis::Plugin::Traverse); PvlGroup truthMerImageRequestParms = truth.findGroup("MerImageRequestParms", Isis::Plugin::Traverse); PvlGroup truthMerSubframeRequestParms = truth.findGroup("MerSubframeRequestParms", Isis::Plugin::Traverse); - + PvlGroup outputDimensions = output.findGroup("Dimensions", Isis::Plugin::Traverse); PvlGroup outputPixels = output.findGroup("Pixels", Isis::Plugin::Traverse); PvlGroup outputArchive = output.findGroup("Archive", Isis::Plugin::Traverse); @@ -253,7 +254,7 @@ TEST_F(TempTestingFiles, FunctionalTestIsisImportMerMICaseTwo){ PvlGroup truthInstrument = truth.findGroup("Instrument", Isis::Plugin::Traverse); PvlGroup truthMerImageRequestParms = truth.findGroup("MerImageRequestParms", Isis::Plugin::Traverse); PvlGroup truthMerSubframeRequestParms = truth.findGroup("MerSubframeRequestParms", Isis::Plugin::Traverse); - + PvlGroup outputDimensions = output.findGroup("Dimensions", Isis::Plugin::Traverse); PvlGroup outputPixels = output.findGroup("Pixels", Isis::Plugin::Traverse); PvlGroup outputArchive = output.findGroup("Archive", Isis::Plugin::Traverse); diff --git a/isis/tests/FunctionalTestsIsisexport.cpp b/isis/tests/FunctionalTestsIsisexport.cpp index 6ecc88544e..9c1052cdfe 100644 --- a/isis/tests/FunctionalTestsIsisexport.cpp +++ b/isis/tests/FunctionalTestsIsisexport.cpp @@ -5,7 +5,7 @@ #include #include -#include "Fixtures.h" +#include "CubeFixtures.h" #include "md5wrapper.h" #include "OriginalLabel.h" #include "OriginalXmlLabel.h" diff --git a/isis/tests/FunctionalTestsJigsaw.cpp b/isis/tests/FunctionalTestsJigsaw.cpp index f04ee09451..a7d811e879 100644 --- a/isis/tests/FunctionalTestsJigsaw.cpp +++ b/isis/tests/FunctionalTestsJigsaw.cpp @@ -14,7 +14,9 @@ #include "jigsaw.h" #include "TestUtilities.h" -#include "Fixtures.h" +#include "NetworkFixtures.h" +#include "CsmFixtures.h" + #include "gmock/gmock.h" using namespace Isis; diff --git a/isis/tests/FunctionalTestsJitterfit.cpp b/isis/tests/FunctionalTestsJitterfit.cpp index 83b86bdcbe..52cb170ad9 100644 --- a/isis/tests/FunctionalTestsJitterfit.cpp +++ b/isis/tests/FunctionalTestsJitterfit.cpp @@ -1,5 +1,5 @@ #include "CSVReader.h" -#include "Fixtures.h" +#include "TempFixtures.h" #include "jitterfit.h" #include "TestUtilities.h" diff --git a/isis/tests/FunctionalTestsKaguyami2isis.cpp b/isis/tests/FunctionalTestsKaguyami2isis.cpp index 07d69c2940..6b42c8d913 100644 --- a/isis/tests/FunctionalTestsKaguyami2isis.cpp +++ b/isis/tests/FunctionalTestsKaguyami2isis.cpp @@ -1,7 +1,6 @@ #include #include "kaguyami2isis.h" -#include "Fixtures.h" #include "Histogram.h" #include "Pvl.h" #include "PvlGroup.h" diff --git a/isis/tests/FunctionalTestsKaguyatc2isis.cpp b/isis/tests/FunctionalTestsKaguyatc2isis.cpp index b50699358b..342db9d996 100644 --- a/isis/tests/FunctionalTestsKaguyatc2isis.cpp +++ b/isis/tests/FunctionalTestsKaguyatc2isis.cpp @@ -1,7 +1,6 @@ #include #include "kaguyatc2isis.h" -#include "Fixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" diff --git a/isis/tests/FunctionalTestsLeisa2isis.cpp b/isis/tests/FunctionalTestsLeisa2isis.cpp index 450e50c7c6..28216abea7 100644 --- a/isis/tests/FunctionalTestsLeisa2isis.cpp +++ b/isis/tests/FunctionalTestsLeisa2isis.cpp @@ -1,7 +1,6 @@ #include #include "leisa2isis.h" -#include "Fixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" diff --git a/isis/tests/FunctionalTestsLo2isis.cpp b/isis/tests/FunctionalTestsLo2isis.cpp index 0380999e44..1bdcd3a599 100644 --- a/isis/tests/FunctionalTestsLo2isis.cpp +++ b/isis/tests/FunctionalTestsLo2isis.cpp @@ -1,7 +1,6 @@ #include #include "lo2isis.h" -#include "Fixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" diff --git a/isis/tests/FunctionalTestsLorri2isis.cpp b/isis/tests/FunctionalTestsLorri2isis.cpp index d481cba751..761781b593 100644 --- a/isis/tests/FunctionalTestsLorri2isis.cpp +++ b/isis/tests/FunctionalTestsLorri2isis.cpp @@ -1,4 +1,5 @@ -#include "Fixtures.h" +#include + #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" diff --git a/isis/tests/FunctionalTestsLronac2isis.cpp b/isis/tests/FunctionalTestsLronac2isis.cpp index 2a3bb10226..c647dc1c44 100644 --- a/isis/tests/FunctionalTestsLronac2isis.cpp +++ b/isis/tests/FunctionalTestsLronac2isis.cpp @@ -1,6 +1,5 @@ #include -#include "Fixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" diff --git a/isis/tests/FunctionalTestsLronac2pds.cpp b/isis/tests/FunctionalTestsLronac2pds.cpp index e001f7c230..2e020d6fb3 100644 --- a/isis/tests/FunctionalTestsLronac2pds.cpp +++ b/isis/tests/FunctionalTestsLronac2pds.cpp @@ -4,7 +4,7 @@ #include #include "lronac2pds.h" -#include "Fixtures.h" +#include "NetworkFixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" diff --git a/isis/tests/FunctionalTestsLronaccal.cpp b/isis/tests/FunctionalTestsLronaccal.cpp index 0718b3ea02..b9ead98261 100644 --- a/isis/tests/FunctionalTestsLronaccal.cpp +++ b/isis/tests/FunctionalTestsLronaccal.cpp @@ -1,5 +1,4 @@ #include -#include "Fixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" @@ -13,7 +12,7 @@ using namespace std; using namespace Isis; -using namespace testing; +using namespace testing; /** * @@ -25,7 +24,7 @@ using namespace testing; * @author 2016-09-16 Victor Silva * * @internal - * @history 2022-04-26 Victor Silva - Original Version - Functional test is against known value for input + * @history 2022-04-26 Victor Silva - Original Version - Functional test is against known value for input * cub since fx is not yet callable */ @@ -45,8 +44,8 @@ TEST(LronaccalDefault, FunctionalTestsLronaccal) { QString oCubeCropFile = outputDir.path() + "/out.default.crop.cub"; QString tCubeFile = "data/lronaccal/truth/M1333276014R.default.crop.cub"; - QVector args = {"from="+iCubeFile, "to="+oCubeFile }; - + QVector args = {"from="+iCubeFile, "to="+oCubeFile }; + UserInterface options(APP_XML, args); try { lronaccal(options); @@ -59,7 +58,7 @@ TEST(LronaccalDefault, FunctionalTestsLronaccal) { QVector argsCrop = {"from=" + oCubeFile, "to=" + oCubeCropFile, "sample=80", "nsamples=80", "line=80", "nlines=80"}; UserInterface options2(CROP_XML, argsCrop); crop(options2); - + Cube oCube(oCubeCropFile, "r"); Cube tCube(tCubeFile, "r"); @@ -70,7 +69,7 @@ TEST(LronaccalDefault, FunctionalTestsLronaccal) { EXPECT_NEAR(oCubeStats->Sum(), tCubeStats->Sum(), 0.001); EXPECT_NEAR(oCubeStats->ValidPixels(), tCubeStats->ValidPixels(), 0.001); EXPECT_NEAR(oCubeStats->StandardDeviation(), tCubeStats->StandardDeviation(), 0.001); - + tCube.close(); oCube.close(); } @@ -94,7 +93,7 @@ TEST(LronaccalNear, FunctionalTestsLronaccal) { QString tCubeFile = "data/lronaccal/truth/M1333276014R.near.crop.cub"; QVector args = {"from="+iCubeFile, "to="+oCubeFile, "DarkFileType=NEAREST"}; - + UserInterface options(APP_XML, args); try { lronaccal(options); @@ -102,12 +101,12 @@ TEST(LronaccalNear, FunctionalTestsLronaccal) { catch (IException &e) { FAIL() << "Unable to calibrate the LRO image: " < argsCrop = {"from=" + oCubeFile, "to=" + oCubeCropFile, "sample=80", "nsamples=80", "line=80", "nlines=80"}; UserInterface options2(CROP_XML, argsCrop); crop(options2); - + Cube oCube(oCubeCropFile, "r"); Cube tCube(tCubeFile, "r"); @@ -118,7 +117,7 @@ TEST(LronaccalNear, FunctionalTestsLronaccal) { EXPECT_NEAR(oCubeStats->Sum(), tCubeStats->Sum(), 0.001); EXPECT_NEAR(oCubeStats->ValidPixels(), tCubeStats->ValidPixels(), 0.001); EXPECT_NEAR(oCubeStats->StandardDeviation(), tCubeStats->StandardDeviation(), 0.001); - + tCube.close(); oCube.close(); } @@ -138,7 +137,7 @@ TEST(LronaccalPair, FunctionalTestsLronaccal) { QString tCubeFile = "data/lronaccal/truth/M1333276014R.pair.crop.cub"; QVector args = {"from="+iCubeFile, "to="+oCubeFile, "DarkFileType=PAIR"}; - + UserInterface options(APP_XML, args); try { lronaccal(options); @@ -151,7 +150,7 @@ TEST(LronaccalPair, FunctionalTestsLronaccal) { QVector argsCrop = {"from=" + oCubeFile, "to=" + oCubeCropFile, "sample=80", "nsamples=80", "line=80", "nlines=80"}; UserInterface options2(CROP_XML, argsCrop); crop(options2); - + Cube oCube(oCubeCropFile, "r"); Cube tCube(tCubeFile, "r"); @@ -162,7 +161,7 @@ TEST(LronaccalPair, FunctionalTestsLronaccal) { EXPECT_NEAR(oCubeStats->Sum(), tCubeStats->Sum(), 0.001); EXPECT_NEAR(oCubeStats->ValidPixels(), tCubeStats->ValidPixels(), 0.001); EXPECT_NEAR(oCubeStats->StandardDeviation(), tCubeStats->StandardDeviation(), 0.001); - + tCube.close(); oCube.close(); } diff --git a/isis/tests/FunctionalTestsLronacpho.cpp b/isis/tests/FunctionalTestsLronacpho.cpp index 2ebbd0dc34..6cbe19794e 100644 --- a/isis/tests/FunctionalTestsLronacpho.cpp +++ b/isis/tests/FunctionalTestsLronacpho.cpp @@ -1,6 +1,5 @@ #include #include "LineManager.h" -#include "Fixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" @@ -11,7 +10,7 @@ #include "gmock/gmock.h" using namespace Isis; -using namespace testing; +using namespace testing; /** * @@ -23,7 +22,7 @@ using namespace testing; * @author 2016-09-16 Victor Silva * * @internal - * @history 2022-04-26 Victor Silva - Original Version - Functional test is against known value for input + * @history 2022-04-26 Victor Silva - Original Version - Functional test is against known value for input * cub since fx is not yet callable */ @@ -38,7 +37,7 @@ TEST(LronacphoNoDemAlgo3, FunctionalTestsLronacpho) { QString outCubeFileName = prefix.path() + "/output.cub"; QString phoParameterFileName = "data/lronacpho/NAC_PHO_LROC_Empirical.0003.pvl"; QVector args = {"from="+inCubeFileName, "to="+outCubeFileName, "PHOPAR="+phoParameterFileName, "usedem=no"}; - + UserInterface options(APP_XML, args); try { lronacpho(options); @@ -56,12 +55,12 @@ TEST(LronacphoNoDemAlgo3, FunctionalTestsLronacpho) { fx="\( f1 ) * ( ( cos(inal(f1) * pi / 180) + cos(emal(f1) * pi / 180) ) / cos(inal(f1) * pi / 180) / ( e ^ ( -1.479654495 -0.000083528 * phal(f1)^2 + 0.012964707 * phal(f1) -0.237774774 * phal(f1) ^ (1/2) + 0.556075496 * ( cos(emal(f1)*pi/180) ) + 0.663671460 * ( cos(inal(f1) * pi / 180) ) -0.439918609 * ( cos(inal(f1) * pi / 180) )^2 ))) * 0.087598" f1=input/M143947267L.cal.echo.crop.cub to=output/output2.cub; */ double algo3Result = 0.26584613; - + // dop! lineManager is not zero based LineManager oLine(outputCube); oLine.SetLine(300); outputCube.read(oLine); - + EXPECT_NEAR(oLine[300],algo3Result, 0.002); outputCube.close(); } @@ -79,7 +78,7 @@ TEST(LronacphoNoDemAlgo2, FunctionalTestsLronacpho) { QString outCubeFileName = prefix.path() + "/output.cub"; QString phoParameterFileName = "data/lronacpho/NAC_PHO_LROC_Empirical.0002.pvl"; QVector args = {"from="+inCubeFileName, "to="+outCubeFileName, "PHOPAR="+phoParameterFileName, "usedem=no"}; - + UserInterface options(APP_XML, args); try { lronacpho(options); @@ -91,14 +90,14 @@ TEST(LronacphoNoDemAlgo2, FunctionalTestsLronacpho) { // open output cube to test al algorithm was applied correctly Cube outputCube; outputCube.open(outCubeFileName, "r"); - + double algo2Result = 0.28940132; // dop! lineManager is not zero based LineManager oLine(outputCube); oLine.SetLine(300); outputCube.read(oLine); - + EXPECT_NEAR(oLine[300],algo2Result, 0.002); outputCube.close(); @@ -117,7 +116,7 @@ TEST(LronacphoNoDemAlgoDefault, FunctionalTestsLronacpho) { QString outCubeFileName = prefix.path() + "/output.cub"; QString phoParameterFileName = "data/lronacpho/NAC_PHO_LROC_Empirical.0003.pvl"; QVector args = {"from="+inCubeFileName, "to="+outCubeFileName, "usedem=no"}; - + UserInterface options(APP_XML, args); try { lronacpho(options); @@ -128,15 +127,15 @@ TEST(LronacphoNoDemAlgoDefault, FunctionalTestsLronacpho) { try{ // open output cube to test al algorithm was applied correctly Cube outputCube; - + outputCube.open(outCubeFileName, "r"); - + double algo3Result = 0.26584613; LineManager oLine(outputCube); oLine.SetLine(300); outputCube.read(oLine); - + EXPECT_NEAR(oLine[300],algo3Result, 0.002); outputCube.close(); } diff --git a/isis/tests/FunctionalTestsLrowac2isis.cpp b/isis/tests/FunctionalTestsLrowac2isis.cpp index c209f2c27f..36f6093744 100644 --- a/isis/tests/FunctionalTestsLrowac2isis.cpp +++ b/isis/tests/FunctionalTestsLrowac2isis.cpp @@ -1,6 +1,5 @@ #include -#include "Fixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" diff --git a/isis/tests/FunctionalTestsLrowac2pds.cpp b/isis/tests/FunctionalTestsLrowac2pds.cpp index aa44268687..742823c575 100644 --- a/isis/tests/FunctionalTestsLrowac2pds.cpp +++ b/isis/tests/FunctionalTestsLrowac2pds.cpp @@ -1,10 +1,10 @@ #include +#include #include #include #include #include "lrowac2pds.h" -#include "Fixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" diff --git a/isis/tests/FunctionalTestsLrowaccal.cpp b/isis/tests/FunctionalTestsLrowaccal.cpp index d93ebafce5..cb848f4d61 100644 --- a/isis/tests/FunctionalTestsLrowaccal.cpp +++ b/isis/tests/FunctionalTestsLrowaccal.cpp @@ -1,4 +1,5 @@ -#include "Fixtures.h" +#include + #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" @@ -14,13 +15,13 @@ static QString APP_XML = FileName("$ISISROOT/bin/xml/lrowaccal.xml").expanded(); TEST(Lrowaccal, FunctionalTestLrowaccalRadianceUnitsLabelExists) { QTemporaryDir tempDir; ASSERT_TRUE(tempDir.isValid()); - + QString outCubeFileName = tempDir.path() + "/outTemp.cub"; QString testCubeFileName = "data/lrowaccal/M1388981421CE.tmp.vis.even.reduced.cub"; - QVector args = {"from=" + testCubeFileName, - "to=" + outCubeFileName, - "radiometrictype=Radiance", + QVector args = {"from=" + testCubeFileName, + "to=" + outCubeFileName, + "radiometrictype=Radiance", "radiometricfile=Default"}; UserInterface options(APP_XML, args); @@ -44,13 +45,13 @@ TEST(Lrowaccal, FunctionalTestLrowaccalRadianceUnitsLabelExists) { TEST(Lrowaccal, FunctionalTestLrowaccalRadianceUnitsLabelNotForIOF) { QTemporaryDir tempDir; ASSERT_TRUE(tempDir.isValid()); - + QString outCubeFileName = tempDir.path() + "/outTemp.cub"; QString testCubeFileName = "data/lrowaccal/M1388981421CE.tmp.vis.even.reduced.cub"; - QVector args = {"from=" + testCubeFileName, - "to=" + outCubeFileName, - "radiometrictype=IOF", + QVector args = {"from=" + testCubeFileName, + "to=" + outCubeFileName, + "radiometrictype=IOF", "radiometricfile=Default"}; UserInterface options(APP_XML, args); diff --git a/isis/tests/FunctionalTestsLrowacphomap.cpp b/isis/tests/FunctionalTestsLrowacphomap.cpp index 19a16134a5..f59975131f 100644 --- a/isis/tests/FunctionalTestsLrowacphomap.cpp +++ b/isis/tests/FunctionalTestsLrowacphomap.cpp @@ -1,4 +1,5 @@ -#include "Fixtures.h" +#include + #include "Histogram.h" #include "Pvl.h" #include "PvlGroup.h" @@ -15,16 +16,16 @@ static QString APP_XML = FileName("$ISISROOT/bin/xml/lrowacphomap.xml").expanded TEST(Lrowacphomap, FunctionalTestLrowacphomapWithBack) { QTemporaryDir tempDir; ASSERT_TRUE(tempDir.isValid()); - + QString outCubeFileName = tempDir.path() + "/outTemp.cub"; QString testCubeFileName = "data/lrowacphomap/M1181493219CE.vis.odd.reduced.cub"; QString backplaneFileName = "data/lrowacphomap/back.reduced.cub"; QString phoPvlFileName = "data/lrowacphomap/hapke_full_reformatted.pvl"; QString paramMapFileName = "data/lrowacphomap/1x1_70NS_7b_wbhs_albflt_grid_geirist_tcorrect.reduced.cub"; - QVector args = {"from=" + testCubeFileName + "+1", - "to=" + outCubeFileName, - "backplane=" + backplaneFileName, + QVector args = {"from=" + testCubeFileName + "+1", + "to=" + outCubeFileName, + "backplane=" + backplaneFileName, "phoa=" + phoPvlFileName, "phop=" + paramMapFileName}; UserInterface options(APP_XML, args); @@ -58,14 +59,14 @@ TEST(Lrowacphomap, FunctionalTestLrowacphomapWithBack) { TEST(Lrowacphomap, FunctionalTestLrowacphomapNoBack) { QTemporaryDir tempDir; ASSERT_TRUE(tempDir.isValid()); - + QString outCubeFileName = tempDir.path() + "/outTemp.cub"; QString testCubeFileName = "data/lrowacphomap/M1181493219CE.vis.odd.reduced.cub"; QString phoPvlFileName = "data/lrowacphomap/hapke_full_reformatted.pvl"; QString paramMapFileName = "data/lrowacphomap/1x1_70NS_7b_wbhs_albflt_grid_geirist_tcorrect.reduced.cub"; - QVector args = {"from=" + testCubeFileName + "+1", - "to=" + outCubeFileName, + QVector args = {"from=" + testCubeFileName + "+1", + "to=" + outCubeFileName, "phoa=" + phoPvlFileName, "phop=" + paramMapFileName, "usedem=true"}; diff --git a/isis/tests/FunctionalTestsMap2map.cpp b/isis/tests/FunctionalTestsMap2map.cpp index 4ed374546c..7bf5c37f3d 100644 --- a/isis/tests/FunctionalTestsMap2map.cpp +++ b/isis/tests/FunctionalTestsMap2map.cpp @@ -1,6 +1,6 @@ #include -#include "Fixtures.h" +#include "NetworkFixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" diff --git a/isis/tests/FunctionalTestsMapmos.cpp b/isis/tests/FunctionalTestsMapmos.cpp index e802988876..38b2d18579 100644 --- a/isis/tests/FunctionalTestsMapmos.cpp +++ b/isis/tests/FunctionalTestsMapmos.cpp @@ -5,7 +5,7 @@ #include #include "mapmos.h" -#include "Fixtures.h" +#include "NetworkFixtures.h" #include "Pvl.h" #include "Histogram.h" #include "TestUtilities.h" @@ -177,7 +177,7 @@ TEST_F(ThreeImageNetwork, FunctionalTestMapmos720deg) { EXPECT_EQ(double(mapping["MaximumLatitude"]), 5); EXPECT_EQ(double(mapping["MinimumLongitude"]), 0); EXPECT_EQ(double(mapping["MaximumLongitude"]), 720); -} +} TEST_F(ThreeImageNetwork, FunctionalTestMapmosExtents) { QTemporaryDir prefix; @@ -230,7 +230,7 @@ TEST_F(ThreeImageNetwork, FunctionalTestMapmosTracking) { PvlGroup bandbin = mosaicLabel.findGroup("BandBin"); PvlGroup tracking = mosaicLabel.findGroup("Tracking"); QString trackPath = prefix.path() + "/" + tracking["FileName"][0]; - + try { Cube trackCube(trackPath); PvlObject trackLabel = trackCube.label()->findObject("IsisCube"); @@ -243,7 +243,7 @@ TEST_F(ThreeImageNetwork, FunctionalTestMapmosTracking) { catch (IException &e) { FAIL() << "Invalid FileName for tracking cube: " << e.toString().toStdString().c_str() << std::endl; } -} +} TEST_F(ThreeImageNetwork, FunctionalTestMapmosMatchBandBin) { QTemporaryDir prefix; diff --git a/isis/tests/FunctionalTestsMappt.cpp b/isis/tests/FunctionalTestsMappt.cpp index a8906be2d0..de6050286e 100644 --- a/isis/tests/FunctionalTestsMappt.cpp +++ b/isis/tests/FunctionalTestsMappt.cpp @@ -4,7 +4,7 @@ #include #include "mappt.h" -#include "Fixtures.h" +#include "CameraFixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" @@ -23,7 +23,7 @@ TEST_F(DefaultCube, FunctionalTestMapptImageTest) { mappt(projTestCube, options, &appLog); PvlGroup mapPoint = appLog.findGroup("Results"); - + EXPECT_PRED_FORMAT2(AssertQStringsEqual, mapPoint.findKeyword("FileName"), projTestCube->fileName()); EXPECT_PRED_FORMAT2(AssertQStringsEqual, mapPoint.findKeyword("FilterName"), "CLEAR"); EXPECT_EQ( (double) mapPoint.findKeyword("Band"), 1); @@ -42,7 +42,7 @@ TEST_F(DefaultCube, FunctionalTestMapptGroundTest) { UserInterface options(APP_XML, args); Pvl appLog; mappt(projTestCube, options, &appLog); - + PvlGroup mapPoint = appLog.findGroup("Results"); EXPECT_PRED_FORMAT2(AssertQStringsEqual, mapPoint.findKeyword("FileName"), projTestCube->fileName()); @@ -65,7 +65,7 @@ TEST_F(DefaultCube, FunctionalTestMapptProjectionTest) { UserInterface options(APP_XML, args); Pvl appLog; mappt(projTestCube, options, &appLog); - + PvlGroup mapPoint = appLog.findGroup("Results"); EXPECT_PRED_FORMAT2(AssertQStringsEqual, mapPoint.findKeyword("FileName"), projTestCube->fileName()); @@ -78,15 +78,15 @@ TEST_F(DefaultCube, FunctionalTestMapptProjectionTest) { EXPECT_DOUBLE_EQ( (double) mapPoint.findKeyword("PositiveWest360Longitude"), 359.14528612684); EXPECT_DOUBLE_EQ( (double) mapPoint.findKeyword("PositiveEast360Longitude"), 0.85471387315749); EXPECT_DOUBLE_EQ( (double) mapPoint.findKeyword("PositiveEast180Longitude"), 0.85471387315749); - EXPECT_DOUBLE_EQ( (double) mapPoint.findKeyword("PositiveWest180Longitude"), -0.85471387315751); + EXPECT_DOUBLE_EQ( (double) mapPoint.findKeyword("PositiveWest180Longitude"), -0.85471387315751); EXPECT_DOUBLE_EQ( (double) mapPoint.findKeyword("x"), 50000); EXPECT_DOUBLE_EQ( (double) mapPoint.findKeyword("y"), 550000); } TEST_F(DefaultCube, FunctionalTestMapptCoordsysTest) { - QVector args = {"append=false", - "coordsys=userdefined", - "type=ground", + QVector args = {"append=false", + "coordsys=userdefined", + "type=ground", "lattype=planetographic" "londir=positivewest", "londom=180", @@ -96,7 +96,7 @@ TEST_F(DefaultCube, FunctionalTestMapptCoordsysTest) { UserInterface options(APP_XML, args); Pvl appLog; mappt(projTestCube, options, &appLog); - + PvlGroup mapPoint = appLog.findGroup("Results"); EXPECT_PRED_FORMAT2(AssertQStringsEqual, mapPoint.findKeyword("FileName"), projTestCube->fileName()); @@ -109,9 +109,9 @@ TEST_F(DefaultCube, FunctionalTestMapptCoordsysTest) { EXPECT_DOUBLE_EQ( (double) mapPoint.findKeyword("PositiveWest360Longitude"), 359.14528612684); EXPECT_DOUBLE_EQ( (double) mapPoint.findKeyword("PositiveEast360Longitude"), 0.85471387315749); EXPECT_DOUBLE_EQ( (double) mapPoint.findKeyword("PositiveEast180Longitude"), 0.85471387315749); - EXPECT_DOUBLE_EQ( (double) mapPoint.findKeyword("PositiveWest180Longitude"), -0.85471387315751); + EXPECT_DOUBLE_EQ( (double) mapPoint.findKeyword("PositiveWest180Longitude"), -0.85471387315751); EXPECT_DOUBLE_EQ( (double) mapPoint.findKeyword("x"), 50000); - EXPECT_DOUBLE_EQ( (double) mapPoint.findKeyword("y"), 550000); + EXPECT_DOUBLE_EQ( (double) mapPoint.findKeyword("y"), 550000); } @@ -123,7 +123,7 @@ TEST_F(DefaultCube, FunctionalTestMapptFlatFileTest) { mappt(projTestCube, options, &appLog); PvlGroup mapPoint = appLog.findGroup("Results"); - + int lineNumber = 0; QTextStream flatStream(&flatFile); @@ -131,7 +131,7 @@ TEST_F(DefaultCube, FunctionalTestMapptFlatFileTest) { while(!flatStream.atEnd()) { QString line = flatStream.readLine(); QStringList fields = line.split(","); - + if(lineNumber == 0) { EXPECT_PRED_FORMAT2(AssertQStringsEqual, fields.value(0), "Filename"); EXPECT_PRED_FORMAT2(AssertQStringsEqual, fields.value(1), "Sample"); @@ -181,7 +181,7 @@ TEST_F(DefaultCube, FunctionalTestMapptAllowOutside) { PvlGroup groundPoint = appLog.findGroup("Results"); EXPECT_DOUBLE_EQ( (double) groundPoint.findKeyword("Sample"), -1.0); EXPECT_DOUBLE_EQ( (double) groundPoint.findKeyword("Line"), -1.0); - + args = {"type=image", "sample=-1", "line=-1", "allowoutside=false"}; mappt(projTestCube, options, &appLog); @@ -196,7 +196,7 @@ TEST_F(DefaultCube, FunctionalTestMapptBandTest) { Pvl appLog; mappt(options, &appLog); PvlGroup mapPoint = appLog.findGroup("Results"); - + EXPECT_PRED_FORMAT2(AssertQStringsEqual, mapPoint.findKeyword("FilterName"), "NIR"); EXPECT_EQ( (double) mapPoint.findKeyword("Band"), 2); } @@ -207,16 +207,16 @@ TEST_F(DefaultCube, FunctionalTestMapptImageCoordList) { of.open(tempDir.path().toStdString()+"/coords.txt"); of << "1, 1\n2, 2\n 3, 3"; of.close(); - + QVector args = {"coordlist="+tempDir.path()+"/coords.txt", - "UseCoordList=True", + "UseCoordList=True", "append=false", "type=image"}; UserInterface options(APP_XML, args); - Pvl appLog; + Pvl appLog; mappt(projTestCube, options, &appLog); - + PvlGroup mapPoint = appLog.group(0); EXPECT_PRED_FORMAT2(AssertQStringsEqual, mapPoint.findKeyword("FileName"), projTestCube->fileName()); @@ -229,10 +229,10 @@ TEST_F(DefaultCube, FunctionalTestMapptImageCoordList) { EXPECT_DOUBLE_EQ( (double) mapPoint.findKeyword("PositiveWest360Longitude"), 359.14528612684); EXPECT_DOUBLE_EQ( (double) mapPoint.findKeyword("PositiveEast360Longitude"), 0.85471387315749); EXPECT_DOUBLE_EQ( (double) mapPoint.findKeyword("PositiveEast180Longitude"), 0.85471387315749); - EXPECT_DOUBLE_EQ( (double) mapPoint.findKeyword("PositiveWest180Longitude"), -0.85471387315751); + EXPECT_DOUBLE_EQ( (double) mapPoint.findKeyword("PositiveWest180Longitude"), -0.85471387315751); EXPECT_DOUBLE_EQ( (double) mapPoint.findKeyword("x"), 50000); - EXPECT_DOUBLE_EQ( (double) mapPoint.findKeyword("y"), 550000); - + EXPECT_DOUBLE_EQ( (double) mapPoint.findKeyword("y"), 550000); + mapPoint = appLog.group(1); EXPECT_PRED_FORMAT2(AssertQStringsEqual, mapPoint.findKeyword("FileName"), projTestCube->fileName()); @@ -245,10 +245,10 @@ TEST_F(DefaultCube, FunctionalTestMapptImageCoordList) { EXPECT_DOUBLE_EQ( (double) mapPoint.findKeyword("PositiveWest360Longitude"), 357.44703128109); EXPECT_DOUBLE_EQ( (double) mapPoint.findKeyword("PositiveEast360Longitude"), 2.5529687189083); EXPECT_DOUBLE_EQ( (double) mapPoint.findKeyword("PositiveEast180Longitude"), 2.5529687189083); - EXPECT_DOUBLE_EQ( (double) mapPoint.findKeyword("PositiveWest180Longitude"), -2.5529687189083); + EXPECT_DOUBLE_EQ( (double) mapPoint.findKeyword("PositiveWest180Longitude"), -2.5529687189083); EXPECT_DOUBLE_EQ( (double) mapPoint.findKeyword("x"), 150000); EXPECT_DOUBLE_EQ( (double) mapPoint.findKeyword("y"), 450000); - + mapPoint = appLog.group(2); EXPECT_PRED_FORMAT2(AssertQStringsEqual, mapPoint.findKeyword("FileName"), projTestCube->fileName()); @@ -261,7 +261,7 @@ TEST_F(DefaultCube, FunctionalTestMapptImageCoordList) { EXPECT_DOUBLE_EQ( (double) mapPoint.findKeyword("PositiveWest360Longitude"), 355.75985208984); EXPECT_DOUBLE_EQ( (double) mapPoint.findKeyword("PositiveEast360Longitude"), 4.2401479101647); EXPECT_DOUBLE_EQ( (double) mapPoint.findKeyword("PositiveEast180Longitude"), 4.2401479101647); - EXPECT_DOUBLE_EQ( (double) mapPoint.findKeyword("PositiveWest180Longitude"), -4.2401479101646); + EXPECT_DOUBLE_EQ( (double) mapPoint.findKeyword("PositiveWest180Longitude"), -4.2401479101646); EXPECT_DOUBLE_EQ( (double) mapPoint.findKeyword("x"), 250000); EXPECT_DOUBLE_EQ( (double) mapPoint.findKeyword("y"), 350000.0); @@ -272,27 +272,27 @@ TEST_F(DefaultCube, FunctionalTestMapptCoordListFlatFile) { of.open(tempDir.path().toStdString()+"/coords.txt"); of << "1, 1\n2, 2\n 3, 3"; of.close(); - + QFile flatFile(tempDir.path() + "/testOut.txt"); - QVector args = {"coordlist="+tempDir.path()+"/coords.txt","to=" + flatFile.fileName(), - "UseCoordList=True", + QVector args = {"coordlist="+tempDir.path()+"/coords.txt","to=" + flatFile.fileName(), + "UseCoordList=True", "append=false", "format=flat", "type=image"}; UserInterface options(APP_XML, args); - Pvl appLog; + Pvl appLog; mappt(projTestCube, options, &appLog); - + int lineNumber = 0; QTextStream flatStream(&flatFile); - + PvlGroup mapPoint = appLog.group(0); if (flatFile.open(QIODevice::ReadOnly)) { while(!flatStream.atEnd()) { QString line = flatStream.readLine(); QStringList fields = line.split(","); - + if(lineNumber == 0) { EXPECT_PRED_FORMAT2(AssertQStringsEqual, fields.value(0), "Filename"); EXPECT_PRED_FORMAT2(AssertQStringsEqual, fields.value(1), "Sample"); @@ -310,8 +310,8 @@ TEST_F(DefaultCube, FunctionalTestMapptCoordListFlatFile) { EXPECT_PRED_FORMAT2(AssertQStringsEqual, fields.value(13), "PositiveWest180Longitude"); } else { - mapPoint = appLog.group(lineNumber-1); - + mapPoint = appLog.group(lineNumber-1); + EXPECT_PRED_FORMAT2(AssertQStringsEqual, fields.value(0), mapPoint.findKeyword("FileName")); EXPECT_DOUBLE_EQ(fields.value(1).toDouble(), mapPoint.findKeyword("Sample")); EXPECT_DOUBLE_EQ(fields.value(2).toDouble(), mapPoint.findKeyword("Line")); @@ -341,9 +341,9 @@ TEST_F(DefaultCube, FunctionalTestMapptBadColumnError) { of.open(tempDir.path().toStdString()+"/coords.txt"); of << "1, 1\n2\n 3, 3"; of.close(); - + QVector args = {"coordlist="+tempDir.path()+"/coords.txt", - "UseCoordList=True", + "UseCoordList=True", "append=false", "type=image"}; diff --git a/isis/tests/FunctionalTestsMaptrim.cpp b/isis/tests/FunctionalTestsMaptrim.cpp index fbae986653..81715f3fd2 100644 --- a/isis/tests/FunctionalTestsMaptrim.cpp +++ b/isis/tests/FunctionalTestsMaptrim.cpp @@ -12,7 +12,7 @@ #include "Table.h" #include "Histogram.h" -#include "Fixtures.h" +#include "CameraFixtures.h" #include "gmock/gmock.h" diff --git a/isis/tests/FunctionalTestsMarci2isis.cpp b/isis/tests/FunctionalTestsMarci2isis.cpp index 1286383771..295379a253 100644 --- a/isis/tests/FunctionalTestsMarci2isis.cpp +++ b/isis/tests/FunctionalTestsMarci2isis.cpp @@ -1,7 +1,6 @@ #include #include "marci2isis.h" -#include "Fixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" @@ -22,7 +21,7 @@ TEST(Marci2Isis, Marci2isisTestDefault) { QString cubeFileNameEven = prefix.path() + "/marci2isis_out.even.cub"; QString cubeFileNameOdd = prefix.path() + "/marci2isis_out.odd.cub"; - + Cube cubeEven(cubeFileNameEven); Cube cubeOdd(cubeFileNameOdd); Pvl *evenLabel = cubeEven.label(); @@ -49,7 +48,7 @@ TEST(Marci2Isis, Marci2isisTestDefault) { EXPECT_PRED_FORMAT2(AssertQStringsEqual, evenPixels["ByteOrder"][0], oddPixels["ByteOrder"][0]); ASSERT_EQ((double)evenPixels["Base"], (double)oddPixels["Base"]); ASSERT_EQ((double)evenPixels["Multiplier"], (double)oddPixels["Multiplier"]); - + // Instrument Group PvlGroup &evenInst = evenLabel->findGroup("Instrument", Pvl::Traverse); PvlGroup &oddInst = oddLabel->findGroup("Instrument", Pvl::Traverse); @@ -127,8 +126,8 @@ TEST(Marci2Isis, Marci2isisTestDefault) { ASSERT_EQ((int)evenKernels["NaifIkCode"], -74420); ASSERT_EQ((int)evenKernels["NaifIkCode"], (int)oddKernels["NaifIkCode"]); - - + + // Label Object ASSERT_EQ((int)evenLabel->findObject("Label").findKeyword("Bytes"), 65536); ASSERT_EQ((int)oddLabel->findObject("Label").findKeyword("Bytes"), 65536); @@ -173,7 +172,7 @@ TEST(Marci2Isis, Marci2isisTestColorOffset) { QString cubeFileNameEven = prefix.path() + "/marci2isis_out.even.cub"; Cube cubeEven(cubeFileNameEven); Pvl *evenLabel = cubeEven.label(); - + ASSERT_EQ((int)evenLabel->findKeyword("TileLines", Pvl::Traverse), 86); PvlGroup dimensions = evenLabel->findGroup("Dimensions", Pvl::Traverse); diff --git a/isis/tests/FunctionalTestsMarcical.cpp b/isis/tests/FunctionalTestsMarcical.cpp index 7338f781b1..18516f3e0c 100644 --- a/isis/tests/FunctionalTestsMarcical.cpp +++ b/isis/tests/FunctionalTestsMarcical.cpp @@ -1,7 +1,6 @@ #include #include "marcical.h" -#include "Fixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" @@ -90,7 +89,7 @@ TEST(Marcical, MarcicalTestSingleDuration) { EXPECT_NEAR( outHist->Average(), 0.00656912, 1e-7 ); EXPECT_NEAR( outHist->Sum(), 0.131382, 1e-6 ); EXPECT_EQ( outHist->ValidPixels(), 20 ); - EXPECT_NEAR( outHist->StandardDeviation(), 0.000671733, 1e-8 ); + EXPECT_NEAR( outHist->StandardDeviation(), 0.000671733, 1e-8 ); } TEST(Marcical, MarcicalTestSingleDurationNoIof) { @@ -110,7 +109,7 @@ TEST(Marcical, MarcicalTestSingleDurationNoIof) { PvlGroup &inst = label->findGroup("Instrument", Pvl::Traverse); EXPECT_EQ( inst["VariableExposureDuration"][0].toStdString(), "8.8" ); - + std::unique_ptr outHist (outCube.histogram()); EXPECT_NEAR( outHist->Average(), 1.61438, 1e-4 ); EXPECT_NEAR( outHist->Sum(), 32.2875, 1e-4 ); diff --git a/isis/tests/FunctionalTestsMarciflip.cpp b/isis/tests/FunctionalTestsMarciflip.cpp index 41d7c830f9..7b523efbea 100644 --- a/isis/tests/FunctionalTestsMarciflip.cpp +++ b/isis/tests/FunctionalTestsMarciflip.cpp @@ -1,7 +1,6 @@ #include #include "marciflip.h" -#include "Fixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" diff --git a/isis/tests/FunctionalTestsMimap2isis.cpp b/isis/tests/FunctionalTestsMimap2isis.cpp index ea793f16ee..f9461b7264 100644 --- a/isis/tests/FunctionalTestsMimap2isis.cpp +++ b/isis/tests/FunctionalTestsMimap2isis.cpp @@ -2,7 +2,6 @@ #include #include "mimap2isis.h" -#include "Fixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" diff --git a/isis/tests/FunctionalTestsMoccal.cpp b/isis/tests/FunctionalTestsMoccal.cpp index 585866f01b..104b0f0e9f 100644 --- a/isis/tests/FunctionalTestsMoccal.cpp +++ b/isis/tests/FunctionalTestsMoccal.cpp @@ -1,4 +1,4 @@ -#include "Fixtures.h" +#include "CameraFixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" diff --git a/isis/tests/FunctionalTestsMsi2isis.cpp b/isis/tests/FunctionalTestsMsi2isis.cpp index 959c567cb9..e0d6fd1c87 100644 --- a/isis/tests/FunctionalTestsMsi2isis.cpp +++ b/isis/tests/FunctionalTestsMsi2isis.cpp @@ -1,7 +1,7 @@ #include #include "msi2isis.h" -#include "Fixtures.h" +#include "TempFixtures.h" #include "LineManager.h" #include "Pvl.h" #include "PvlGroup.h" diff --git a/isis/tests/FunctionalTestsMvic2isis.cpp b/isis/tests/FunctionalTestsMvic2isis.cpp index 7e0ae12e6e..8845fba90c 100644 --- a/isis/tests/FunctionalTestsMvic2isis.cpp +++ b/isis/tests/FunctionalTestsMvic2isis.cpp @@ -2,7 +2,7 @@ #include #include "mvic2isis.h" -#include "Fixtures.h" +#include "TempFixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" @@ -13,8 +13,6 @@ #include "gtest/gtest.h" #include "gmock/gmock.h" -#include "Fixtures.h" - using namespace Isis; static QString APP_XML = FileName("$ISISROOT/bin/xml/mvic2isis.xml").expanded(); diff --git a/isis/tests/FunctionalTestsNocam2map.cpp b/isis/tests/FunctionalTestsNocam2map.cpp index 73cb89a464..6c6087f403 100644 --- a/isis/tests/FunctionalTestsNocam2map.cpp +++ b/isis/tests/FunctionalTestsNocam2map.cpp @@ -1,4 +1,5 @@ -#include "Fixtures.h" +#include "CameraFixtures.h" +#include "CubeFixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" diff --git a/isis/tests/FunctionalTestsNoproj.cpp b/isis/tests/FunctionalTestsNoproj.cpp index 0529c9f7bf..02db595a8c 100644 --- a/isis/tests/FunctionalTestsNoproj.cpp +++ b/isis/tests/FunctionalTestsNoproj.cpp @@ -2,7 +2,7 @@ #include -#include "Fixtures.h" +#include "CameraFixtures.h" #include "Histogram.h" #include "LineManager.h" #include "PvlGroup.h" @@ -176,7 +176,7 @@ TEST_F(DefaultCube, FunctionalTestNoprojSpecs) { Created = 2006-12-14T10:10:49 LastModified = 2019-06-27 # 2019-11-05 Modified by ladoramkershner: Added Mariner 10 - + # Group name and values will change once stabilized Group = "Clipper EIS 2025/EIS-NAC-RS" DetectorSamples = 4000 @@ -234,7 +234,7 @@ TEST_F(DefaultCube, FunctionalTestNoprojSpecs) { TransY = -0.39031635 ItransS = 55.759479 End_Group - + Group = "MARS RECONNAISSANCE ORBITER/HIRISE" DetectorSamples = 20000 # Use the average of red ccd's 4 & 5 for the offsets diff --git a/isis/tests/FunctionalTestsOverlapstats.cpp b/isis/tests/FunctionalTestsOverlapstats.cpp index db8e5cd32c..5ed262b717 100644 --- a/isis/tests/FunctionalTestsOverlapstats.cpp +++ b/isis/tests/FunctionalTestsOverlapstats.cpp @@ -4,10 +4,12 @@ #include "findimageoverlaps.h" #include "overlapstats.h" -#include "Fixtures.h" +#include "ImagePolygon.h" +#include "NetworkFixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" + #include "gmock/gmock.h" using namespace Isis; diff --git a/isis/tests/FunctionalTestsPds2isis.cpp b/isis/tests/FunctionalTestsPds2isis.cpp index eb90a76962..90ab832fd6 100644 --- a/isis/tests/FunctionalTestsPds2isis.cpp +++ b/isis/tests/FunctionalTestsPds2isis.cpp @@ -1,7 +1,6 @@ #include #include "pds2isis.h" -#include "Fixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" diff --git a/isis/tests/FunctionalTestsPhocube.cpp b/isis/tests/FunctionalTestsPhocube.cpp index ad612d7859..a44ed010d0 100644 --- a/isis/tests/FunctionalTestsPhocube.cpp +++ b/isis/tests/FunctionalTestsPhocube.cpp @@ -5,7 +5,7 @@ #include #include "BandManager.h" -#include "Fixtures.h" +#include "CameraFixtures.h" #include "Histogram.h" #include "LineManager.h" #include "PvlGroup.h" diff --git a/isis/tests/FunctionalTestsPointreg.cpp b/isis/tests/FunctionalTestsPointreg.cpp index 84e6f69b69..331c533bba 100644 --- a/isis/tests/FunctionalTestsPointreg.cpp +++ b/isis/tests/FunctionalTestsPointreg.cpp @@ -1,6 +1,6 @@ #include "pointreg.h" -#include "Fixtures.h" +#include "NetworkFixtures.h" #include "TestUtilities.h" #include "UserInterface.h" #include "ControlNet.h" @@ -36,7 +36,7 @@ TEST_F(ThreeImageNetwork, FunctionalTestPointregDefault) { PvlGroup measures = log.findGroup("Measures"); EXPECT_EQ(int(points["Total"]), 16); EXPECT_EQ(int(measures["Registered"]), 3); - + // Check flatFile QFile flatFile(flatFilePath); EXPECT_TRUE(flatFile.size() > 0) ; @@ -75,7 +75,7 @@ TEST_F(ThreeImageNetwork, FunctionalTestPointregFailOptions) { PvlGroup measures = log.findGroup("Measures"); EXPECT_EQ(int(points["Total"]), 3); EXPECT_EQ(int(measures["Registered"]), 3); - + // Check flatFile QFile flatFile(flatFilePath); EXPECT_TRUE(flatFile.size() > 0) ; @@ -115,7 +115,7 @@ TEST_F(ThreeImageNetwork, FunctionalTestPointregOutputOptionsA) { EXPECT_EQ(int(points["Total"]), 16); EXPECT_EQ(int(measures["Registered"]), 0); EXPECT_EQ(int(surface["SurfaceModelNotEnoughValidData"]), 0); - + // Check flatFile QFile flatFile(flatFilePath); EXPECT_TRUE(flatFile.size() > 0) ; @@ -155,7 +155,7 @@ TEST_F(ThreeImageNetwork, FunctionalTestPointregOutputOptionsB) { EXPECT_EQ(int(points["Total"]), 16); EXPECT_EQ(int(measures["Registered"]), 3); EXPECT_EQ(int(surface["SurfaceModelNotEnoughValidData"]), 15); - + // Check flatFile QFile flatFile(flatFilePath); EXPECT_TRUE(flatFile.size() > 0) ; @@ -195,7 +195,7 @@ TEST_F(ThreeImageNetwork, FunctionalTestPointregOutputOptionsC) { EXPECT_EQ(int(points["Total"]), 3); EXPECT_EQ(int(measures["Registered"]), 3); EXPECT_EQ(int(surface["SurfaceModelNotEnoughValidData"]), 15); - + // Check flatFile QFile flatFile(flatFilePath); EXPECT_TRUE(flatFile.size() > 0) ; @@ -299,7 +299,7 @@ TEST_F(ThreeImageNetwork, FunctionalTestPointregValidation) { EXPECT_EQ(int(points["Total"]), 16); EXPECT_EQ(int(measures["Registered"]), 3); EXPECT_EQ(int(valid["Total"]), 3); - + QFile falsePos(falsePosPath); // Should be empty EXPECT_TRUE(falsePos.size() > 140); // 140 is the size of the empty table due to column names @@ -339,8 +339,8 @@ TEST_F(ThreeImageNetwork, FunctionalTestPointregValidationRevert) { EXPECT_EQ(int(points["Total"]), 16); EXPECT_EQ(int(measures["Registered"]), 0); EXPECT_EQ(int(valid["Total"]), 0); - - QFile falsePos(falsePosPath); // Should be empty + + QFile falsePos(falsePosPath); // Should be empty EXPECT_TRUE(falsePos.size() == 140); // 140 is the size of the empty table due to column names } @@ -380,8 +380,8 @@ TEST_F(ThreeImageNetwork, FunctionalTestPointregValidationSkipped) { EXPECT_EQ(int(points["Total"]), 16); EXPECT_EQ(int(measures["Registered"]), 0); EXPECT_EQ(int(valid["Total"]), 0); - - QFile falsePos(falsePosPath); // Should be empty + + QFile falsePos(falsePosPath); // Should be empty EXPECT_TRUE(falsePos.size() == 140); // 140 is the size of the empty table due to column names } diff --git a/isis/tests/FunctionalTestsReduce.cpp b/isis/tests/FunctionalTestsReduce.cpp index 12d2b40b88..695112530d 100644 --- a/isis/tests/FunctionalTestsReduce.cpp +++ b/isis/tests/FunctionalTestsReduce.cpp @@ -1,4 +1,4 @@ -#include "Fixtures.h" +#include "CubeFixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" diff --git a/isis/tests/FunctionalTestsRingsautomos.cpp b/isis/tests/FunctionalTestsRingsautomos.cpp index 08401101c7..2c7a25d21c 100644 --- a/isis/tests/FunctionalTestsRingsautomos.cpp +++ b/isis/tests/FunctionalTestsRingsautomos.cpp @@ -1,6 +1,6 @@ #include "ringsautomos.h" -#include "Fixtures.h" +#include "CubeFixtures.h" #include "TestUtilities.h" #include "UserInterface.h" #include "Histogram.h" diff --git a/isis/tests/FunctionalTestsSegment.cpp b/isis/tests/FunctionalTestsSegment.cpp index 230e7c3d0c..aac96a6f05 100644 --- a/isis/tests/FunctionalTestsSegment.cpp +++ b/isis/tests/FunctionalTestsSegment.cpp @@ -1,4 +1,4 @@ -#include "Fixtures.h" +#include "CubeFixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" diff --git a/isis/tests/FunctionalTestsShadow.cpp b/isis/tests/FunctionalTestsShadow.cpp index a527660bc4..94e93d86ee 100644 --- a/isis/tests/FunctionalTestsShadow.cpp +++ b/isis/tests/FunctionalTestsShadow.cpp @@ -4,13 +4,14 @@ #include #include "Cube.h" +#include "FileName.h" #include "Histogram.h" +#include "LineManager.h" #include "Pvl.h" +#include "Table.h" #include "TestUtilities.h" -#include "FileName.h" -#include "LineManager.h" -#include "Fixtures.h" +#include "CameraFixtures.h" #include "gtest/gtest.h" #include "gmock/gmock.h" diff --git a/isis/tests/FunctionalTestsSocetlinescankeywords.cpp b/isis/tests/FunctionalTestsSocetlinescankeywords.cpp index e4be15e075..6ed5580e01 100644 --- a/isis/tests/FunctionalTestsSocetlinescankeywords.cpp +++ b/isis/tests/FunctionalTestsSocetlinescankeywords.cpp @@ -1,4 +1,4 @@ -#include "Fixtures.h" +#include "CameraFixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" diff --git a/isis/tests/FunctionalTestsSpiceinit.cpp b/isis/tests/FunctionalTestsSpiceinit.cpp index 796b5d2809..8fe4fd53ff 100644 --- a/isis/tests/FunctionalTestsSpiceinit.cpp +++ b/isis/tests/FunctionalTestsSpiceinit.cpp @@ -17,7 +17,8 @@ #include "TestUtilities.h" #include "FileName.h" -#include "Fixtures.h" +#include "CameraFixtures.h" +#include "CubeFixtures.h" using json = nlohmann::json; diff --git a/isis/tests/FunctionalTestsSpiceserver.cpp b/isis/tests/FunctionalTestsSpiceserver.cpp index 79773208a4..522b2940f8 100644 --- a/isis/tests/FunctionalTestsSpiceserver.cpp +++ b/isis/tests/FunctionalTestsSpiceserver.cpp @@ -7,7 +7,8 @@ #include #include "spiceserver.h" -#include "Fixtures.h" +#include "CameraFixtures.h" +#include "TempFixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" @@ -21,16 +22,16 @@ static QString APP_XML = FileName("$ISISROOT/bin/xml/spiceserver.xml").expanded( class TestPayload : public DefaultCube { protected: - - QString asciiPayloadPath; - QString hexPayloadPath; - void SetUp() override { + QString asciiPayloadPath; + QString hexPayloadPath; + + void SetUp() override { DefaultCube::SetUp(); QByteArray prefix = R"( - 352e312e312e3020616c706861207c20323031322d30352d3231 + 352e312e312e3020616c706861207c20323031322d30352d3231 @@ -46,28 +47,28 @@ class TestPayload : public DefaultCube { )"; - + QByteArray asciiPayload = prefix+labelBytes.toHex()+suffix; - QByteArray hexPayload = asciiPayload.toHex(); - + QByteArray hexPayload = asciiPayload.toHex(); + asciiPayloadPath = tempDir.path() + "/asciiPayload.txt"; hexPayloadPath = tempDir.path() + "/hexPayload.txt"; - + QFile asciiFile(asciiPayloadPath); asciiFile.open(QIODevice::WriteOnly); asciiFile.write(asciiPayload); asciiFile.close(); - + QFile hexFile(hexPayloadPath); hexFile.open(QIODevice::WriteOnly); hexFile.write(hexPayload); @@ -83,24 +84,24 @@ TEST_F(TestPayload, FunctionalTestSpiceserverDefaultParameters) { Pvl appLog; spiceserver(options, &appLog); - - TextFile inFile(outputFile); - QString hexCode; + + TextFile inFile(outputFile); + QString hexCode; inFile.GetLine(hexCode); - + QString xml( QByteArray::fromHex( QByteArray( hexCode.toLatin1() ) ).constData() ); - + QDomDocument document; QString error; Pvl kernelsLabel; Pvl instrumentPositionTable; - - // Use Qt's XML API to get elements we want to compare + + // Use Qt's XML API to get elements we want to compare int errorLine, errorCol; if ( document.setContent(QString(xml), &error, &errorLine, &errorCol) ) { QDomElement rootElement = document.firstChild().toElement(); for ( QDomNode node = rootElement.firstChild(); !node.isNull(); node = node.nextSibling() ) { - + QDomElement element = node.toElement(); if (element.tagName() == "kernels_label") { @@ -112,7 +113,7 @@ TEST_F(TestPayload, FunctionalTestSpiceserverDefaultParameters) { else if (element.tagName() == "tables") { for ( QDomNode node = element.firstChild(); !node.isNull(); node = node.nextSibling() ) { QDomElement table = node.toElement(); - + if (table.tagName() == "instrument_position") { QString encoded = table.firstChild().toText().data(); std::stringstream labStream; @@ -126,14 +127,14 @@ TEST_F(TestPayload, FunctionalTestSpiceserverDefaultParameters) { else { FAIL() << "Unable to open output file, either doesn't exist for formatted incorrectly."; } - + PvlGroup naifKeywords = kernelsLabel.group(0); EXPECT_EQ((int)naifKeywords.findKeyword("NaifFrameCode"), -27002); EXPECT_PRED_FORMAT2(AssertQStringsEqual, naifKeywords.findKeyword("TargetPosition")[0], "Table"); EXPECT_PRED_FORMAT2(AssertQStringsEqual, naifKeywords.findKeyword("InstrumentPointing")[0], "Table"); EXPECT_PRED_FORMAT2(AssertQStringsEqual, naifKeywords.findKeyword("InstrumentPosition")[0], "Table"); - + PvlObject table = instrumentPositionTable.findObject("Table"); EXPECT_PRED_FORMAT2(AssertQStringsEqual, QString(table.findKeyword("Name")), "InstrumentPosition"); EXPECT_PRED_FORMAT2(AssertQStringsEqual, QString(table.group(0).findKeyword("Name")), "J2000X"); @@ -146,7 +147,7 @@ TEST_F(TestPayload, FunctionalTestSpiceserverDefaultParameters) { TEST_F(TempTestingFiles, FunctionalTestSpiceserverIsisVersion) { - + // Isis Version 3.4.1 QByteArray badPayload = R"( @@ -155,10 +156,10 @@ TEST_F(TempTestingFiles, FunctionalTestSpiceserverIsisVersion) { )"; - - QString outputFile = tempDir.path() + "/out.txt"; + + QString outputFile = tempDir.path() + "/out.txt"; QString badPayloadPath = tempDir.path() + "/out.txt"; - + QFile asciiFile(badPayloadPath); asciiFile.open(QIODevice::WriteOnly); asciiFile.write(badPayload.toHex()); @@ -166,7 +167,7 @@ TEST_F(TempTestingFiles, FunctionalTestSpiceserverIsisVersion) { QVector args = {"From="+badPayloadPath, "To="+outputFile}; UserInterface options(APP_XML, args); - + EXPECT_THROW({ try{ spiceserver(options); @@ -177,4 +178,4 @@ TEST_F(TempTestingFiles, FunctionalTestSpiceserverIsisVersion) { throw; } }, IException); -} +} diff --git a/isis/tests/FunctionalTestsSpkwriter.cpp b/isis/tests/FunctionalTestsSpkwriter.cpp index e4efc94ff7..9eb46fbb1f 100644 --- a/isis/tests/FunctionalTestsSpkwriter.cpp +++ b/isis/tests/FunctionalTestsSpkwriter.cpp @@ -1,7 +1,13 @@ #include "spkwriter.h" -#include "Fixtures.h" +#include + +#include "Camera.h" +#include "CameraFixtures.h" +#include "NaifStatus.h" +#include "NetworkFixtures.h" #include "Pvl.h" +#include "Table.h" #include "TextFile.h" #include "TestUtilities.h" diff --git a/isis/tests/FunctionalTestsStd2isis.cpp b/isis/tests/FunctionalTestsStd2isis.cpp index 16ee106e26..4df229706e 100644 --- a/isis/tests/FunctionalTestsStd2isis.cpp +++ b/isis/tests/FunctionalTestsStd2isis.cpp @@ -6,7 +6,7 @@ #include #include -#include "Fixtures.h" +#include "TempFixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" diff --git a/isis/tests/FunctionalTestsStretch.cpp b/isis/tests/FunctionalTestsStretch.cpp index 269f20e592..fabdd10147 100644 --- a/isis/tests/FunctionalTestsStretch.cpp +++ b/isis/tests/FunctionalTestsStretch.cpp @@ -1,4 +1,4 @@ -#include "Fixtures.h" +#include "CubeFixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" diff --git a/isis/tests/FunctionalTestsSumspice.cpp b/isis/tests/FunctionalTestsSumspice.cpp index 1c7c560999..6286f4bd91 100644 --- a/isis/tests/FunctionalTestsSumspice.cpp +++ b/isis/tests/FunctionalTestsSumspice.cpp @@ -2,8 +2,8 @@ #include #include "sumspice.h" -#include "Fixtures.h" #include "TestUtilities.h" +#include "Table.h" #include "UserInterface.h" #include "Histogram.h" #include "iTime.h" diff --git a/isis/tests/FunctionalTestsTgocassis2isis.cpp b/isis/tests/FunctionalTestsTgocassis2isis.cpp index e20a678d07..62f2a7f15d 100644 --- a/isis/tests/FunctionalTestsTgocassis2isis.cpp +++ b/isis/tests/FunctionalTestsTgocassis2isis.cpp @@ -1,7 +1,6 @@ #include #include "tgocassis2isis.h" -#include "Fixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" diff --git a/isis/tests/FunctionalTestsTgocassisstitch.cpp b/isis/tests/FunctionalTestsTgocassisstitch.cpp index e71445d5fa..038d351306 100644 --- a/isis/tests/FunctionalTestsTgocassisstitch.cpp +++ b/isis/tests/FunctionalTestsTgocassisstitch.cpp @@ -1,7 +1,7 @@ #include #include "tgocassisstitch.h" -#include "Fixtures.h" +#include "FileList.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" @@ -16,7 +16,7 @@ static QString APP_XML = FileName("$ISISROOT/bin/xml/tgocassisstitch.xml").expan TEST(TgoCassisstitch, TgoCassisstitchMultiframeTest) { QTemporaryDir prefix; - + FileList *cubeList = new FileList(); cubeList->append("data/tgoCassis/tgocassisstitch/CAS-MCO-2016-11-22T16.16.16.833-BLU-03006-B1.cub"); cubeList->append("data/tgoCassis/tgocassisstitch/CAS-MCO-2016-11-22T16.16.16.833-RED-01006-B1_crop.cub"); @@ -26,7 +26,7 @@ TEST(TgoCassisstitch, TgoCassisstitchMultiframeTest) { QString cubeListFile = prefix.path() + "/cubelist.lis"; cubeList->write(cubeListFile); - QVector args = {"fromlist=" + cubeListFile, + QVector args = {"fromlist=" + cubeListFile, "outputprefix=" + prefix.path() + "/CAS-MCO"}; UserInterface options(APP_XML, args); @@ -36,7 +36,7 @@ TEST(TgoCassisstitch, TgoCassisstitchMultiframeTest) { catch (IException &e) { FAIL() << "Unable to run tgocassisstitch with cube list: " << e.what() << std::endl; } - + Cube cube(prefix.path() + "/CAS-MCO-2016-11-22T16:16:16.833.cub"); Pvl *isisLabel = cube.label(); @@ -55,12 +55,12 @@ TEST(TgoCassisstitch, TgoCassisstitchMultiframeTest) { EXPECT_EQ(inst["ExposureDuration"][0].toStdString(), "1.152e-003"); EXPECT_EQ(int(inst["SummingMode"]), 0); EXPECT_EQ(inst["Filter"][0].toStdString(), "FULLCCD"); - + // Red Archive Group PvlGroup &arcRed = isisLabel->findGroup("archiveRED", Pvl::Traverse); EXPECT_EQ(arcRed["DataSetId"][0].toStdString(), "TBD"); EXPECT_EQ(arcRed["ProductVersionId"][0].toStdString(), "UNK"); - EXPECT_EQ(arcRed["ProductCreationTime"][0].toStdString(), "2017-10-03T09:38:29"); + EXPECT_EQ(arcRed["ProductCreationTime"][0].toStdString(), "2017-10-03T09:38:29"); EXPECT_DOUBLE_EQ(double(arcRed["ScalingFactor"]), 1.0); EXPECT_DOUBLE_EQ(double(arcRed["Offset"]), 0.0); EXPECT_DOUBLE_EQ(double(arcRed["PredictMaximumExposureTime"]), 5.2866); @@ -77,16 +77,16 @@ TEST(TgoCassisstitch, TgoCassisstitchMultiframeTest) { EXPECT_EQ(int(arcRed["ImageFrequency"]), 1000000); EXPECT_EQ(int(arcRed["NumberOfWindows"]), 6); EXPECT_EQ(int(arcRed["UniqueIdentifier"]), 100732832); - EXPECT_EQ(arcRed["ExposureTimestamp"][0].toStdString(), "2f014e931416226d"); + EXPECT_EQ(arcRed["ExposureTimestamp"][0].toStdString(), "2f014e931416226d"); EXPECT_DOUBLE_EQ(double(arcRed["ExposureTimePEHK"]), 1.152e-003); EXPECT_DOUBLE_EQ(double(arcRed["PixelsPossiblySaturated"]), 0.00); EXPECT_EQ(int(arcRed["YearDoy"]), 2016327); - + // Pan Archive Group PvlGroup &arcPan = isisLabel->findGroup("archivePAN", Pvl::Traverse); EXPECT_EQ(arcPan["DataSetId"][0].toStdString(), "TBD"); EXPECT_EQ(arcPan["ProductVersionId"][0].toStdString(), "UNK"); - EXPECT_EQ(arcPan["ProductCreationTime"][0].toStdString(), "2017-10-03T09:38:29"); + EXPECT_EQ(arcPan["ProductCreationTime"][0].toStdString(), "2017-10-03T09:38:29"); EXPECT_DOUBLE_EQ(double(arcPan["ScalingFactor"]), 1.0); EXPECT_DOUBLE_EQ(double(arcPan["Offset"]), 0.0); EXPECT_DOUBLE_EQ(double(arcPan["PredictMaximumExposureTime"]), 5.2866); @@ -103,16 +103,16 @@ TEST(TgoCassisstitch, TgoCassisstitchMultiframeTest) { EXPECT_EQ(int(arcPan["ImageFrequency"]), 1000000); EXPECT_EQ(int(arcPan["NumberOfWindows"]), 6); EXPECT_EQ(int(arcPan["UniqueIdentifier"]), 100732832); - EXPECT_EQ(arcPan["ExposureTimestamp"][0].toStdString(), "2f014e931416226d"); + EXPECT_EQ(arcPan["ExposureTimestamp"][0].toStdString(), "2f014e931416226d"); EXPECT_DOUBLE_EQ(double(arcPan["ExposureTimePEHK"]), 1.152e-003); EXPECT_DOUBLE_EQ(double(arcPan["PixelsPossiblySaturated"]), 0.00); EXPECT_EQ(int(arcPan["YearDoy"]), 2016327); - + // Nir Archive Group PvlGroup &arcNir = isisLabel->findGroup("archiveNIR", Pvl::Traverse); EXPECT_EQ(arcNir["DataSetId"][0].toStdString(), "TBD"); EXPECT_EQ(arcNir["ProductVersionId"][0].toStdString(), "UNK"); - EXPECT_EQ(arcNir["ProductCreationTime"][0].toStdString(), "2017-10-03T09:38:29"); + EXPECT_EQ(arcNir["ProductCreationTime"][0].toStdString(), "2017-10-03T09:38:29"); EXPECT_DOUBLE_EQ(double(arcNir["ScalingFactor"]), 1.0); EXPECT_DOUBLE_EQ(double(arcNir["Offset"]), 0.0); EXPECT_DOUBLE_EQ(double(arcNir["PredictMaximumExposureTime"]), 5.2866); @@ -129,16 +129,16 @@ TEST(TgoCassisstitch, TgoCassisstitchMultiframeTest) { EXPECT_EQ(int(arcNir["ImageFrequency"]), 1000000); EXPECT_EQ(int(arcNir["NumberOfWindows"]), 6); EXPECT_EQ(int(arcNir["UniqueIdentifier"]), 100732832); - EXPECT_EQ(arcNir["ExposureTimestamp"][0].toStdString(), "2f014e931416226d"); + EXPECT_EQ(arcNir["ExposureTimestamp"][0].toStdString(), "2f014e931416226d"); EXPECT_DOUBLE_EQ(double(arcNir["ExposureTimePEHK"]), 1.152e-003); EXPECT_DOUBLE_EQ(double(arcNir["PixelsPossiblySaturated"]), 0.00); EXPECT_EQ(int(arcNir["YearDoy"]), 2016327); - + // Blue Archive Group PvlGroup &arcBlu = isisLabel->findGroup("archiveBLU", Pvl::Traverse); EXPECT_EQ(arcBlu["DataSetId"][0].toStdString(), "TBD"); EXPECT_EQ(arcBlu["ProductVersionId"][0].toStdString(), "UNK"); - EXPECT_EQ(arcBlu["ProductCreationTime"][0].toStdString(), "2017-10-03T09:38:29"); + EXPECT_EQ(arcBlu["ProductCreationTime"][0].toStdString(), "2017-10-03T09:38:29"); EXPECT_DOUBLE_EQ(double(arcBlu["ScalingFactor"]), 1.0); EXPECT_DOUBLE_EQ(double(arcBlu["Offset"]), 0.0); EXPECT_DOUBLE_EQ(double(arcBlu["PredictMaximumExposureTime"]), 5.2866); @@ -155,12 +155,12 @@ TEST(TgoCassisstitch, TgoCassisstitchMultiframeTest) { EXPECT_EQ(int(arcBlu["ImageFrequency"]), 1000000); EXPECT_EQ(int(arcBlu["NumberOfWindows"]), 6); EXPECT_EQ(int(arcBlu["UniqueIdentifier"]), 100732832); - EXPECT_EQ(arcBlu["ExposureTimestamp"][0].toStdString(), "2f014e931416226d"); + EXPECT_EQ(arcBlu["ExposureTimestamp"][0].toStdString(), "2f014e931416226d"); EXPECT_DOUBLE_EQ(double(arcBlu["ExposureTimePEHK"]), 1.152e-003); EXPECT_DOUBLE_EQ(double(arcBlu["PixelsPossiblySaturated"]), 0.00); EXPECT_EQ(int(arcBlu["YearDoy"]), 2016327); - - // Stitch Group + + // Stitch Group PvlGroup &stitch = isisLabel->findGroup("Stitch", Pvl::Traverse); EXPECT_EQ(stitch["OriginalFilters"][0].toStdString(), "PAN"); EXPECT_EQ(stitch["OriginalFilters"][1].toStdString(), "NIR"); @@ -210,7 +210,7 @@ TEST(TgoCassisstitch, TgoCassisstitchMultiframeTest) { TEST(TgoCassisstitch, TgoCassisstitchSingleframeTest) { QTemporaryDir prefix; - + FileList *cubeList = new FileList(); cubeList->append("data/tgoCassis/tgocassisstitch/CAS-MCO-2016-11-22T16.16.10.833-BLU-03000-B1_crop.cub"); cubeList->append("data/tgoCassis/tgocassisstitch/CAS-MCO-2016-11-22T16.16.10.833-NIR-02000-B1_crop.cub"); @@ -220,7 +220,7 @@ TEST(TgoCassisstitch, TgoCassisstitchSingleframeTest) { QString cubeListFile = prefix.path() + "/cubelist.lis"; cubeList->write(cubeListFile); - QVector args = {"fromlist=" + cubeListFile, + QVector args = {"fromlist=" + cubeListFile, "outputprefix=" + prefix.path() + "/CAS-MCO"}; UserInterface options(APP_XML, args); @@ -230,7 +230,7 @@ TEST(TgoCassisstitch, TgoCassisstitchSingleframeTest) { catch (IException &e) { FAIL() << "Unable to run tgocassisstitch with cube list: " << e.what() << std::endl; } - + Cube cube(prefix.path() + "/CAS-MCO-2016-11-22T16:16:10.833.cub"); Pvl *isisLabel = cube.label(); @@ -249,12 +249,12 @@ TEST(TgoCassisstitch, TgoCassisstitchSingleframeTest) { EXPECT_EQ(inst["ExposureDuration"][0].toStdString(), "1.152e-003"); EXPECT_EQ(int(inst["SummingMode"]), 0); EXPECT_EQ(inst["Filter"][0].toStdString(), "FULLCCD"); - + // Red Archive Group PvlGroup &arcRed = isisLabel->findGroup("archiveRED", Pvl::Traverse); EXPECT_EQ(arcRed["DataSetId"][0].toStdString(), "TBD"); EXPECT_EQ(arcRed["ProductVersionId"][0].toStdString(), "UNK"); - EXPECT_EQ(arcRed["ProductCreationTime"][0].toStdString(), "2017-10-03T09:38:28"); + EXPECT_EQ(arcRed["ProductCreationTime"][0].toStdString(), "2017-10-03T09:38:28"); EXPECT_DOUBLE_EQ(double(arcRed["ScalingFactor"]), 1.0); EXPECT_DOUBLE_EQ(double(arcRed["Offset"]), 0.0); EXPECT_DOUBLE_EQ(double(arcRed["PredictMaximumExposureTime"]), 5.3718000000000004); @@ -271,16 +271,16 @@ TEST(TgoCassisstitch, TgoCassisstitchSingleframeTest) { EXPECT_EQ(int(arcRed["ImageFrequency"]), 1000000); EXPECT_EQ(int(arcRed["NumberOfWindows"]), 6); EXPECT_EQ(int(arcRed["UniqueIdentifier"]), 100732832); - EXPECT_EQ(arcRed["ExposureTimestamp"][0].toStdString(), "2f014e930e16226d"); + EXPECT_EQ(arcRed["ExposureTimestamp"][0].toStdString(), "2f014e930e16226d"); EXPECT_DOUBLE_EQ(double(arcRed["ExposureTimePEHK"]), 1.152e-003); EXPECT_DOUBLE_EQ(double(arcRed["PixelsPossiblySaturated"]), 0.00); EXPECT_EQ(int(arcRed["YearDoy"]), 2016327); - + // Pan Archive Group PvlGroup &arcPan = isisLabel->findGroup("archivePAN", Pvl::Traverse); EXPECT_EQ(arcPan["DataSetId"][0].toStdString(), "TBD"); EXPECT_EQ(arcPan["ProductVersionId"][0].toStdString(), "UNK"); - EXPECT_EQ(arcPan["ProductCreationTime"][0].toStdString(), "2017-10-03T09:38:28"); + EXPECT_EQ(arcPan["ProductCreationTime"][0].toStdString(), "2017-10-03T09:38:28"); EXPECT_DOUBLE_EQ(double(arcPan["ScalingFactor"]), 1.0); EXPECT_DOUBLE_EQ(double(arcPan["Offset"]), 0.0); EXPECT_DOUBLE_EQ(double(arcPan["PredictMaximumExposureTime"]), 5.3718); @@ -297,16 +297,16 @@ TEST(TgoCassisstitch, TgoCassisstitchSingleframeTest) { EXPECT_EQ(int(arcPan["ImageFrequency"]), 1000000); EXPECT_EQ(int(arcPan["NumberOfWindows"]), 6); EXPECT_EQ(int(arcPan["UniqueIdentifier"]), 100732832); - EXPECT_EQ(arcPan["ExposureTimestamp"][0].toStdString(), "2f014e930e16226d"); + EXPECT_EQ(arcPan["ExposureTimestamp"][0].toStdString(), "2f014e930e16226d"); EXPECT_DOUBLE_EQ(double(arcPan["ExposureTimePEHK"]), 1.152e-003); EXPECT_DOUBLE_EQ(double(arcPan["PixelsPossiblySaturated"]), 0.00); EXPECT_EQ(int(arcPan["YearDoy"]), 2016327); - + // Nir Archive Group PvlGroup &arcNir = isisLabel->findGroup("archiveNIR", Pvl::Traverse); EXPECT_EQ(arcNir["DataSetId"][0].toStdString(), "TBD"); EXPECT_EQ(arcNir["ProductVersionId"][0].toStdString(), "UNK"); - EXPECT_EQ(arcNir["ProductCreationTime"][0].toStdString(), "2017-10-03T09:38:28"); + EXPECT_EQ(arcNir["ProductCreationTime"][0].toStdString(), "2017-10-03T09:38:28"); EXPECT_DOUBLE_EQ(double(arcNir["ScalingFactor"]), 1.0); EXPECT_DOUBLE_EQ(double(arcNir["Offset"]), 0.0); EXPECT_DOUBLE_EQ(double(arcNir["PredictMaximumExposureTime"]), 5.3718); @@ -323,16 +323,16 @@ TEST(TgoCassisstitch, TgoCassisstitchSingleframeTest) { EXPECT_EQ(int(arcNir["ImageFrequency"]), 1000000); EXPECT_EQ(int(arcNir["NumberOfWindows"]), 6); EXPECT_EQ(int(arcNir["UniqueIdentifier"]), 100732832); - EXPECT_EQ(arcNir["ExposureTimestamp"][0].toStdString(), "2f014e930e16226d"); + EXPECT_EQ(arcNir["ExposureTimestamp"][0].toStdString(), "2f014e930e16226d"); EXPECT_DOUBLE_EQ(double(arcNir["ExposureTimePEHK"]), 1.152e-003); EXPECT_DOUBLE_EQ(double(arcNir["PixelsPossiblySaturated"]), 0.00); EXPECT_EQ(int(arcNir["YearDoy"]), 2016327); - + // Blue Archive Group PvlGroup &arcBlu = isisLabel->findGroup("archiveBLU", Pvl::Traverse); EXPECT_EQ(arcBlu["DataSetId"][0].toStdString(), "TBD"); EXPECT_EQ(arcBlu["ProductVersionId"][0].toStdString(), "UNK"); - EXPECT_EQ(arcBlu["ProductCreationTime"][0].toStdString(), "2017-10-03T09:38:28"); + EXPECT_EQ(arcBlu["ProductCreationTime"][0].toStdString(), "2017-10-03T09:38:28"); EXPECT_DOUBLE_EQ(double(arcBlu["ScalingFactor"]), 1.0); EXPECT_DOUBLE_EQ(double(arcBlu["Offset"]), 0.0); EXPECT_DOUBLE_EQ(double(arcBlu["PredictMaximumExposureTime"]), 5.3718); @@ -349,12 +349,12 @@ TEST(TgoCassisstitch, TgoCassisstitchSingleframeTest) { EXPECT_EQ(int(arcBlu["ImageFrequency"]), 1000000); EXPECT_EQ(int(arcBlu["NumberOfWindows"]), 6); EXPECT_EQ(int(arcBlu["UniqueIdentifier"]), 100732832); - EXPECT_EQ(arcBlu["ExposureTimestamp"][0].toStdString(), "2f014e930e16226d"); + EXPECT_EQ(arcBlu["ExposureTimestamp"][0].toStdString(), "2f014e930e16226d"); EXPECT_DOUBLE_EQ(double(arcBlu["ExposureTimePEHK"]), 1.152e-003); EXPECT_DOUBLE_EQ(double(arcBlu["PixelsPossiblySaturated"]), 0.00); EXPECT_EQ(int(arcBlu["YearDoy"]), 2016327); - - // Stitch Group + + // Stitch Group PvlGroup &stitch = isisLabel->findGroup("Stitch", Pvl::Traverse); EXPECT_EQ(stitch["OriginalFilters"][0].toStdString(), "RED"); EXPECT_EQ(stitch["OriginalFilters"][1].toStdString(), "PAN"); @@ -400,5 +400,5 @@ TEST(TgoCassisstitch, TgoCassisstitchSingleframeTest) { EXPECT_DOUBLE_EQ(hist->Sum(), 19.647446379065514); EXPECT_EQ(hist->ValidPixels(), 100); EXPECT_NEAR(hist->StandardDeviation(), 0.063902362199265747, 0.0001); - + } \ No newline at end of file diff --git a/isis/tests/FunctionalTestsTgocassisunstitch.cpp b/isis/tests/FunctionalTestsTgocassisunstitch.cpp index 51a387d25f..b531f192e6 100644 --- a/isis/tests/FunctionalTestsTgocassisunstitch.cpp +++ b/isis/tests/FunctionalTestsTgocassisunstitch.cpp @@ -1,7 +1,6 @@ #include #include "tgocassisunstitch.h" -#include "Fixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" @@ -16,23 +15,23 @@ static QString APP_XML = FileName("$ISISROOT/bin/xml/tgocassisunstitch.xml").exp TEST(TgoCassisunstitch, TgoCassisunstitchDefaultTest) { QTemporaryDir prefix; - - QVector args = {"from=data/tgoCassis/tgocassisunstitch/stitched-2016-11-26T22-50-27.381_crop.cub", + + QVector args = {"from=data/tgoCassis/tgocassisunstitch/stitched-2016-11-26T22-50-27.381_crop.cub", "outputprefix=" + prefix.path() + "/unstitched"}; UserInterface options(APP_XML, args); - + try { tgocassisunstitch(options); } catch (IException &e) { FAIL() << "Unable to run tgocassisunstitch with stitched cube: " << e.what() << std::endl; } - + // Unstitched Pan Cube QString panFile = prefix.path() + "/unstitched_PAN.cub"; Cube panCube(panFile); Pvl *panLabel = panCube.label(); - + // Dimensions group EXPECT_EQ(panCube.sampleCount(), 2048); EXPECT_EQ(panCube.lineCount(), 280); @@ -48,12 +47,12 @@ TEST(TgoCassisunstitch, TgoCassisunstitchDefaultTest) { EXPECT_EQ(panInst["ExposureDuration"][0].toStdString(), "1.440e-003"); EXPECT_EQ(int(panInst["SummingMode"]), 0); EXPECT_EQ(panInst["Filter"][0].toStdString(), "PAN"); - + // Archive Group PvlGroup &panArch = panLabel->findGroup("Archive", Pvl::Traverse); EXPECT_EQ(panArch["DataSetId"][0].toStdString(), "TBD"); EXPECT_EQ(panArch["ProductVersionId"][0].toStdString(), "UNK"); - EXPECT_EQ(panArch["ProductCreationTime"][0].toStdString(), "2017-10-03T10:50:12"); + EXPECT_EQ(panArch["ProductCreationTime"][0].toStdString(), "2017-10-03T10:50:12"); EXPECT_DOUBLE_EQ(double(panArch["ScalingFactor"]), 1.0); EXPECT_DOUBLE_EQ(double(panArch["Offset"]), 0.0); EXPECT_DOUBLE_EQ(double(panArch["PredictMaximumExposureTime"]), 1.5952); @@ -70,12 +69,12 @@ TEST(TgoCassisunstitch, TgoCassisunstitchDefaultTest) { EXPECT_EQ(int(panArch["ImageFrequency"]), 400000); EXPECT_EQ(int(panArch["NumberOfWindows"]), 6); EXPECT_EQ(int(panArch["UniqueIdentifier"]), 100799268); - EXPECT_EQ(panArch["ExposureTimestamp"][0].toStdString(), "2f015435767e275a"); + EXPECT_EQ(panArch["ExposureTimestamp"][0].toStdString(), "2f015435767e275a"); EXPECT_DOUBLE_EQ(double(panArch["ExposureTimePEHK"]), 1.440e-003); EXPECT_DOUBLE_EQ(double(panArch["PixelsPossiblySaturated"]), 29.17); EXPECT_EQ(int(panArch["WindowCount"]), 0); EXPECT_EQ(int(panArch["Window1Binning"]), 0); - EXPECT_EQ(int(panArch["Window1StartSample"]), 0); + EXPECT_EQ(int(panArch["Window1StartSample"]), 0); EXPECT_EQ(int(panArch["Window1EndSample"]), 2047); EXPECT_EQ(int(panArch["Window1StartLine"]), 354); EXPECT_EQ(int(panArch["Window1EndLine"]), 633); @@ -88,7 +87,7 @@ TEST(TgoCassisunstitch, TgoCassisunstitchDefaultTest) { EXPECT_EQ(int(panArch["Window3StartSample"]), 0); EXPECT_EQ(int(panArch["Window3EndSample"]), 2047); EXPECT_EQ(int(panArch["Window3StartLine"]), 1048); - EXPECT_EQ(int(panArch["Window3EndLine"]), 1302); + EXPECT_EQ(int(panArch["Window3EndLine"]), 1302); EXPECT_EQ(int(panArch["Window4Binning"]), 0); EXPECT_EQ(int(panArch["Window4StartSample"]), 1024); EXPECT_EQ(int(panArch["Window4EndSample"]), 1087); @@ -112,16 +111,16 @@ TEST(TgoCassisunstitch, TgoCassisunstitchDefaultTest) { EXPECT_DOUBLE_EQ(double(panBand["Center"]), 675.0); EXPECT_DOUBLE_EQ(double(panBand["Width"]), 250.0); EXPECT_EQ(panBand["NaifIkCode"][0].toStdString(), "-143421"); - + // Kernels Group PvlGroup &panKern = panLabel->findGroup("Kernels", Pvl::Traverse); EXPECT_EQ(int(panKern["NaifFrameCode"]), -143400); - + // Unstitched Red Cube QString redFile = prefix.path() + "/unstitched_RED.cub"; Cube redCube(redFile); Pvl *redLabel = redCube.label(); - + // Dimensions group EXPECT_EQ(redCube.sampleCount(), 2048); EXPECT_EQ(redCube.lineCount(), 256); @@ -137,12 +136,12 @@ TEST(TgoCassisunstitch, TgoCassisunstitchDefaultTest) { EXPECT_EQ(redInst["ExposureDuration"][0].toStdString(), "1.440e-003"); EXPECT_EQ(int(redInst["SummingMode"]), 0); EXPECT_EQ(redInst["Filter"][0].toStdString(), "RED"); - + // Archive Group PvlGroup &redArch = redLabel->findGroup("Archive", Pvl::Traverse); EXPECT_EQ(redArch["DataSetId"][0].toStdString(), "TBD"); EXPECT_EQ(redArch["ProductVersionId"][0].toStdString(), "UNK"); - EXPECT_EQ(redArch["ProductCreationTime"][0].toStdString(), "2017-10-03T10:50:12"); + EXPECT_EQ(redArch["ProductCreationTime"][0].toStdString(), "2017-10-03T10:50:12"); EXPECT_DOUBLE_EQ(double(redArch["ScalingFactor"]), 1.0); EXPECT_DOUBLE_EQ(double(redArch["Offset"]), 0.0); EXPECT_DOUBLE_EQ(double(redArch["PredictMaximumExposureTime"]), 1.5952); @@ -159,12 +158,12 @@ TEST(TgoCassisunstitch, TgoCassisunstitchDefaultTest) { EXPECT_EQ(int(redArch["ImageFrequency"]), 400000); EXPECT_EQ(int(redArch["NumberOfWindows"]), 6); EXPECT_EQ(int(redArch["UniqueIdentifier"]), 100799268); - EXPECT_EQ(redArch["ExposureTimestamp"][0].toStdString(), "2f015435767e275a"); + EXPECT_EQ(redArch["ExposureTimestamp"][0].toStdString(), "2f015435767e275a"); EXPECT_DOUBLE_EQ(double(redArch["ExposureTimePEHK"]), 1.440e-003); EXPECT_DOUBLE_EQ(double(redArch["PixelsPossiblySaturated"]), 0.16); EXPECT_EQ(int(redArch["WindowCount"]), 1); EXPECT_EQ(int(redArch["Window1Binning"]), 0); - EXPECT_EQ(int(redArch["Window1StartSample"]), 0); + EXPECT_EQ(int(redArch["Window1StartSample"]), 0); EXPECT_EQ(int(redArch["Window1EndSample"]), 2047); EXPECT_EQ(int(redArch["Window1StartLine"]), 354); EXPECT_EQ(int(redArch["Window1EndLine"]), 632); @@ -177,7 +176,7 @@ TEST(TgoCassisunstitch, TgoCassisunstitchDefaultTest) { EXPECT_EQ(int(redArch["Window3StartSample"]), 0); EXPECT_EQ(int(redArch["Window3EndSample"]), 2047); EXPECT_EQ(int(redArch["Window3StartLine"]), 1048); - EXPECT_EQ(int(redArch["Window3EndLine"]), 1302); + EXPECT_EQ(int(redArch["Window3EndLine"]), 1302); EXPECT_EQ(int(redArch["Window4Binning"]), 0); EXPECT_EQ(int(redArch["Window4StartSample"]), 1024); EXPECT_EQ(int(redArch["Window4EndSample"]), 1087); @@ -201,12 +200,12 @@ TEST(TgoCassisunstitch, TgoCassisunstitchDefaultTest) { EXPECT_DOUBLE_EQ(double(redBand["Center"]), 840.0); EXPECT_DOUBLE_EQ(double(redBand["Width"]), 100.0); EXPECT_EQ(redBand["NaifIkCode"][0].toStdString(), "-143422"); - + // Kernels Group PvlGroup &redKern = redLabel->findGroup("Kernels", Pvl::Traverse); EXPECT_EQ(int(redKern["NaifFrameCode"]), -143400); - - + + // Unstitched Blu Cube QString bluFile = prefix.path() + "/unstitched_BLU.cub"; Cube bluCube(bluFile); @@ -232,7 +231,7 @@ TEST(TgoCassisunstitch, TgoCassisunstitchDefaultTest) { PvlGroup &bluArch = bluLabel->findGroup("Archive", Pvl::Traverse); EXPECT_EQ(bluArch["DataSetId"][0].toStdString(), "TBD"); EXPECT_EQ(bluArch["ProductVersionId"][0].toStdString(), "UNK"); - EXPECT_EQ(bluArch["ProductCreationTime"][0].toStdString(), "2017-10-03T10:50:12"); + EXPECT_EQ(bluArch["ProductCreationTime"][0].toStdString(), "2017-10-03T10:50:12"); EXPECT_DOUBLE_EQ(double(bluArch["ScalingFactor"]), 1.0); EXPECT_DOUBLE_EQ(double(bluArch["Offset"]), 0.0); EXPECT_DOUBLE_EQ(double(bluArch["PredictMaximumExposureTime"]), 1.5952); @@ -249,12 +248,12 @@ TEST(TgoCassisunstitch, TgoCassisunstitchDefaultTest) { EXPECT_EQ(int(bluArch["ImageFrequency"]), 400000); EXPECT_EQ(int(bluArch["NumberOfWindows"]), 6); EXPECT_EQ(int(bluArch["UniqueIdentifier"]), 100799268); - EXPECT_EQ(bluArch["ExposureTimestamp"][0].toStdString(), "2f015435767e275a"); + EXPECT_EQ(bluArch["ExposureTimestamp"][0].toStdString(), "2f015435767e275a"); EXPECT_DOUBLE_EQ(double(bluArch["ExposureTimePEHK"]), 1.440e-003); EXPECT_DOUBLE_EQ(double(bluArch["PixelsPossiblySaturated"]), 0); EXPECT_EQ(int(bluArch["WindowCount"]), 3); EXPECT_EQ(int(bluArch["Window1Binning"]), 0); - EXPECT_EQ(int(bluArch["Window1StartSample"]), 0); + EXPECT_EQ(int(bluArch["Window1StartSample"]), 0); EXPECT_EQ(int(bluArch["Window1EndSample"]), 2047); EXPECT_EQ(int(bluArch["Window1StartLine"]), 354); EXPECT_EQ(int(bluArch["Window1EndLine"]), 632); @@ -267,7 +266,7 @@ TEST(TgoCassisunstitch, TgoCassisunstitchDefaultTest) { EXPECT_EQ(int(bluArch["Window3StartSample"]), 0); EXPECT_EQ(int(bluArch["Window3EndSample"]), 2047); EXPECT_EQ(int(bluArch["Window3StartLine"]), 1048); - EXPECT_EQ(int(bluArch["Window3EndLine"]), 1302); + EXPECT_EQ(int(bluArch["Window3EndLine"]), 1302); EXPECT_EQ(int(bluArch["Window4Binning"]), 0); EXPECT_EQ(int(bluArch["Window4StartSample"]), 1024); EXPECT_EQ(int(bluArch["Window4EndSample"]), 1087); @@ -295,13 +294,13 @@ TEST(TgoCassisunstitch, TgoCassisunstitchDefaultTest) { // Kernels Group PvlGroup &bluKern = bluLabel->findGroup("Kernels", Pvl::Traverse); EXPECT_EQ(int(bluKern["NaifFrameCode"]), -143400); - - + + // Unstitched Nir Cube QString nirFile = prefix.path() + "/unstitched_NIR.cub"; Cube nirCube(nirFile); Pvl *nirLabel = nirCube.label(); - + // Dimensions group EXPECT_EQ(nirCube.sampleCount(), 2048); EXPECT_EQ(nirCube.lineCount(), 256); @@ -317,12 +316,12 @@ TEST(TgoCassisunstitch, TgoCassisunstitchDefaultTest) { EXPECT_EQ(nirInst["ExposureDuration"][0].toStdString(), "1.440e-003"); EXPECT_EQ(int(nirInst["SummingMode"]), 0); EXPECT_EQ(nirInst["Filter"][0].toStdString(), "NIR"); - + // Archive Group PvlGroup &nirArch = nirLabel->findGroup("Archive", Pvl::Traverse); EXPECT_EQ(nirArch["DataSetId"][0].toStdString(), "TBD"); EXPECT_EQ(nirArch["ProductVersionId"][0].toStdString(), "UNK"); - EXPECT_EQ(nirArch["ProductCreationTime"][0].toStdString(), "2017-10-03T10:50:12"); + EXPECT_EQ(nirArch["ProductCreationTime"][0].toStdString(), "2017-10-03T10:50:12"); EXPECT_DOUBLE_EQ(double(nirArch["ScalingFactor"]), 1.0); EXPECT_DOUBLE_EQ(double(nirArch["Offset"]), 0.0); EXPECT_DOUBLE_EQ(double(nirArch["PredictMaximumExposureTime"]), 1.5952); @@ -339,12 +338,12 @@ TEST(TgoCassisunstitch, TgoCassisunstitchDefaultTest) { EXPECT_EQ(int(nirArch["ImageFrequency"]), 400000); EXPECT_EQ(int(nirArch["NumberOfWindows"]), 6); EXPECT_EQ(int(nirArch["UniqueIdentifier"]), 100799268); - EXPECT_EQ(nirArch["ExposureTimestamp"][0].toStdString(), "2f015435767e275a"); + EXPECT_EQ(nirArch["ExposureTimestamp"][0].toStdString(), "2f015435767e275a"); EXPECT_DOUBLE_EQ(double(nirArch["ExposureTimePEHK"]), 1.440e-003); EXPECT_DOUBLE_EQ(double(nirArch["PixelsPossiblySaturated"]), 0); EXPECT_EQ(int(nirArch["WindowCount"]), 2); EXPECT_EQ(int(nirArch["Window1Binning"]), 0); - EXPECT_EQ(int(nirArch["Window1StartSample"]), 0); + EXPECT_EQ(int(nirArch["Window1StartSample"]), 0); EXPECT_EQ(int(nirArch["Window1EndSample"]), 2047); EXPECT_EQ(int(nirArch["Window1StartLine"]), 354); EXPECT_EQ(int(nirArch["Window1EndLine"]), 632); @@ -357,7 +356,7 @@ TEST(TgoCassisunstitch, TgoCassisunstitchDefaultTest) { EXPECT_EQ(int(nirArch["Window3StartSample"]), 0); EXPECT_EQ(int(nirArch["Window3EndSample"]), 2047); EXPECT_EQ(int(nirArch["Window3StartLine"]), 1048); - EXPECT_EQ(int(nirArch["Window3EndLine"]), 1303); + EXPECT_EQ(int(nirArch["Window3EndLine"]), 1303); EXPECT_EQ(int(nirArch["Window4Binning"]), 0); EXPECT_EQ(int(nirArch["Window4StartSample"]), 1024); EXPECT_EQ(int(nirArch["Window4EndSample"]), 1087); @@ -381,7 +380,7 @@ TEST(TgoCassisunstitch, TgoCassisunstitchDefaultTest) { EXPECT_DOUBLE_EQ(double(nirBand["Center"]), 985.0); EXPECT_DOUBLE_EQ(double(nirBand["Width"]), 220.0); EXPECT_EQ(nirBand["NaifIkCode"][0].toStdString(), "-143423"); - + // Kernels Group PvlGroup &nirKern = nirLabel->findGroup("Kernels", Pvl::Traverse); EXPECT_EQ(int(nirKern["NaifFrameCode"]), -143400); @@ -390,23 +389,23 @@ TEST(TgoCassisunstitch, TgoCassisunstitchDefaultTest) { TEST(TgoCassisunstitch, TgoCassisunstitchSpiceTest) { QTemporaryDir prefix; - - QVector args = {"from=data/tgoCassis/tgocassisunstitch/stitched-spice-2016-11-26T22:50:27.381_crop.cub", + + QVector args = {"from=data/tgoCassis/tgocassisunstitch/stitched-spice-2016-11-26T22:50:27.381_crop.cub", "outputprefix=" + prefix.path() + "/unstitched"}; UserInterface options(APP_XML, args); - + try { tgocassisunstitch(options); } catch (IException &e) { FAIL() << "Unable to run tgocassisunstitch with stitched cube: " << e.what() << std::endl; } - + // Unstitched Pan Cube QString panFile = prefix.path() + "/unstitched_PAN.cub"; Cube panCube(panFile); Pvl *panLabel = panCube.label(); - + // Dimensions group EXPECT_EQ(panCube.sampleCount(), 2048); EXPECT_EQ(panCube.lineCount(), 280); @@ -422,12 +421,12 @@ TEST(TgoCassisunstitch, TgoCassisunstitchSpiceTest) { EXPECT_EQ(panInst["ExposureDuration"][0].toStdString(), "1.440e-003"); EXPECT_EQ(int(panInst["SummingMode"]), 0); EXPECT_EQ(panInst["Filter"][0].toStdString(), "PAN"); - + // Archive Group PvlGroup &panArch = panLabel->findGroup("Archive", Pvl::Traverse); EXPECT_EQ(panArch["DataSetId"][0].toStdString(), "TBD"); EXPECT_EQ(panArch["ProductVersionId"][0].toStdString(), "UNK"); - EXPECT_EQ(panArch["ProductCreationTime"][0].toStdString(), "2017-10-03T10:50:12"); + EXPECT_EQ(panArch["ProductCreationTime"][0].toStdString(), "2017-10-03T10:50:12"); EXPECT_DOUBLE_EQ(double(panArch["ScalingFactor"]), 1.0); EXPECT_DOUBLE_EQ(double(panArch["Offset"]), 0.0); EXPECT_DOUBLE_EQ(double(panArch["PredictMaximumExposureTime"]), 1.5952); @@ -444,12 +443,12 @@ TEST(TgoCassisunstitch, TgoCassisunstitchSpiceTest) { EXPECT_EQ(int(panArch["ImageFrequency"]), 400000); EXPECT_EQ(int(panArch["NumberOfWindows"]), 6); EXPECT_EQ(int(panArch["UniqueIdentifier"]), 100799268); - EXPECT_EQ(panArch["ExposureTimestamp"][0].toStdString(), "2f015435767e275a"); + EXPECT_EQ(panArch["ExposureTimestamp"][0].toStdString(), "2f015435767e275a"); EXPECT_DOUBLE_EQ(double(panArch["ExposureTimePEHK"]), 1.440e-003); EXPECT_DOUBLE_EQ(double(panArch["PixelsPossiblySaturated"]), 29.17); EXPECT_EQ(int(panArch["WindowCount"]), 0); EXPECT_EQ(int(panArch["Window1Binning"]), 0); - EXPECT_EQ(int(panArch["Window1StartSample"]), 0); + EXPECT_EQ(int(panArch["Window1StartSample"]), 0); EXPECT_EQ(int(panArch["Window1EndSample"]), 2047); EXPECT_EQ(int(panArch["Window1StartLine"]), 354); EXPECT_EQ(int(panArch["Window1EndLine"]), 633); @@ -462,7 +461,7 @@ TEST(TgoCassisunstitch, TgoCassisunstitchSpiceTest) { EXPECT_EQ(int(panArch["Window3StartSample"]), 0); EXPECT_EQ(int(panArch["Window3EndSample"]), 2047); EXPECT_EQ(int(panArch["Window3StartLine"]), 1048); - EXPECT_EQ(int(panArch["Window3EndLine"]), 1302); + EXPECT_EQ(int(panArch["Window3EndLine"]), 1302); EXPECT_EQ(int(panArch["Window4Binning"]), 0); EXPECT_EQ(int(panArch["Window4StartSample"]), 1024); EXPECT_EQ(int(panArch["Window4EndSample"]), 1087); @@ -486,7 +485,7 @@ TEST(TgoCassisunstitch, TgoCassisunstitchSpiceTest) { EXPECT_DOUBLE_EQ(double(panBand["Center"]), 675.0); EXPECT_DOUBLE_EQ(double(panBand["Width"]), 250.0); EXPECT_EQ(panBand["NaifIkCode"][0].toStdString(), "-143421"); - + // Kernels Group PvlGroup &panKern = panLabel->findGroup("Kernels", Pvl::Traverse); EXPECT_EQ(int(panKern["NaifFrameCode"]), -143400); @@ -499,12 +498,12 @@ TEST(TgoCassisunstitch, TgoCassisunstitchSpiceTest) { EXPECT_TRUE(panKern.hasKeyword("InstrumentPosition")); EXPECT_TRUE(panKern.hasKeyword("InstrumentAddendum")); EXPECT_TRUE(panKern.hasKeyword("ShapeModel")); - + // Unstitched Red Cube QString redFile = prefix.path() + "/unstitched_RED.cub"; Cube redCube(redFile); Pvl *redLabel = redCube.label(); - + // Dimensions group EXPECT_EQ(redCube.sampleCount(), 2048); EXPECT_EQ(redCube.lineCount(), 256); @@ -520,12 +519,12 @@ TEST(TgoCassisunstitch, TgoCassisunstitchSpiceTest) { EXPECT_EQ(redInst["ExposureDuration"][0].toStdString(), "1.440e-003"); EXPECT_EQ(int(redInst["SummingMode"]), 0); EXPECT_EQ(redInst["Filter"][0].toStdString(), "RED"); - + // Archive Group PvlGroup &redArch = redLabel->findGroup("Archive", Pvl::Traverse); EXPECT_EQ(redArch["DataSetId"][0].toStdString(), "TBD"); EXPECT_EQ(redArch["ProductVersionId"][0].toStdString(), "UNK"); - EXPECT_EQ(redArch["ProductCreationTime"][0].toStdString(), "2017-10-03T10:50:12"); + EXPECT_EQ(redArch["ProductCreationTime"][0].toStdString(), "2017-10-03T10:50:12"); EXPECT_DOUBLE_EQ(double(redArch["ScalingFactor"]), 1.0); EXPECT_DOUBLE_EQ(double(redArch["Offset"]), 0.0); EXPECT_DOUBLE_EQ(double(redArch["PredictMaximumExposureTime"]), 1.5952); @@ -542,12 +541,12 @@ TEST(TgoCassisunstitch, TgoCassisunstitchSpiceTest) { EXPECT_EQ(int(redArch["ImageFrequency"]), 400000); EXPECT_EQ(int(redArch["NumberOfWindows"]), 6); EXPECT_EQ(int(redArch["UniqueIdentifier"]), 100799268); - EXPECT_EQ(redArch["ExposureTimestamp"][0].toStdString(), "2f015435767e275a"); + EXPECT_EQ(redArch["ExposureTimestamp"][0].toStdString(), "2f015435767e275a"); EXPECT_DOUBLE_EQ(double(redArch["ExposureTimePEHK"]), 1.440e-003); EXPECT_DOUBLE_EQ(double(redArch["PixelsPossiblySaturated"]), 0.16); EXPECT_EQ(int(redArch["WindowCount"]), 1); EXPECT_EQ(int(redArch["Window1Binning"]), 0); - EXPECT_EQ(int(redArch["Window1StartSample"]), 0); + EXPECT_EQ(int(redArch["Window1StartSample"]), 0); EXPECT_EQ(int(redArch["Window1EndSample"]), 2047); EXPECT_EQ(int(redArch["Window1StartLine"]), 354); EXPECT_EQ(int(redArch["Window1EndLine"]), 632); @@ -560,7 +559,7 @@ TEST(TgoCassisunstitch, TgoCassisunstitchSpiceTest) { EXPECT_EQ(int(redArch["Window3StartSample"]), 0); EXPECT_EQ(int(redArch["Window3EndSample"]), 2047); EXPECT_EQ(int(redArch["Window3StartLine"]), 1048); - EXPECT_EQ(int(redArch["Window3EndLine"]), 1302); + EXPECT_EQ(int(redArch["Window3EndLine"]), 1302); EXPECT_EQ(int(redArch["Window4Binning"]), 0); EXPECT_EQ(int(redArch["Window4StartSample"]), 1024); EXPECT_EQ(int(redArch["Window4EndSample"]), 1087); @@ -584,7 +583,7 @@ TEST(TgoCassisunstitch, TgoCassisunstitchSpiceTest) { EXPECT_DOUBLE_EQ(double(redBand["Center"]), 840.0); EXPECT_DOUBLE_EQ(double(redBand["Width"]), 100.0); EXPECT_EQ(redBand["NaifIkCode"][0].toStdString(), "-143422"); - + // Kernels Group PvlGroup &redKern = redLabel->findGroup("Kernels", Pvl::Traverse); EXPECT_EQ(int(redKern["NaifFrameCode"]), -143400); @@ -597,8 +596,8 @@ TEST(TgoCassisunstitch, TgoCassisunstitchSpiceTest) { EXPECT_TRUE(redKern.hasKeyword("InstrumentPosition")); EXPECT_TRUE(redKern.hasKeyword("InstrumentAddendum")); EXPECT_TRUE(redKern.hasKeyword("ShapeModel")); - - + + // Unstitched Blu Cube QString bluFile = prefix.path() + "/unstitched_BLU.cub"; Cube bluCube(bluFile); @@ -624,7 +623,7 @@ TEST(TgoCassisunstitch, TgoCassisunstitchSpiceTest) { PvlGroup &bluArch = bluLabel->findGroup("Archive", Pvl::Traverse); EXPECT_EQ(bluArch["DataSetId"][0].toStdString(), "TBD"); EXPECT_EQ(bluArch["ProductVersionId"][0].toStdString(), "UNK"); - EXPECT_EQ(bluArch["ProductCreationTime"][0].toStdString(), "2017-10-03T10:50:12"); + EXPECT_EQ(bluArch["ProductCreationTime"][0].toStdString(), "2017-10-03T10:50:12"); EXPECT_DOUBLE_EQ(double(bluArch["ScalingFactor"]), 1.0); EXPECT_DOUBLE_EQ(double(bluArch["Offset"]), 0.0); EXPECT_DOUBLE_EQ(double(bluArch["PredictMaximumExposureTime"]), 1.5952); @@ -641,12 +640,12 @@ TEST(TgoCassisunstitch, TgoCassisunstitchSpiceTest) { EXPECT_EQ(int(bluArch["ImageFrequency"]), 400000); EXPECT_EQ(int(bluArch["NumberOfWindows"]), 6); EXPECT_EQ(int(bluArch["UniqueIdentifier"]), 100799268); - EXPECT_EQ(bluArch["ExposureTimestamp"][0].toStdString(), "2f015435767e275a"); + EXPECT_EQ(bluArch["ExposureTimestamp"][0].toStdString(), "2f015435767e275a"); EXPECT_DOUBLE_EQ(double(bluArch["ExposureTimePEHK"]), 1.440e-003); EXPECT_DOUBLE_EQ(double(bluArch["PixelsPossiblySaturated"]), 0); EXPECT_EQ(int(bluArch["WindowCount"]), 3); EXPECT_EQ(int(bluArch["Window1Binning"]), 0); - EXPECT_EQ(int(bluArch["Window1StartSample"]), 0); + EXPECT_EQ(int(bluArch["Window1StartSample"]), 0); EXPECT_EQ(int(bluArch["Window1EndSample"]), 2047); EXPECT_EQ(int(bluArch["Window1StartLine"]), 354); EXPECT_EQ(int(bluArch["Window1EndLine"]), 632); @@ -659,7 +658,7 @@ TEST(TgoCassisunstitch, TgoCassisunstitchSpiceTest) { EXPECT_EQ(int(bluArch["Window3StartSample"]), 0); EXPECT_EQ(int(bluArch["Window3EndSample"]), 2047); EXPECT_EQ(int(bluArch["Window3StartLine"]), 1048); - EXPECT_EQ(int(bluArch["Window3EndLine"]), 1302); + EXPECT_EQ(int(bluArch["Window3EndLine"]), 1302); EXPECT_EQ(int(bluArch["Window4Binning"]), 0); EXPECT_EQ(int(bluArch["Window4StartSample"]), 1024); EXPECT_EQ(int(bluArch["Window4EndSample"]), 1087); @@ -696,13 +695,13 @@ TEST(TgoCassisunstitch, TgoCassisunstitchSpiceTest) { EXPECT_TRUE(bluKern.hasKeyword("InstrumentPosition")); EXPECT_TRUE(bluKern.hasKeyword("InstrumentAddendum")); EXPECT_TRUE(bluKern.hasKeyword("ShapeModel")); - - + + // Unstitched Nir Cube QString nirFile = prefix.path() + "/unstitched_NIR.cub"; Cube nirCube(nirFile); Pvl *nirLabel = nirCube.label(); - + // Dimensions group EXPECT_EQ(nirCube.sampleCount(), 2048); EXPECT_EQ(nirCube.lineCount(), 256); @@ -718,12 +717,12 @@ TEST(TgoCassisunstitch, TgoCassisunstitchSpiceTest) { EXPECT_EQ(nirInst["ExposureDuration"][0].toStdString(), "1.440e-003"); EXPECT_EQ(int(nirInst["SummingMode"]), 0); EXPECT_EQ(nirInst["Filter"][0].toStdString(), "NIR"); - + // Archive Group PvlGroup &nirArch = nirLabel->findGroup("Archive", Pvl::Traverse); EXPECT_EQ(nirArch["DataSetId"][0].toStdString(), "TBD"); EXPECT_EQ(nirArch["ProductVersionId"][0].toStdString(), "UNK"); - EXPECT_EQ(nirArch["ProductCreationTime"][0].toStdString(), "2017-10-03T10:50:12"); + EXPECT_EQ(nirArch["ProductCreationTime"][0].toStdString(), "2017-10-03T10:50:12"); EXPECT_DOUBLE_EQ(double(nirArch["ScalingFactor"]), 1.0); EXPECT_DOUBLE_EQ(double(nirArch["Offset"]), 0.0); EXPECT_DOUBLE_EQ(double(nirArch["PredictMaximumExposureTime"]), 1.5952); @@ -740,12 +739,12 @@ TEST(TgoCassisunstitch, TgoCassisunstitchSpiceTest) { EXPECT_EQ(int(nirArch["ImageFrequency"]), 400000); EXPECT_EQ(int(nirArch["NumberOfWindows"]), 6); EXPECT_EQ(int(nirArch["UniqueIdentifier"]), 100799268); - EXPECT_EQ(nirArch["ExposureTimestamp"][0].toStdString(), "2f015435767e275a"); + EXPECT_EQ(nirArch["ExposureTimestamp"][0].toStdString(), "2f015435767e275a"); EXPECT_DOUBLE_EQ(double(nirArch["ExposureTimePEHK"]), 1.440e-003); EXPECT_DOUBLE_EQ(double(nirArch["PixelsPossiblySaturated"]), 0); EXPECT_EQ(int(nirArch["WindowCount"]), 2); EXPECT_EQ(int(nirArch["Window1Binning"]), 0); - EXPECT_EQ(int(nirArch["Window1StartSample"]), 0); + EXPECT_EQ(int(nirArch["Window1StartSample"]), 0); EXPECT_EQ(int(nirArch["Window1EndSample"]), 2047); EXPECT_EQ(int(nirArch["Window1StartLine"]), 354); EXPECT_EQ(int(nirArch["Window1EndLine"]), 632); @@ -758,7 +757,7 @@ TEST(TgoCassisunstitch, TgoCassisunstitchSpiceTest) { EXPECT_EQ(int(nirArch["Window3StartSample"]), 0); EXPECT_EQ(int(nirArch["Window3EndSample"]), 2047); EXPECT_EQ(int(nirArch["Window3StartLine"]), 1048); - EXPECT_EQ(int(nirArch["Window3EndLine"]), 1303); + EXPECT_EQ(int(nirArch["Window3EndLine"]), 1303); EXPECT_EQ(int(nirArch["Window4Binning"]), 0); EXPECT_EQ(int(nirArch["Window4StartSample"]), 1024); EXPECT_EQ(int(nirArch["Window4EndSample"]), 1087); @@ -782,7 +781,7 @@ TEST(TgoCassisunstitch, TgoCassisunstitchSpiceTest) { EXPECT_DOUBLE_EQ(double(nirBand["Center"]), 985.0); EXPECT_DOUBLE_EQ(double(nirBand["Width"]), 220.0); EXPECT_EQ(nirBand["NaifIkCode"][0].toStdString(), "-143423"); - + // Kernels Group PvlGroup &nirKern = nirLabel->findGroup("Kernels", Pvl::Traverse); EXPECT_EQ(int(nirKern["NaifFrameCode"]), -143400); diff --git a/isis/tests/FunctionalTestsThm2isis.cpp b/isis/tests/FunctionalTestsThm2isis.cpp index 1b3552784b..7733c6a333 100644 --- a/isis/tests/FunctionalTestsThm2isis.cpp +++ b/isis/tests/FunctionalTestsThm2isis.cpp @@ -1,4 +1,4 @@ -#include "Fixtures.h" +#include "TempFixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "Histogram.h" @@ -24,7 +24,7 @@ TEST_F(TempTestingFiles, FunctionalTestThm2isisVis) { catch (IException &e) { FAIL() << "Unable to open image: " << e.what() << std::endl; } - + // open even cube Cube evenCube( tempDir.path() + "/test.even.cub"); Pvl *isisLabel = evenCube.label(); @@ -147,7 +147,7 @@ TEST_F(TempTestingFiles, FunctionalTestThm2isisIr) { catch (IException &e) { FAIL() << "Unable to open image: " << e.what() << std::endl; } - + Cube oCube(outCubeFileName); Pvl *isisLabel = oCube.label(); @@ -188,9 +188,9 @@ TEST_F(TempTestingFiles, FunctionalTestThm2isisIr) { EXPECT_EQ(bandbin["FilterNumber"].size(), 10); std::unique_ptr hist (oCube.histogram()); - + EXPECT_NEAR(hist->Minimum(), 0.00029065093258395791, 0.0001); - EXPECT_NEAR(hist->Maximum(), 0.00064912717789411545, 0.0001); + EXPECT_NEAR(hist->Maximum(), 0.00064912717789411545, 0.0001); EXPECT_NEAR(hist->Average(), 0.00047608536842744795, 0.0001); EXPECT_NEAR(hist->Sum(), 0.023804268421372399, .00001); EXPECT_EQ(hist->ValidPixels(), 50); @@ -210,7 +210,7 @@ TEST_F(TempTestingFiles, FunctionalTestThm2isisOutAttributes) { catch (IException &e) { FAIL() << "Unable to open image: " << e.what() << std::endl; } - + // open even cube Cube evenCube( tempDir.path() + "/test.even.cub"); @@ -221,9 +221,9 @@ TEST_F(TempTestingFiles, FunctionalTestThm2isisOutAttributes) { EXPECT_DOUBLE_EQ(evenCube.multiplier(), 3.95256916996048e-07); std::unique_ptr hist (evenCube.histogram()); - + EXPECT_NEAR(hist->Minimum(), 0.0012, 0.0001); - EXPECT_NEAR(hist->Maximum(), 0.0013, 0.0001); + EXPECT_NEAR(hist->Maximum(), 0.0013, 0.0001); EXPECT_NEAR(hist->Average(), 0.00122, 0.0001); EXPECT_NEAR(hist->Sum(), 6.6702830039524876, .00001); EXPECT_EQ(hist->ValidPixels(), 5472); diff --git a/isis/tests/FunctionalTestsVikcal.cpp b/isis/tests/FunctionalTestsVikcal.cpp index 76fdcf7f58..076f17bd94 100644 --- a/isis/tests/FunctionalTestsVikcal.cpp +++ b/isis/tests/FunctionalTestsVikcal.cpp @@ -1,4 +1,4 @@ -#include "Fixtures.h" +#include "CameraFixtures.h" #include "Pvl.h" #include "PvlGroup.h" #include "TestUtilities.h" @@ -25,11 +25,11 @@ TEST_F(DefaultCube, FunctionalTestVikcalDefault) { catch (IException &e) { FAIL() << "Unable to open image: " << e.what() << std::endl; } - + Cube oCube(outCubeFileName, "r"); PvlGroup radGroup = oCube.label()->findObject("IsisCube").findGroup("Radiometry"); - + EXPECT_DOUBLE_EQ((double)radGroup.findKeyword("offc"), 0); EXPECT_DOUBLE_EQ((double)radGroup.findKeyword("exp"), 7.73); EXPECT_DOUBLE_EQ((double)radGroup.findKeyword("gain"), 1.0); @@ -50,7 +50,7 @@ TEST_F(DefaultCube, FunctionalTestVikcalDefault) { TEST_F(DefaultCube, FunctionalTestCtxcalCameraComparison) { // Note: DefaultCube is a viking image - + QString outCubeFileNameCam = tempDir.path() + "/outTemp.cub"; QVector args = {"to="+outCubeFileNameCam}; @@ -64,7 +64,7 @@ TEST_F(DefaultCube, FunctionalTestCtxcalCameraComparison) { } // force camera to not construct - Pvl *lab = testCube->label(); + Pvl *lab = testCube->label(); lab->deleteObject("NaifKeywords"); QString outCubeFileNameNoCam = tempDir.path() + "/outTempNoCam.cub"; @@ -80,10 +80,10 @@ TEST_F(DefaultCube, FunctionalTestCtxcalCameraComparison) { Cube oNoCamCube(outCubeFileNameCam, "r"); Cube oCamCube(outCubeFileNameCam, "r"); - Pvl *noCamLab = oNoCamCube.label(); + Pvl *noCamLab = oNoCamCube.label(); Pvl *camLab = oCamCube.label(); - EXPECT_DOUBLE_EQ((double)noCamLab->findObject("IsisCube").findGroup("Radiometry").findKeyword("dist1"), + EXPECT_DOUBLE_EQ((double)noCamLab->findObject("IsisCube").findGroup("Radiometry").findKeyword("dist1"), (double)camLab->findObject("IsisCube").findGroup("Radiometry").findKeyword("dist1")); EXPECT_DOUBLE_EQ((double)noCamLab->findObject("IsisCube").findGroup("Radiometry").findKeyword("dist1"), 211727039.58284); diff --git a/isis/tests/ImageImporterTests.cpp b/isis/tests/ImageImporterTests.cpp index 1fb43861b6..4279c3607c 100644 --- a/isis/tests/ImageImporterTests.cpp +++ b/isis/tests/ImageImporterTests.cpp @@ -3,10 +3,10 @@ #include #include "Cube.h" -#include "Fixtures.h" +#include "TempFixtures.h" #include "TestUtilities.h" #include "ImageImporter.h" -#include "Histogram.h" +#include "Histogram.h" #include "gmock/gmock.h" @@ -18,12 +18,12 @@ TEST_F(TempTestingFiles, DISABLED_UnitTestImageImporterTestJpeg) { ImageImporter *importer = ImageImporter::fromFileName(inputName); FileName outputName(tempDir.path() + "/out.cub"); - importer->import(outputName); - delete importer; + importer->import(outputName); + delete importer; Cube outCube(outputName.expanded()); Pvl *outLabel = outCube.label(); - + PvlGroup dimensions = outLabel->findGroup("Dimensions", Pvl::Traverse); ASSERT_EQ((int)dimensions["Samples"], 126); ASSERT_EQ((int)dimensions["Lines"], 126); @@ -36,7 +36,7 @@ TEST_F(TempTestingFiles, DISABLED_UnitTestImageImporterTestJpeg) { ASSERT_EQ((double)pixels["Multiplier"], 1.0); PvlGroup bandbin = outLabel->findGroup("BandBin", Pvl::Traverse); - ASSERT_EQ(bandbin["Name"][0].toStdString(), "Red"); + ASSERT_EQ(bandbin["Name"][0].toStdString(), "Red"); ASSERT_EQ(bandbin["Name"][1].toStdString(), "Green"); ASSERT_EQ(bandbin["Name"][2].toStdString(), "Blue"); @@ -53,12 +53,12 @@ TEST_F(TempTestingFiles, UnitTestImageImporterStd2IsisTiffRgb) { ImageImporter *importer = ImageImporter::fromFileName(inputName); FileName outputName(tempDir.path() + "/out.cub"); - importer->import(outputName); - delete importer; + importer->import(outputName); + delete importer; Cube outCube(outputName.expanded()); Pvl *outLabel = outCube.label(); - + PvlGroup dimensions = outLabel->findGroup("Dimensions", Pvl::Traverse); ASSERT_EQ((int)dimensions["Samples"], 256); ASSERT_EQ((int)dimensions["Lines"], 192); @@ -71,7 +71,7 @@ TEST_F(TempTestingFiles, UnitTestImageImporterStd2IsisTiffRgb) { ASSERT_EQ((double)pixels["Multiplier"], 1.0); PvlGroup bandbin = outLabel->findGroup("BandBin", Pvl::Traverse); - ASSERT_EQ(bandbin["Name"][0].toStdString(), "Red"); + ASSERT_EQ(bandbin["Name"][0].toStdString(), "Red"); ASSERT_EQ(bandbin["Name"][1].toStdString(), "Green"); ASSERT_EQ(bandbin["Name"][2].toStdString(), "Blue"); @@ -88,12 +88,12 @@ TEST_F(TempTestingFiles, UnitTestImageImporterStd2IsisJp2) { ImageImporter *importer = ImageImporter::fromFileName(inputName); FileName outputName(tempDir.path() + "/out.cub"); - importer->import(outputName); - delete importer; - + importer->import(outputName); + delete importer; + Cube outCube(outputName.expanded()); Pvl *outLabel = outCube.label(); - + PvlGroup dimensions = outLabel->findGroup("Dimensions", Pvl::Traverse); ASSERT_EQ((int)dimensions["Samples"], 126); ASSERT_EQ((int)dimensions["Lines"], 126); @@ -106,12 +106,12 @@ TEST_F(TempTestingFiles, UnitTestImageImporterStd2IsisJp2) { ASSERT_EQ((double)pixels["Multiplier"], 1.0); PvlGroup bandbin = outLabel->findGroup("BandBin", Pvl::Traverse); - ASSERT_EQ(bandbin["Name"][0].toStdString(), "Red"); + ASSERT_EQ(bandbin["Name"][0].toStdString(), "Red"); ASSERT_EQ(bandbin["Name"][1].toStdString(), "Green"); ASSERT_EQ(bandbin["Name"][2].toStdString(), "Blue"); std::unique_ptr hist (outCube.histogram()); - + ASSERT_NEAR(hist->Average(), 113.12452758881331, .00001); ASSERT_EQ(hist->Sum(), 1795965); ASSERT_EQ(hist->ValidPixels(), 15876); diff --git a/isis/tests/Map2camTests.cpp b/isis/tests/Map2camTests.cpp index b2a3f1b919..765c93a97c 100644 --- a/isis/tests/Map2camTests.cpp +++ b/isis/tests/Map2camTests.cpp @@ -12,7 +12,7 @@ #include "TestUtilities.h" #include "FileName.h" -#include "Fixtures.h" +#include "CameraFixtures.h" #include "gmock/gmock.h" diff --git a/isis/tests/NearMsiCameraTests.cpp b/isis/tests/NearMsiCameraTests.cpp index c5512364ff..4a41ee0e27 100644 --- a/isis/tests/NearMsiCameraTests.cpp +++ b/isis/tests/NearMsiCameraTests.cpp @@ -1,5 +1,5 @@ #include "Camera.h" -#include "Fixtures.h" +#include "CameraFixtures.h" #include "TestUtilities.h" #include diff --git a/isis/tests/NetworkFixtures.cpp b/isis/tests/NetworkFixtures.cpp new file mode 100644 index 0000000000..bb5922ffb3 --- /dev/null +++ b/isis/tests/NetworkFixtures.cpp @@ -0,0 +1,311 @@ +#include "NetworkFixtures.h" + +#include "ImagePolygon.h" +#include "LineManager.h" +#include "OriginalLabel.h" + +namespace Isis { + + void ThreeImageNetwork::SetUp() { + TempTestingFiles::SetUp(); + + FileName labelPath1("data/threeImageNetwork/cube1.pvl"); + FileName labelPath2("data/threeImageNetwork/cube2.pvl"); + FileName labelPath3("data/threeImageNetwork/cube3.pvl"); + + FileName mappedLabelPath1("data/threeImageNetwork/cube1map.pvl"); + FileName mappedLabelPath2("data/threeImageNetwork/cube2map.pvl"); + FileName mappedLabelPath3("data/threeImageNetwork/cube3map.pvl"); + + isdPath1 = new FileName("data/threeImageNetwork/cube1.isd"); + isdPath2 = new FileName("data/threeImageNetwork/cube2.isd"); + isdPath3 = new FileName("data/threeImageNetwork/cube3.isd"); + + threeImageOverlapFile = new FileName("data/threeImageNetwork/threeImageOverlaps.lis"); + twoImageOverlapFile = new FileName("data/threeImageNetwork/twoImageOverlaps.lis"); + + cube1 = new Cube(); + cube1->fromIsd(tempDir.path() + "/cube1.cub", labelPath1, *isdPath1, "rw"); + + ImagePolygon poly; + coords = {{30, 0}, + {30, 10}, + {35, 10}, + {35, 0}, + {30, 0}}; + poly.Create(coords); + cube1->write(poly); + + cube2 = new Cube(); + cube2->fromIsd(tempDir.path() + "/cube2.cub", labelPath2, *isdPath2, "rw"); + + coords = {{31, 1}, + {31, 11}, + {36, 11}, + {36, 1}, + {31, 1}}; + poly.Create(coords); + cube2->write(poly); + + cube3 = new Cube(); + cube3->fromIsd(tempDir.path() + "/cube3.cub", labelPath3, *isdPath3, "rw"); + + LineManager line(*cube1); + LineManager line2(*cube2); + LineManager line3(*cube3); + int pixelValue = 1; + for(line.begin(); !line.end(); line++) { + for(int i = 0; i < line.size(); i++) { + line[i] = (double) (pixelValue %255); + pixelValue++; + } + cube1->write(line); + } + + for(line2.begin(); !line2.end(); line2++) { + for(int i = 0; i < line.size(); i++) { + line2[i] = (double) (pixelValue %255); + pixelValue++; + } + cube2->write(line2); + } + + for(line3.begin(); !line3.end(); line3++) { + for(int i = 0; i < line3.size(); i++) { + line3[i] = (double) (pixelValue %255); + pixelValue++; + } + cube3->write(line3); + } + + cube1->reopen("rw"); + cube2->reopen("rw"); + cube3->reopen("rw"); + + cubeList = new FileList(); + cubeList->append(cube1->fileName()); + cubeList->append(cube2->fileName()); + + twoCubeListFile = tempDir.path() + "/2cubes.lis"; + cubeList->write(twoCubeListFile); + cubeList->append(cube3->fileName()); + + cubeListFile = tempDir.path() + "/cubes.lis"; + cubeList->write(cubeListFile); + + networkFile = "data/threeImageNetwork/controlnetwork.net"; + + network = new ControlNet(); + network->ReadControl(networkFile); + + cube1map = new Cube(); + cube2map = new Cube(); + cube3map = new Cube(); + cube1map->fromIsd(tempDir.path() + "/cube1map.cub", mappedLabelPath1, *isdPath1, "rw"); + cube2map->fromIsd(tempDir.path() + "/cube2map.cub", mappedLabelPath2, *isdPath2, "rw"); + cube3map->fromIsd(tempDir.path() + "/cube3map.cub", mappedLabelPath3, *isdPath3, "rw"); + } + + + void ThreeImageNetwork::TearDown() { + delete cubeList; + delete network; + + delete cube1; + delete cube2; + delete cube3; + + delete cube1map; + delete cube2map; + delete cube3map; + + delete isdPath1; + delete isdPath2; + delete isdPath3; + + delete threeImageOverlapFile; + delete twoImageOverlapFile; + } + + + void ApolloNetwork::SetUp() { + TempTestingFiles::SetUp(); + + cubes.fill(nullptr, 7); + + cubeList = new FileList(); + + for(int i = 0; i < cubes.size(); i++) { + int n = i+1; // filenames use 1 based indexing + isdFiles.push_back(FileName("data/apolloNetwork/apolloImage"+QString::number(n)+".isd")); + labelFiles.push_back(FileName("data/apolloNetwork/apolloImage"+QString::number(n)+".pvl")); + cubes[i] = new Cube(); + cubes[i]->fromIsd(tempDir.path() + "/cube"+QString::number(n)+".cub", labelFiles[i], isdFiles[i], "rw"); + cubeList->append(cubes[i]->fileName()); + } + + cubeListFile = tempDir.path() + "/cubes.lis"; + cubeList->write(cubeListFile); + + network = new ControlNet("data/apolloNetwork/apolloNet.pvl"); + controlNetPath = tempDir.path() + "/apolloNet.net"; + network->Write(controlNetPath); + } + + + void ApolloNetwork::TearDown() { + for(int i = 0; i < cubes.size(); i++) { + if(cubes[i] && cubes[i]->isOpen()) { + delete cubes[i]; + } + } + + if (cubeList) { + delete cubeList; + } + } + + + void ObservationPair::SetUp() { + FileName labelPathL = FileName("data/observationPair/observationImageL.pvl"); + FileName labelPathR = FileName("data/observationPair/observationImageR.pvl"); + + isdPathL = new FileName("data/observationPair/observationImageL.isd"); + isdPathR = new FileName("data/observationPair/observationImageR.isd"); + + cubeL = new Cube(); + cubeR = new Cube(); + + cubeLPath = tempDir.path() + "/observationPairL.cub"; + cubeRPath = tempDir.path() + "/observationPairR.cub"; + + cubeL->fromIsd(cubeLPath, labelPathL, *isdPathL, "rw"); + Pvl originalPdsLabL("data/observationPair/observationImageLOriginalLabel.pvl"); + OriginalLabel origLabel(originalPdsLabL); + cubeL->write(origLabel); + cubeL->reopen("rw"); + + cubeR->fromIsd(cubeRPath, labelPathR, *isdPathR, "rw"); + + cubeList = new FileList(); + cubeList->append(cubeL->fileName()); + cubeList->append(cubeR->fileName()); + + cubeListFile = tempDir.path() + "/cubes.lis"; + cubeList->write(cubeListFile); + + cnetPath = "data/observationPair/observationPair.net"; + network = new ControlNet(); + network->ReadControl(cnetPath); + } + + + void ObservationPair::TearDown() { + delete cubeList; + delete network; + + if (cubeL) { + delete cubeL; + } + + if (cubeR) { + delete cubeR; + } + + delete isdPathL; + delete isdPathR; + } + + + void MiniRFNetwork::SetUp() { + TempTestingFiles::SetUp(); + + testCube1 = new Cube("data/miniRFImage/LSZ_00455_1CD_XKU_87S324_V1_S1_Null.crop.cub"); + testCube2 = new Cube("data/miniRFImage/LSZ_00457_1CD_XKU_87S321_V1_S1_Null.crop.cub"); + testCube3 = new Cube("data/miniRFImage/LSZ_00459_1CD_XKU_88S327_V1_S1_Null.crop.cub"); + + cubeList = new FileList(); + + cubeList->append(testCube1->fileName()); + cubeList->append(testCube2->fileName()); + cubeList->append(testCube3->fileName()); + + + cubeListFile = tempDir.path() + "/cubes.lis"; + cubeList->write(cubeListFile); + + network = new ControlNet("data/miniRFImage/Cabeus_Orbit400_withSS_AprioriPts.net"); + controlNetPath = tempDir.path() + "/miniRFNet.net"; + network->Write(controlNetPath); + } + + + void MiniRFNetwork::TearDown() { + if (testCube1->isOpen()) { + testCube1->close(); + } + delete testCube1; + if (testCube2->isOpen()) { + testCube2->close(); + } + delete testCube2; + if (testCube3->isOpen()) { + testCube3->close(); + } + delete testCube3; + + if (cubeList) { + delete cubeList; + } + } + + + void VikThmNetwork::SetUp() { + TempTestingFiles::SetUp(); + + testCube1 = new Cube("data/vikingThemisNetwork/F704b51.lev1_slo_crop.cub"); + testCube2 = new Cube("data/vikingThemisNetwork/F857a32.lev1_slo_crop.cub"); + testCube3 = new Cube("data/vikingThemisNetwork/I28234014RDR_crop.cub"); + testCube4 = new Cube("data/vikingThemisNetwork/I52634011RDR_crop.cub"); + + cubeList = new FileList(); + + cubeList->append(testCube1->fileName()); + cubeList->append(testCube2->fileName()); + cubeList->append(testCube3->fileName()); + cubeList->append(testCube4->fileName()); + + + cubeListFile = tempDir.path() + "/cubes.lis"; + cubeList->write(cubeListFile); + + network = new ControlNet("data/vikingThemisNetwork/themis_dayir_VO_arcadia_extract_hand.net"); + controlNetPath = tempDir.path() + "/vikThmNet.net"; + network->Write(controlNetPath); + } + + + void VikThmNetwork::TearDown() { + if (testCube1->isOpen()) { + testCube1->close(); + } + delete testCube1; + if (testCube2->isOpen()) { + testCube2->close(); + } + delete testCube2; + if (testCube3->isOpen()) { + testCube3->close(); + } + delete testCube3; + if (testCube4->isOpen()) { + testCube4->close(); + } + delete testCube4; + + if (cubeList) { + delete cubeList; + } + } + +} \ No newline at end of file diff --git a/isis/tests/NetworkFixtures.h b/isis/tests/NetworkFixtures.h new file mode 100644 index 0000000000..219b894602 --- /dev/null +++ b/isis/tests/NetworkFixtures.h @@ -0,0 +1,120 @@ +#ifndef NetworkFixtures_h +#define NetworkFixtures_h + +#include + +#include "ControlNet.h" +#include "Cube.h" +#include "FileList.h" +#include "FileName.h" +#include "TempFixtures.h" + +namespace Isis { + + class ThreeImageNetwork : public TempTestingFiles { + protected: + + ControlNet *network; + QString networkFile; + + Cube *cube1; + Cube *cube2; + Cube *cube3; + + Cube *cube1map; + Cube *cube2map; + Cube *cube3map; + + FileName *isdPath1; + FileName *isdPath2; + FileName *isdPath3; + + FileName *threeImageOverlapFile; + FileName *twoImageOverlapFile; + + FileList *cubeList; + QString cubeListFile; + QString twoCubeListFile; + + std::vector> coords; + + void SetUp() override; + void AddFeatures(); + void TearDown() override; + }; + + class ObservationPair : public TempTestingFiles { + protected: + + Cube *cubeL; + Cube *cubeR; + + QString cubeLPath; + QString cubeRPath; + + FileName *isdPathL; + FileName *isdPathR; + + FileList *cubeList; + QString cubeListFile; + + ControlNet *network; + QString cnetPath; + + void SetUp() override; + void TearDown() override; + }; + + class ApolloNetwork : public TempTestingFiles { + protected: + QVector isdFiles; + QVector labelFiles; + QVector cubes; + + FileList *cubeList; + QString cubeListFile; + + ControlNet *network; + QString controlNetPath; + + void SetUp() override; + void TearDown() override; + }; + + + class MiniRFNetwork : public TempTestingFiles { + protected: + Cube *testCube1; + Cube *testCube2; + Cube *testCube3; + + FileList *cubeList; + QString cubeListFile; + + ControlNet *network; + QString controlNetPath; + + void SetUp() override; + void TearDown() override; + }; + + class VikThmNetwork : public TempTestingFiles { + protected: + Cube *testCube1; + Cube *testCube2; + Cube *testCube3; + Cube *testCube4; + + FileList *cubeList; + QString cubeListFile; + + ControlNet *network; + QString controlNetPath; + + void SetUp() override; + void TearDown() override; + }; + +} + +#endif \ No newline at end of file diff --git a/isis/tests/OsirisRexOCamsCameraTests.cpp b/isis/tests/OsirisRexOCamsCameraTests.cpp index f00335f4eb..bd3cdd20a6 100644 --- a/isis/tests/OsirisRexOCamsCameraTests.cpp +++ b/isis/tests/OsirisRexOCamsCameraTests.cpp @@ -3,7 +3,7 @@ #include "TestUtilities.h" #include "iTime.h" -#include "Fixtures.h" +#include "CameraFixtures.h" #include using namespace Isis; diff --git a/isis/tests/SensorUtilWrappersTests.cpp b/isis/tests/SensorUtilWrappersTests.cpp index 7ac32dc090..f9e7878268 100644 --- a/isis/tests/SensorUtilWrappersTests.cpp +++ b/isis/tests/SensorUtilWrappersTests.cpp @@ -1,6 +1,6 @@ #include "gmock/gmock.h" -#include "Fixtures.h" +#include "CameraFixtures.h" #include "Mocks.h" #include "csm.h" diff --git a/isis/tests/TableTests.cpp b/isis/tests/TableTests.cpp index fe3e6a9344..b8da823ec9 100644 --- a/isis/tests/TableTests.cpp +++ b/isis/tests/TableTests.cpp @@ -1,4 +1,5 @@ -#include "Fixtures.h" +#include "Blob.h" +#include "TempFixtures.h" #include "Table.h" #include "TableField.h" #include "TableRecord.h" diff --git a/isis/tests/TempFixtures.cpp b/isis/tests/TempFixtures.cpp new file mode 100644 index 0000000000..f6a3af7604 --- /dev/null +++ b/isis/tests/TempFixtures.cpp @@ -0,0 +1,9 @@ +#include "TempFixtures.h" + +namespace Isis { + + void TempTestingFiles::SetUp() { + ASSERT_TRUE(tempDir.isValid()); + } + +} \ No newline at end of file diff --git a/isis/tests/TempFixtures.h b/isis/tests/TempFixtures.h new file mode 100644 index 0000000000..bfb65842ba --- /dev/null +++ b/isis/tests/TempFixtures.h @@ -0,0 +1,19 @@ +#ifndef TempFixtures_h +#define TempFixtures_h + +#include "gtest/gtest.h" + +#include + +namespace Isis { + + class TempTestingFiles : public ::testing::Test { + protected: + QTemporaryDir tempDir; + + void SetUp() override; + }; + +} + +#endif \ No newline at end of file diff --git a/isis/tests/TestUtilities.cpp b/isis/tests/TestUtilities.cpp index 7ec88826ad..fc01b1a3e8 100644 --- a/isis/tests/TestUtilities.cpp +++ b/isis/tests/TestUtilities.cpp @@ -232,25 +232,6 @@ namespace Isis { } }; - - // Matches a CSM Image Coord for gMock - ::testing::Matcher MatchImageCoord(const csm::ImageCoord &expected) { - return ::testing::AllOf( - ::testing::Field(&csm::ImageCoord::line, ::testing::DoubleNear(expected.line, 0.0001)), - ::testing::Field(&csm::ImageCoord::samp, ::testing::DoubleNear(expected.samp, 0.0001)) - ); -} - - - // Matches a CSM ECEF Coord for gMock - ::testing::Matcher MatchEcefCoord(const csm::EcefCoord &expected) { - return ::testing::AllOf( - ::testing::Field(&csm::EcefCoord::x, ::testing::DoubleNear(expected.x, 0.0001)), - ::testing::Field(&csm::EcefCoord::y, ::testing::DoubleNear(expected.y, 0.0001)), - ::testing::Field(&csm::EcefCoord::z, ::testing::DoubleNear(expected.z, 0.0001)) - ); - } - // Writes binary kernels to the data area. Unsure of the best way to handle // clean up. Didn't want to dive into the rabbit hole of C++ alternatives // to python yeild statements diff --git a/isis/tests/TestUtilities.h b/isis/tests/TestUtilities.h index 23792eaad1..32c93a573f 100644 --- a/isis/tests/TestUtilities.h +++ b/isis/tests/TestUtilities.h @@ -64,9 +64,6 @@ namespace Isis { void compareCsvLine(CSVReader::CSVAxis csvLine, CSVReader::CSVAxis csvLine2, int initialIndex=0, double tolerance = 0.000001); - ::testing::Matcher MatchImageCoord(const csm::ImageCoord &expected); - ::testing::Matcher MatchEcefCoord(const csm::EcefCoord &expected); - QVector generateBinaryKernels(QVector kernelList); QString fileListToString(QVector fileList); } diff --git a/isis/tests/UnitTestImagePolygon.cpp b/isis/tests/UnitTestImagePolygon.cpp index ad7467225f..952c50a2df 100644 --- a/isis/tests/UnitTestImagePolygon.cpp +++ b/isis/tests/UnitTestImagePolygon.cpp @@ -10,7 +10,8 @@ #include -#include "Fixtures.h" +#include "CameraFixtures.h" +#include "TempFixtures.h" using namespace Isis; diff --git a/isis/tests/UnitTestMarciCam.cpp b/isis/tests/UnitTestMarciCam.cpp index 780240d486..811a470c2a 100644 --- a/isis/tests/UnitTestMarciCam.cpp +++ b/isis/tests/UnitTestMarciCam.cpp @@ -1,7 +1,7 @@ -#include "MarciCamera.h" +#include "MarciCamera.h" #include "PushFrameCameraDetectorMap.h" -#include "Fixtures.h" +#include "TempFixtures.h" #include "gmock/gmock.h" using namespace Isis; @@ -9,9 +9,9 @@ using namespace Isis; TEST_F(TempTestingFiles, UnitTestMarciCameraPhocubeBandChange) { QString cubeFileName = "data/marcical/P12_005901_3391_MA_00N096W_cropped.cub"; - - // simulate phocube - std::istringstream bbin_stream(R"( + + // simulate phocube + std::istringstream bbin_stream(R"( Group = BandBin FilterName = BLUE OriginalBand = (1, 1, 1, 1, 1) @@ -21,19 +21,19 @@ TEST_F(TempTestingFiles, UnitTestMarciCameraPhocubeBandChange) { Width = (1.0, 1.0, 1.0, 1.0, 1.0) End_Group )"); - + PvlGroup newbbin; bbin_stream >> newbbin; - + Cube cube(cubeFileName); Pvl *isisLabel = cube.label(); PvlGroup &ogbbin = isisLabel->findGroup("BandBin", Pvl::Traverse); ogbbin = newbbin; - + Camera *cam = cube.camera(); PushFrameCameraDetectorMap *dmap = (PushFrameCameraDetectorMap*) cam->DetectorMap(); - // properties should BLUE filter's properties after band change + // properties should BLUE filter's properties after band change cam->SetBand(1); EXPECT_EQ(dmap->GetBandFirstDetectorLine(), 709); cam->SetBand(4);