From 495555716e98a02b571a5dbc3200ef4ce928272c Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 24 Feb 2017 14:57:28 +0000 Subject: Format XML sub output nicely with indents and such. --- src/interop_subtitle_asset.cc | 2 +- src/smpte_subtitle_asset.cc | 2 +- test/write_subtitle_test.cc | 128 +++++++++++++++++++++--------------------- 3 files changed, 66 insertions(+), 66 deletions(-) diff --git a/src/interop_subtitle_asset.cc b/src/interop_subtitle_asset.cc index cfd37cb8..99511222 100644 --- a/src/interop_subtitle_asset.cc +++ b/src/interop_subtitle_asset.cc @@ -102,7 +102,7 @@ InteropSubtitleAsset::xml_as_string () const subtitles_as_xml (root, 250, INTEROP); - return doc.write_to_string ("UTF-8"); + return doc.write_to_string_formatted ("UTF-8"); } void diff --git a/src/smpte_subtitle_asset.cc b/src/smpte_subtitle_asset.cc index c2456b9c..3b30a0c7 100644 --- a/src/smpte_subtitle_asset.cc +++ b/src/smpte_subtitle_asset.cc @@ -278,7 +278,7 @@ SMPTESubtitleAsset::xml_as_string () const subtitles_as_xml (root->add_child ("SubtitleList", "dcst"), _time_code_rate, SMPTE); - return doc.write_to_string ("UTF-8"); + return doc.write_to_string_formatted ("UTF-8"); } /** Write this content to a MXF file */ diff --git a/test/write_subtitle_test.cc b/test/write_subtitle_test.cc index 02dc5e1e..773109f1 100644 --- a/test/write_subtitle_test.cc +++ b/test/write_subtitle_test.cc @@ -197,22 +197,22 @@ BOOST_AUTO_TEST_CASE (write_interop_subtitle_test) check_xml ( c.xml_as_string (), - "" - "a6c58cff-3e1e-4b38-acec-a42224475ef6" - "Test" - "1" - "EN" - "" - "" - "Hello world" - "" - "" - "" - "" - "What's going on" - "" - "" - "", + "\n" + " a6c58cff-3e1e-4b38-acec-a42224475ef6\n" + " Test\n" + " 1\n" + " EN\n" + " \n" + " \n" + " Hello world\n" + " \n" + " \n" + " \n" + " \n" + " What's going on\n" + " \n" + " \n" + "\n", list () ); } @@ -278,28 +278,28 @@ BOOST_AUTO_TEST_CASE (write_smpte_subtitle_test) check_xml ( c.xml_as_string (), - "" - "" - "urn:uuid:a6c58cff-3e1e-4b38-acec-a42224475ef6" - "Test" - "2016-04-01T03:52:00.000+00:00" - "1" - "EN" - "24 1" - "24" - "" - "" - "" - "Hello world" - "" - "" - "" - "" - "What's going on" - "" - "" - "" - "", + "\n" + "\n" + " urn:uuid:a6c58cff-3e1e-4b38-acec-a42224475ef6\n" + " Test\n" + " 2016-04-01T03:52:00.000+00:00\n" + " 1\n" + " EN\n" + " 24 1\n" + " 24\n" + " \n" + " \n" + " \n" + " Hello world\n" + " \n" + " \n" + " \n" + " \n" + " What's going on\n" + " \n" + " \n" + " \n" + "\n", list () ); } @@ -463,32 +463,32 @@ BOOST_AUTO_TEST_CASE (write_smpte_subtitle_test2) check_xml ( c.xml_as_string (), - "" - "" - "urn:uuid:a6c58cff-3e1e-4b38-acec-a42224475ef6" - "Test" - "2016-04-01T03:52:00.000+00:00" - "1" - "EN" - "24 1" - "24" - "" - "" - "" - "" - "Testing is " - "really" - " fun" - "" - "" - "This is the " - "second" - " line" - "" - "" - "" - "" - "", + "\n" + "\n" + " urn:uuid:a6c58cff-3e1e-4b38-acec-a42224475ef6\n" + " Test\n" + " 2016-04-01T03:52:00.000+00:00\n" + " 1\n" + " EN\n" + " 24 1\n" + " 24\n" + " \n" + " \n" + " \n" + " \n" + " Testing is \n" + " really\n" + " fun\n" + " \n" + " \n" + " This is the \n" + " second\n" + " line\n" + " \n" + " \n" + " \n" + " \n" + "\n", list () ); } -- cgit v1.2.3