From cb17c3035bbd80bd8ea6718bae4c57cfb2555653 Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Thu, 15 Jun 2017 23:20:00 +0200 Subject: Initial monitor GUI Basic monitor functionality, GTK-3.0 and QT5 backends --- test/.gitignore | 1 + test/Makefile.am | 5 ++++- test/test-htmlattrtext.cc | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 test/test-htmlattrtext.cc (limited to 'test') diff --git a/test/.gitignore b/test/.gitignore index b102ce1..aa33417 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -8,3 +8,4 @@ /test-xdg /test-xdg /test-observers +/test-htmlattrtext diff --git a/test/Makefile.am b/test/Makefile.am index 4daf511..b5d2cee 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -3,7 +3,7 @@ MAINTAINERCLEANFILES = Makefile.in AM_CXXFLAGS = @DEFINES@ TESTS = test-url test-http test-args test-xdg test-paths test-strings \ - test-observers + test-observers test-htmlattrtext check_PROGRAMS = $(TESTS) @@ -26,3 +26,6 @@ test_paths_SOURCES = test-paths.cc test_paths_LDADD = $(top_builddir)/src/libtp.a test_observers_SOURCES = test-observers.cc + +test_htmlattrtext_SOURCES = test-htmlattrtext.cc +test_htmlattrtext_LDADD = $(top_builddir)/src/libattrstr.a diff --git a/test/test-htmlattrtext.cc b/test/test-htmlattrtext.cc new file mode 100644 index 0000000..a0d18e6 --- /dev/null +++ b/test/test-htmlattrtext.cc @@ -0,0 +1,38 @@ +// -*- 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; +} -- cgit v1.2.3-70-g09d2