endif()
endif()
-set(SRC_FILES testsuites/barcode/test_barcode.cpp
+set(SRC_FILES
+ testsuites/barcode/test_barcode.cpp
+ testsuites/barcode/test_designqr.cpp
testsuites/machine_learning/inference/test_inference_helper.cpp
testsuites/machine_learning/inference/test_image_classification.cpp
testsuites/machine_learning/inference/test_object_detection.cpp
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);
-}
-
-TEST_F(TestBarcodeGen, DataCirclePositiveQR)
-{
- 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_int_attribute(engine_cfg, MV_BARCODE_GENERATE_ATTR_DATA_SHAPE,
- MV_BARCODE_GENERATE_ATTR_SHAPE_CIRCLE),
- MEDIA_VISION_ERROR_NONE);
- ASSERT_EQ(mv_barcode_generate_image(engine_cfg, "https://samsung.com/", 512, 512, 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);
-}
-
-TEST_F(TestBarcodeGen, FinderCirclePositiveQR)
-{
- 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_int_attribute(engine_cfg, MV_BARCODE_GENERATE_ATTR_FINDER_SHAPE,
- MV_BARCODE_GENERATE_ATTR_SHAPE_CIRCLE),
- MEDIA_VISION_ERROR_NONE);
- ASSERT_EQ(mv_barcode_generate_image(engine_cfg, "https://samsung.com/", 512, 512, 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);
-}
-
-TEST_F(TestBarcodeGen, FinderRoundRectPositiveQR)
-{
- 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_int_attribute(engine_cfg, MV_BARCODE_GENERATE_ATTR_FINDER_SHAPE,
- MV_BARCODE_GENERATE_ATTR_SHAPE_ROUND_RECT),
- MEDIA_VISION_ERROR_NONE);
- ASSERT_EQ(mv_barcode_generate_image(engine_cfg, "https://samsung.com/", 512, 512, 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);
}
\ No newline at end of file
--- /dev/null
+#include <gtest/gtest.h>
+#include <algorithm>
+#include <mv_barcode_generate.h>
+
+#define LARGE_COMB_SET 0
+using namespace std;
+
+using DesignQRCombParams = tuple<string, mv_barcode_qr_mode_e, mv_barcode_qr_ecc_e, int, pair<string, string>, int,
+ mv_barcode_generate_attr_shape_e, mv_barcode_generate_attr_shape_e>;
+
+class CombinationsTest : public testing::TestWithParam<DesignQRCombParams>
+{
+protected:
+ void SetUp() override
+ {
+ test_file = string { testing::UnitTest::GetInstance()->current_test_info()->name() } + ".png";
+ replace(test_file.begin(), test_file.end(), '/', '_');
+ test_file = "/tmp/" + test_file;
+ ASSERT_EQ(mv_create_engine_config(&engine_cfg), MEDIA_VISION_ERROR_NONE);
+ }
+ void TearDown() override
+ {
+ ASSERT_EQ(mv_destroy_engine_config(engine_cfg), MEDIA_VISION_ERROR_NONE);
+ }
+
+ 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, img_size;
+ string test_file;
+ mv_barcode_image_format_e image_format = MV_BARCODE_IMAGE_FORMAT_PNG;
+ string message, foreground_color, background_color;
+ mv_barcode_generate_attr_shape_e data_shape, finder_shape;
+};
+
+TEST_P(CombinationsTest, DesignQR)
+{
+ forward_as_tuple(message, qr_enc_mode, qr_ecc, qr_version, tie(foreground_color, background_color), img_size,
+ data_shape, finder_shape) = GetParam();
+ ASSERT_EQ(mv_engine_config_set_string_attribute(engine_cfg, MV_BARCODE_GENERATE_ATTR_COLOR_FRONT,
+ foreground_color.c_str()),
+ MEDIA_VISION_ERROR_NONE);
+ ASSERT_EQ(mv_engine_config_set_string_attribute(engine_cfg, MV_BARCODE_GENERATE_ATTR_COLOR_BACK,
+ background_color.c_str()),
+ MEDIA_VISION_ERROR_NONE);
+ ASSERT_EQ(mv_engine_config_set_int_attribute(engine_cfg, MV_BARCODE_GENERATE_ATTR_DATA_SHAPE, data_shape),
+ MEDIA_VISION_ERROR_NONE);
+ ASSERT_EQ(mv_engine_config_set_int_attribute(engine_cfg, MV_BARCODE_GENERATE_ATTR_FINDER_SHAPE, finder_shape),
+ MEDIA_VISION_ERROR_NONE);
+ EXPECT_EQ(mv_barcode_generate_image(engine_cfg, message.c_str(), img_size, img_size, type, qr_enc_mode, qr_ecc,
+ qr_version, test_file.c_str(), image_format),
+ MEDIA_VISION_ERROR_NONE);
+}
+INSTANTIATE_TEST_CASE_P(
+ Combinations, CombinationsTest,
+ testing::Combine(testing::ValuesIn(vector<string> {
+ "smalletextHttps://",
+ }),
+ testing::ValuesIn(vector<mv_barcode_qr_mode_e> { MV_BARCODE_QR_MODE_UTF8 }),
+ testing::ValuesIn(vector<mv_barcode_qr_ecc_e> {
+ MV_BARCODE_QR_ECC_HIGH,
+#if LARGE_COMB_SET
+ MV_BARCODE_QR_ECC_LOW
+#endif
+ }),
+ testing::ValuesIn(vector<int> { 5 }),
+ testing::ValuesIn(vector<pair<string, string> > { { "000000", "ffffff" },
+ { "56849A", "E7E7E7" } }),
+ testing::ValuesIn(vector<int> { 400 }),
+ testing::ValuesIn(vector<mv_barcode_generate_attr_shape_e> {
+ MV_BARCODE_GENERATE_ATTR_SHAPE_RECT, MV_BARCODE_GENERATE_ATTR_SHAPE_CIRCLE }),
+ testing::ValuesIn(vector<mv_barcode_generate_attr_shape_e> {
+ MV_BARCODE_GENERATE_ATTR_SHAPE_RECT, MV_BARCODE_GENERATE_ATTR_SHAPE_ROUND_RECT,
+ MV_BARCODE_GENERATE_ATTR_SHAPE_CIRCLE })));