Fix Logger and other build issues (#7)
All checks were successful
Build ptprnt / build (push) Successful in 1m49s
All checks were successful
Build ptprnt / build (push) Successful in 1m49s
This branch fixes a couple of issues with the build - stop linking everything in a library which is then linked against a single main. It doesn't work the way I wanted. If functionality needs to be exposed by a library, it can be done later or with a separate target - This should also fix spdlog - Source files are now in a separate meson file using mesons files() feautre - Improve coverage generation by adding a script generating html coverage reports. This will hopefully keep the motivation higher to create more unit tests - Increase the code coverage a bit to demonstrate that statement above is not a fluke 😄 Reviewed-on: #7
This commit is contained in:
@@ -21,7 +21,9 @@
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
||||
TEST(basic_test, Bitmap_createBitmapWithCertainSize_yieldsSpecifiedSize) {
|
||||
auto bm = ptprnt::graphics::Bitmap<ptprnt::graphics::ALPHA8>(16, 8);
|
||||
@@ -64,3 +66,36 @@ TEST(basic_test, Bitmap_getBitmapColInsideOfImage_yieldsValidColSize) {
|
||||
auto colSize = col->size();
|
||||
ASSERT_EQ(8, colSize);
|
||||
}
|
||||
|
||||
TEST(basic_test, Bitmap_setPixels_setsGivenPixels) {
|
||||
auto bm = ptprnt::graphics::Bitmap<ptprnt::graphics::ALPHA8>(16, 8);
|
||||
std::vector<uint8_t> pix(16 * 8);
|
||||
|
||||
bm.setPixels(pix);
|
||||
auto pixCpy = bm.getPixelsCpy();
|
||||
|
||||
ASSERT_EQ(pix, pixCpy);
|
||||
}
|
||||
|
||||
TEST(basic_test, Bitmap_setPixels_isSuccessfulWithValidPixels) {
|
||||
auto bm = ptprnt::graphics::Bitmap<ptprnt::graphics::ALPHA8>(16, 8);
|
||||
std::vector<uint8_t> pix(16 * 8);
|
||||
|
||||
ASSERT_TRUE(bm.setPixels(pix));
|
||||
}
|
||||
|
||||
TEST(basic_test, Bitmap_setPixels_yieldsSamePixelsBack) {
|
||||
auto bm = ptprnt::graphics::Bitmap<ptprnt::graphics::ALPHA8>(16, 8);
|
||||
std::vector<uint8_t> pix(16 * 8);
|
||||
|
||||
bm.setPixels(pix);
|
||||
auto pixCpy = bm.getPixelsCpy();
|
||||
ASSERT_EQ(pix, pixCpy);
|
||||
}
|
||||
|
||||
TEST(basic_test, Bitmap_setPixelsWithWrongSize_isFailing) {
|
||||
auto bm = ptprnt::graphics::Bitmap<ptprnt::graphics::ALPHA8>(5, 8);
|
||||
std::vector<uint8_t> pix(16 * 8);
|
||||
|
||||
ASSERT_FALSE(bm.setPixels(pix));
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
tests = [['bitmap_test', 'bitmap_test_exe', ['bitmap_test/bitmap_test.cpp']],
|
||||
['image_test', 'image_test_exe', ['image_test/image_test.cpp']],
|
||||
['monochrome_test', 'monochrome_test_exe', ['monochrome_test/monochrome_test.cpp']]
|
||||
tests = [['bitmap_test', 'bitmap_test_exe', ptprnt_srcs + ['bitmap_test/bitmap_test.cpp']],
|
||||
['image_test', 'image_test_exe', ptprnt_srcs +['image_test/image_test.cpp']],
|
||||
['monochrome_test', 'monochrome_test_exe', ptprnt_srcs +['monochrome_test/monochrome_test.cpp']]
|
||||
]
|
||||
|
||||
foreach test : tests
|
||||
@@ -8,8 +8,7 @@ foreach test : tests
|
||||
executable(test.get(1),
|
||||
sources: test.get(2),
|
||||
include_directories: incdir,
|
||||
link_with:[ptprnt_lib],
|
||||
dependencies: [gtest_dep, pangocairo_dep]
|
||||
dependencies: [gtest_dep, usb_dep, log_dep, pangocairo_dep, cli11_dep]
|
||||
)
|
||||
)
|
||||
endforeach
|
Reference in New Issue
Block a user