Skip to content

Commit 38955d4

Browse files
committed
Register the pen extension
1 parent 1605034 commit 38955d4

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/projectloader.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <scratchcpp/iengine.h>
44
#include <scratchcpp/value.h>
55
#include <scratchcpp/monitor.h>
6+
#include <scratchcpp/scratchconfiguration.h>
67
#include <QtConcurrent/QtConcurrent>
78
#include <QApplication>
89

@@ -11,6 +12,7 @@
1112
#include "valuemonitormodel.h"
1213
#include "listmonitormodel.h"
1314
#include "renderedtarget.h"
15+
#include "blocks/penextension.h"
1416

1517
using namespace scratchcpprender;
1618
using namespace libscratchcpp;
@@ -31,6 +33,9 @@ ProjectLoader::ProjectLoader(QObject *parent) :
3133
});
3234

3335
initTimer();
36+
37+
// Register pen blocks
38+
ScratchConfiguration::registerExtension(std::make_shared<PenExtension>());
3439
}
3540

3641
ProjectLoader::~ProjectLoader()

test/projectloader/projectloader_test.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
#include <QtTest/QSignalSpy>
2+
#include <scratchcpp/scratchconfiguration.h>
23
#include <projectloader.h>
34
#include <spritemodel.h>
45
#include <valuemonitormodel.h>
56
#include <listmonitormodel.h>
7+
#include <blocks/penextension.h>
68
#include <enginemock.h>
79
#include <renderedtargetmock.h>
810

@@ -62,6 +64,9 @@ TEST_F(ProjectLoaderTest, Constructors)
6264
ProjectLoader loader1;
6365
ProjectLoader loader2(&loader1);
6466
ASSERT_EQ(loader2.parent(), &loader1);
67+
68+
// Pen extension should be registered
69+
ASSERT_TRUE(dynamic_cast<PenExtension *>(ScratchConfiguration::getExtension("pen")));
6570
}
6671

6772
TEST_F(ProjectLoaderTest, Load)

0 commit comments

Comments
 (0)