Fix minor issues and create a .clangd config for different builddirs
All checks were successful
Build ptprnt / build (push) Successful in 2m19s

This commit is contained in:
2025-10-19 14:47:52 +02:00
parent 56a3722da9
commit b24793bce6
7 changed files with 19 additions and 13 deletions

11
.clangd Normal file
View File

@@ -0,0 +1,11 @@
---
If:
PathMatch: tests/.*
CompileFlags:
CompilationDatabase: builddir-debug/
---
If:
PathMatch: src/.*
CompileFlags:
CompilationDatabase: builddir/

View File

@@ -5,9 +5,10 @@
"compilerPath": "/usr/bin/clang",
"cStandard": "c11",
"cppStandard": "c++20",
"compileCommands": "${workspaceFolder}/builddir/compile_commands.json",
"browse": {
"path": ["${workspaceFolder}"]
"path": [
"${workspaceFolder}"
]
}
}
],

View File

@@ -1,7 +1,6 @@
{
"clangd.arguments": [
"-background-index",
"-compile-commands-dir=builddir/"
],
"editor.formatOnType": false,
"editor.formatOnSave": true,

View File

@@ -25,8 +25,8 @@
#include <memory>
#include <vector>
#include "../../tests/mocks/MockCairoWrapper.hpp"
#include "graphics/interface/ILabel.hpp"
#include "mocks/MockCairoWrapper.hpp"
using ::testing::_;
using ::testing::DoAll;

View File

@@ -57,9 +57,6 @@ TEST(basic_test, Monochrome_convertWithCustomThreshhold_yieldsMonochromeRespecti
}
TEST(basic_test, Monochrome_convertNonAlignedPixels_spillsOverIntoNewByte) {
// TODO: We need to find to access the vector without the possiblity of out-of-bounds access
// Ideas: constexpr? compile time check?
GTEST_SKIP() << "Skipping this test, as ASAN will halt as this is an out-of-bounds access";
const std::vector<uint8_t> pixels(
{0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF});

View File

@@ -22,9 +22,9 @@
#include <memory>
#include "../../tests/mocks/MockUsbDevice.hpp"
#include "graphics/Bitmap.hpp"
#include "graphics/Monochrome.hpp"
#include "mocks/MockUsbDevice.hpp"
#include "printers/P700Printer.hpp"
using ::testing::_;
@@ -39,8 +39,8 @@ namespace ptprnt::printer {
class P700PrinterTest : public ::testing::Test {
protected:
void SetUp() override {
printer = std::make_unique<P700Printer>();
mockUsbDev = std::make_shared<NiceMock<libusbwrap::MockUsbDevice>>();
printer = std::make_unique<P700Printer>();
mockUsbDev = std::make_shared<NiceMock<libusbwrap::MockUsbDevice>>();
// Default mock behaviors
ON_CALL(*mockUsbDev, open()).WillByDefault(Return(true));

View File

@@ -23,8 +23,6 @@
#include <memory>
#include <vector>
#include "../../tests/mocks/MockPrinterDriver.hpp"
#include "../../tests/mocks/MockUsbDevice.hpp"
#include "core/PrinterDriverFactory.hpp"
#include "core/PrinterService.hpp"