Add basic test coverage for curve sketching tools.

This commit is contained in:
whitequark 2016-07-31 08:43:33 +00:00
parent 4f49a8a9d4
commit fd9ee94437
175 changed files with 649 additions and 18 deletions

View File

@ -233,8 +233,9 @@ void OpenWebsite(const char *url) {
// Resources
//-----------------------------------------------------------------------------
std::vector<std::string> fontFiles;
std::vector<std::string> GetFontFiles() {
return {};
return fontFiles;
}
std::string resourceDir;

View File

@ -19,6 +19,10 @@ void CairoRenderer::OutputStart() {
cairo_translate(context, camera.width / 2.0, camera.height / 2.0);
// Avoid pixel boundaries; when not using antialiasing, we would otherwise
// get numerically unstable output.
cairo_translate(context, 0.1, 0.1);
cairo_set_line_join(context, CAIRO_LINE_JOIN_ROUND);
cairo_set_line_cap(context, CAIRO_LINE_CAP_ROUND);
}

View File

@ -7,7 +7,48 @@ include_directories(
set(testsuite_SOURCES
harness.cpp
request/line_segment/test.cpp)
constraint/points_coincident/test.cpp
constraint/pt_pt_distance/test.cpp
constraint/pt_plane_distance/test.cpp
constraint/pt_line_distance/test.cpp
constraint/pt_face_distance/test.cpp
constraint/proj_pt_distance/test.cpp
constraint/pt_in_plane/test.cpp
constraint/pt_on_line/test.cpp
constraint/pt_on_face/test.cpp
constraint/equal_length_lines/test.cpp
constraint/length_ratio/test.cpp
constraint/eq_len_pt_line_d/test.cpp
constraint/eq_pt_ln_distances/test.cpp
constraint/equal_angle/test.cpp
constraint/equal_line_arc_len/test.cpp
constraint/length_difference/test.cpp
constraint/symmetric/test.cpp
constraint/symmetric_horiz/test.cpp
constraint/symmetric_vert/test.cpp
constraint/symmetric_line/test.cpp
constraint/at_midpoint/test.cpp
constraint/horizontal/test.cpp
constraint/vertical/test.cpp
constraint/diameter/test.cpp
constraint/pt_on_circle/test.cpp
constraint/same_orientation/test.cpp
constraint/angle/test.cpp
constraint/parallel/test.cpp
constraint/perpendicular/test.cpp
constraint/arc_line_tangent/test.cpp
constraint/cubic_line_tangent/test.cpp
constraint/curve_curve_tangent/test.cpp
constraint/equal_radius/test.cpp
constraint/where_dragged/test.cpp
constraint/comment/test.cpp
request/arc_of_circle/test.cpp
request/circle/test.cpp
request/cubic/test.cpp
request/cubic_periodic/test.cpp
request/datum_point/test.cpp
request/line_segment/test.cpp
request/ttf_text/test.cpp)
add_executable(solvespace_testsuite
${testsuite_SOURCES})

BIN
test/Gentium-R.ttf Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,13 @@
#include "harness.h"
TEST_CASE(roundtrip) {
CHECK_LOAD("normal.slvs");
CHECK_RENDER("normal.png");
CHECK_SAVE("normal.slvs");
}
TEST_CASE(migrate_from_v20) {
CHECK_LOAD("normal_v20.slvs");
CHECK_RENDER("normal.png");
CHECK_SAVE("normal.slvs");
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,13 @@
#include "harness.h"
TEST_CASE(roundtrip) {
CHECK_LOAD("normal.slvs");
CHECK_RENDER("normal.png");
CHECK_SAVE("normal.slvs");
}
TEST_CASE(migrate_from_v20) {
CHECK_LOAD("normal_v20.slvs");
CHECK_RENDER("normal.png");
CHECK_SAVE("normal.slvs");
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,13 @@
#include "harness.h"
TEST_CASE(roundtrip) {
CHECK_LOAD("normal.slvs");
CHECK_RENDER("normal.png");
CHECK_SAVE("normal.slvs");
}
TEST_CASE(migrate_from_v20) {
CHECK_LOAD("normal_v20.slvs");
CHECK_RENDER("normal.png");
CHECK_SAVE("normal.slvs");
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,13 @@
#include "harness.h"
TEST_CASE(roundtrip) {
CHECK_LOAD("normal.slvs");
CHECK_RENDER("normal.png");
CHECK_SAVE("normal.slvs");
}
TEST_CASE(migrate_from_v20) {
CHECK_LOAD("normal_v20.slvs");
CHECK_RENDER("normal.png");
CHECK_SAVE("normal.slvs");
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,13 @@
#include "harness.h"
TEST_CASE(roundtrip) {
CHECK_LOAD("normal.slvs");
CHECK_RENDER("normal.png");
CHECK_SAVE("normal.slvs");
}
TEST_CASE(migrate_from_v20) {
CHECK_LOAD("normal_v20.slvs");
CHECK_RENDER("normal.png");
CHECK_SAVE("normal.slvs");
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,13 @@
#include "harness.h"
TEST_CASE(roundtrip) {
CHECK_LOAD("normal.slvs");
CHECK_RENDER("normal.png");
CHECK_SAVE("normal.slvs");
}
TEST_CASE(migrate_from_v20) {
CHECK_LOAD("normal_v20.slvs");
CHECK_RENDER("normal.png");
CHECK_SAVE("normal.slvs");
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,13 @@
#include "harness.h"
TEST_CASE(roundtrip) {
CHECK_LOAD("normal.slvs");
CHECK_RENDER("normal.png");
CHECK_SAVE("normal.slvs");
}
TEST_CASE(migrate_from_v20) {
CHECK_LOAD("normal_v20.slvs");
CHECK_RENDER("normal.png");
CHECK_SAVE("normal.slvs");
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,13 @@
#include "harness.h"
TEST_CASE(roundtrip) {
CHECK_LOAD("normal.slvs");
CHECK_RENDER("normal.png");
CHECK_SAVE("normal.slvs");
}
TEST_CASE(migrate_from_v20) {
CHECK_LOAD("normal_v20.slvs");
CHECK_RENDER("normal.png");
CHECK_SAVE("normal.slvs");
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,13 @@
#include "harness.h"
TEST_CASE(roundtrip) {
CHECK_LOAD("normal.slvs");
CHECK_RENDER("normal.png");
CHECK_SAVE("normal.slvs");
}
TEST_CASE(migrate_from_v20) {
CHECK_LOAD("normal_v20.slvs");
CHECK_RENDER("normal.png");
CHECK_SAVE("normal.slvs");
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,13 @@
#include "harness.h"
TEST_CASE(roundtrip) {
CHECK_LOAD("normal.slvs");
CHECK_RENDER("normal.png");
CHECK_SAVE("normal.slvs");
}
TEST_CASE(migrate_from_v20) {
CHECK_LOAD("normal_v20.slvs");
CHECK_RENDER("normal.png");
CHECK_SAVE("normal.slvs");
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,13 @@
#include "harness.h"
TEST_CASE(roundtrip) {
CHECK_LOAD("normal.slvs");
CHECK_RENDER("normal.png");
CHECK_SAVE("normal.slvs");
}
TEST_CASE(migrate_from_v20) {
CHECK_LOAD("normal_v20.slvs");
CHECK_RENDER("normal.png");
CHECK_SAVE("normal.slvs");
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,13 @@
#include "harness.h"
TEST_CASE(roundtrip) {
CHECK_LOAD("normal.slvs");
CHECK_RENDER("normal.png");
CHECK_SAVE("normal.slvs");
}
TEST_CASE(migrate_from_v20) {
CHECK_LOAD("normal_v20.slvs");
CHECK_RENDER("normal.png");
CHECK_SAVE("normal.slvs");
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,13 @@
#include "harness.h"
TEST_CASE(roundtrip) {
CHECK_LOAD("normal.slvs");
CHECK_RENDER("normal.png");
CHECK_SAVE("normal.slvs");
}
TEST_CASE(migrate_from_v20) {
CHECK_LOAD("normal_v20.slvs");
CHECK_RENDER("normal.png");
CHECK_SAVE("normal.slvs");
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,25 @@
#include "harness.h"
TEST_CASE(line_roundtrip) {
CHECK_LOAD("line.slvs");
CHECK_RENDER("line.png");
CHECK_SAVE("line.slvs");
}
TEST_CASE(line_migrate_from_v20) {
CHECK_LOAD("line_v20.slvs");
CHECK_RENDER("line.png");
CHECK_SAVE("line.slvs");
}
TEST_CASE(pt_pt_roundtrip) {
CHECK_LOAD("pt_pt.slvs");
CHECK_RENDER("pt_pt.png");
CHECK_SAVE("pt_pt.slvs");
}
TEST_CASE(pt_pt_migrate_from_v20) {
CHECK_LOAD("pt_pt_v20.slvs");
CHECK_RENDER("pt_pt.png");
CHECK_SAVE("pt_pt.slvs");
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

View File

@ -0,0 +1,7 @@
#include "harness.h"
TEST_CASE(roundtrip) {
CHECK_LOAD("normal.slvs");
CHECK_RENDER("normal.png");
CHECK_SAVE("normal.slvs");
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,13 @@
#include "harness.h"
TEST_CASE(roundtrip) {
CHECK_LOAD("normal.slvs");
CHECK_RENDER("normal.png");
CHECK_SAVE("normal.slvs");
}
TEST_CASE(migrate_from_v20) {
CHECK_LOAD("normal_v20.slvs");
CHECK_RENDER("normal.png");
CHECK_SAVE("normal.slvs");
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,13 @@
#include "harness.h"
TEST_CASE(roundtrip) {
CHECK_LOAD("normal.slvs");
CHECK_RENDER("normal.png");
CHECK_SAVE("normal.slvs");
}
TEST_CASE(migrate_from_v20) {
CHECK_LOAD("normal_v20.slvs");
CHECK_RENDER("normal.png");
CHECK_SAVE("normal.slvs");
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,13 @@
#include "harness.h"
TEST_CASE(roundtrip) {
CHECK_LOAD("normal.slvs");
CHECK_RENDER("normal.png");
CHECK_SAVE("normal.slvs");
}
TEST_CASE(migrate_from_v20) {
CHECK_LOAD("normal_v20.slvs");
CHECK_RENDER("normal.png");
CHECK_SAVE("normal.slvs");
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,13 @@
#include "harness.h"
TEST_CASE(roundtrip) {
CHECK_LOAD("normal.slvs");
CHECK_RENDER("normal.png");
CHECK_SAVE("normal.slvs");
}
TEST_CASE(migrate_from_v20) {
CHECK_LOAD("normal_v20.slvs");
CHECK_RENDER("normal.png");
CHECK_SAVE("normal.slvs");
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,13 @@
#include "harness.h"
TEST_CASE(roundtrip) {
CHECK_LOAD("normal.slvs");
CHECK_RENDER("normal.png");
CHECK_SAVE("normal.slvs");
}
TEST_CASE(migrate_from_v20) {
CHECK_LOAD("normal_v20.slvs");
CHECK_RENDER("normal.png");
CHECK_SAVE("normal.slvs");
}

View File

@ -0,0 +1,12 @@
#include "harness.h"
// TEST_CASE(roundtrip) {
// CHECK_LOAD("normal.slvs");
// CHECK_RENDER("normal.png");
// CHECK_SAVE("normal.slvs");
// }
// TEST_CASE(migrate_from_v20) {
// CHECK_LOAD("normal_v20.slvs");
// CHECK_SAVE("normal.slvs");
// }

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,13 @@
#include "harness.h"
TEST_CASE(roundtrip) {
CHECK_LOAD("normal.slvs");
CHECK_RENDER("normal.png");
CHECK_SAVE("normal.slvs");
}
TEST_CASE(migrate_from_v20) {
CHECK_LOAD("normal_v20.slvs");
CHECK_RENDER("normal.png");
CHECK_SAVE("normal.slvs");
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,18 @@
#include "harness.h"
TEST_CASE(roundtrip) {
CHECK_LOAD("normal.slvs");
CHECK_RENDER("normal.png");
CHECK_SAVE("normal.slvs");
}
TEST_CASE(migrate_from_v20) {
CHECK_LOAD("normal_v20.slvs");
CHECK_RENDER("normal.png");
CHECK_SAVE("normal.slvs");
}
TEST_CASE(render_extended) {
CHECK_LOAD("extended.slvs");
CHECK_RENDER("extended.png");
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More