Skip to content

Commit

Permalink
chore: renames
Browse files Browse the repository at this point in the history
  • Loading branch information
enzoevers committed May 25, 2024
1 parent 3730e14 commit 5e2345a
Show file tree
Hide file tree
Showing 11 changed files with 73 additions and 39 deletions.
4 changes: 2 additions & 2 deletions Code/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ endif()
add_subdirectory(Common)
add_subdirectory(HAL)
add_subdirectory(Displays)
add_subdirectory(TextContent)
add_subdirectory(TextProvider)

if(NOT TEST_ON_PC)
set(EXECUTABLE_NAME LedDisplayDriverExecutable)
Expand All @@ -59,7 +59,7 @@ if(NOT TEST_ON_PC)
Common
HAL
Displays
TextContent
TextProvider
)
if(USE_STM32)
stm32_print_size_of_target(${EXECUTABLE_NAME})
Expand Down
1 change: 0 additions & 1 deletion Code/TextContent/src/TextContent.cpp

This file was deleted.

14 changes: 0 additions & 14 deletions Code/TextContent/test/CMakeLists.txt

This file was deleted.

14 changes: 0 additions & 14 deletions Code/TextContent/test/TestTextContent.cpp

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
add_library(TextContent STATIC
${CMAKE_CURRENT_SOURCE_DIR}/src/TextContent.cpp
add_library(TextProvider STATIC
${CMAKE_CURRENT_SOURCE_DIR}/src/TextBmhFormat.cpp
)

set(FONT_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/Generated/Fonts")
Expand All @@ -10,10 +10,10 @@ execute_process(COMMAND ${GENERATE_FONT_SCRIPT} ${FONT_INCLUDE_DIR} "Bitstream V
execute_process(COMMAND ${GENERATE_FONT_SCRIPT} ${FONT_INCLUDE_DIR} "Bitstream Vera Sans Mono" 12)
execute_process(COMMAND ${GENERATE_FONT_SCRIPT} ${FONT_INCLUDE_DIR} "Bitstream Vera Sans Mono" 16)

target_include_directories(TextContent PUBLIC ${FONT_INCLUDE_DIR}/../)
target_include_directories(TextProvider PUBLIC ${FONT_INCLUDE_DIR}/../)

target_include_directories(TextContent PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_link_libraries(TextContent Displays)
target_include_directories(TextProvider PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_link_libraries(TextProvider Displays)

if(TEST_ON_PC)
add_subdirectory(test)
Expand Down
34 changes: 34 additions & 0 deletions Code/TextProvider/include/ITextProvider.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#pragma once

#include <stdint.h>

#include "Monochrome.h"
#include "PixelArea.h"
#include "VecXD.h"

class ITextProvider {
public:
virtual ~ITextProvider() = default;

/*!
@return The dimensions required to show the character
*/
virtual auto GetRequiredSizeCharacter(char character) -> Vec2D;

/*!
@param string A null-terminated string
@param spacing The amount of pixels between characters in the string
@return The dimensions required to show the string
*/
virtual auto GetRequiredSizeString(char* string, uint8_t spacing) -> Vec2D;

/*!
@param string A null-terminated string
@param spacing The amount of pixels between characters in the string
@param offset The offset from the top-left of the
@return success
*/
virtual auto SetString(char* string, uint8_t spacing, Vec2D offset, PixelArea<Monochrome>& pixelArea) -> bool;

// Note: when new colors are required, copy paste the SetString(...) function interface
};
File renamed without changes.
1 change: 1 addition & 0 deletions Code/TextProvider/src/TextBmhFormat.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "TextBmhFormat.h"
14 changes: 14 additions & 0 deletions Code/TextProvider/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
add_executable(TestTextProvider
${CMAKE_CURRENT_SOURCE_DIR}/TestTextBmhFormat.cpp
)

link_fuzztest(TestTextProvider)

target_link_libraries(TestTextProvider PRIVATE
gtest
gmock
gtest_main
TextProvider
)

gtest_discover_tests(TestTextProvider)
14 changes: 14 additions & 0 deletions Code/TextProvider/test/TestTextBmhFormat.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "TextBmhFormat.h"
#include "fuzztest/fuzztest.h"
#include "gmock/gmock.h"

using namespace testing;
using namespace fuzztest;

namespace TextBmhFormatTesting {

class FixtureTextBmhFormat : public Test {};

TEST_F(FixtureTextBmhFormat, dummy) { ASSERT_TRUE(true); }

} // namespace TextBmhFormatTesting
6 changes: 3 additions & 3 deletions Scripts/Test/RunTest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,12 @@ GenerateTraceFile TestDisplays ${BUILD_DIR_TEST}/Displays/test/

echo
echo "//========================="
echo "// Running TestTextContent"
echo "// Running TestTextProvider"
echo "//========================="
echo

RunTests TestTextContent ${BUILD_DIR_TEST}/TextContent/test/
GenerateTraceFile TestTextContent ${BUILD_DIR_TEST}/TextContent/test/
RunTests TestTextProvider ${BUILD_DIR_TEST}/TextProvider/test/
GenerateTraceFile TestTextProvider ${BUILD_DIR_TEST}/TextProvider/test/

echo
echo "//========================="
Expand Down

0 comments on commit 5e2345a

Please sign in to comment.