From 795b049f4a167677a8a2d39a4a09e8f5c2bb8dca Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 28 Dec 2014 02:41:13 +0000 Subject: More tests. --- test/interop_load_font_test.cc | 66 ++++++++++++++++++++++++++++++++++++++++++ test/wscript | 1 + 2 files changed, 67 insertions(+) create mode 100644 test/interop_load_font_test.cc (limited to 'test') 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 + + 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 +#include +#include + +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 -- cgit v1.2.3