From e337c5ad89deef26446e000a4cc8536bc161d5e9 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Wed, 4 Jul 2018 14:12:00 -0500 Subject: [PATCH] Test setting a 2D Point from a 3D point (narrowing, remove Z coordinate) and using get_point3 on a 2D point. --- src/test/GUI/test_field_point.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/test/GUI/test_field_point.cpp b/src/test/GUI/test_field_point.cpp index bee75120c..f924fb1ad 100644 --- a/src/test/GUI/test_field_point.cpp +++ b/src/test/GUI/test_field_point.cpp @@ -80,6 +80,24 @@ SCENARIO( "UI_Point: set_value works with several types of inputs") { REQUIRE(test_field.ctrl_y()->GetValue() == wxString("2.1"s)); } } + WHEN( "set_value is called with a Pointf3(19.0, 2.1, 0.2)") { + test_field.set_value(Pointf3(19.0, 2.1, 0.2)); + THEN( "get_point() returns a Pointf(19.0, 2.1)") { + REQUIRE(test_field.get_point() == Pointf(19.0, 2.1)); + } + THEN( "get_point() returns a Pointf(19.0, 2.1)") { + REQUIRE(test_field.get_point3() == Pointf3(19.0, 2.1, 0.0)); + } + THEN( "get_string() returns '19.0;2.1'") { + REQUIRE(test_field.get_string() == "19.0;2.1"s); + } + THEN( "X TextCtrl contains X coordinate") { + REQUIRE(test_field.ctrl_x()->GetValue() == wxString("19.0"s)); + } + THEN( "Y TextCtrl contains Y coordinate") { + REQUIRE(test_field.ctrl_y()->GetValue() == wxString("2.1"s)); + } + } WHEN( "set_value is called with a string of the form '30.9;211.2'") { test_field.set_value("30.9;211.2"s); THEN( "get_point() returns a Pointf(30.9, 211.2)") {