Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/Experior.Activity/script_calculate.py
blob: 93f0fa4bf89035980f2ad043246424ddbcd2402f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import time
import logging

sugarActivityName = 'Calculate'

def sugarbot_main(widgets):
	# Test 'selected' functionality.
	assert widgets['Share with:'].selected == "Private"
	widgets['Share with:'].selected = "My Neighborhood"
	assert widgets['Share with:'].selected == "My Neighborhood"

	# Test widget fetching/assignment
	one 	= widgets['1']
	plus 	= widgets['+']
	enter 	= widgets['enter']
	
	for i in range(0,5):
		# Test click
		one.click()
		plus.click()
		one.click()
		
		# Test Entry text assignment
		assert widgets['TextEntry'].text == '1+1'
		
		enter.click()
		
		assert len(widgets['TextEntry'].text) == 0
		
		time.sleep(1)
	
	# More Entry text assignment
	widgets['TextEntry'].text = "1+5"
	assert widgets['TextEntry'].text == '1+5'
	enter.click()