diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-12-28 15:05:42 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-12-28 15:05:42 +0000 |
| commit | 1d3602b37934c3d0404e6a2fa9a5d3c5f6b70309 (patch) | |
| tree | 6ee6f2af8ce1841e272c21d764f1ddc462792d62 | |
| parent | 16340d64a8471969b27af4a7782995dd061927b9 (diff) | |
Remove Image:swap(); add some more tests.
| -rw-r--r-- | src/image.cc | 6 | ||||
| -rw-r--r-- | src/image.h | 3 | ||||
| -rw-r--r-- | test/image_test.cc | 68 | ||||
| -rw-r--r-- | test/wscript | 1 |
4 files changed, 69 insertions, 9 deletions
diff --git a/src/image.cc b/src/image.cc index 15ff24dc..15f1e589 100644 --- a/src/image.cc +++ b/src/image.cc @@ -39,9 +39,3 @@ Image::Image (boost::shared_ptr<const Image> other) { } - -void -Image::swap (Image& other) -{ - std::swap (_size, other._size); -} diff --git a/src/image.h b/src/image.h index 069534ea..d9109939 100644 --- a/src/image.h +++ b/src/image.h @@ -38,10 +38,7 @@ public: } protected: - void swap (Image &); - Size _size; - }; } diff --git a/test/image_test.cc b/test/image_test.cc new file mode 100644 index 00000000..26f27499 --- /dev/null +++ b/test/image_test.cc @@ -0,0 +1,68 @@ +/* + Copyright (C) 2014 Carl Hetherington <cth@carlh.net> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#include "image.h" +#include <boost/test/unit_test.hpp> + +using std::string; +using boost::shared_ptr; + +class TestImage : public dcp::Image +{ +public: + TestImage (dcp::Size s) + : Image (s) + { + + } + + TestImage (TestImage const & other) + : Image (other) + { + + } + + TestImage (shared_ptr<const TestImage> other) + : Image (other) + { + + } + + uint8_t** data () const { + return 0; + } + + int* stride () const { + return 0; + } +}; + +/** Token test for Image class to keep gcov happy */ +BOOST_AUTO_TEST_CASE (image_test) +{ + TestImage im (dcp::Size (412, 930)); + BOOST_CHECK_EQUAL (im.size (), dcp::Size (412, 930)); + + TestImage im2 (im); + BOOST_CHECK_EQUAL (im2.size (), im.size ()); + + shared_ptr<TestImage> im3 (new TestImage (dcp::Size (1203, 1294))); + TestImage im4 (im3); + BOOST_CHECK_EQUAL (im4.size (), im3->size ()); +} diff --git a/test/wscript b/test/wscript index 3ad2002c..b616b59d 100644 --- a/test/wscript +++ b/test/wscript @@ -38,6 +38,7 @@ def build(bld): exception_test.cc fraction_test.cc frame_info_test.cc + image_test.cc interop_load_font_test.cc local_time_test.cc kdm_test.cc |
