crypto icon indicating copy to clipboard operation
crypto copied to clipboard

Is there a way to mock m.top.getScene() call?

Open adheus opened this issue 5 years ago • 1 comments

I currently have a component that is dependent on m.top.getScene(). Is there a way to mock this function so I wouldn't have to change the current code base?

Currently, it isn't available in a Node scope.

SomeNode.brs(17,19-20): 'getScene' is not a function and cannot be called.Runtime error encountered in BRS implementation:  Error: Something terrible happened and we didn't throw a `BlockEnd` instance.

The getScene() function is declared in the ifSGNodeChildren interface, which is implemented by roSGNode:

getScene() as roSGNode

Description Returns the node's root Scene. This returns a valid Scene even if the node is not parented.

Return Value The node's root Scene.

adheus avatar Jul 31 '20 16:07 adheus

We don't currently have any scene support, unfortunately. But I think that it should be possible to mock it with #495.

lkipke avatar Aug 07 '20 20:08 lkipke