From ad2e8afb557c56ee991e1563706b8cdb03b90bc3 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Thu, 30 Apr 2015 06:57:47 -0700 Subject: [PATCH] fix failing C++ tests that depend on test data - closes #2787 --- .gitmodules | 3 +++ INSTALL.md | 1 + test/data | 1 + test/unit/geometry/geometry.cpp | 4 ++-- test/unit/imaging/image_io_test.cpp | 10 +++++----- test/unit/imaging/tiff_io.cpp | 24 ++++++++++++------------ 6 files changed, 24 insertions(+), 19 deletions(-) create mode 100644 .gitmodules create mode 160000 test/data diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..f2fa9aa8d --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "test/data"] + path = test/data + url = git@github.com:mapnik/test-data diff --git a/INSTALL.md b/INSTALL.md index 6bcca64f8..974a2809c 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -29,6 +29,7 @@ NOTE: the above will not work on windows, rather see https://github.com/mapnik/m Then to run the tests locally (without needing to install): + git submodule update --init make test Install like: diff --git a/test/data b/test/data new file mode 160000 index 000000000..9f7c39f85 --- /dev/null +++ b/test/data @@ -0,0 +1 @@ +Subproject commit 9f7c39f85fceb4aa20c07a66f9848d10bf1451db diff --git a/test/unit/geometry/geometry.cpp b/test/unit/geometry/geometry.cpp index af004d5d6..b3e01cc2f 100644 --- a/test/unit/geometry/geometry.cpp +++ b/test/unit/geometry/geometry.cpp @@ -9,7 +9,7 @@ TEST_CASE("geometry") { SECTION("json point") { - mapnik::util::file input("./test-data/json/point1.json"); + mapnik::util::file input("./test/data/json/point1.json"); REQUIRE( input.open() ); auto json = input.data(); mapnik::geometry::geometry geom; @@ -24,7 +24,7 @@ SECTION("json point") { } SECTION("json point reversed") { - mapnik::util::file input("./test-data/json/point2.json"); + mapnik::util::file input("./test/data/json/point2.json"); REQUIRE( input.open() ); auto json = input.data(); mapnik::geometry::geometry geom; diff --git a/test/unit/imaging/image_io_test.cpp b/test/unit/imaging/image_io_test.cpp index b263cdacd..299801008 100644 --- a/test/unit/imaging/image_io_test.cpp +++ b/test/unit/imaging/image_io_test.cpp @@ -21,7 +21,7 @@ SECTION("readers") { try { #if defined(HAVE_JPEG) - should_throw = "./test-data/images/blank.jpg"; + should_throw = "./test/data/images/blank.jpg"; REQUIRE( mapnik::util::exists( should_throw ) ); type = mapnik::type_from_filename(should_throw); REQUIRE( type ); @@ -59,7 +59,7 @@ SECTION("readers") { #endif #if defined(HAVE_PNG) - should_throw = "./test-data/images/blank.png"; + should_throw = "./test/data/images/blank.png"; REQUIRE( mapnik::util::exists( should_throw ) ); type = mapnik::type_from_filename(should_throw); REQUIRE( type ); @@ -73,7 +73,7 @@ SECTION("readers") { REQUIRE( true ); } - should_throw = "./test-data/images/xcode-CgBI.png"; + should_throw = "./test/data/images/xcode-CgBI.png"; REQUIRE( mapnik::util::exists( should_throw ) ); type = mapnik::type_from_filename(should_throw); REQUIRE( type ); @@ -89,7 +89,7 @@ SECTION("readers") { #endif #if defined(HAVE_TIFF) - should_throw = "./test-data/images/blank.tiff"; + should_throw = "./test/data/images/blank.tiff"; REQUIRE( mapnik::util::exists( should_throw ) ); type = mapnik::type_from_filename(should_throw); REQUIRE( type ); @@ -105,7 +105,7 @@ SECTION("readers") { #endif #if defined(HAVE_WEBP) - should_throw = "./test-data/images/blank.webp"; + should_throw = "./test/data/images/blank.webp"; REQUIRE( mapnik::util::exists( should_throw ) ); type = mapnik::type_from_filename(should_throw); REQUIRE( type ); diff --git a/test/unit/imaging/tiff_io.cpp b/test/unit/imaging/tiff_io.cpp index 8fc603b46..badf8302e 100644 --- a/test/unit/imaging/tiff_io.cpp +++ b/test/unit/imaging/tiff_io.cpp @@ -59,7 +59,7 @@ TEST_CASE("tiff io") { SECTION("scan rgb8 striped") { - std::string filename("./test-data/tiff/scan_512x512_rgb8_striped.tif"); + std::string filename("./test/data/tiff/scan_512x512_rgb8_striped.tif"); mapnik::tiff_reader tiff_reader(filename); REQUIRE( tiff_reader.width() == 512 ); REQUIRE( tiff_reader.height() == 512 ); @@ -89,7 +89,7 @@ SECTION("scan rgb8 striped") { } SECTION("scan rgb8 tiled") { - std::string filename("./test-data/tiff/scan_512x512_rgb8_tiled.tif"); + std::string filename("./test/data/tiff/scan_512x512_rgb8_tiled.tif"); mapnik::tiff_reader tiff_reader(filename); REQUIRE( tiff_reader.width() == 512 ); REQUIRE( tiff_reader.height() == 512 ); @@ -119,7 +119,7 @@ SECTION("scan rgb8 tiled") { } SECTION("rgba8 striped") { - TIFF_ASSERT("./test-data/tiff/ndvi_256x256_rgba8_striped.tif") + TIFF_ASSERT("./test/data/tiff/ndvi_256x256_rgba8_striped.tif") REQUIRE( tiff_reader.rows_per_strip() == 1 ); REQUIRE( tiff_reader.bits_per_sample() == 8 ); REQUIRE( tiff_reader.is_tiled() == false ); @@ -135,7 +135,7 @@ SECTION("rgba8 striped") { } SECTION("rgba8 tiled") { - TIFF_ASSERT("./test-data/tiff/ndvi_256x256_rgba8_tiled.tif") + TIFF_ASSERT("./test/data/tiff/ndvi_256x256_rgba8_tiled.tif") REQUIRE( tiff_reader.rows_per_strip() == 0 ); REQUIRE( tiff_reader.bits_per_sample() == 8 ); REQUIRE( tiff_reader.is_tiled() == true ); @@ -151,7 +151,7 @@ SECTION("rgba8 tiled") { } SECTION("rgb8 striped") { - TIFF_ASSERT("./test-data/tiff/ndvi_256x256_rgb8_striped.tif") + TIFF_ASSERT("./test/data/tiff/ndvi_256x256_rgb8_striped.tif") REQUIRE( tiff_reader.rows_per_strip() == 10 ); REQUIRE( tiff_reader.bits_per_sample() == 8 ); REQUIRE( tiff_reader.is_tiled() == false ); @@ -167,7 +167,7 @@ SECTION("rgb8 striped") { } SECTION("rgb8 tiled") { - TIFF_ASSERT("./test-data/tiff/ndvi_256x256_rgb8_tiled.tif") + TIFF_ASSERT("./test/data/tiff/ndvi_256x256_rgb8_tiled.tif") REQUIRE( tiff_reader.rows_per_strip() == 0 ); REQUIRE( tiff_reader.bits_per_sample() == 8 ); REQUIRE( tiff_reader.is_tiled() == true ); @@ -183,7 +183,7 @@ SECTION("rgb8 tiled") { } SECTION("gray8 striped") { - TIFF_ASSERT("./test-data/tiff/ndvi_256x256_gray8_striped.tif") + TIFF_ASSERT("./test/data/tiff/ndvi_256x256_gray8_striped.tif") REQUIRE( tiff_reader.rows_per_strip() == 32 ); REQUIRE( tiff_reader.bits_per_sample() == 8 ); REQUIRE( tiff_reader.is_tiled() == false ); @@ -199,7 +199,7 @@ SECTION("gray8 striped") { } SECTION("gray8 tiled") { - TIFF_ASSERT("./test-data/tiff/ndvi_256x256_gray8_tiled.tif") + TIFF_ASSERT("./test/data/tiff/ndvi_256x256_gray8_tiled.tif") REQUIRE( tiff_reader.rows_per_strip() == 0 ); REQUIRE( tiff_reader.bits_per_sample() == 8 ); REQUIRE( tiff_reader.is_tiled() == true ); @@ -215,7 +215,7 @@ SECTION("gray8 tiled") { } SECTION("gray16 striped") { - TIFF_ASSERT("./test-data/tiff/ndvi_256x256_gray16_striped.tif") + TIFF_ASSERT("./test/data/tiff/ndvi_256x256_gray16_striped.tif") REQUIRE( tiff_reader.rows_per_strip() == 16 ); REQUIRE( tiff_reader.bits_per_sample() == 16 ); REQUIRE( tiff_reader.is_tiled() == false ); @@ -231,7 +231,7 @@ SECTION("gray16 striped") { } SECTION("gray16 tiled") { - TIFF_ASSERT("./test-data/tiff/ndvi_256x256_gray16_tiled.tif") + TIFF_ASSERT("./test/data/tiff/ndvi_256x256_gray16_tiled.tif") REQUIRE( tiff_reader.rows_per_strip() == 0 ); REQUIRE( tiff_reader.bits_per_sample() == 16 ); REQUIRE( tiff_reader.is_tiled() == true ); @@ -247,7 +247,7 @@ SECTION("gray16 tiled") { } SECTION("gray32f striped") { - TIFF_ASSERT("./test-data/tiff/ndvi_256x256_gray32f_striped.tif") + TIFF_ASSERT("./test/data/tiff/ndvi_256x256_gray32f_striped.tif") REQUIRE( tiff_reader.rows_per_strip() == 8 ); REQUIRE( tiff_reader.bits_per_sample() == 32 ); REQUIRE( tiff_reader.is_tiled() == false ); @@ -263,7 +263,7 @@ SECTION("gray32f striped") { } SECTION("gray32f tiled") { - TIFF_ASSERT("./test-data/tiff/ndvi_256x256_gray32f_tiled.tif") + TIFF_ASSERT("./test/data/tiff/ndvi_256x256_gray32f_tiled.tif") REQUIRE( tiff_reader.rows_per_strip() == 0 ); REQUIRE( tiff_reader.bits_per_sample() == 32 ); REQUIRE( tiff_reader.is_tiled() == true );