test: fix broken plugin support.
[platform/core/graphics/tizenvg.git] / test / testSavers.cpp
index 949f460..acd723e 100644 (file)
  */
 
 #include <thorvg.h>
+#include <fstream>
+#include "config.h"
 #include "catch.hpp"
 
 using namespace tvg;
+using namespace std;
 
 TEST_CASE("Saver Creation", "[tvgSavers]")
 {
@@ -31,6 +34,8 @@ TEST_CASE("Saver Creation", "[tvgSavers]")
     REQUIRE(saver);
 }
 
+#ifdef THORVG_TVG_SAVER_SUPPORT
+
 TEST_CASE("Save empty shape", "[tvgSavers]")
 {
     auto shape = Shape::gen();
@@ -65,7 +70,14 @@ TEST_CASE("Save scene into tvg", "[tvgSavers]")
 
     auto picture = tvg::Picture::gen();
     REQUIRE(picture);
-    REQUIRE(picture->load(TEST_DIR"/test.png") == Result::Success);
+
+    ifstream file(TEST_DIR"/rawimage_200x300.raw");
+    if (!file.is_open()) return;
+    auto data = (uint32_t*)malloc(sizeof(uint32_t) * (200*300));
+    file.read(reinterpret_cast<char *>(data), sizeof (uint32_t) * 200 * 300);
+    file.close();
+
+    REQUIRE(picture->load(data, 200, 300, false) == Result::Success);
     REQUIRE(picture->translate(50, 0) == Result::Success);
     REQUIRE(picture->scale(2) == Result::Success);
 
@@ -81,4 +93,8 @@ TEST_CASE("Save scene into tvg", "[tvgSavers]")
     REQUIRE(saver->sync() == Result::Success);
 
     REQUIRE(Initializer::term(CanvasEngine::Sw) == Result::Success);
+
+    free(data);
 }
+
+#endif
\ No newline at end of file