File tree Expand file tree Collapse file tree 6 files changed +9
-9
lines changed
Expand file tree Collapse file tree 6 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -20,8 +20,8 @@ class LIBSCRATCHCPP_EXPORT Comment : public Entity
2020 const std::string &blockId () const ;
2121 void setBlockId (const std::string id);
2222
23- std::shared_ptr< Block> block () const ;
24- void setBlock (std::shared_ptr< Block> block);
23+ Block * block () const ;
24+ void setBlock (Block * block);
2525
2626 double x () const ;
2727 void setX (double x);
Original file line number Diff line number Diff line change @@ -182,7 +182,7 @@ void Engine::resolveIds()
182182 block->setComment (comment);
183183
184184 if (comment) {
185- comment->setBlock (block);
185+ comment->setBlock (block. get () );
186186 assert (comment->blockId () == block->id ());
187187 }
188188 }
Original file line number Diff line number Diff line change @@ -28,13 +28,13 @@ void Comment::setBlockId(const std::string id)
2828}
2929
3030/* ! Returns the block the comment is attached to. */
31- std::shared_ptr< Block> Comment::block () const
31+ Block * Comment::block () const
3232{
3333 return impl->block ;
3434}
3535
3636/* ! Sets the block the comment is attached to. */
37- void Comment::setBlock (std::shared_ptr< Block> block)
37+ void Comment::setBlock (Block * block)
3838{
3939 impl->block = block;
4040
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ struct CommentPrivate
1616 CommentPrivate (const CommentPrivate &) = delete ;
1717
1818 std::string blockId;
19- std::shared_ptr< Block> block;
19+ Block * block = nullptr ;
2020 double x = 0 ;
2121 double y = 0 ;
2222 double width = 200 ;
Original file line number Diff line number Diff line change @@ -424,7 +424,7 @@ TEST(LoadProjectTest, LoadTestProject)
424424 auto commentBlock = sprite2->blockAt (sprite2->findBlock (" e" ));
425425 ASSERT_EQ (comment->id (), " w" );
426426 ASSERT_EQ (comment->blockId (), " e" );
427- ASSERT_EQ (comment->block (), commentBlock);
427+ ASSERT_EQ (comment->block (), commentBlock. get () );
428428 ASSERT_EQ (comment->x (), 247.3981475830078 );
429429 ASSERT_EQ (comment->y (), 208 );
430430 ASSERT_EQ (comment->width (), 189.62969970703125 );
Original file line number Diff line number Diff line change @@ -29,8 +29,8 @@ TEST(CommentTest, Block)
2929 ASSERT_TRUE (comment.blockId ().empty ());
3030
3131 auto block = std::make_shared<Block>(" abc" , " " );
32- comment.setBlock (block);
33- ASSERT_EQ (comment.block (), block);
32+ comment.setBlock (block. get () );
33+ ASSERT_EQ (comment.block (), block. get () );
3434 ASSERT_EQ (comment.blockId (), " abc" );
3535
3636 comment.setBlock (nullptr );
You can’t perform that action at this time.
0 commit comments