From 5fc72aab36a92556891253157c8d443629e35ae1 Mon Sep 17 00:00:00 2001 From: Yurii Rashkovskii Date: Thu, 30 Aug 2018 11:34:22 +0200 Subject: [PATCH] test, compose: preferred_type = html should still give text for viewable_text (false) --- tests/test_composed_message.cc | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tests/test_composed_message.cc b/tests/test_composed_message.cc index e401dd0ef..e148a3b1d 100644 --- a/tests/test_composed_message.cc +++ b/tests/test_composed_message.cc @@ -8,6 +8,7 @@ # include "account_manager.hh" # include "utils/address.hh" # include "utils/ustring_utils.hh" +# include BOOST_AUTO_TEST_SUITE(Composing) @@ -150,5 +151,37 @@ BOOST_AUTO_TEST_SUITE(Composing) teardown (); } + BOOST_AUTO_TEST_CASE (compose_test_body_preferred_html) + { + using Astroid::ComposeMessage; + using Astroid::Message; + using boost::property_tree::ptree; + + setup (); + const_cast(astroid->config()).put ("thread_view.preferred_type", "html"); + + ComposeMessage * c = new ComposeMessage (); + + ustring bdy = "This is test: æøå.\n > testing\ntesting\n..."; + + LOG (trace) << "cm: writing utf-8 text to message body: " << bdy; + c->body << bdy; + + c->build (); + c->finalize (); + ustring fn = c->write_tmp (); + + delete c; + + Message m (fn); + + ustring rbdy = m.viewable_text (false); + + BOOST_CHECK_MESSAGE (bdy == rbdy, "message reading produces the same output as compose message input"); + + unlink (fn.c_str ()); + teardown (); + } + BOOST_AUTO_TEST_SUITE_END()