updated copyright.
[platform/core/graphics/tizenvg.git] / test / testShape.cpp
index 66e0bb6..a4a82c4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2021 - 2023 the ThorVG project. All rights reserved.
 
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
 
 using namespace tvg;
 
+TEST_CASE("Shape Creation", "[tvgShape]")
+{
+    auto shape = Shape::gen();
+    REQUIRE(shape);
+
+    REQUIRE(shape->identifier() == Shape::identifier());
+    REQUIRE(shape->identifier() != Picture::identifier());
+    REQUIRE(shape->identifier() != Scene::identifier());
+}
 
 TEST_CASE("Appending Commands", "[tvgShape]")
 {
@@ -34,17 +43,17 @@ TEST_CASE("Appending Commands", "[tvgShape]")
     REQUIRE(shape->close() == Result::Success);
 
     REQUIRE(shape->moveTo(100, 100) == Result::Success);
-    REQUIRE(shape->moveTo(99999999, -99999999) == Result::Success);
+    REQUIRE(shape->moveTo(99999999.0f, -99999999.0f) == Result::Success);
     REQUIRE(shape->moveTo(0, 0) == Result::Success);
 
     REQUIRE(shape->lineTo(120, 140) == Result::Success);
-    REQUIRE(shape->lineTo(99999999, -99999999) == Result::Success);
+    REQUIRE(shape->lineTo(99999999.0f, -99999999.0f) == Result::Success);
     REQUIRE(shape->lineTo(0, 0) == Result::Success);
 
     REQUIRE(shape->cubicTo(0, 0, 0, 0, 0, 0) == Result::Success);
-    REQUIRE(shape->cubicTo(0, 0, 99999999, -99999999, 0, 0) == Result::Success);
-    REQUIRE(shape->cubicTo(0, 0, 99999999, -99999999, 99999999, -99999999) == Result::Success);
-    REQUIRE(shape->cubicTo(99999999, -99999999, 99999999, -99999999, 99999999, -99999999) == Result::Success);
+    REQUIRE(shape->cubicTo(0, 0, 99999999.0f, -99999999.0f, 0, 0) == Result::Success);
+    REQUIRE(shape->cubicTo(0, 0, 99999999.0f, -99999999.0f, 99999999.0f, -99999999.0f) == Result::Success);
+    REQUIRE(shape->cubicTo(99999999.0f, -99999999.0f, 99999999.0f, -99999999.0f, 99999999.0f, -99999999.0f) == Result::Success);
 
     REQUIRE(shape->close() == Result::Success);
 
@@ -61,22 +70,22 @@ TEST_CASE("Appending Shapes", "[tvgShape]")
     REQUIRE(shape->lineTo(120, 140) == Result::Success);
 
     REQUIRE(shape->appendRect(0, 0, 0, 0, 0, 0) == Result::Success);
-    REQUIRE(shape->appendRect(0, 0,99999999, -99999999, 0, 0) == Result::Success);
-    REQUIRE(shape->appendRect(0, 0, 0, 0, -99999999, 99999999) == Result::Success);
-    REQUIRE(shape->appendRect(99999999, -99999999, 99999999, -99999999, 99999999, -99999999) == Result::Success);
+    REQUIRE(shape->appendRect(0, 0,99999999.0f, -99999999.0f, 0, 0) == Result::Success);
+    REQUIRE(shape->appendRect(0, 0, 0, 0, -99999999.0f, 99999999.0f) == Result::Success);
+    REQUIRE(shape->appendRect(99999999.0f, -99999999.0f, 99999999.0f, -99999999.0f, 99999999.0f, -99999999.0f) == Result::Success);
 
     REQUIRE(shape->appendCircle(0, 0, 0, 0) == Result::Success);
-    REQUIRE(shape->appendCircle(-99999999, 99999999, 0, 0) == Result::Success);
-    REQUIRE(shape->appendCircle(-99999999, 99999999, -99999999, 99999999) == Result::Success);
+    REQUIRE(shape->appendCircle(-99999999.0f, 99999999.0f, 0, 0) == Result::Success);
+    REQUIRE(shape->appendCircle(-99999999.0f, 99999999.0f, -99999999.0f, 99999999.0f) == Result::Success);
 
     REQUIRE(shape->appendArc(0, 0, 0, 0, 0, false) == Result::Success);
     REQUIRE(shape->appendArc(0, 0, 0, 0, 0, true) == Result::Success);
-    REQUIRE(shape->appendArc(-99999999, 99999999, 0, 0, 0, false) == Result::Success);
-    REQUIRE(shape->appendArc(-99999999, 99999999, 0, 0, 0, true) == Result::Success);
-    REQUIRE(shape->appendArc(-99999999, 99999999, -99999999, 99999999, 0, false) == Result::Success);
-    REQUIRE(shape->appendArc(-99999999, 99999999, -99999999, 99999999, 0, true) == Result::Success);
-    REQUIRE(shape->appendArc(-99999999, 99999999, -99999999, 99999999, -400, false) == Result::Success);
-    REQUIRE(shape->appendArc(-99999999, 99999999, -99999999, 99999999, 400, true) == Result::Success);
+    REQUIRE(shape->appendArc(-99999999.0f, 99999999.0f, 0, 0, 0, false) == Result::Success);
+    REQUIRE(shape->appendArc(-99999999.0f, 99999999.0f, 0, 0, 0, true) == Result::Success);
+    REQUIRE(shape->appendArc(-99999999.0f, 99999999.0f, -99999999.0f, 99999999.0f, 0, false) == Result::Success);
+    REQUIRE(shape->appendArc(-99999999.0f, 99999999.0f, -99999999.0f, 99999999.0f, 0, true) == Result::Success);
+    REQUIRE(shape->appendArc(-99999999.0f, 99999999.0f, -99999999.0f, 99999999.0f, -400, false) == Result::Success);
+    REQUIRE(shape->appendArc(-99999999.0f, 99999999.0f, -99999999.0f, 99999999.0f, 400, true) == Result::Success);
 }
 
 TEST_CASE("Appending Pathes", "[tvgShape]")
@@ -197,4 +206,4 @@ TEST_CASE("Shape Filling", "[tvgShape]")
     REQUIRE(shape->fillRule() == FillRule::Winding);
     REQUIRE(shape->fill(FillRule::EvenOdd) == Result::Success);
     REQUIRE(shape->fillRule() == FillRule::EvenOdd);
-}
\ No newline at end of file
+}