summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJonathon Jongsma <jjongsma@gnome.org>2008-10-06 22:25:44 +0900
committerJonathon Jongsma <jjongsma@gnome.org>2008-10-06 22:25:44 +0900
commit643262b3bf7ee36c9ae366cb5adb184d9d4e6c79 (patch)
tree8c2cd5a5c5261ff3f72c15f7149586b5113ec9d5 /tests
parentdc26aaf781da09b69598cf106ec79c8c06fca8fa (diff)
Fixe some test failures that were accidentally introduced
Also fix a distcheck issue where the example png file was not being opened from the correct location when builddir != srcdir
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am4
-rw-r--r--tests/test-matrix.cc28
-rw-r--r--tests/test-surface.cc4
3 files changed, 30 insertions, 6 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 52a4bec..b088433 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -10,6 +10,8 @@ test_scaled_font_SOURCES=test-scaled-font.cc
test_font_options_SOURCES=test-font-options.cc
test_matrix_SOURCES=test-matrix.cc
+test_surface_CPPFLAGS=-DPNG_STREAM_FILE=\"$(srcdir)/png-stream-test.png\"
+
else
#don't build anything
@@ -22,3 +24,5 @@ INCLUDES = -I$(top_srcdir) @CAIROMM_CFLAGS@
#The libraries that the executable needs to link against:
LIBS = $(top_builddir)/cairomm/libcairomm-1.0.la @LIBS@ @CAIROMM_LIBS@ @BOOST_UNIT_TEST_FRAMEWORK_STATIC_LIB@
+
+EXTRA_DIST=png-stream-test.png
diff --git a/tests/test-matrix.cc b/tests/test-matrix.cc
index acc9708..8e40d01 100644
--- a/tests/test-matrix.cc
+++ b/tests/test-matrix.cc
@@ -35,7 +35,12 @@ void test_constructors()
{
cairo_matrix_t c_identity;
cairo_matrix_init_identity(&c_identity);
- BOOST_CHECK_EQUAL(c_identity, Cairo::identity_matrix());
+ BOOST_CHECK_EQUAL(c_identity.xx, Cairo::identity_matrix().xx);
+ BOOST_CHECK_EQUAL(c_identity.xy, Cairo::identity_matrix().xy);
+ BOOST_CHECK_EQUAL(c_identity.yx, Cairo::identity_matrix().yx);
+ BOOST_CHECK_EQUAL(c_identity.yy, Cairo::identity_matrix().yy);
+ BOOST_CHECK_EQUAL(c_identity.x0, Cairo::identity_matrix().x0);
+ BOOST_CHECK_EQUAL(c_identity.y0, Cairo::identity_matrix().y0);
// nonsense values, just for testing
const double xx=1, yx=2, xy=3, yy=5, x0=6, y0=7;
@@ -43,7 +48,12 @@ void test_constructors()
cairo_matrix_init(&c_matrix, xx, yx, xy, yy, x0, y0);
Cairo::Matrix cpp_matrix(xx, yx, xy, yy, x0, y0);
- BOOST_CHECK_EQUAL(c_matrix, cpp_matrix);
+ BOOST_CHECK_EQUAL(c_matrix.xx, cpp_matrix.xx);
+ BOOST_CHECK_EQUAL(c_matrix.xy, cpp_matrix.xy);
+ BOOST_CHECK_EQUAL(c_matrix.yx, cpp_matrix.yx);
+ BOOST_CHECK_EQUAL(c_matrix.yy, cpp_matrix.yy);
+ BOOST_CHECK_EQUAL(c_matrix.x0, cpp_matrix.x0);
+ BOOST_CHECK_EQUAL(c_matrix.y0, cpp_matrix.y0);
}
void test_invert()
@@ -70,11 +80,21 @@ void test_cast()
cairo_matrix_t identity;
cairo_matrix_init_identity(&identity);
- BOOST_CHECK_EQUAL(casted, identity);
+ BOOST_CHECK_EQUAL(casted.xx, identity.xx);
+ BOOST_CHECK_EQUAL(casted.xy, identity.xy);
+ BOOST_CHECK_EQUAL(casted.yx, identity.yx);
+ BOOST_CHECK_EQUAL(casted.yy, identity.yy);
+ BOOST_CHECK_EQUAL(casted.x0, identity.x0);
+ BOOST_CHECK_EQUAL(casted.y0, identity.y0);
// pass C++ type as an argument to C
foo(&matrix);
- BOOST_CHECK_EQUAL(matrix, *test_matrix);
+ BOOST_CHECK_EQUAL(matrix.xx, test_matrix->xx);
+ BOOST_CHECK_EQUAL(matrix.xy, test_matrix->xy);
+ BOOST_CHECK_EQUAL(matrix.yx, test_matrix->yx);
+ BOOST_CHECK_EQUAL(matrix.yy, test_matrix->yy);
+ BOOST_CHECK_EQUAL(matrix.x0, test_matrix->x0);
+ BOOST_CHECK_EQUAL(matrix.y0, test_matrix->y0);
}
void test_multiply()
diff --git a/tests/test-surface.cc b/tests/test-surface.cc
index 7700baf..3a5e6ae 100644
--- a/tests/test-surface.cc
+++ b/tests/test-surface.cc
@@ -70,13 +70,13 @@ void test_create_from_png()
{
RefPtr<ImageSurface> surface;
// try the sigc::slot version
- png_file.open("png-stream-test.png");
+ png_file.open(PNG_STREAM_FILE);
surface = ImageSurface::create_from_png_stream(sigc::ptr_fun(&test_read_func));
png_file.close();
BOOST_CHECK(test_read_func_called > 0);
// now try the raw C function (deprecated) version
- png_file.open("png-stream-test.png");
+ png_file.open(PNG_STREAM_FILE);
surface = ImageSurface::create_from_png(&c_test_read_func, NULL);
png_file.close();
BOOST_CHECK(c_test_read_func_called > 0);