42_cube3D/MLX42/tests/WindowFixture.hpp
Etienne Rey-bethbeder baab9b52cd Add MLX42 V3
2023-04-26 14:03:40 +02:00

34 lines
689 B
C++

# pragma once
# include <gtest/gtest.h>
# include <MLX42/MLX42.h>
class Window : public ::testing::Test
{
protected:
mlx_t* mlx = NULL;
static constexpr const char* name = "MLX42";
static const int32_t height = 400;
static const int32_t width = 400;
inline void SetUp() override
{
// reset error code as it is shared between tests
mlx_errno = MLX_SUCCESS;
mlx_set_setting(MLX_HEADLESS, true);
ASSERT_EQ(mlx_errno, MLX_SUCCESS);
mlx = mlx_init(width, height, name, false);
ASSERT_NE(mlx, nullptr);
ASSERT_EQ(mlx_errno, MLX_SUCCESS);
}
inline void TearDown() override
{
ASSERT_NE(mlx, nullptr);
mlx_terminate(mlx);
ASSERT_EQ(mlx_errno, MLX_SUCCESS);
}
};