Skip to content

Commit

Permalink
trying to get the "french" SICD unit-test working
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Smith committed Dec 9, 2021
1 parent d63e6ea commit 4a4d621
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion six/modules/c++/six.sicd/unittests/test_valid_six.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,31 @@ TEST_CASE(valid_six_50x50)
test_nitf_image_info(*pComplexData, inputPathname, nitf::PixelValueType::Floating);
}

TEST_CASE(sicd_French_xml)
{
setNitfPluginPath();

const auto inputPathname = getNitfPath("sicd_French_xml.nitf");
std::unique_ptr<six::sicd::ComplexData> pComplexData;
const auto image = six::sicd::readFromNITF(inputPathname, pComplexData);
const six::Data* pData = pComplexData.get();

TEST_ASSERT_EQ(six::PixelType::RE32F_IM32F, pData->getPixelType());
TEST_ASSERT_EQ(static_cast<size_t>(8), pData->getNumBytesPerPixel());

// UTF-8 characters in 50x50.nitf
#ifdef _WIN32
const std::string classificationText("NON CLASSIFI\xc9 / UNCLASSIFIED"); // ISO8859-1 "NON CLASSIFIÉ / UNCLASSIFIED"
#else
const std::string classificationText("NON CLASSIFI\xc3\x89 / UNCLASSIFIED"); // UTF-8 "NON CLASSIFIÉ / UNCLASSIFIED"
#endif
const auto& classification = pData->getClassification();
const auto actual = classification.getLevel();
TEST_ASSERT_EQ(actual, classificationText);

test_nitf_image_info(*pComplexData, inputPathname, nitf::PixelValueType::Floating);
}

static void test_assert(const six::sicd::ComplexData& complexData,
six::PixelType expectedPixelType, size_t expectedNumBytesPerPixel)
{
Expand Down Expand Up @@ -359,8 +384,8 @@ TEST_CASE(test_create_sicd_from_mem_32f)

TEST_MAIN((void)argc; (void)argv;
TEST_CHECK(valid_six_50x50);
TEST_CHECK(sicd_French_xml);
TEST_CHECK(test_readFromNITF_sicd_50x50);
TEST_CHECK(test_read_sicd_50x50);
TEST_CHECK(test_create_sicd_from_mem_32f);
)

0 comments on commit 4a4d621

Please sign in to comment.