mirror of
https://git.shylie.info/shylie/glerminal.git
synced 2025-10-06 23:00:14 +00:00
Setup basic testing framework
This commit is contained in:
1724
tests/test-common/stb_image_write.h
Normal file
1724
tests/test-common/stb_image_write.h
Normal file
File diff suppressed because it is too large
Load Diff
21
tests/test-common/test-common.cpp
Normal file
21
tests/test-common/test-common.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#include <test-common.h>
|
||||
|
||||
#include <glerminal.h>
|
||||
#include <glad/glad.h>
|
||||
|
||||
#define STB_IMAGE_WRITE_IMPLEMENTATION
|
||||
#include <stb_image_write.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
unsigned char pixels[1280 * 800 * 3];
|
||||
}
|
||||
|
||||
void glerminal_test_save_image()
|
||||
{
|
||||
glReadBuffer(GL_LEFT);
|
||||
glReadPixels(0, 0, GRID_WIDTH * CELL_SCALE * 8, GRID_HEIGHT * CELL_SCALE * 8, GL_RGB, GL_UNSIGNED_BYTE, pixels);
|
||||
|
||||
stbi_flip_vertically_on_write(true);
|
||||
stbi_write_png("image.png", GRID_WIDTH * CELL_SCALE * 8, GRID_HEIGHT * CELL_SCALE * 8, 3, pixels, 1280 * 3);
|
||||
}
|
6
tests/test-common/test-common.h
Normal file
6
tests/test-common/test-common.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef GLERMINAL_TEST_COMMON_H
|
||||
#define GLERMINAL_TEST_COMMON_H
|
||||
|
||||
void glerminal_test_save_image();
|
||||
|
||||
#endif//GLERMINAL_TEST_COMMON_H
|
Reference in New Issue
Block a user