Skip to content

Commit

Permalink
Force object position evaluation
Browse files Browse the repository at this point in the history
  • Loading branch information
PalumboN committed Mar 9, 2021
1 parent 3a6424d commit d126f05
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ class WollokConventionExtensions {
public static val DEFAULT_TEXT_COLOR = Color.BLUE


def static asVisual(WollokObject it) { new VisualComponent(it) }
def static asVisual(WollokObject it) {
position // Force evaluate position or MDU error
new VisualComponent(it)
}
def static asVisualIn(WollokObject it, WollokObject position) { new VisualComponentWithPosition(it, position) }


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ class GameTest extends AbstractWollokInterpreterTestCase {
assert.equals(1, game.at(0,1).allElements().size())
'''.test
}

@Test
def void noPositionableObjectShouldFailAsVisual() {
'''
assert.throwsException({ game.addVisual(object {}) })
'''.test
}

@Test
def void configOnPressKey() {
Expand Down

0 comments on commit d126f05

Please sign in to comment.