MEDIA_VISION_ERROR_NONE);
}
-INSTANTIATE_TEST_CASE_P(GeneralAndSpecial, TestBarcode, testing::ValuesIn(ReadDetPositive1()));
\ No newline at end of file
+INSTANTIATE_TEST_CASE_P(GeneralAndSpecial, TestBarcode, testing::ValuesIn(ReadDetPositive1()));
+
+class TestBarcodeGen : public ::testing::Test
+{
+protected:
+ void SetUp() override
+ {
+ test_file = "/tmp/" + string { testing::UnitTest::GetInstance()->current_test_info()->name() } + ".png";
+ }
+ void TearDown() override
+ {
+ if (access(test_file.c_str(), F_OK) != -1) {
+ std::remove(test_file.c_str());
+ }
+ }
+
+ mv_engine_config_h engine_cfg = NULL;
+ mv_barcode_type_e type = MV_BARCODE_QR;
+ mv_barcode_qr_mode_e qr_enc_mode = MV_BARCODE_QR_MODE_UTF8;
+ mv_barcode_qr_ecc_e qr_ecc = MV_BARCODE_QR_ECC_LOW;
+ int qr_version = 5;
+ std::string test_file;
+ mv_barcode_image_format_e image_format = MV_BARCODE_IMAGE_FORMAT_PNG;
+};
+
+TEST_F(TestBarcodeGen, SimplePositiveQP)
+{
+ ASSERT_EQ(mv_barcode_generate_image(engine_cfg, "https://test.com", 100, 100, type, qr_enc_mode, qr_ecc, qr_version,
+ test_file.c_str(), image_format),
+ MEDIA_VISION_ERROR_NONE);
+}
+
+TEST_F(TestBarcodeGen, SimpleNegativeQR)
+{
+ ASSERT_EQ(mv_barcode_generate_image(engine_cfg, "한글사용https://test.com", 100, 100, type, qr_enc_mode, qr_ecc,
+ qr_version, test_file.c_str(), image_format),
+ MEDIA_VISION_ERROR_INTERNAL);
+}
+
+TEST_F(TestBarcodeGen, ColorPositiveQR)
+{
+ ASSERT_EQ(mv_create_engine_config(&engine_cfg), MEDIA_VISION_ERROR_NONE);
+ ASSERT_EQ(mv_engine_config_set_string_attribute(engine_cfg, "MV_BARCODE_GENERATE_ATTR_COLOR_FRONT", "3366ff"),
+ MEDIA_VISION_ERROR_NONE);
+ ASSERT_EQ(mv_engine_config_set_string_attribute(engine_cfg, "MV_BARCODE_GENERATE_ATTR_COLOR_BACK", "ff9966"),
+ MEDIA_VISION_ERROR_NONE);
+ ASSERT_EQ(mv_barcode_generate_image(engine_cfg, "1239592https://test.com", 100, 100, type, qr_enc_mode, qr_ecc,
+ qr_version, test_file.c_str(), image_format),
+ MEDIA_VISION_ERROR_NONE);
+ ASSERT_EQ(mv_destroy_engine_config(engine_cfg), MEDIA_VISION_ERROR_NONE);
+}