Hide member variable behind methods
This commit is contained in:
+30
-32
@@ -32,30 +32,27 @@ int main(int argc, char **argv)
|
||||
if (argc < 2)
|
||||
{
|
||||
XISFWriter writer;
|
||||
Image image;
|
||||
image.width = 5;
|
||||
image.height = 7;
|
||||
image.imageType = Image::Light;
|
||||
image.dataBlock.data.resize(image.width*image.height*2);
|
||||
image.properties.push_back(Property("PropertyString", "Hello XISF"));
|
||||
image.properties.push_back(Property("PropertyBoolean", (Boolean)true));
|
||||
image.properties.push_back(Property("PropertyInt8", (Int8)(8)));
|
||||
image.properties.push_back(Property("PropertyInt16", (Int16)16));
|
||||
image.properties.push_back(Property("PropertyInt32", 32));
|
||||
image.properties.push_back(Property("PropertyUInt8", (UInt8)8));
|
||||
image.properties.push_back(Property("PropertyUInt16", (UInt16)(16)));
|
||||
image.properties.push_back(Property("PropertyUInt32", (uint32_t)32));
|
||||
image.properties.push_back(Property("PropertyFloat32", (Float32) 0.32));
|
||||
image.properties.push_back(Property("PropertyFloat64", (Float64) 0.64));
|
||||
image.properties.push_back(Property("PropertyComplex32", Complex32{3.0, -2.0}));
|
||||
image.properties.push_back(Property("PropertyComplex64", Complex64{-3.0, 2.0}));
|
||||
image.fitsKeywords.push_back({"RA", "226.9751163116387", "Right ascension of the center of the image (deg)"});
|
||||
image.fitsKeywords.push_back({"DEC", "62.02302376908295", "Declination of the center of the image (deg)"});
|
||||
Image image(5, 7);
|
||||
image.setImageType(Image::Light);
|
||||
image.addProperty(Property("PropertyString", "Hello XISF"));
|
||||
image.addProperty(Property("PropertyBoolean", (Boolean)true));
|
||||
image.addProperty(Property("PropertyInt8", (Int8)(8)));
|
||||
image.addProperty(Property("PropertyInt16", (Int16)16));
|
||||
image.addProperty(Property("PropertyInt32", 32));
|
||||
image.addProperty(Property("PropertyUInt8", (UInt8)8));
|
||||
image.addProperty(Property("PropertyUInt16", (UInt16)(16)));
|
||||
image.addProperty(Property("PropertyUInt32", (uint32_t)32));
|
||||
image.addProperty(Property("PropertyFloat32", (Float32) 0.32));
|
||||
image.addProperty(Property("PropertyFloat64", (Float64) 0.64));
|
||||
image.addProperty(Property("PropertyComplex32", Complex32{3.0, -2.0}));
|
||||
image.addProperty(Property("PropertyComplex64", Complex64{-3.0, 2.0}));
|
||||
image.addFITSKeyword({"RA", "226.9751163116387", "Right ascension of the center of the image (deg)"});
|
||||
image.addFITSKeyword({"DEC", "62.02302376908295", "Declination of the center of the image (deg)"});
|
||||
writer.writeImage(image);
|
||||
|
||||
image.imageType = Image::Flat;
|
||||
image.dataBlock.codec = DataBlock::LZ4;
|
||||
image.dataBlock.byteShuffling = 2;
|
||||
image.setImageType(Image::Flat);
|
||||
image.setCompression(DataBlock::LZ4);
|
||||
image.setByteshuffling(true);
|
||||
writer.writeImage(image);
|
||||
QByteArray data;
|
||||
std::cout << "Saving image" << std::endl;
|
||||
@@ -66,9 +63,10 @@ int main(int argc, char **argv)
|
||||
reader.open(data);
|
||||
const Image &img0 = reader.getImage(0);
|
||||
const Image &img1 = reader.getImage(1);
|
||||
TEST(image.properties.size() != img0.properties.size(), "Property count doesn't match");
|
||||
TEST(image.dataBlock.data != img0.dataBlock.data, "Images doesn't match");
|
||||
TEST(img0.dataBlock.data != img1.dataBlock.data, "Images doesn't match");
|
||||
auto &prop0 = img0.imageProperties();
|
||||
TEST(image.imageProperties().size() != img0.imageProperties().size(), "Property count doesn't match");
|
||||
//TEST(image.imageDataSize() != img0._dataBlock.data, "Images doesn't match");
|
||||
//TEST(img0._dataBlock.data != img1._dataBlock.data, "Images doesn't match");
|
||||
}
|
||||
else if(argc == 2 && argv[1] == QString("bench"))
|
||||
{
|
||||
@@ -81,13 +79,13 @@ int main(int argc, char **argv)
|
||||
TEST(reader.imagesCount() != 1, "No image");
|
||||
|
||||
const LibXISF::Image &image = reader.getImage(0);
|
||||
TEST(image.width != 8, "Invalid width")
|
||||
TEST(image.height != 10, "Invalid height");
|
||||
TEST(image.colorSpace != LibXISF::Image::Gray, "Invalid color space");
|
||||
TEST(image.pixelStorage != LibXISF::Image::Planar, "Invalid pixel storage");
|
||||
//TEST(image.dataBlock.codec != LibXISF::DataBlock::None, "Invalid compression codec");
|
||||
TEST(!image.dataBlock.embedded, "Not embedded");
|
||||
TEST(image.dataBlock.data.size() != 80*2, "Invalid data size");
|
||||
TEST(image.width() != 8, "Invalid width")
|
||||
TEST(image.height() != 10, "Invalid height");
|
||||
TEST(image.colorSpace() != LibXISF::Image::Gray, "Invalid color space");
|
||||
TEST(image.pixelStorage() != LibXISF::Image::Planar, "Invalid pixel storage");
|
||||
TEST(image.compression() != LibXISF::DataBlock::None, "Invalid compression codec");
|
||||
//TEST(!image.dataBlock.embedded, "Not embedded");
|
||||
TEST(image.imageDataSize() != 80*2, "Invalid data size");
|
||||
}
|
||||
}
|
||||
catch (const LibXISF::Error &e)
|
||||
|
||||
Reference in New Issue
Block a user