MLX42 1.0
MLX42
Loading...
Searching...
No Matches
tests.cpp
Go to the documentation of this file.
1// -----------------------------------------------------------------------------
2// Codam Coding College, Amsterdam @ 2022-2023 by Jelle van Kraaij.
3// See README in the root project for more information.
4// -----------------------------------------------------------------------------
5
6// If your new to gtest follow the following documentation:
7// http://google.github.io/googletest/primer.html
8
9#include "WindowFixture.hpp"
10
11// --------------------------------------------
12// Fixture for window tests
13// For every TEST_F(window, ...) the SetUp() and TearDown() functions are called
14// MLX can be accessed via the mlx variable in each test
15// For the implementation of the fixture see tests/windowFixture.hpp
16// --------------------------------------------
17
19{
20 // Basic window is already tested in the fixture
21}
22
23
24// NOTE: This test cannot be run with a fixture because the settings need to be set before the window is created
48
62
87
88
89static void ft_draw(void* param)
90{
91 static char buf[256];
92 static int32_t count = 0;
93 static mlx_image_t* img = nullptr;
94 mlx_t* mlx = (mlx_t*)param;
95
96 if (img == nullptr)
97 {
100 }
101
102 // Cheap itoa lol
103 memset(buf, '\0', sizeof(buf));
104 snprintf(buf, sizeof(buf), "%d", count);
105
106 img = mlx_put_string(mlx, buf, 0, 0);
107 ASSERT_NE(img, nullptr);
109
110 if (count >= 420)
111 {
114 }
115 count++;
116}
117
int32_t mlx_image_to_window(mlx_t *mlx, mlx_image_t *img, int32_t x, int32_t y)
Definition mlx_images.c:121
mlx_t * mlx_init(int32_t width, int32_t height, const char *title, bool resize)
Definition mlx_init.c:164
mlx_image_t * mlx_put_string(mlx_t *mlx, const char *str, int32_t x, int32_t y)
Definition mlx_font.c:60
@ MLX_DECORATED
Definition MLX42.h:402
@ MLX_MAXIMIZED
Definition MLX42.h:401
@ MLX_HEADLESS
Definition MLX42.h:403
@ MLX_FULLSCREEN
Definition MLX42.h:400
@ MLX_STRETCH_IMAGE
Definition MLX42.h:399
void mlx_close_window(mlx_t *mlx)
Definition mlx_exit.c:26
void mlx_set_setting(mlx_settings_t setting, int32_t value)
Definition mlx_init.c:213
mlx_errno
Definition MLX42.h:371
@ MLX_SUCCESS
Definition MLX42.h:372
void mlx_delete_image(mlx_t *mlx, mlx_image_t *image)
Definition mlx_images.c:204
mlx_image_t * mlx_new_image(mlx_t *mlx, uint32_t width, uint32_t height)
Definition mlx_images.c:161
void mlx_loop(mlx_t *mlx)
Definition mlx_loop.c:97
void mlx_terminate(mlx_t *mlx)
Definition mlx_exit.c:36
bool mlx_loop_hook(mlx_t *mlx, void(*f)(void *), void *param)
Definition mlx_loop.c:70
static const int32_t width
static const int32_t height
GLint GLsizei count
Definition glad.h:2869
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition glad.h:4719
GLuint GLfloat * val
Definition glad.h:3979
GLuint GLsizei GLsizei * length
Definition glad.h:3372
GLint void * img
Definition glad.h:3003
GLenum GLfloat param
Definition glad.h:1968
Definition MLX42.h:361
TEST(MWindow, Settings)
Definition tests.cpp:25
TEST_F(Window, Basic)
Definition tests.cpp:18
static void ft_draw(void *param)
Definition tests.cpp:89