Fix video selection bug (#419)

* Fix video selection bug

* Refactor key handling

* comment
This commit is contained in:
Brahim Hadriche authored and GitHub committed 2024-07-04 11:16:09 -04:00
1 parent 896d0b9bf3
commit ebc5d81180
28 files changed
+216 -160

No files matched your search

@@ -16,9 +16,9 @@ namespace Tests
node1 = CreateObject("roSGNode", "Node")
node2 = CreateObject("roSGNode", "Node")
m.top@.SetNavigation(node1, "right", node2)
m.top@.SetNavigation(node1, RemoteKeys.Right, node2)
m.assertAAHasKey(m.node._navigation, "right")
m.assertAAHasKey(m.node._navigation, RemoteKeys.Right)
end function
@it("navigates to the right node")
@@ -26,12 +26,12 @@ namespace Tests
node1 = CreateObject("roSGNode", "Node")
node2 = CreateObject("roSGNode", "Node")
m.top@.SetNavigation(node1, "right", node2)
m.top@.SetNavigation(node1, RemoteKeys.Right, node2)
NodeSetFocus(node1, true)
node2.focusable = true
m.top@.NavigationKeyHandler("right", true)
m.top@.NavigationKeyHandler(RemoteKeys.Right, true)
m.assertFalse(node1.hasFocus())
m.assertTrue(node2.hasFocus())
@@ -41,11 +41,11 @@ namespace Tests
function _()
node2 = CreateObject("roSGNode", "Node")
m.top@.SetNavigation(invalid, "right", node2)
m.top@.SetNavigation(invalid, RemoteKeys.Right, node2)
node2.focusable = true
m.top@.NavigationKeyHandler("right", true)
m.top@.NavigationKeyHandler(RemoteKeys.Right, true)
m.assertTrue(node2.hasFocus())
end function
@@ -0,0 +1,20 @@
' https://developer.roku.com/en-ca/docs/references/scenegraph/component-functions/onkeyevent.md
enum RemoteKeys
Back = "back"
Up = "up"
Down = "down"
Left = "left"
Right = "right"
Ok = "OK"
Replay = "replay"
Play = "play"
PlayOnly = "playonly"
Rewind = "rewind"
FastForward = "fastforward"
Options = "options"
Pause = "pause"
' Long press keys - these are not standard, and used to handle long press events
OkLongPress = "OK_LONG_PRESS"
OptionsLongPress = "OPTIONS_LONG_PRESS"
end enum