Skip to content

Commit c9f5998

Browse files
emaicusbmcutler
authored andcommitted
Updated 14 and 15 to use the new action specifications (#27)
1 parent 9286e29 commit c9f5998

File tree

2 files changed

+174
-49
lines changed

2 files changed

+174
-49
lines changed

examples/14_tkinter/config/config.json

+34-15
Original file line numberDiff line numberDiff line change
@@ -35,37 +35,56 @@
3535
//it is recommended that programs with GUIs begin with
3636
//an extra delay to allow student code time to fully
3737
//initialize.
38-
"delay 2",
38+
{
39+
"action" : "delay",
40+
"seconds" : 2
41+
},
3942
//This command will screenshot the student's window.
4043
//Pair it with the validation below to show it to
4144
//display it to the students.
42-
"screenshot",
45+
{
46+
"action" : "screenshot"
47+
},
4348
//The type command will submitty the provided characters
4449
//as keyboard input to the student's window.
45-
"type 'Submitty'",
50+
{
51+
"action" : "type",
52+
"string" : "Submitty"
53+
},
4654
//This screenshot should show the effects of the type command
4755
//above
48-
"screenshot",
56+
{
57+
"action" : "screenshot"
58+
},
4959
//We will now move the mouse (in pixels relative to the upper
5060
//left hand corner of the screen). This location correlates with
5161
//where the student's ok button should be. Note that we could have
5262
//required the student to map the button to a specific hotkey and typed
5363
//that instead.
54-
"mouse move 200 75",
64+
{
65+
"action" : "move mouse",
66+
"end_x" : 200,
67+
"end_y" : 75
68+
},
5569
//This delay is added merely so that instructors can watch the grading
5670
//happen, in practice it is unnecessary.
57-
"delay 1",
71+
{
72+
"action" : "delay",
73+
"seconds" : 1
74+
},
5875
//now we click the ok button.
59-
"click",
76+
{
77+
"action" : "click"
78+
},
6079
//This screenshot should show the effect of the previous command.
61-
"screenshot",
62-
"delay 1",
63-
//The no clamp option allows us to move the mouse 'outside' of the window
64-
//It is recommended that this option only be used after much testing to avoid
65-
//unwelcome interactions. In this case, it was necessary to access the 'x' in
66-
//border of the student's screen.
67-
"mouse move no clamp 10 -10",
68-
"click"],
80+
{
81+
"action" : "screenshot"
82+
},
83+
{
84+
"action" : "delay",
85+
"seconds" : 1
86+
}
87+
],
6988
// Point value of this testcase.
7089
"points" : 10,
7190
//These validation steps check for the screenshots taken above, which are created

examples/15_GLFW/config/config.json

+140-34
Original file line numberDiff line numberDiff line change
@@ -29,45 +29,139 @@
2929
//programs additional time to initialize. Actions are taken beginning
3030
//at window load time. Note that all actions are padded with a .1 sec
3131
//delay.
32-
"delay 1",
32+
{
33+
"action" : "delay",
34+
"seconds" : 1
35+
},
3336
//The click and drag delta command moves a specific distance from the
3437
//current mouse position. For additional information about actions
3538
//and their syntax, please view the submitty wiki.
36-
"click and drag delta 100 0",
39+
{
40+
"action" : "click and drag delta",
41+
"end_x" : 100
42+
},
3743
//This program uses many unecessarily delays. Experiment by removing
3844
//them.
39-
"delay 1",
40-
"click and drag delta -100 0",
41-
"delay 1",
42-
"click and drag delta 0 100",
43-
"delay 1",
44-
"click and drag delta 0 -100",
45-
"delay 1",
46-
"click and drag delta 1000 0",
47-
"delay 1",
48-
"click and drag delta -1000 0",
49-
"delay 1",
50-
"click and drag delta 0 160",
51-
"delay 1",
52-
"click and drag delta 0 -160",
53-
"delay 1",
54-
"click and drag delta 300 300",
55-
"delay 1",
45+
{
46+
"action" : "delay",
47+
"seconds" : 1
48+
},
49+
{
50+
"action" : "click and drag delta",
51+
"end_x" : -100
52+
},
53+
{
54+
"action" : "delay",
55+
"seconds" : 1
56+
},
57+
{
58+
"action" : "click and drag delta",
59+
"end_y" : 100
60+
},
61+
{
62+
"action" : "delay",
63+
"seconds" : 1
64+
},
65+
{
66+
"action" : "click and drag delta",
67+
"end_y" : -100
68+
},
69+
{
70+
"action" : "delay",
71+
"seconds" : 1
72+
},
73+
{
74+
"action" : "click and drag delta",
75+
"end_x" : 1000
76+
},
77+
{
78+
"action" : "delay",
79+
"seconds" : 1
80+
},
81+
{
82+
"action" : "click and drag delta",
83+
"end_x" : -1000
84+
},
85+
{
86+
"action" : "delay",
87+
"seconds" : 1
88+
},
89+
{
90+
"action" : "click and drag delta",
91+
"end_y" : 160
92+
},
93+
{
94+
"action" : "delay",
95+
"seconds" : 1
96+
},
97+
{
98+
"action" : "click and drag delta",
99+
"end_y" : -160
100+
},
101+
{
102+
"action" : "delay",
103+
"seconds" : 1
104+
},
105+
{
106+
"action" : "click and drag delta",
107+
"end_x" : 300,
108+
"end_y" : 300
109+
},
110+
{
111+
"action" : "delay",
112+
"seconds" : 1
113+
},
56114
//moves the mouse to 0,0 (upper left) on the window.
57-
"origin",
58-
"delay 1",
115+
{
116+
"action" : "origin"
117+
},
118+
{
119+
"action" : "delay",
120+
"seconds" : 1
121+
},
59122
//Centers the mouse on the screen
60-
"center",
61-
"delay 1",
62-
"mouse move 10 200",
63-
"delay 1",
64-
"click and drag 10 10 150 150",
65-
"delay 1",
66-
"click and drag 160 160",
123+
{
124+
"action" : "center"
125+
},
126+
{
127+
"action" : "delay",
128+
"seconds" : 1
129+
},
130+
{
131+
"action" : "move mouse",
132+
"end_x" : 10,
133+
"end_y" : 200
134+
},
135+
{
136+
"action" : "delay",
137+
"seconds" : 1
138+
},
139+
{
140+
"action" : "click and drag",
141+
"start_x" : 10,
142+
"start_y" : 10,
143+
"end_x" : 150,
144+
"end_y" : 150
145+
},
146+
{
147+
"action" : "delay",
148+
"seconds" : 1
149+
},
150+
{
151+
"action" : "click and drag",
152+
"end_x" : 160,
153+
"end_y" : 160
154+
},
67155
//takes a screenshot, labeled sequentially starting from 0.
68-
"screenshot",
156+
{
157+
"action" : "screenshot"
158+
},
69159
//In the provided application, q indicates a program quit.
70-
"type 'q'"],
160+
{
161+
"action" : "key",
162+
"key_combination" : "q"
163+
}
164+
],
71165
"points" : 1,
72166
"validation": [
73167
{
@@ -85,10 +179,22 @@
85179
"title" : "Graphics program 1",
86180
"command" : "./a.out -input sierpinski_triangle.txt -size 400 -iters 0 -cubes",
87181
"actions" : [
88-
"click and drag delta 50 -125",
89-
"delay 1",
90-
"screenshot",
91-
"type 'q'"
182+
{
183+
"action" : "click and drag delta",
184+
"end_x" : 50,
185+
"end_y" : -125
186+
},
187+
{
188+
"action" : "delay",
189+
"seconds" : 1
190+
},
191+
{
192+
"action" : "screenshot"
193+
},
194+
{
195+
"action" : "key",
196+
"key_combination" : "q"
197+
}
92198
],
93199
"points" : 1,
94200
"validation": [

0 commit comments

Comments
 (0)