MLX42 1.0
MLX42
Loading...
Searching...
No Matches
tests.cpp File Reference
#include "WindowFixture.hpp"
Include dependency graph for tests.cpp:

Go to the source code of this file.

Functions

 TEST_F (Window, Basic)
 
 TEST (MWindow, Settings)
 
 TEST_F (Window, SingleImage)
 
 TEST_F (Window, MultipleImages)
 
static void ft_draw (void *param)
 
 TEST_F (Window, stringTortureTest)
 

Function Documentation

◆ ft_draw()

static void ft_draw ( void param)
static

Definition at line 89 of file tests.cpp.

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}
mlx_image_t * mlx_put_string(mlx_t *mlx, const char *str, int32_t x, int32_t y)
Definition mlx_font.c:60
void mlx_close_window(mlx_t *mlx)
Definition mlx_exit.c:26
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
GLint GLsizei count
Definition glad.h:2869
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition glad.h:4719
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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ TEST()

TEST ( MWindow  ,
Settings   
)

Definition at line 25 of file tests.cpp.

26{
32
35 mlx_t *mlx = mlx_init(400, 400, "MLX42", false);
36 ASSERT_NE(mlx, nullptr);
38
41
42 // Set all settings to default
47}
mlx_t * mlx_init(int32_t width, int32_t height, const char *title, bool resize)
Definition mlx_init.c:164
@ 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_set_setting(mlx_settings_t setting, int32_t value)
Definition mlx_init.c:213
void mlx_terminate(mlx_t *mlx)
Definition mlx_exit.c:36
Here is the call graph for this function:

◆ TEST_F() [1/4]

TEST_F ( Window  ,
Basic   
)

Definition at line 18 of file tests.cpp.

19{
20 // Basic window is already tested in the fixture
21}

◆ TEST_F() [2/4]

TEST_F ( Window  ,
MultipleImages   
)

Definition at line 63 of file tests.cpp.

64{
66 ASSERT_NE(img1, nullptr);
68
70 ASSERT_NE(img2, nullptr);
72
74 EXPECT_GE(val1, 0);
76
78 EXPECT_GE(val2, 0);
80
83
86}
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_image_t * mlx_new_image(mlx_t *mlx, uint32_t width, uint32_t height)
Definition mlx_images.c:161
static const int32_t width
static const int32_t height
Here is the call graph for this function:

◆ TEST_F() [3/4]

TEST_F ( Window  ,
SingleImage   
)

Definition at line 49 of file tests.cpp.

Here is the call graph for this function:

◆ TEST_F() [4/4]

TEST_F ( Window  ,
stringTortureTest   
)

Definition at line 118 of file tests.cpp.

119{
121 ASSERT_NE(img, nullptr);
123
124 memset(img->pixels, 255, sizeof(int32_t) * img->width * img->height);
125
129
131 EXPECT_EQ(val_hook, true);
133
134 mlx_loop(mlx);
136
139}
void mlx_loop(mlx_t *mlx)
Definition mlx_loop.c:97
bool mlx_loop_hook(mlx_t *mlx, void(*f)(void *), void *param)
Definition mlx_loop.c:70
static void ft_draw(void *param)
Definition tests.cpp:89
Here is the call graph for this function: