Add MLX42 V3

This commit is contained in:
Etienne Rey-bethbeder
2023-04-26 14:03:40 +02:00
parent bc5fc2fc59
commit baab9b52cd
22 changed files with 125 additions and 298 deletions

View File

@ -1,12 +1,12 @@
# -----------------------------------------------------------------------------
# Codam Coding College, Amsterdam @ 2022-2023 by Jelle van Kraaij.
# Codam Coding College, Amsterdam @ 2022-2023 by W2Wizard.
# See README in the root project for more information.
# -----------------------------------------------------------------------------
set(TEST_EXECUTABLE_NAME unit_tests)
# Download GoogleTest
# -----------------------------------------------------------------------------
# --------------------------------------------------
include(GoogleTest)
include(FetchContent)
@ -19,7 +19,7 @@ FetchContent_Declare(
FetchContent_MakeAvailable(googletest)
# -----------------------------------------------------------------------------
# --------------------------------------------------
add_executable(
${TEST_EXECUTABLE_NAME}
tests.cpp
@ -35,6 +35,6 @@ set_property(TARGET ${TEST_EXECUTABLE_NAME} PROPERTY CXX_STANDARD 14)
# Add tests to CTest
# Set working directory to the the testing folder so that the test can find their test files
# -----------------------------------------------------------------------------
# --------------------------------------------------
gtest_discover_tests(${TEST_EXECUTABLE_NAME} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} TEST_PREFIX "MLX42.")
enable_testing()

View File

@ -1,17 +1,13 @@
// -----------------------------------------------------------------------------
// Codam Coding College, Amsterdam @ 2022-2023 by Jelle van Kraaij.
// See README in the root project for more information.
// -----------------------------------------------------------------------------
# pragma once
# include <gtest/gtest.h>
# include <MLX42/MLX42.h>
class Window : public ::testing::Test
{
protected:
mlx_t* mlx = nullptr;
mlx_t* mlx = NULL;
static constexpr const char* name = "MLX42";
static const int32_t height = 400;

View File

@ -1,10 +1,10 @@
// -----------------------------------------------------------------------------
// Codam Coding College, Amsterdam @ 2022-2023 by Jelle van Kraaij.
// See README in the root project for more information.
// -----------------------------------------------------------------------------
#include <gtest/gtest.h>
#include <MLX42/MLX42.h>
// --------------------------------------------
// If your new to gtest follow the following documentation:
// http://google.github.io/googletest/primer.html
// --------------------------------------------
#include "WindowFixture.hpp"
@ -70,7 +70,7 @@ TEST_F(Window, MultipleImages)
ASSERT_NE(img2, nullptr);
ASSERT_EQ(mlx_errno, MLX_SUCCESS);
int32_t val1 = mlx_image_to_window(mlx, img1, Window::width / 4, Window::height / 4);
int32_t val1 = mlx_image_to_window(mlx, img1, Window::width / 4 , Window::height / 4);
EXPECT_GE(val1, 0);
ASSERT_EQ(mlx_errno, MLX_SUCCESS);
@ -117,7 +117,7 @@ static void ft_draw(void* param)
TEST_F(Window, stringTortureTest)
{
mlx_image_t *img = mlx_new_image(mlx, Window::width / 2, Window::height / 2);
mlx_image_t *img = mlx_new_image(mlx,Window::width / 2 , Window::height / 2);
ASSERT_NE(img, nullptr);
ASSERT_EQ(mlx_errno, MLX_SUCCESS);