Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preferred html always #545

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
test, compose: preferred_type = html should still give text for viewa…
…ble_text (false)
  • Loading branch information
yrashk authored and gauteh committed Oct 19, 2018
commit b571187e009982c6ecce2a9deed14ab4ea4aa97c
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()