Skip to content

Commit

Permalink
[Bugfix:Autograding] graphics schema for mouse motion (Submitty#9017)
Browse files Browse the repository at this point in the history
update graphics schema for mouse motion

Co-authored-by: Barb Cutler <Barb Cutler>
  • Loading branch information
bmcutler authored Mar 9, 2023
1 parent 49ecd3b commit b602594
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
8 changes: 4 additions & 4 deletions bin/json_schemas/complete_config_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -915,22 +915,22 @@
"start_x" : {
"description" : "(Optional) An integer starting x position for the mouse in window coordinates. Values will be clamped to within the window’s size. Defaults to zero.",
"type" : "integer",
"minimum" : 1
"minimum" : 0
},
"start_y" : {
"description" : "(Optional) An integer starting y position for the mouse in window coordinates. Values will be clamped to within the window’s size. Defaults to zero.",
"type" : "integer",
"minimum" : 1
"minimum" : 0
},
"end_x" : {
"description" : "(Optional) An integer ending x position for the mouse in window coordinates. Values will be clamped to within the window’s size. Defaults to zero.",
"type" : "integer",
"minimum" : 1
"minimum" : 0
},
"end_y" : {
"description" : "(Optional) An integer ending y position for the mouse in window coordinates. Values will be clamped to within the window’s size. Defaults to zero.",
"type" : "integer",
"minimum" : 1
"minimum" : 0
},
"mouse_button" : {
"description" : "(Optional) left, middle, or right. The mouse button to be clicked. Defaults to left.",
Expand Down
7 changes: 2 additions & 5 deletions grading/load_config_json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -758,9 +758,8 @@ void FormatGraphicsActions(nlohmann::json &testcases, nlohmann::json &whole_conf
validate_integer(action, "end_y", true, 0, 0);

if(action["end_x"] == 0 && action["end_y"] == 0){
std::cout << "ERROR: some movement must be specified in click and drag" << std::endl;
std::cout << "WARNING: some movement expected in click and drag" << std::endl;
}
assert(action["end_x"] != 0 || action["end_y"] != 0);

}
//Click and drag delta can have an optional mouse button, and must have and end_x and end_y.
Expand All @@ -772,11 +771,9 @@ void FormatGraphicsActions(nlohmann::json &testcases, nlohmann::json &whole_conf
validate_integer(action, "end_y", true, -100000, 0);

if(action["end_x"] == 0 && action["end_y"] == 0){
std::cout << "ERROR: some movement must be specified in click and drag" << std::endl;
std::cout << "WARNING: some movement expected in click and drag delta" << std::endl;
}

assert(action["end_x"] != 0 || action["end_y"] != 0);

}
//Click has an optional mouse button.
else if(action_name == "click"){
Expand Down

0 comments on commit b602594

Please sign in to comment.