// -*- mode: c++; c-basic-offset: 2; -*- #include "common.hh" #include "test.hh" #include #include "gui_htmlattrtext.hh" namespace { bool test_sanity() { std::unique_ptr attr(HtmlAttributedText::create()); HtmlAttributedText::Attribute red(0xff, 0, 0); HtmlAttributedText::Attribute bold; HtmlAttributedText::Attribute green(0, 0xff, 0); bold.set_bold(true); ASSERT_EQ("", attr->html()); attr->append("Hello World"); ASSERT_EQ("Hello World", attr->html()); attr->append(" ", red); ASSERT_EQ("Hello World <!>", attr->html()); attr->add(bold, 0, 5); ASSERT_EQ("Hello World <!>", attr->html()); attr->add(red, 1, 2); ASSERT_EQ("Hello World <!>", attr->html()); attr->set(green, 1, 1); ASSERT_EQ("Hello World <!>", attr->html()); return true; } } // namespace int main(void) { BEFORE; RUN(test_sanity()); AFTER; }