File: test_lottieanimation_capi.cpp

package info (click to toggle)
rlottie 0.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 9,264 kB
  • sloc: cpp: 20,304; asm: 221; ansic: 194; makefile: 16
file content (34 lines) | stat: -rw-r--r-- 889 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <gtest/gtest.h>
#include "rlottie_capi.h"

class AnimationCApiTest : public ::testing::Test {
public:
    void SetUp()
    {
        animationInvalid = lottie_animation_from_file("wrong_file.json");
        std::string filePath = DEMO_DIR;
        filePath +="mask.json";
        animation = lottie_animation_from_file(filePath.c_str());

    }
    void TearDown()
    {
        if (animation) lottie_animation_destroy(animation);
    }
public:
    Lottie_Animation *animationInvalid;
    Lottie_Animation *animation;
};

TEST_F(AnimationCApiTest, loadFromFile_N) {
    ASSERT_FALSE(animationInvalid);
}

TEST_F(AnimationCApiTest, loadFromFile) {
    ASSERT_TRUE(animation);
    ASSERT_EQ(lottie_animation_get_totalframe(animation), 30);
    size_t width, height;
    lottie_animation_get_size(animation, &width, &height);
    ASSERT_EQ(width, 500);
    ASSERT_EQ(height, 500);
}