"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "test/canvas.cpp" between
libcaca-0.99.beta19.tar.gz and libcaca-0.99.beta20.tar.bz2

About: libcaca is a graphics library that outputs text instead of pixels, so that it can work on older video cards or text terminals (something like an advanced AAlib library).

canvas.cpp  (libcaca-0.99.beta19):canvas.cpp  (libcaca-0.99.beta20.tar.bz2)
skipping to change at line 19 skipping to change at line 19
* to Public License, Version 2, as published by Sam Hocevar. See * to Public License, Version 2, as published by Sam Hocevar. See
* http://www.wtfpl.net/ for more details. * http://www.wtfpl.net/ for more details.
*/ */
#include "config.h" #include "config.h"
#include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/HelperMacros.h>
#include <cppunit/TestCaller.h> #include <cppunit/TestCaller.h>
#include <cppunit/TestCase.h> #include <cppunit/TestCase.h>
#include <cppunit/TestSuite.h> #include <cppunit/TestSuite.h>
#include <climits>
#include "caca.h" #include "caca.h"
class CanvasTest : public CppUnit::TestCase class CanvasTest : public CppUnit::TestCase
{ {
CPPUNIT_TEST_SUITE(CanvasTest); CPPUNIT_TEST_SUITE(CanvasTest);
CPPUNIT_TEST(test_creation); CPPUNIT_TEST(test_creation);
CPPUNIT_TEST(test_resize); CPPUNIT_TEST(test_resize);
CPPUNIT_TEST(test_chars); CPPUNIT_TEST(test_chars);
CPPUNIT_TEST(test_utf8); CPPUNIT_TEST(test_utf8);
skipping to change at line 56 skipping to change at line 57
} }
void test_resize() void test_resize()
{ {
caca_canvas_t *cv; caca_canvas_t *cv;
cv = caca_create_canvas(0, 0); cv = caca_create_canvas(0, 0);
CPPUNIT_ASSERT_EQUAL(caca_get_canvas_width(cv), 0); CPPUNIT_ASSERT_EQUAL(caca_get_canvas_width(cv), 0);
CPPUNIT_ASSERT_EQUAL(caca_get_canvas_height(cv), 0); CPPUNIT_ASSERT_EQUAL(caca_get_canvas_height(cv), 0);
caca_set_canvas_size(cv, 1, 1); int ret = caca_set_canvas_size(cv, 1, 1);
CPPUNIT_ASSERT_EQUAL(ret, 0);
CPPUNIT_ASSERT_EQUAL(caca_get_canvas_width(cv), 1); CPPUNIT_ASSERT_EQUAL(caca_get_canvas_width(cv), 1);
CPPUNIT_ASSERT_EQUAL(caca_get_canvas_height(cv), 1); CPPUNIT_ASSERT_EQUAL(caca_get_canvas_height(cv), 1);
caca_set_canvas_size(cv, 1234, 1001); ret = caca_set_canvas_size(cv, 1234, 1001);
CPPUNIT_ASSERT_EQUAL(ret, 0);
CPPUNIT_ASSERT_EQUAL(caca_get_canvas_width(cv), 1234); CPPUNIT_ASSERT_EQUAL(caca_get_canvas_width(cv), 1234);
CPPUNIT_ASSERT_EQUAL(caca_get_canvas_height(cv), 1001); CPPUNIT_ASSERT_EQUAL(caca_get_canvas_height(cv), 1001);
caca_set_canvas_size(cv, 0, 0); ret = caca_set_canvas_size(cv, 0, 0);
CPPUNIT_ASSERT_EQUAL(ret, 0);
CPPUNIT_ASSERT_EQUAL(caca_get_canvas_width(cv), 0); CPPUNIT_ASSERT_EQUAL(caca_get_canvas_width(cv), 0);
CPPUNIT_ASSERT_EQUAL(caca_get_canvas_height(cv), 0); CPPUNIT_ASSERT_EQUAL(caca_get_canvas_height(cv), 0);
CPPUNIT_ASSERT_EQUAL(-1, caca_set_canvas_size(cv, -1, 50));
CPPUNIT_ASSERT_EQUAL(-1, caca_set_canvas_size(cv, 50, -1));
CPPUNIT_ASSERT_EQUAL(-1, caca_set_canvas_size(cv, -1, -1));
CPPUNIT_ASSERT_EQUAL(-1, caca_set_canvas_size(cv, INT_MAX / 2, 3));
CPPUNIT_ASSERT_EQUAL(-1, caca_set_canvas_size(cv, 3, INT_MAX / 2));
CPPUNIT_ASSERT_EQUAL(-1, caca_set_canvas_size(cv, INT_MAX / 2, INT_MAX /
2));
CPPUNIT_ASSERT_EQUAL(0, caca_set_canvas_size(cv, 0, 0));
caca_free_canvas(cv); caca_free_canvas(cv);
} }
void test_chars() void test_chars()
{ {
caca_canvas_t *cv; caca_canvas_t *cv;
cv = caca_create_canvas(0, 0); cv = caca_create_canvas(0, 0);
CPPUNIT_ASSERT(caca_get_char(cv, 0, 0) == ' '); CPPUNIT_ASSERT(caca_get_char(cv, 0, 0) == ' ');
 End of changes. 5 change blocks. 
3 lines changed or deleted 16 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)