diff --git a/test/images/tag.tvg b/test/images/tag.tvg index db992761..0ce8f0a6 100644 Binary files a/test/images/tag.tvg and b/test/images/tag.tvg differ diff --git a/test/images/test.tvg b/test/images/test.tvg index 22b10cef..7f46de36 100644 Binary files a/test/images/test.tvg and b/test/images/test.tvg differ diff --git a/test/testScene.cpp b/test/testScene.cpp index 82456791..34144e1a 100644 --- a/test/testScene.cpp +++ b/test/testScene.cpp @@ -41,10 +41,20 @@ TEST_CASE("Pushing Paints Into Scene", "[tvgScene]") auto scene = Scene::gen(); REQUIRE(scene); + Paint* paints[3]; + //Pushing Paints - REQUIRE(scene->push(Shape::gen()) == Result::Success); - REQUIRE(scene->push(Picture::gen()) == Result::Success); - REQUIRE(scene->push(Scene::gen()) == Result::Success); + auto p1 = Shape::gen(); + paints[0] = p1.get(); + REQUIRE(scene->push(std::move(p1)) == Result::Success); + + auto p2 = Picture::gen(); + paints[1] = p2.get(); + REQUIRE(scene->push(std::move(p2)) == Result::Success); + + auto p3 = Picture::gen(); + paints[2] = p3.get(); + REQUIRE(scene->push(std::move(p3)) == Result::Success); //Pushing Null Pointer REQUIRE(scene->push(nullptr) == Result::MemoryCorruption); @@ -52,6 +62,15 @@ TEST_CASE("Pushing Paints Into Scene", "[tvgScene]") //Pushing Invalid Paint std::unique_ptr shape = nullptr; REQUIRE(scene->push(std::move(shape)) == Result::MemoryCorruption); + + //Check list of paints + auto list = scene->paints(); + REQUIRE(list.size() == 3); + int idx = 0; + for (auto paint : list) { + REQUIRE(paints[idx] == paint); + ++idx; + } } TEST_CASE("Scene Clear", "[tvgScene]") diff --git a/test/testSwCanvasBase.cpp b/test/testSwCanvasBase.cpp index 6b4fde75..b2fc1130 100644 --- a/test/testSwCanvasBase.cpp +++ b/test/testSwCanvasBase.cpp @@ -50,7 +50,11 @@ TEST_CASE("Pushing Paints", "[tvgSwCanvasBase]") REQUIRE(canvas->clear() == Result::Success); - REQUIRE(canvas->push(Shape::gen()) == Result::Success); + Paint* paints[2]; + + auto p1 = Shape::gen(); + paints[0] = p1.get(); + REQUIRE(canvas->push(std::move(p1)) == Result::Success); //Negative case 1 REQUIRE(canvas->push(nullptr) == Result::MemoryCorruption); @@ -59,11 +63,23 @@ TEST_CASE("Pushing Paints", "[tvgSwCanvasBase]") std::unique_ptr shape6 = nullptr; REQUIRE(canvas->push(std::move(shape6)) == Result::MemoryCorruption); - //Negative case 3 - REQUIRE(canvas->push(Shape::gen()) == Result::Success); + auto p2 = Shape::gen(); + paints[1] = p2.get(); + REQUIRE(canvas->push(std::move(p2)) == Result::Success); REQUIRE(canvas->draw() == Result::Success); + + //Negative case 3 REQUIRE(canvas->push(Shape::gen()) == Result::InsufficientCondition); + //Check list of paints + auto list = canvas->paints(); + REQUIRE(list.size() == 2); + int idx = 0; + for (auto paint : list) { + REQUIRE(paints[idx] == paint); + ++idx; + } + REQUIRE(Initializer::term(CanvasEngine::Sw) == Result::Success); } @@ -225,4 +241,4 @@ TEST_CASE("Asynchronized Drawing", "[tvgSwCanvasBase]") REQUIRE(canvas->sync() == Result::Success); REQUIRE(Initializer::term(CanvasEngine::Sw) == Result::Success); -} +} \ No newline at end of file