From: Kwanghoon Son Date: Fri, 3 Feb 2023 02:33:35 +0000 (+0900) Subject: Add design QR finder shape X-Git-Tag: accepted/tizen/unified/20230220.174431~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a0723961be881142497557c7e57efea422b6721c;p=platform%2Fcore%2Fapi%2Fmediavision.git Add design QR finder shape Change-Id: I9641480cbc213cc9862694d9c57614445a8d7a51 Signed-off-by: Kwanghoon Son --- diff --git a/media-vision-config.json b/media-vision-config.json index 1ae22adc..4f4f4e4d 100644 --- a/media-vision-config.json +++ b/media-vision-config.json @@ -307,6 +307,11 @@ "name" : "MV_BARCODE_GENERATE_ATTR_DATA_SHAPE", "type" : "integer", "value" : 0 + }, + { + "name" : "MV_BARCODE_GENERATE_ATTR_FINDER_SHAPE", + "type" : "integer", + "value" : 0 } ] } diff --git a/mv_barcode/barcode_generator/src/BarcodeGenerator.cpp b/mv_barcode/barcode_generator/src/BarcodeGenerator.cpp index 92d23535..9b1e757a 100644 --- a/mv_barcode/barcode_generator/src/BarcodeGenerator.cpp +++ b/mv_barcode/barcode_generator/src/BarcodeGenerator.cpp @@ -117,6 +117,22 @@ int createBarcode(const std::string &message, BarcodeType type, BarcodeQREncodin break; } } + + ret = engineCfg->getIntegerAttribute(MV_BARCODE_GENERATE_ATTR_FINDER_SHAPE, &value); + + if (ret == MEDIA_VISION_ERROR_NONE) { + switch (value) { + case MV_BARCODE_GENERATE_ATTR_SHAPE_ROUND_RECT: + symbol->output_options |= BARCODE_FINDER_ROUNDRECT; + break; + case MV_BARCODE_GENERATE_ATTR_SHAPE_CIRCLE: + symbol->output_options |= BARCODE_FINDER_CIRCLE; + break; + + default: + break; + } + } } if (type == BARCODE_QR) { diff --git a/test/testsuites/barcode/test_barcode.cpp b/test/testsuites/barcode/test_barcode.cpp index beaf2eb3..1068111c 100644 --- a/test/testsuites/barcode/test_barcode.cpp +++ b/test/testsuites/barcode/test_barcode.cpp @@ -158,4 +158,32 @@ TEST_F(TestBarcodeGen, DataCirclePositiveQR) 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