Skip to content

Commit b571187

Browse files
yrashkgauteh
authored andcommitted
test, compose: preferred_type = html should still give text for viewable_text (false)
1 parent 55f1d30 commit b571187

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

tests/test_composed_message.cc

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
# include "account_manager.hh"
99
# include "utils/address.hh"
1010
# include "utils/ustring_utils.hh"
11+
# include <boost/property_tree/ptree.hpp>
1112

1213
BOOST_AUTO_TEST_SUITE(Composing)
1314

@@ -150,5 +151,37 @@ BOOST_AUTO_TEST_SUITE(Composing)
150151
teardown ();
151152
}
152153

154+
BOOST_AUTO_TEST_CASE (compose_test_body_preferred_html)
155+
{
156+
using Astroid::ComposeMessage;
157+
using Astroid::Message;
158+
using boost::property_tree::ptree;
159+
160+
setup ();
161+
const_cast<ptree&>(astroid->config()).put ("thread_view.preferred_type", "html");
162+
163+
ComposeMessage * c = new ComposeMessage ();
164+
165+
ustring bdy = "This is test: æøå.\n > testing\ntesting\n...";
166+
167+
LOG (trace) << "cm: writing utf-8 text to message body: " << bdy;
168+
c->body << bdy;
169+
170+
c->build ();
171+
c->finalize ();
172+
ustring fn = c->write_tmp ();
173+
174+
delete c;
175+
176+
Message m (fn);
177+
178+
ustring rbdy = m.viewable_text (false);
179+
180+
BOOST_CHECK_MESSAGE (bdy == rbdy, "message reading produces the same output as compose message input");
181+
182+
unlink (fn.c_str ());
183+
teardown ();
184+
}
185+
153186
BOOST_AUTO_TEST_SUITE_END()
154187

0 commit comments

Comments
 (0)