2 * Copyright (c) 2021 - 2022 Samsung Electronics Co., Ltd. All rights reserved.
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in all
12 * copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28 TEST_CASE("Saver Creation", "[tvgSavers]")
30 auto saver = Saver::gen();
34 TEST_CASE("Save empty shape", "[tvgSavers]")
36 auto shape = Shape::gen();
39 auto saver = Saver::gen();
42 REQUIRE(saver->save(move(shape), TEST_DIR"/test.tvg") == Result::Unknown);
45 TEST_CASE("Save svg into tvg", "[tvgSavers]")
47 REQUIRE(Initializer::init(CanvasEngine::Sw, 0) == Result::Success);
49 auto picture = Picture::gen();
51 REQUIRE(picture->load(TEST_DIR"/tag.svg") == Result::Success);
53 auto saver = Saver::gen();
56 REQUIRE(saver->save(move(picture), TEST_DIR"/tag.tvg") == Result::Success);
57 REQUIRE(saver->sync() == Result::Success);
59 REQUIRE(Initializer::term(CanvasEngine::Sw) == Result::Success);
62 TEST_CASE("Save scene into tvg", "[tvgSavers]")
64 REQUIRE(Initializer::init(CanvasEngine::Sw, 0) == Result::Success);
66 auto picture = tvg::Picture::gen();
68 REQUIRE(picture->load(TEST_DIR"/test.png") == Result::Success);
69 REQUIRE(picture->translate(50, 0) == Result::Success);
70 REQUIRE(picture->scale(2) == Result::Success);
72 auto mask = tvg::Shape::gen();
74 REQUIRE(mask->appendCircle(400, 400, 15, 15) == Result::Success);
75 REQUIRE(mask->fill(0, 0, 0, 255) == Result::Success);
76 REQUIRE(picture->composite(move(mask), tvg::CompositeMethod::InvAlphaMask) == Result::Success);
78 auto saver = Saver::gen();
80 REQUIRE(saver->save(move(picture), TEST_DIR"/test.tvg") == Result::Success);
81 REQUIRE(saver->sync() == Result::Success);
83 REQUIRE(Initializer::term(CanvasEngine::Sw) == Result::Success);