diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-12-28 02:41:13 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-12-28 02:41:13 +0000 |
| commit | 795b049f4a167677a8a2d39a4a09e8f5c2bb8dca (patch) | |
| tree | 09ed1934110e30e3f5eaa3a1d15cca3e05573572 /test | |
| parent | 1e0e3f4c2f3c956a4c011aaa1f9fb42a7339b129 (diff) | |
More tests.
Diffstat (limited to 'test')
| -rw-r--r-- | test/interop_load_font_test.cc | 66 | ||||
| -rw-r--r-- | test/wscript | 1 |
2 files changed, 67 insertions, 0 deletions
diff --git a/test/interop_load_font_test.cc b/test/interop_load_font_test.cc new file mode 100644 index 00000000..b5972762 --- /dev/null +++ b/test/interop_load_font_test.cc @@ -0,0 +1,66 @@ +/* + 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 "interop_load_font.h" +#include <libcxml/cxml.h> +#include <libxml++/libxml++.h> +#include <boost/test/unit_test.hpp> + +BOOST_AUTO_TEST_CASE (interop_load_font_test1) +{ + dcp::InteropLoadFont lf ("my-great-id", "my-great-uri"); + BOOST_CHECK_EQUAL (lf.id, "my-great-id"); + BOOST_CHECK_EQUAL (lf.uri, "my-great-uri"); +} + +BOOST_AUTO_TEST_CASE (interop_load_font_test2) +{ + xmlpp::Document doc; + xmlpp::Element* text = doc.create_root_node("Font"); + + text->set_attribute("Id", "my-great-id"); + text->set_attribute("URI", "my-great-uri"); + dcp::InteropLoadFont lf (cxml::ConstNodePtr (new cxml::Node (text))); + + BOOST_CHECK_EQUAL (lf.id, "my-great-id"); +} + +/** As per _test2 but with another capitalisation of ID */ +BOOST_AUTO_TEST_CASE (interop_load_font_test3) +{ + xmlpp::Document doc; + xmlpp::Element* text = doc.create_root_node("Font"); + + text->set_attribute("ID", "my-great-id"); + text->set_attribute("URI", "my-great-uri"); + dcp::InteropLoadFont lf (cxml::ConstNodePtr (new cxml::Node (text))); + + BOOST_CHECK_EQUAL (lf.id, "my-great-id"); +} + +/** Test operator== and operator!= */ +BOOST_AUTO_TEST_CASE (interop_load_font_test4) +{ + dcp::InteropLoadFont A ("my-create-id", "my-great-uri"); + dcp::InteropLoadFont B ("my-create-id", "my-great-uri"); + dcp::InteropLoadFont C ("my-create-id", "another-great-uri"); + + BOOST_CHECK (A == B); + BOOST_CHECK (B != C); +} diff --git a/test/wscript b/test/wscript index 28248eb4..ad1f0c02 100644 --- a/test/wscript +++ b/test/wscript @@ -37,6 +37,7 @@ def build(bld): encryption_test.cc fraction_test.cc frame_info_test.cc + interop_load_font_test.cc local_time_test.cc kdm_test.cc read_dcp_test.cc |
