Skip to content

Commit

Permalink
Fix/add mc node support (#208)
Browse files Browse the repository at this point in the history
* bump

* add support for mc_Node
  • Loading branch information
georgejecook authored Dec 23, 2022
1 parent a467185 commit f25cc63
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 18 deletions.
8 changes: 7 additions & 1 deletion bsc-plugin/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,16 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### [5.3.3](https://github.com/georgejecook/rooibos/compare/5.3.2...5.3.3)
#### [5.3.4](https://github.com/georgejecook/rooibos/compare/5.3.3...5.3.4)

- fixes issue with creating main.brs file that would cause the entire project to go south [`#207`](https://github.com/georgejecook/rooibos/pull/207)
- bump [`567940c`](https://github.com/georgejecook/rooibos/commit/567940c5d17319bf792b61682a0cccf333cf20f0)
- bump to bsc 0.61.2 [`f0af100`](https://github.com/georgejecook/rooibos/commit/f0af1004ff265e4c0bbaf39dd35914a551f73d69)

#### [5.3.3](https://github.com/georgejecook/rooibos/compare/5.3.2...5.3.3)

> 21 December 2022
#### [5.3.2](https://github.com/georgejecook/rooibos/compare/5.3.1...5.3.2)

> 21 December 2022
Expand Down
2 changes: 1 addition & 1 deletion bsc-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rooibos-roku",
"version": "5.3.3",
"version": "5.3.4",
"description": "simple, flexible, fun brightscript test framework for roku scenegraph apps - roku brighterscript plugin",
"repository": {
"type": "git",
Expand Down
44 changes: 34 additions & 10 deletions framework/src/source/BaseTestSuite.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1176,10 +1176,17 @@ namespace rooibos
end if
try
if type(node) = "roSGNode"
if node.getChildCount() <> count
msg = "node items count <> " + Rooibos.Common.asString(count) + ". Received " + Rooibos.Common.asString(node.getChildCount())
m.currentResult.fail(msg, m.currentAssertLineNumber)
return false
if node.isSubType("mc_Node")
if node.isSubType("mc_Node")
childCount = node.length
else
childCount = node.getChildCount()
end if
if childCount <> count
msg = "node items count <> " + Rooibos.Common.asString(count) + ". Received " + Rooibos.Common.asString(childCount)
m.currentResult.fail(msg, m.currentAssertLineNumber)
return false
end if
end if
else
msg = "Input value is not an node."
Expand Down Expand Up @@ -1212,7 +1219,12 @@ namespace rooibos
end if
try
if type(node) = "roSGNode"
if node.getChildCount() = count
if node.isSubType("mc_Node")
childCount = node.length
else
childCount = node.getChildCount()
end if
if childCount = count
msg = "node items count = " + Rooibos.Common.asString(count) + "."
m.currentResult.fail(msg, m.currentAssertLineNumber)
return false
Expand Down Expand Up @@ -1247,7 +1259,12 @@ namespace rooibos
end if
try
if type(node) = "roSGNode"
if node.getChildCount() > 0
if node.isSubType("mc_Node")
childCount = node.length
else
childCount = node.getChildCount()
end if
if childCount > 0
msg = "node is not empty."
m.currentResult.fail(msg, m.currentAssertLineNumber)
return false
Expand Down Expand Up @@ -1350,10 +1367,17 @@ namespace rooibos
msg = "Node doesn't have the '" + Rooibos.Common.asString(value, true) + "' value."
m.currentResult.fail(msg, m.currentAssertLineNumber)
return false
else if node.getChildCount() <> 1
msg = "Node Contains speicified value; but other values as well"
m.currentResult.fail(msg, m.currentAssertLineNumber)
return false
else
if node.isSubType("mc_Node")
childCount = node.length
else
childCount = node.getChildCount()
end if
if childCount <> 1
msg = "Node Contains specified value; but other values as well"
m.currentResult.fail(msg, m.currentAssertLineNumber)
return false
end if
end if
else
msg = "Input value is not an Node."
Expand Down
21 changes: 15 additions & 6 deletions framework/src/source/CommonUtils.bs
Original file line number Diff line number Diff line change
Expand Up @@ -570,12 +570,21 @@ namespace rooibos.Common
' */
function findElementIndexInNode(node, value) as integer
if type(node) = "roSGNode"
for i = 0 to node.getChildCount() - 1
compareValue = node.getChild(i)
if type(compareValue) = "roSGNode" and compareValue.isSameNode(value)
return i
end if
next
if node.isSubType("mc_Node")
for i = 0 to node.length - 1
compareValue = node@.getChild(i)
if type(compareValue) = "roSGNode" and compareValue.isSameNode(value)
return i
end if
end for
else
for i = 0 to node.getChildCount() - 1
compareValue = node.getChild(i)
if type(compareValue) = "roSGNode" and compareValue.isSameNode(value)
return i
end if
end for
end if
end if
return -1
end function
Expand Down

0 comments on commit f25cc63

Please sign in to comment.