Skip to content

Commit

Permalink
test, compose: preferred_type = html should still give text for viewa…
Browse files Browse the repository at this point in the history
…ble_text (false)
  • Loading branch information
yrashk authored and gauteh committed Aug 30, 2018
1 parent 20b9171 commit 5fc72aa
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tests/test_composed_message.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# include "account_manager.hh"
# include "utils/address.hh"
# include "utils/ustring_utils.hh"
# include <boost/property_tree/ptree.hpp>

BOOST_AUTO_TEST_SUITE(Composing)

Expand Down Expand Up @@ -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<ptree&>(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()

0 comments on commit 5fc72aa

Please sign in to comment.