File tree Expand file tree Collapse file tree 7 files changed +89
-3
lines changed
Expand file tree Collapse file tree 7 files changed +89
-3
lines changed Original file line number Diff line number Diff line change @@ -78,6 +78,11 @@ qt_add_qml_module(scratchcpp-render
7878 effecttransform.h
7979)
8080
81+ target_sources (scratchcpp-render
82+ PRIVATE
83+ blocks/penblocks.cpp
84+ blocks/penblocks.h )
85+
8186list (APPEND QML_IMPORT_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} )
8287list (REMOVE_DUPLICATES QML_IMPORT_PATH)
8388set (QML_IMPORT_PATH ${QML_IMPORT_PATH} CACHE STRING "" FORCE )
Original file line number Diff line number Diff line change 1+ #include " penblocks.h"
2+
3+ using namespace scratchcpprender ;
4+ using namespace libscratchcpp ;
5+
6+ std::string PenBlocks::name () const
7+ {
8+ return " Pen" ;
9+ }
10+
11+ std::string PenBlocks::description () const
12+ {
13+ return name () + " blocks" ;
14+ }
15+
16+ Rgb PenBlocks::color () const
17+ {
18+ return rgb (15 , 189 , 140 );
19+ }
20+
21+ void PenBlocks::registerBlocks (IEngine *engine)
22+ {
23+ }
Original file line number Diff line number Diff line change 1+ #include < scratchcpp/iextension.h>
2+
3+ namespace scratchcpprender
4+ {
5+
6+ class PenBlocks : public libscratchcpp ::IExtension
7+ {
8+ public:
9+ std::string name () const override ;
10+ std::string description () const override ;
11+ libscratchcpp::Rgb color () const override ;
12+
13+ void registerBlocks (libscratchcpp::IEngine *engine) override ;
14+ };
15+
16+ } // namespace scratchcpprender
Original file line number Diff line number Diff line change 1212#include " valuemonitormodel.h"
1313#include " listmonitormodel.h"
1414#include " renderedtarget.h"
15- // #include "blocks/penblocks.h"
15+ #include " blocks/penblocks.h"
1616
1717using namespace scratchcpprender ;
1818using namespace libscratchcpp ;
@@ -37,8 +37,8 @@ ProjectLoader::ProjectLoader(QObject *parent) :
3737 initTimer ();
3838 m_renderTimer.start ();
3939
40- // TODO: Register pen blocks
41- // ScratchConfiguration::registerExtension(std::make_shared<PenBlocks>());
40+ // Register pen blocks
41+ ScratchConfiguration::registerExtension (std::make_shared<PenBlocks>());
4242}
4343
4444ProjectLoader::~ProjectLoader ()
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ add_subdirectory(penattributes)
3636add_subdirectory (penstate )
3737add_subdirectory (penlayer )
3838add_subdirectory (penlayerpainter )
39+ add_subdirectory (blocks )
3940add_subdirectory (graphicseffect )
4041add_subdirectory (shadermanager )
4142add_subdirectory (textbubbleshape )
Original file line number Diff line number Diff line change 1+ # pen_blocks_test
2+ add_executable (
3+ pen_blocks_test
4+ pen_blocks_test.cpp
5+ )
6+
7+ target_link_libraries (
8+ pen_blocks_test
9+ GTest::gtest_main
10+ GTest::gmock_main
11+ scratchcpp-render
12+ scratchcpprender_mocks
13+ ${QT_LIBS}
14+ )
15+
16+ add_test (pen_blocks_test )
17+ gtest_discover_tests (pen_blocks_test )
Original file line number Diff line number Diff line change 1+ #include < scratchcpp/project.h>
2+ #include < enginemock.h>
3+ #include < gtest/gtest.h>
4+
5+ #include " blocks/penblocks.h"
6+
7+ using namespace scratchcpprender ;
8+ using namespace libscratchcpp ;
9+
10+ class PenBlocksTest : public testing ::Test
11+ {
12+ public:
13+ void SetUp () override
14+ {
15+ m_extension = std::make_unique<PenBlocks>();
16+ m_engine = m_project.engine ().get ();
17+ m_extension->registerBlocks (m_engine);
18+ }
19+
20+ std::unique_ptr<IExtension> m_extension;
21+ Project m_project;
22+ IEngine *m_engine = nullptr ;
23+ EngineMock m_engineMock;
24+ };
You can’t perform that action at this time.
0 commit comments