test: fix memory leak.
authorHermet Park <chuneon.park@samsung.com>
Fri, 5 Nov 2021 12:10:59 +0000 (21:10 +0900)
committerJunsuChoi <jsuya.choi@samsung.com>
Mon, 8 Nov 2021 09:01:54 +0000 (18:01 +0900)
these duplicates are not unique_ptr, should be taken care.

@Issue: https://github.com/Samsung/thorvg/issues/995

test/testPaint.cpp
test/testPicture.cpp

index a993a3f..111b84e 100644 (file)
@@ -24,7 +24,7 @@
 #include "catch.hpp"
 
 using namespace tvg;
-
+using namespace std;
 
 TEST_CASE("Custom Transformation", "[tvgPaint]")
 {
@@ -158,7 +158,7 @@ TEST_CASE("Duplication", "[tvgPaint]")
     REQUIRE(shape->composite(move(comp), CompositeMethod::ClipPath) == Result::Success);
 
     //Duplication
-    auto dup = shape->duplicate();
+    auto dup = unique_ptr<Shape>((Shape*)shape->duplicate());
     REQUIRE(dup);
 
     //Compare properties
index 8448128..402d95f 100644 (file)
@@ -264,7 +264,7 @@ TEST_CASE("Picture Duplication", "[tvgPicture]")
     REQUIRE(picture->load(TEST_DIR"/logo.svg") == Result::Success);
     REQUIRE(picture->size(100, 100) == Result::Success);
 
-    auto dup = picture->duplicate();
+    auto dup = unique_ptr<Picture>((Picture*)picture->duplicate());
     REQUIRE(dup);
 
     float w, h;