Line 32: |
Line 32: |
| Basic structure of the code would look like: | | Basic structure of the code would look like: |
| | | |
− | root = uitree.get_root() | + | root = uitree.get_root() |
− | activity = root.find_child(name="HelloWorld Activity", | + | activity = root.find_child(name="HelloWorld Activity", |
− | role_name="frame")
| + | role_name="frame") |
− | toolbox = activity.find_children()[0] | + | toolbox = activity.find_children()[0] |
− | stop_button = toolbox.find_child(name="StopButton") | + | stop_button = toolbox.find_child(name="StopButton") |
− | assert (stop_button != None) | + | assert (stop_button != None) |
− | activity_button = toolbox.find_child(name="ActivityButton") | + | activity_button = toolbox.find_child(name="ActivityButton") |
− | assert (activity_button != None) | + | assert (activity_button != None) |
| | | |
| - The second stage would be to test if the buttons work as expected, we'd get the button reference using the uitree module and use the do_action method to run that particular action. | | - The second stage would be to test if the buttons work as expected, we'd get the button reference using the uitree module and use the do_action method to run that particular action. |
| + | one_button = activity_node.find_child(name="1", |
| + | role_name="push button") |
| + | one_button.do_action("click") |
| | | |
− | An example from the calculate activity, there is a
| + | # check if 1 is entered in the text box |
− | | + | result = activity.find_child(name="", role_name="text") |
− | one_button = activity_node.find_child(name="1",
| + | assert(result.get_text() == "1") |
− | role_name="push button")
| |
− | one_button.do_action("click")
| |
− | | |
− | # check if 1 is entered in the text box | |
− | result = activity.find_child(name="", role_name="text") | |
− | assert(result.get_text() == "1") | |
− | | |
| | | |
| That's it for the technicalities of the project. I'd start working on the simpler activities (Read, Write, Calculate) and work my way towards some relatively complex ones (Etoys and TurtleArt). I figure Etoys and Turtle Art would take the most of the time, so I'd try to complete everything else and start on TurtleArt before the mid-evaluation week. | | That's it for the technicalities of the project. I'd start working on the simpler activities (Read, Write, Calculate) and work my way towards some relatively complex ones (Etoys and TurtleArt). I figure Etoys and Turtle Art would take the most of the time, so I'd try to complete everything else and start on TurtleArt before the mid-evaluation week. |