utc: increase coverage up
authorMichal Maciola <m.maciola@samsung.com>
Wed, 18 Aug 2021 13:56:59 +0000 (15:56 +0200)
committerJunsuChoi <jsuya.choi@samsung.com>
Fri, 20 Aug 2021 00:57:14 +0000 (09:57 +0900)
test/images/tag.svg
test/testPicture.cpp

index 4533376..4d3542a 100644 (file)
@@ -1,6 +1,6 @@
 <svg width="1000" height="1000" viewBox="0 0 1000 1000"
        xmlns="http://www.w3.org/2000/svg">
-       <g fill="url(#grad1)" mask="url(#vg)" transform="rotate(0 50% 50%) scale(1.0)">
+       <g fill="url(#grad1)" mask="url(#vg)" transform="rotate(0 0 0) translate(0 0) scale(1.0)">
                <path d="M420.82388 380H588.68467V422.805317H420.82388Z" stroke-width="0" stroke-dasharray="100%" stroke-dashoffset="0" />
                <path d="m420.82403 440.7101v63.94623l167.86079 25.5782V440.7101Z"/>
                <path d="M420.82403 523.07258V673.47362L588.68482 612.59701V548.13942Z"/>
                <polyline fill="none" stroke-width="10" 
             points="0,0 1000,0 1000,1000 0,1000" />
                <line x1="0" y1="0" x2="1000" y2="0" stroke="" />
+               <path d="M647.5 800C692.5 786 730 786 775 800S857.5 814 902.5 800" stroke="#222f35" stroke-width="2" fill="transparent"/>
+               <path d="M647.5 800Q711.25 786 775 800T902.5 800" stroke="#222f35" stroke-width="2" fill="transparent"/>
        </g>
        <image href="data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgNTAgNTAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGNpcmNsZSBmaWxsPSIjMjIyZjM1IiBjeD0iNTAlIiBjeT0iNTAlIiByPSI1MCUiLz48L3N2Zz4=" height="50" width="50" x="650" y="875" />
        <image href="data:image/svg+xml;utf8,%3Csvg viewBox='0 0 50 50' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle fill='%23222f35' cx='50%25' cy='50%25' r='50%25'/%3E%3C/svg%3E" height="50" width="50" x="725" y="875" />
        <image href="data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%2050%2050%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Ccircle%20fill%3D%22%23222f35%22%20cx%3D%2250%25%22%20cy%3D%2250%25%22%20r%3D%2250%25%22%2F%3E%3C%2Fsvg%3E" height="50" width="50" x="800" y="875" />
+       <path d="M885.834 872.086A45 45 0 1 1 885.834 919.815L909.698 895.95Z" fill="#223" opacity="0.6" stroke-linejoin="miter" stroke-linecap="round" id="man"/>
+       <use href="#man" x="0" y="0" />
        <defs>
-               <linearGradient id="grad1">
+               <linearGradient id="grad1" gradientTransform="translate(0, 0)">
                        <stop offset="0%" stop-color="#50585d"/>
                        <stop offset="100%" stop-color="#252f35"/>
                </linearGradient>
-               <radialGradient id="grad2" cx="100%" cy="0.25" r="1.5">
+               <radialGradient id="grad2" cx="100%" cy="0.25" r="1.5" gradientTransform="scale(1)">
                        <stop offset="0%" stop-color="#50585d"/>
                        <stop offset="100%" stop-color="#252f35"/>
                </radialGradient>
index 53b48f4..6be9189 100644 (file)
@@ -208,8 +208,8 @@ TEST_CASE("Load SVG file and render", "[tvgPicture]")
     auto canvas = SwCanvas::gen();
     REQUIRE(canvas);
 
-    uint32_t buffer[100*100];
-    REQUIRE(canvas->target(buffer, 100, 100, 100, SwCanvas::Colorspace::ABGR8888) == Result::Success);
+    uint32_t buffer[1000*1000];
+    REQUIRE(canvas->target(buffer, 1000, 1000, 1000, SwCanvas::Colorspace::ABGR8888) == Result::Success);
 
     auto picture = Picture::gen();
     REQUIRE(picture);
@@ -260,3 +260,33 @@ TEST_CASE("Load JPG file and render", "[tvgPicture]")
 
     REQUIRE(Initializer::term(CanvasEngine::Sw) == Result::Success);
 }
+
+TEST_CASE("Load RAW file and render", "[tvgPicture]")
+{
+    REQUIRE(Initializer::init(CanvasEngine::Sw, 0) == Result::Success);
+
+    auto canvas = SwCanvas::gen();
+    REQUIRE(canvas);
+
+    uint32_t buffer[100*100];
+    REQUIRE(canvas->target(buffer, 100, 100, 100, SwCanvas::Colorspace::ABGR8888) == Result::Success);
+
+    auto picture = Picture::gen();
+    REQUIRE(picture);
+
+    string path(TEST_DIR"/rawimage_200x300.raw");
+
+    ifstream file(path);
+    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(canvas->push(move(picture)) == Result::Success);
+
+    REQUIRE(Initializer::term(CanvasEngine::Sw) == Result::Success);
+
+    free(data);
+}