Initial Video, Render, and Properties implementations.
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
#include <doctest/doctest.h>
|
||||
|
||||
#include <hdk/sdl/video/Surface.hpp>
|
||||
|
||||
|
||||
TEST_CASE("Surface bindings are exercised") {
|
||||
|
||||
auto surface = hdk::sdl::Surface::Create(10, 10, SDL_PIXELFORMAT_RGBA8888);
|
||||
REQUIRE(surface);
|
||||
|
||||
CHECK(surface->w == 10);
|
||||
CHECK(surface->h == 10);
|
||||
CHECK(surface->format == SDL_PIXELFORMAT_RGBA8888);
|
||||
|
||||
surface.Clear(1.0f, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
Uint8 r, g, b, a;
|
||||
CHECK(surface.ReadPixel(0, 0, &r, &g, &b, &a));
|
||||
CHECK(r == 255);
|
||||
CHECK(g == 0);
|
||||
CHECK(b == 0);
|
||||
CHECK(a == 255);
|
||||
|
||||
auto scaled = surface.Scale(20, 20, SDL_ScaleMode::SDL_SCALEMODE_LINEAR);
|
||||
REQUIRE(scaled);
|
||||
CHECK(scaled->w == 20);
|
||||
CHECK(scaled->h == 20);
|
||||
}
|
||||
Reference in New Issue
Block a user