Skip to content

Commit e35c3db

Browse files
committed
Add ImageFormatStub test
1 parent c053124 commit e35c3db

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,4 @@ add_subdirectory(engine)
3131
add_subdirectory(clock)
3232
add_subdirectory(timer)
3333
add_subdirectory(randomgenerator)
34+
add_subdirectory(imageformats)

test/imageformats/CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# stub
2+
add_executable(
3+
imageformatstub_test
4+
imageformatstub_test.cpp
5+
)
6+
7+
target_link_libraries(
8+
imageformatstub_test
9+
GTest::gtest_main
10+
scratchcpp
11+
)
12+
13+
gtest_discover_tests(imageformatstub_test)
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#include <imageformats/stub/imageformatstub.h>
2+
3+
#include "../common.h"
4+
5+
using namespace libscratchcpp;
6+
7+
TEST(ImageFormatStubTest, Width)
8+
{
9+
ImageFormatStub img;
10+
ASSERT_EQ(img.width(), 0);
11+
}
12+
13+
TEST(ImageFormatStubTest, Height)
14+
{
15+
ImageFormatStub img;
16+
ASSERT_EQ(img.height(), 0);
17+
}
18+
19+
TEST(ImageFormatStubTest, ColorAt)
20+
{
21+
ImageFormatStub img;
22+
ASSERT_EQ(img.colorAt(0, 0, 1), 0);
23+
ASSERT_EQ(img.colorAt(0, 1, 1), 0);
24+
ASSERT_EQ(img.colorAt(0, 2, 1), 0);
25+
ASSERT_EQ(img.colorAt(1, 0, 1), 0);
26+
ASSERT_EQ(img.colorAt(1, 1, 1), 0);
27+
ASSERT_EQ(img.colorAt(1, 2, 1), 0);
28+
ASSERT_EQ(img.colorAt(2, 0, 1), 0);
29+
ASSERT_EQ(img.colorAt(2, 1, 1), 0);
30+
ASSERT_EQ(img.colorAt(2, 2, 1), 0);
31+
ASSERT_EQ(img.colorAt(2, 2, 2.5), 0);
32+
}

0 commit comments

Comments
 (0)