42_cube3D/MLX42/tests/WindowFixture.hpp

34 lines
689 B
C++
Raw Normal View History

2023-04-26 07:39:03 -04:00
# pragma once
# include <gtest/gtest.h>
2023-04-26 08:03:40 -04:00
2023-04-26 07:39:03 -04:00
# include <MLX42/MLX42.h>
class Window : public ::testing::Test
{
protected:
2023-04-26 08:03:40 -04:00
mlx_t* mlx = NULL;
2023-04-26 07:39:03 -04:00
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);
}
};