Skip to content

Commit

Permalink
if no layer is given, uses the main partition for the prop container
Browse files Browse the repository at this point in the history
  • Loading branch information
niom committed Dec 6, 2012
1 parent 0e615e0 commit e69299a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions rapanui-sdk/RNScreen.lua
Expand Up @@ -71,6 +71,10 @@ function RNScreen:addRNObject(object, mode, layer)
return
end
if layer == nil then
layer = self.mainPartition
end
object:setLocatingMode(mode)
layer:insertProp(object:getProp())
Expand Down
7 changes: 7 additions & 0 deletions rapanui-test/RNScreenTest.lua
Expand Up @@ -151,6 +151,13 @@ function testThatTheObjectIsAddedToPartition()
assert_that(TEST_PARTITION.insertPropCalled,is(greater_than(0)))
end

function testThatTheObjectIsAddedToMainPartitionIfNoLayerIsGiven()
local rnscreen = init()
rnscreen:initWith(MVC.WIDTH, MVC.HEIGHT, MVC.SCREENWIDTH, MVC.SCREENHEIGHT)
rnscreen:addRNObject(RNOBJECT)
assert_that(TEST_PARTITION.insertPropCalled,is(greater_than(0)))
end

function testThatTheObjectIsAddedToGivenLayer()
local rnscreen = init()
rnscreen:initWith(MVC.WIDTH, MVC.HEIGHT, MVC.SCREENWIDTH, MVC.SCREENHEIGHT)
Expand Down

0 comments on commit e69299a

Please sign in to comment.