Upload test images as artifacts

This commit is contained in:
Shylie 2024-05-28 13:23:49 -04:00
parent be6a31043a
commit 526924d02a
2 changed files with 14 additions and 4 deletions

View File

@ -23,9 +23,19 @@ jobs:
run: cmake -S curr -B curr/build -DGLERMINAL_TEST=ON && cmake --build curr/build run: cmake -S curr -B curr/build -DGLERMINAL_TEST=ON && cmake --build curr/build
- name: Build previous - name: Build previous
run: cmake -S prev -B prev/build -DGLERMINAL_TEST=ON && cmake --build prev/build run: cmake -S prev -B prev/build -DGLERMINAL_TEST=ON && cmake --build prev/build
- name: Generate PNG file for curr - name: Generate PNG file for current
run: cd curr/build/tests && XDG_RUNTIME_DIR=$PWD xvfb-run -a ./test-basic run: cd curr/build/tests && XDG_RUNTIME_DIR=$PWD xvfb-run -a ./test-basic
- name: Generate PNG file for prev - name: Generate PNG file for previous
run: cd prev/build/tests && XDG_RUNTIME_DIR=$PWD xvfb-run -a ./test-basic run: cd prev/build/tests && XDG_RUNTIME_DIR=$PWD xvfb-run -a ./test-basic
- name: Upload current PNG
uses: actions/upload-artifact@v4
with:
name: current-basic
path: curr/build/tests/image.png
- name: Upload previous PNG
uses: actions/upload-artifact@v4
with:
name: previous-basic
path: prev/build/tests/image.png
- name: Compare PNG files - name: Compare PNG files
run: diff curr/build/tests/image.png prev/build/tests/image.png run: diff curr/build/tests/image.png prev/build/tests/image.png

View File

@ -8,7 +8,7 @@
namespace namespace
{ {
unsigned char pixels[1280 * 800 * 3]; unsigned char pixels[(GRID_WIDTH * CELL_SCALE * 8) * (GRID_HEIGHT * CELL_SCALE * 8) * 3];
} }
void glerminal_test_save_image() void glerminal_test_save_image()
@ -21,5 +21,5 @@ void glerminal_test_save_image()
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGB, GL_UNSIGNED_BYTE, pixels); glGetTexImage(GL_TEXTURE_2D, 0, GL_RGB, GL_UNSIGNED_BYTE, pixels);
stbi_flip_vertically_on_write(true); 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); stbi_write_png("image.png", GRID_WIDTH * CELL_SCALE * 8, GRID_HEIGHT * CELL_SCALE * 8, 3, pixels, GRID_WIDTH * CELL_SCALE * 8 * 3);
} }