From c9f599830909fb1ae921704e0e24ea71b43ac600 Mon Sep 17 00:00:00 2001 From: Evan Maicus Date: Thu, 12 Dec 2019 20:18:22 -0500 Subject: [PATCH] Updated 14 and 15 to use the new action specifications (#27) --- examples/14_tkinter/config/config.json | 49 ++++--- examples/15_GLFW/config/config.json | 174 ++++++++++++++++++++----- 2 files changed, 174 insertions(+), 49 deletions(-) diff --git a/examples/14_tkinter/config/config.json b/examples/14_tkinter/config/config.json index 1244433..fbc5bca 100644 --- a/examples/14_tkinter/config/config.json +++ b/examples/14_tkinter/config/config.json @@ -35,37 +35,56 @@ //it is recommended that programs with GUIs begin with //an extra delay to allow student code time to fully //initialize. - "delay 2", + { + "action" : "delay", + "seconds" : 2 + }, //This command will screenshot the student's window. //Pair it with the validation below to show it to //display it to the students. - "screenshot", + { + "action" : "screenshot" + }, //The type command will submitty the provided characters //as keyboard input to the student's window. - "type 'Submitty'", + { + "action" : "type", + "string" : "Submitty" + }, //This screenshot should show the effects of the type command //above - "screenshot", + { + "action" : "screenshot" + }, //We will now move the mouse (in pixels relative to the upper //left hand corner of the screen). This location correlates with //where the student's ok button should be. Note that we could have //required the student to map the button to a specific hotkey and typed //that instead. - "mouse move 200 75", + { + "action" : "move mouse", + "end_x" : 200, + "end_y" : 75 + }, //This delay is added merely so that instructors can watch the grading //happen, in practice it is unnecessary. - "delay 1", + { + "action" : "delay", + "seconds" : 1 + }, //now we click the ok button. - "click", + { + "action" : "click" + }, //This screenshot should show the effect of the previous command. - "screenshot", - "delay 1", - //The no clamp option allows us to move the mouse 'outside' of the window - //It is recommended that this option only be used after much testing to avoid - //unwelcome interactions. In this case, it was necessary to access the 'x' in - //border of the student's screen. - "mouse move no clamp 10 -10", - "click"], + { + "action" : "screenshot" + }, + { + "action" : "delay", + "seconds" : 1 + } + ], // Point value of this testcase. "points" : 10, //These validation steps check for the screenshots taken above, which are created diff --git a/examples/15_GLFW/config/config.json b/examples/15_GLFW/config/config.json index ee93536..ea43692 100644 --- a/examples/15_GLFW/config/config.json +++ b/examples/15_GLFW/config/config.json @@ -29,45 +29,139 @@ //programs additional time to initialize. Actions are taken beginning //at window load time. Note that all actions are padded with a .1 sec //delay. - "delay 1", + { + "action" : "delay", + "seconds" : 1 + }, //The click and drag delta command moves a specific distance from the //current mouse position. For additional information about actions //and their syntax, please view the submitty wiki. - "click and drag delta 100 0", + { + "action" : "click and drag delta", + "end_x" : 100 + }, //This program uses many unecessarily delays. Experiment by removing //them. - "delay 1", - "click and drag delta -100 0", - "delay 1", - "click and drag delta 0 100", - "delay 1", - "click and drag delta 0 -100", - "delay 1", - "click and drag delta 1000 0", - "delay 1", - "click and drag delta -1000 0", - "delay 1", - "click and drag delta 0 160", - "delay 1", - "click and drag delta 0 -160", - "delay 1", - "click and drag delta 300 300", - "delay 1", + { + "action" : "delay", + "seconds" : 1 + }, + { + "action" : "click and drag delta", + "end_x" : -100 + }, + { + "action" : "delay", + "seconds" : 1 + }, + { + "action" : "click and drag delta", + "end_y" : 100 + }, + { + "action" : "delay", + "seconds" : 1 + }, + { + "action" : "click and drag delta", + "end_y" : -100 + }, + { + "action" : "delay", + "seconds" : 1 + }, + { + "action" : "click and drag delta", + "end_x" : 1000 + }, + { + "action" : "delay", + "seconds" : 1 + }, + { + "action" : "click and drag delta", + "end_x" : -1000 + }, + { + "action" : "delay", + "seconds" : 1 + }, + { + "action" : "click and drag delta", + "end_y" : 160 + }, + { + "action" : "delay", + "seconds" : 1 + }, + { + "action" : "click and drag delta", + "end_y" : -160 + }, + { + "action" : "delay", + "seconds" : 1 + }, + { + "action" : "click and drag delta", + "end_x" : 300, + "end_y" : 300 + }, + { + "action" : "delay", + "seconds" : 1 + }, //moves the mouse to 0,0 (upper left) on the window. - "origin", - "delay 1", + { + "action" : "origin" + }, + { + "action" : "delay", + "seconds" : 1 + }, //Centers the mouse on the screen - "center", - "delay 1", - "mouse move 10 200", - "delay 1", - "click and drag 10 10 150 150", - "delay 1", - "click and drag 160 160", + { + "action" : "center" + }, + { + "action" : "delay", + "seconds" : 1 + }, + { + "action" : "move mouse", + "end_x" : 10, + "end_y" : 200 + }, + { + "action" : "delay", + "seconds" : 1 + }, + { + "action" : "click and drag", + "start_x" : 10, + "start_y" : 10, + "end_x" : 150, + "end_y" : 150 + }, + { + "action" : "delay", + "seconds" : 1 + }, + { + "action" : "click and drag", + "end_x" : 160, + "end_y" : 160 + }, //takes a screenshot, labeled sequentially starting from 0. - "screenshot", + { + "action" : "screenshot" + }, //In the provided application, q indicates a program quit. - "type 'q'"], + { + "action" : "key", + "key_combination" : "q" + } + ], "points" : 1, "validation": [ { @@ -85,10 +179,22 @@ "title" : "Graphics program 1", "command" : "./a.out -input sierpinski_triangle.txt -size 400 -iters 0 -cubes", "actions" : [ - "click and drag delta 50 -125", - "delay 1", - "screenshot", - "type 'q'" + { + "action" : "click and drag delta", + "end_x" : 50, + "end_y" : -125 + }, + { + "action" : "delay", + "seconds" : 1 + }, + { + "action" : "screenshot" + }, + { + "action" : "key", + "key_combination" : "q" + } ], "points" : 1, "validation": [