From 95c071758917718dae898e5eca94f96041897969 Mon Sep 17 00:00:00 2001 From: Markus Gans Date: Mon, 24 May 2021 21:13:10 +0200 Subject: [PATCH] Using std::string for the attribute buffer --- ChangeLog | 3 + examples/termcap.cpp | 11 +- src/ffiledialog.cpp | 23 +- src/fkeyboard.cpp | 14 +- src/foptiattr.cpp | 14 +- src/fterm.cpp | 38 +- src/fterm_functions.cpp | 4 +- src/ftermdetection.cpp | 8 +- src/ftermxterminal.cpp | 12 +- src/fvterm.cpp | 10 +- src/fwidget.cpp | 28 +- src/include/final/fkeyboard.h | 2 +- src/include/final/foptiattr.h | 9 +- src/include/final/fterm.h | 8 +- src/include/final/sgr_optimizer.h | 11 +- src/sgr_optimizer.cpp | 17 +- test/foptiattr-test.cpp | 1870 +++++++++++++++-------------- 17 files changed, 1053 insertions(+), 1029 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7f7230fb..22014ac6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2021-05-24 Markus Gans + * Using std::string for the attribute buffer + 2021-05-22 Markus Gans * Convert FOptiMove from char[] to std::string diff --git a/examples/termcap.cpp b/examples/termcap.cpp index 50dc8cec..8c3f4bc9 100644 --- a/examples/termcap.cpp +++ b/examples/termcap.cpp @@ -167,22 +167,21 @@ void tcapNumeric (const std::string& name, int cap_num) } //---------------------------------------------------------------------- -void tcapString (const std::string& name, const char cap_str[]) +void tcapString (const std::string& name, const char cap_string[]) { std::string sequence{}; + std::string cap_str{cap_string ? cap_string : std::string{}}; std::cout << name << ": "; - if ( cap_str == nullptr ) + if ( cap_str.empty() ) { std::cout << "\r\n"; return; } - const auto len = uInt(std::strlen(cap_str)); - - for (uInt i{0}; i < len; i++) + for (auto&& ch : cap_str) { - const auto c = uChar(cap_str[i]); + const auto c = uChar(ch); if ( c > 127 ) { diff --git a/src/ffiledialog.cpp b/src/ffiledialog.cpp index 67e78537..902fc494 100644 --- a/src/ffiledialog.cpp +++ b/src/ffiledialog.cpp @@ -372,18 +372,16 @@ void FFileDialog::initCallbacks() inline bool FFileDialog::patternMatch ( const char* const pattern , const char fname[] ) const { - std::array search{}; + std::string search{}; + search.reserve(128); if ( show_hidden && fname[0] == '.' && fname[1] != '\0' ) // hidden files { - search[0] = '.'; - search[1] = '\0'; - std::strncat(search.data(), pattern, search.size() - std::strlen(search.data()) - 1); + search = "."; + search.append(pattern); } else - std::strncpy(search.data(), pattern, search.size() - 1); - - search[search.size() - 1] = '\0'; + search = pattern; if ( fnmatch (search.data(), fname, FNM_PERIOD) == 0 ) return true; @@ -550,16 +548,11 @@ void FFileDialog::followSymLink (const char* const dir, FDirEntry& entry) const return; // No symbolic link std::array resolved_path{}; - std::array symLink{}; + std::string symLink{}; + symLink.reserve(MAXPATHLEN); struct stat sb{}; - const auto& fsystem = FTerm::getFSystem(); - std::strncpy (symLink.data(), dir, symLink.size() - 1); - symLink[symLink.size() - 1] = '\0'; - std::strncat ( symLink.data() - , entry.name.c_str() - , symLink.size() - std::strlen(symLink.data()) - 1); - symLink[symLink.size() - 1] = '\0'; + symLink = dir + entry.name; if ( fsystem->realpath(symLink.data(), resolved_path.data()) == nullptr ) return; // Cannot follow the symlink diff --git a/src/fkeyboard.cpp b/src/fkeyboard.cpp index 2fdd8351..30c8f6ae 100644 --- a/src/fkeyboard.cpp +++ b/src/fkeyboard.cpp @@ -396,18 +396,18 @@ inline bool FKeyboard::isKeypressTimeout() } //---------------------------------------------------------------------- -FKey FKeyboard::UTF8decode (const char utf8[]) const +FKey FKeyboard::UTF8decode (const std::string& utf8) const { + using distance_type = std::iterator_traits::difference_type; FKey ucs{FKey::None}; // Universal coded character constexpr std::size_t max = 4; - std::size_t len = std::strlen(utf8); + const auto len = utf8.length(); + auto end = utf8.begin() + + static_cast(std::min(len, max)); - if ( len > max ) - len = max; - - for (std::size_t i{0}; i < len; ++i) + for (auto iter{utf8.begin()}; iter < end; ++iter) { - const auto ch = uChar(utf8[i]); + const auto ch = uChar(*iter); if ( (ch & 0xc0) == 0x80 ) { diff --git a/src/foptiattr.cpp b/src/foptiattr.cpp index 6231b47f..82b57601 100644 --- a/src/foptiattr.cpp +++ b/src/foptiattr.cpp @@ -39,6 +39,8 @@ namespace finalcut //---------------------------------------------------------------------- FOptiAttr::FOptiAttr() { + attr_buf.reserve(SGRoptimizer::ATTR_BUF_SIZE); + // Set bits that must not be reset reset_byte_mask.attr.bit.transparent = true; reset_byte_mask.attr.bit.color_overlay = true; @@ -543,11 +545,11 @@ FColor FOptiAttr::vga2ansi (FColor color) } //---------------------------------------------------------------------- -const char* FOptiAttr::changeAttribute (FChar& term, FChar& next) +std::string FOptiAttr::changeAttribute (FChar& term, FChar& next) { const bool next_has_color = hasColor(next); fake_reverse = false; - attr_buf[0] = '\0'; + attr_buf.clear(); prevent_no_color_video_attributes (term, next_has_color); prevent_no_color_video_attributes (next); detectSwitchOn (term, next); @@ -559,7 +561,7 @@ const char* FOptiAttr::changeAttribute (FChar& term, FChar& next) // Look for no changes if ( ! (switchOn() || switchOff() || hasColorChanged(term, next)) ) - return nullptr; + return {}; if ( hasNoAttribute(next) ) { @@ -578,7 +580,7 @@ const char* FOptiAttr::changeAttribute (FChar& term, FChar& next) if ( FStartOptions::getFStartOptions().sgr_optimizer ) sgr_optimizer.optimize(); - return attr_buf.data(); + return attr_buf; } @@ -1537,9 +1539,7 @@ inline bool FOptiAttr::append_sequence (const char seq[]) if ( ! seq ) return false; - char* attr_ptr{attr_buf.data()}; - std::strncat (attr_ptr, seq, attr_buf.size() - std::strlen(attr_ptr)); - attr_buf[attr_buf.size() - 1] = '\0'; + attr_buf.append(seq); return true; } diff --git a/src/fterm.cpp b/src/fterm.cpp index 1105de3b..fe227bbe 100644 --- a/src/fterm.cpp +++ b/src/fterm.cpp @@ -428,9 +428,9 @@ bool FTerm::isInitialized() //---------------------------------------------------------------------- bool FTerm::isCursorHideable() { - const char* cursor_off_str = disableCursorString(); + const auto& cursor_off_str = disableCursorString(); - if ( cursor_off_str && std::strlen(cursor_off_str) > 0 ) + if ( ! cursor_off_str.empty() ) return true; return false; @@ -732,28 +732,28 @@ std::string FTerm::moveCursorString (int xold, int yold, int xnew, int ynew) } //---------------------------------------------------------------------- -const char* FTerm::cursorsVisibilityString (bool enable) +std::string FTerm::cursorsVisibilityString (bool enable) { // Hides or shows the input cursor on the terminal - const char* visibility_str{nullptr}; + std::string visibility_str{}; auto& data = FTerm::getFTermData(); if ( data.isCursorHidden() == enable ) - return nullptr; + return {}; if ( enable ) { visibility_str = disableCursorString(); - if ( visibility_str ) + if ( ! visibility_str.empty() ) data.setCursorHidden (true); // Global state } else { visibility_str = enableCursorString(); - if ( visibility_str ) + if ( ! visibility_str.empty() ) data.setCursorHidden (false); // Global state } @@ -1157,7 +1157,7 @@ void FTerm::initScreenSettings() } //---------------------------------------------------------------------- -const char* FTerm::changeAttribute (FChar& term_attr, FChar& next_attr) +std::string FTerm::changeAttribute (FChar& term_attr, FChar& next_attr) { auto& opti_attr = FTerm::getFOptiAttr(); return opti_attr.changeAttribute (term_attr, next_attr); @@ -1837,19 +1837,20 @@ void FTerm::setOverwriteCursorStyle() } //---------------------------------------------------------------------- -const char* FTerm::enableCursorString() +std::string FTerm::enableCursorString() { // Returns the cursor enable string - static constexpr std::size_t SIZE = 32; - static std::array enable_str{}; + static constexpr std::string::size_type SIZE{32u}; + std::string enable_str{}; + enable_str.reserve(SIZE); const auto& vs = TCAP(t_cursor_visible); const auto& ve = TCAP(t_cursor_normal); if ( ve ) - std::strncpy (enable_str.data(), ve, SIZE - 1); + enable_str = ve; else if ( vs ) - std::strncpy (enable_str.data(), vs, SIZE - 1); + enable_str = vs; #if defined(__linux__) if ( isLinuxTerm() ) @@ -1857,13 +1858,10 @@ const char* FTerm::enableCursorString() // Restore the last used Linux console cursor style auto& linux_console = FTerm::getFTermLinux(); const char* cstyle = linux_console.getCursorStyleString(); - std::size_t length = std::strlen(enable_str.data()); - std::strncat (enable_str.data(), cstyle, SIZE - length - 1); + enable_str.append(cstyle); } #endif // defined(__linux__) - enable_str[SIZE - 1] = '\0'; - #if defined(__FreeBSD__) || defined(__DragonFly__) || defined(UNIT_TEST) if ( isFreeBSDTerm() ) { @@ -1873,11 +1871,11 @@ const char* FTerm::enableCursorString() } #endif // defined(__FreeBSD__) || defined(__DragonFly__) || defined(UNIT_TEST) - return enable_str.data(); + return enable_str; } //---------------------------------------------------------------------- -const char* FTerm::disableCursorString() +std::string FTerm::disableCursorString() { // Returns the cursor disable string @@ -1886,7 +1884,7 @@ const char* FTerm::disableCursorString() if ( vi ) return vi; - return nullptr; + return {}; } //---------------------------------------------------------------------- diff --git a/src/fterm_functions.cpp b/src/fterm_functions.cpp index f170036e..8ad22ec3 100644 --- a/src/fterm_functions.cpp +++ b/src/fterm_functions.cpp @@ -689,10 +689,10 @@ FPoint readCursorPos() const int stdout_no{FTermios::getStdOut()}; fd_set ifds{}; struct timeval tv{}; - constexpr auto& DECXCPR{ESC "[6n"}; + const std::string DECXCPR{ESC "[6n"}; // Report Cursor Position (DECXCPR) - if ( write(stdout_no, DECXCPR, std::strlen(DECXCPR)) < 1 ) + if ( write(stdout_no, DECXCPR.data(), DECXCPR.length()) < 1 ) return {x, y}; std::fflush(stdout); diff --git a/src/ftermdetection.cpp b/src/ftermdetection.cpp index e32cabc9..c7b9b41e 100644 --- a/src/ftermdetection.cpp +++ b/src/ftermdetection.cpp @@ -330,9 +330,9 @@ void FTermDetection::termtypeAnalysis() if ( std::strncmp(termtype, "screen", 6) == 0 ) { terminal_type.screen = true; - const char* tmux = std::getenv("TMUX"); + std::string tmux = std::getenv("TMUX"); - if ( tmux && std::strlen(tmux) != 0 ) + if ( tmux.length() != 0 ) terminal_type.tmux = true; } @@ -813,10 +813,10 @@ FString FTermDetection::getSecDA() const int stdout_no{FTermios::getStdOut()}; fd_set ifds{}; struct timeval tv{}; - constexpr auto& SECDA{ESC "[>c"}; + const std::string SECDA{ESC "[>c"}; // Get the secondary device attributes - if ( write(stdout_no, SECDA, std::strlen(SECDA)) == -1 ) + if ( write(stdout_no, SECDA.data(), SECDA.length()) == -1 ) return sec_da_str; std::fflush(stdout); diff --git a/src/ftermxterminal.cpp b/src/ftermxterminal.cpp index e5529213..1e15cbfe 100644 --- a/src/ftermxterminal.cpp +++ b/src/ftermxterminal.cpp @@ -769,12 +769,12 @@ FString FTermXTerminal::captureXTermFont() const && temp[3] == '0' && temp[4] == ';' ) { // Skip leading Esc ] 5 0 ; - char* str = &temp[5]; - const std::size_t n = std::strlen(str); + std::string str = &temp[5]; + const std::size_t n = str.length(); // BEL + '\0' = string terminator if ( n >= 5 && str[n - 1] == BEL[0] && str[n] == '\0' ) - str[n - 1] = '\0'; + str.erase(n - 1); return {str}; } @@ -822,8 +822,8 @@ FString FTermXTerminal::captureXTermTitle() const if ( pos > 6 && temp[0] == ESC[0] && temp[1] == ']' && temp[2] == 'l' ) { // Skip leading Esc + ] + l = OSC l - char* str = &temp[3]; - const std::size_t n = std::strlen(str); + std::string str = &temp[3]; + const std::size_t n = str.length(); // Esc + \ = OSC string terminator if ( n >= 2 && str[n - 2] == ESC[0] && str[n - 1] == '\\' ) @@ -831,7 +831,7 @@ FString FTermXTerminal::captureXTermTitle() const if ( n < 4 ) return {}; - str[n - 2] = '\0'; + str.erase(n - 2); return {str}; } } diff --git a/src/fvterm.cpp b/src/fvterm.cpp index 17e3f734..a7f9de00 100644 --- a/src/fvterm.cpp +++ b/src/fvterm.cpp @@ -185,9 +185,9 @@ void FVTerm::hideCursor (bool enable) const if ( ! cursor_hideable ) return; - const char* visibility_str = FTerm::cursorsVisibilityString (enable); + auto visibility_str = FTerm::cursorsVisibilityString (enable); - if ( ! visibility_str ) // Exit the function if the string is empty + if ( visibility_str.empty() ) // Exit the function if the string is empty return; appendOutputBuffer(FTermControl{visibility_str}); @@ -1764,8 +1764,8 @@ FChar FVTerm::getCharacter ( CharacterType char_type const int x = pos.getX(); const int y = pos.getY(); - int xx = ( x > 0 ) ? x : 0; - int yy = ( y > 0 ) ? y : 0; + int xx = std::max(x, 0); + int yy = std::max(y, 0); if ( xx >= vterm->width ) xx = vterm->width - 1; @@ -3080,7 +3080,7 @@ inline void FVTerm::appendAttributes (FChar& next_attr) const // generate attribute string for the next character const auto& attr_str = FTerm::changeAttribute (term_attribute, next_attr); - if ( attr_str ) + if ( ! attr_str.empty() ) appendOutputBuffer (FTermControl{attr_str}); } diff --git a/src/fwidget.cpp b/src/fwidget.cpp index 0db33288..84acddf1 100644 --- a/src/fwidget.cpp +++ b/src/fwidget.cpp @@ -20,6 +20,7 @@ * . * ***********************************************************************/ +#include #include #include "final/fapplication.h" @@ -405,7 +406,7 @@ void FWidget::setPos (const FPoint& p, bool adjust) return; } - if ( ! isWindowWidget() ) + if ( ! isWindowWidget() ) // A widgets must be inside the client area { if ( pos.getX() < 1 ) pos.setX(1); @@ -430,7 +431,7 @@ void FWidget::setWidth (std::size_t width, bool adjust) if ( getWidth() == width && wsize.getWidth() == width ) return; - if ( width < 1 ) + if ( width < 1 ) // A width can never be narrower than 1 character width = 1; wsize.setWidth(width); @@ -452,7 +453,7 @@ void FWidget::setHeight (std::size_t height, bool adjust) if ( getHeight() == height && wsize.getHeight() == height ) return; - if ( height < 1 ) + if ( height < 1 ) // A height can never be narrower than 1 character height = 1; wsize.setHeight(height); @@ -479,10 +480,10 @@ void FWidget::setSize (const FSize& size, bool adjust) && getHeight() == height && wsize.getHeight() == height ) return; - if ( width < 1 ) + if ( width < 1 ) // A width can never be narrower than 1 character width = 1; - if ( height < 1 ) + if ( height < 1 ) // A height can never be narrower than 1 character height = 1; wsize.setWidth(width); @@ -624,20 +625,19 @@ void FWidget::setGeometry (const FPoint& p, const FSize& s, bool adjust) if ( getPos() == p && getWidth() == w && getHeight() == h ) return; - if ( ! isWindowWidget() ) - { - ( x < 1 ) ? wsize.setX(1) : wsize.setX(x); - ( y < 1 ) ? wsize.setY(1) : wsize.setY(y); - } - else + if ( isWindowWidget() ) // A window widget can be outside { wsize.setX(x); wsize.setY(y); } + else // A normal widget must be inside the client area + { + wsize.setX(std::max(x, 1)); + wsize.setY(std::max(y, 1)); + } - ( w < 1 ) ? wsize.setWidth(1) : wsize.setWidth(w); - ( h < 1 ) ? wsize.setHeight(1) : wsize.setHeight(h); - + wsize.setWidth(std::max(w, std::size_t(1u))); + wsize.setHeight(std::max(h, std::size_t(1u))); adjust_wsize = wsize; const int term_x = getTermX(); const int term_y = getTermY(); diff --git a/src/include/final/fkeyboard.h b/src/include/final/fkeyboard.h index f3a8552c..42df7eef 100644 --- a/src/include/final/fkeyboard.h +++ b/src/include/final/fkeyboard.h @@ -162,7 +162,7 @@ class FKeyboard final static bool isIntervalTimeout(); // Methods - FKey UTF8decode (const char[]) const; + FKey UTF8decode (const std::string&) const; ssize_t readKey(); void parseKeyBuffer(); FKey parseKeyString(); diff --git a/src/include/final/foptiattr.h b/src/include/final/foptiattr.h index 18af4e5e..a7f1cfbb 100644 --- a/src/include/final/foptiattr.h +++ b/src/include/final/foptiattr.h @@ -3,7 +3,7 @@ * * * This file is part of the FINAL CUT widget toolkit * * * -* Copyright 2016-2020 Markus Gans * +* Copyright 2016-2021 Markus Gans * * * * FINAL CUT is free software; you can redistribute it and/or modify * * it under the terms of the GNU Lesser General Public License as * @@ -156,7 +156,7 @@ class FOptiAttr final // Methods void initialize(); static FColor vga2ansi (FColor); - const char* changeAttribute (FChar&, FChar&); + std::string changeAttribute (FChar&, FChar&); private: struct Capability @@ -165,9 +165,6 @@ class FOptiAttr final bool caused_reset; }; - // Using-declaration - using AttributeBuffer = SGRoptimizer::AttributeBuffer; - // Enumerations enum init_reset_tests { @@ -303,8 +300,8 @@ class FOptiAttr final FChar off{}; FChar reset_byte_mask{}; + std::string attr_buf{}; SGRoptimizer sgr_optimizer{attr_buf}; - AttributeBuffer attr_buf{}; int max_color{1}; int attr_without_color{0}; diff --git a/src/include/final/fterm.h b/src/include/final/fterm.h index 2616441c..7fcb8ac8 100644 --- a/src/include/final/fterm.h +++ b/src/include/final/fterm.h @@ -268,7 +268,7 @@ class FTerm final static int openConsole(); static int closeConsole(); static std::string moveCursorString (int, int, int, int); - static const char* cursorsVisibilityString (bool = true); + static std::string cursorsVisibilityString (bool = true); static void detectTermSize(); static void setTermSize (const FSize&); static void setTermTitle (const FString&); @@ -301,7 +301,7 @@ class FTerm final void initTerminal(); static void initScreenSettings(); - static const char* changeAttribute (FChar&, FChar&); + static std::string changeAttribute (FChar&, FChar&); static void changeTermSizeFinished(); private: @@ -336,8 +336,8 @@ class FTerm final static void restoreColorPalette(); static void setInsertCursorStyle(); static void setOverwriteCursorStyle(); - static const char* enableCursorString(); - static const char* disableCursorString(); + static std::string enableCursorString(); + static std::string disableCursorString(); static void enableMouse(); static void disableMouse(); static void enableApplicationEscKey(); diff --git a/src/include/final/sgr_optimizer.h b/src/include/final/sgr_optimizer.h index 700c7320..81cde00a 100644 --- a/src/include/final/sgr_optimizer.h +++ b/src/include/final/sgr_optimizer.h @@ -3,7 +3,7 @@ * * * This file is part of the FINAL CUT widget toolkit * * * -* Copyright 2019-2020 Markus Gans * +* Copyright 2019-2021 Markus Gans * * * * FINAL CUT is free software; you can redistribute it and/or modify * * it under the terms of the GNU Lesser General Public License as * @@ -49,13 +49,10 @@ class SGRoptimizer final { public: // Constants - static constexpr std::size_t ATTR_BUF_SIZE{8192}; - - // Using-declaration - using AttributeBuffer = std::array; + static constexpr std::string::size_type ATTR_BUF_SIZE{8192u}; // Constructors - explicit SGRoptimizer (AttributeBuffer&); + explicit SGRoptimizer (std::string&); // Disable copy constructor SGRoptimizer (const SGRoptimizer&) = delete; @@ -78,7 +75,7 @@ class SGRoptimizer final void combineParameter(); // Data member - AttributeBuffer& seq; + std::string& seq; struct parameter { diff --git a/src/sgr_optimizer.cpp b/src/sgr_optimizer.cpp index a26f7e6f..fa426d88 100644 --- a/src/sgr_optimizer.cpp +++ b/src/sgr_optimizer.cpp @@ -3,7 +3,7 @@ * * * This file is part of the FINAL CUT widget toolkit * * * -* Copyright 2019-2020 Markus Gans * +* Copyright 2019-2021 Markus Gans * * * * FINAL CUT is free software; you can redistribute it and/or modify * * it under the terms of the GNU Lesser General Public License as * @@ -19,7 +19,7 @@ * License along with this program. If not, see * * . * ***********************************************************************/ - +#include #include #include @@ -35,9 +35,11 @@ namespace finalcut // constructors and destructor //---------------------------------------------------------------------- -SGRoptimizer::SGRoptimizer (AttributeBuffer& sequence) +SGRoptimizer::SGRoptimizer (std::string& sequence) : seq{sequence} -{ } +{ + seq.reserve(ATTR_BUF_SIZE); +} // public methods of SGRoptimizer @@ -55,7 +57,7 @@ void SGRoptimizer::findParameter() { // Find ANSI X3.64 terminal SGR (Select Graphic Rendition) strings - const std::size_t len = std::strlen(seq.data()); + const std::size_t len = seq.length(); csi_parameter.clear(); if ( len < 6 ) @@ -105,6 +107,7 @@ void SGRoptimizer::combineParameter() return; const auto& first = csi_parameter.front(); + const std::size_t len = seq.length(); std::size_t count = 1; std::size_t read_pos{}; std::size_t write_pos = first.end; @@ -146,12 +149,14 @@ void SGRoptimizer::combineParameter() } } - while ( seq[write_pos] != '\0' ) + while ( read_pos < len ) { seq[write_pos] = seq[read_pos]; read_pos++; write_pos++; } + + seq.erase(write_pos); } } // namespace finalcut diff --git a/test/foptiattr-test.cpp b/test/foptiattr-test.cpp index a5322b3e..9f24d0f7 100644 --- a/test/foptiattr-test.cpp +++ b/test/foptiattr-test.cpp @@ -3,7 +3,7 @@ * * * This file is part of the FINAL CUT widget toolkit * * * -* Copyright 2018-2020 Markus Gans * +* Copyright 2018-2021 Markus Gans * * * * FINAL CUT is free software; you can redistribute it and/or modify * * it under the terms of the GNU Lesser General Public License as * @@ -36,20 +36,17 @@ #include -#define CPPUNIT_ASSERT_CSTRING(expected, actual) \ - check_c_string (expected, actual, CPPUNIT_SOURCELINE()) +#define CPPUNIT_ASSERT_STRING(expected, actual) \ + check_string (expected, actual, CPPUNIT_SOURCELINE()) //---------------------------------------------------------------------- -void check_c_string ( const char* s1 - , const char* s2 - , CppUnit::SourceLine sourceLine ) +void check_string ( const std::string& s1 + , const std::string& s2 + , CppUnit::SourceLine sourceLine ) { - if ( s1 == 0 && s2 == 0 ) // Strings are equal + if ( s1 == s2 ) // Strings are equal return; - if ( s1 && s2 && std::strcmp (s1, s2) == 0 ) // Strings are equal - return; - ::CppUnit::Asserter::fail ("Strings are not equal", sourceLine); } @@ -187,7 +184,7 @@ void FOptiAttrTest::sgrOptimizerTest() finalcut::FChar from{}; finalcut::FChar to{}; - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Blue text on white background + bold + dim + italic to.fg_color = finalcut::FColor::Blue; @@ -196,10 +193,10 @@ void FOptiAttrTest::sgrOptimizerTest() to.attr.bit.dim = true; to.attr.bit.italic = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;10;2;1;3;34;47m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Yellow text on Black Yellow + bold to.fg_color = finalcut::FColor::Yellow; @@ -208,88 +205,123 @@ void FOptiAttrTest::sgrOptimizerTest() to.attr.bit.dim = false; to.attr.bit.italic = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;10;1;33;40m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Test only the optimizer // ----------------------- - finalcut::SGRoptimizer::AttributeBuffer buffer = { CSI "0;10m" CSI "11m" CSI "36m" CSI "44m" }; + std::string buffer = { CSI "0;10m" CSI "11m" CSI "36m" CSI "44m" }; finalcut::SGRoptimizer sgr_optimizer(buffer); + CPPUNIT_ASSERT ( buffer.length() == 22 ); sgr_optimizer.optimize(); - CPPUNIT_ASSERT_CSTRING ( buffer.data(), CSI "0;10;11;36;44m" ); + CPPUNIT_ASSERT ( buffer.length() == 16 ); + CPPUNIT_ASSERT_STRING ( buffer.data(), CSI "0;10;11;36;44m" ); - std::strcpy(buffer.data(), CSI "0;1m" CSI "34m"); + buffer = CSI "0;1m" CSI "34m"; + CPPUNIT_ASSERT ( buffer.length() == 11 ); sgr_optimizer.optimize(); - CPPUNIT_ASSERT_CSTRING ( buffer.data(), CSI "0;1;34m" ); + CPPUNIT_ASSERT ( buffer.length() == 9 ); + CPPUNIT_ASSERT_STRING ( buffer.data(), CSI "0;1;34m" ); - std::strcpy(buffer.data(), CSI "m" CSI "34m"); + buffer = CSI "m" CSI "34m"; + CPPUNIT_ASSERT ( buffer.length() == 8 ); sgr_optimizer.optimize(); - CPPUNIT_ASSERT_CSTRING ( buffer.data(), CSI "0;34m" ); + CPPUNIT_ASSERT ( buffer.length() == 7 ); + CPPUNIT_ASSERT_STRING ( buffer.data(), CSI "0;34m" ); - std::strcpy(buffer.data(), CSI "1m" CSI "m" CSI "45m"); + buffer = CSI "1m" CSI "m" CSI "45m"; + CPPUNIT_ASSERT ( buffer.length() == 12 ); sgr_optimizer.optimize(); - CPPUNIT_ASSERT_CSTRING ( buffer.data(), CSI "1;0;45m" ); + CPPUNIT_ASSERT ( buffer.length() == 9 ); + CPPUNIT_ASSERT_STRING ( buffer.data(), CSI "1;0;45m" ); - std::strcpy(buffer.data(), CSI "47m"); + buffer = CSI "47m"; + CPPUNIT_ASSERT ( buffer.length() == 5 ); sgr_optimizer.optimize(); - CPPUNIT_ASSERT_CSTRING ( buffer.data(), CSI "47m" ); + CPPUNIT_ASSERT ( buffer.length() == 5 ); + CPPUNIT_ASSERT_STRING ( buffer.data(), CSI "47m" ); - std::strcpy(buffer.data(), CSI "47m" CSI "m" CSI "1m"); + buffer = CSI "47m" CSI "m" CSI "1m"; + CPPUNIT_ASSERT ( buffer.length() == 12 ); sgr_optimizer.optimize(); - CPPUNIT_ASSERT_CSTRING ( buffer.data(), CSI "47;0;1m" ); + CPPUNIT_ASSERT ( buffer.length() == 9 ); + CPPUNIT_ASSERT_STRING ( buffer.data(), CSI "47;0;1m" ); - std::strcpy(buffer.data(), CSI "49m" CSI "m" CSI "0m"); + buffer = CSI "49m" CSI "m" CSI "0m"; + CPPUNIT_ASSERT ( buffer.length() == 12 ); sgr_optimizer.optimize(); - CPPUNIT_ASSERT_CSTRING ( buffer.data(), CSI "49;0;0m" ); + CPPUNIT_ASSERT ( buffer.length() == 9 ); + CPPUNIT_ASSERT_STRING ( buffer.data(), CSI "49;0;0m" ); - std::strcpy(buffer.data(), CSI "m" CSI "m" CSI "m"); + buffer = CSI "m" CSI "m" CSI "m"; + CPPUNIT_ASSERT ( buffer.length() == 9 ); sgr_optimizer.optimize(); - CPPUNIT_ASSERT_CSTRING ( buffer.data(), CSI "0;0;0m" ); + CPPUNIT_ASSERT ( buffer.length() == 8 ); + CPPUNIT_ASSERT_STRING ( buffer.data(), CSI "0;0;0m" ); - std::strcpy(buffer.data(), CSI "m"); + buffer = CSI "m"; + CPPUNIT_ASSERT ( buffer.length() == 3 ); sgr_optimizer.optimize(); - CPPUNIT_ASSERT_CSTRING ( buffer.data(), CSI "m" ); + CPPUNIT_ASSERT ( buffer.length() == 3 ); + CPPUNIT_ASSERT_STRING ( buffer.data(), CSI "m" ); - std::strcpy(buffer.data(), CSI "0;10;1;7m" CSI "3m" CSI "39m" CSI "49m"); + buffer = CSI "0;10;1;7m" CSI "3m" CSI "39m" CSI "49m"; + CPPUNIT_ASSERT ( buffer.length() == 25 ); sgr_optimizer.optimize(); - CPPUNIT_ASSERT_CSTRING ( buffer.data(), CSI "0;10;1;7;3;39;49m" ); + CPPUNIT_ASSERT ( buffer.length() == 19 ); + CPPUNIT_ASSERT_STRING ( buffer.data(), CSI "0;10;1;7;3;39;49m" ); - std::strcpy(buffer.data(), CSI "m" CSI "38;5;20m" CSI "48;5;229m"); + buffer = CSI "m" CSI "38;5;20m" CSI "48;5;229m"; + CPPUNIT_ASSERT ( buffer.length() == 24 ); sgr_optimizer.optimize(); - CPPUNIT_ASSERT_CSTRING ( buffer.data(), CSI "0;38;5;20;48;5;229m" ); + CPPUNIT_ASSERT ( buffer.length() == 21 ); + CPPUNIT_ASSERT_STRING ( buffer.data(), CSI "0;38;5;20;48;5;229m" ); - std::strcpy(buffer.data(), CSI "m" CSI "38;5;20m" CSI "11;16H"); + buffer = CSI "m" CSI "38;5;20m" CSI "11;16H"; + CPPUNIT_ASSERT ( buffer.length() == 21 ); sgr_optimizer.optimize(); - CPPUNIT_ASSERT_CSTRING ( buffer.data(), CSI "0;38;5;20m" CSI "11;16H" ); + CPPUNIT_ASSERT ( buffer.length() == 20 ); + CPPUNIT_ASSERT_STRING ( buffer.data(), CSI "0;38;5;20m" CSI "11;16H" ); - std::strcpy(buffer.data(), CSI "1;1H" CSI "m" CSI "38;5;35m"); + buffer = CSI "1;1H" CSI "m" CSI "38;5;35m"; + CPPUNIT_ASSERT ( buffer.length() == 19 ); sgr_optimizer.optimize(); - CPPUNIT_ASSERT_CSTRING ( buffer.data(), CSI "1;1H" CSI "0;38;5;35m" ); + CPPUNIT_ASSERT ( buffer.length() == 18 ); + CPPUNIT_ASSERT_STRING ( buffer.data(), CSI "1;1H" CSI "0;38;5;35m" ); - std::strcpy(buffer.data(), CSI "m" CSI "38;5;20m" CSI "11;16H" CSI "48;5;229m"); + buffer = CSI "m" CSI "38;5;20m" CSI "11;16H" CSI "48;5;229m"; + CPPUNIT_ASSERT ( buffer.length() == 32 ); sgr_optimizer.optimize(); - CPPUNIT_ASSERT_CSTRING ( buffer.data(), CSI "0;38;5;20m" CSI "11;16H" CSI "48;5;229m" ); + CPPUNIT_ASSERT ( buffer.length() == 31 ); + CPPUNIT_ASSERT_STRING ( buffer.data(), CSI "0;38;5;20m" CSI "11;16H" CSI "48;5;229m" ); - std::strcpy(buffer.data(), CSI "m" CSI "38;5;20m" "ABC" CSI "48;5;229m"); + buffer = CSI "m" CSI "38;5;20m" "ABC" CSI "48;5;229m"; + CPPUNIT_ASSERT ( buffer.length() == 27 ); sgr_optimizer.optimize(); - CPPUNIT_ASSERT_CSTRING ( buffer.data(), CSI "0;38;5;20mABC" CSI "48;5;229m" ); + CPPUNIT_ASSERT ( buffer.length() == 26 ); + CPPUNIT_ASSERT_STRING ( buffer.data(), CSI "0;38;5;20mABC" CSI "48;5;229m" ); - - std::strcpy(buffer.data(), CSI "m" CSI "1m" CSI "2m" CSI "3m" CSI "4m" - CSI "5m" CSI "7m" CSI "8m" CSI "9m"); + buffer = CSI "m" CSI "1m" CSI "2m" CSI "3m" CSI "4m" + CSI "5m" CSI "7m" CSI "8m" CSI "9m"; + CPPUNIT_ASSERT ( buffer.length() == 35 ); sgr_optimizer.optimize(); - CPPUNIT_ASSERT_CSTRING ( buffer.data(), CSI "0;1;2;3;4;5;7;8;9m" ); + CPPUNIT_ASSERT ( buffer.length() == 20 ); + CPPUNIT_ASSERT_STRING ( buffer.data(), CSI "0;1;2;3;4;5;7;8;9m" ); - std::strcpy(buffer.data(), CSI "0m" CSI "46;36;1m"); + buffer = CSI "0m" CSI "46;36;1m"; + CPPUNIT_ASSERT ( buffer.length() == 14 ); sgr_optimizer.optimize(); - CPPUNIT_ASSERT_CSTRING ( buffer.data(), CSI "0;46;36;1m" ); + CPPUNIT_ASSERT ( buffer.length() == 12 ); + CPPUNIT_ASSERT_STRING ( buffer.data(), CSI "0;46;36;1m" ); - std::strcpy(buffer.data(), CSI "m" CSI "38;2;0;139;139m" CSI "48;2;240;255;240m"); + buffer = CSI "m" CSI "38;2;0;139;139m" CSI "48;2;240;255;240m"; + CPPUNIT_ASSERT ( buffer.length() == 39 ); sgr_optimizer.optimize(); - CPPUNIT_ASSERT_CSTRING ( buffer.data(), CSI "0;38;2;0;139;139;48;2;240;255;240m" ); + CPPUNIT_ASSERT ( buffer.length() == 36 ); + CPPUNIT_ASSERT_STRING ( buffer.data(), CSI "0;38;2;0;139;139;48;2;240;255;240m" ); } //---------------------------------------------------------------------- @@ -361,21 +393,21 @@ void FOptiAttrTest::fakeReverseTest() finalcut::FChar from{}; finalcut::FChar to{}; - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Gray text on blue background to.fg_color = finalcut::FColor::LightGray; to.bg_color = finalcut::FColor::Blue; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "37m" CSI "44m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Reverse on to.attr.bit.reverse = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "34m" CSI "47m" ); CPPUNIT_ASSERT ( from.fg_color == finalcut::FColor::LightGray ); CPPUNIT_ASSERT ( from.bg_color == finalcut::FColor::Blue ); @@ -384,18 +416,18 @@ void FOptiAttrTest::fakeReverseTest() // Gray text on red background to.bg_color = finalcut::FColor::Red; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "31m" CSI "47m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Reverse off to.attr.bit.reverse = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "37m" CSI "41m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); } //---------------------------------------------------------------------- @@ -454,7 +486,7 @@ void FOptiAttrTest::ansiTest() finalcut::FChar from{}; finalcut::FChar to{}; - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Default color + bold from.fg_color = finalcut::FColor::Default; @@ -463,10 +495,10 @@ void FOptiAttrTest::ansiTest() to.fg_color = finalcut::FColor::Default; to.bg_color = finalcut::FColor::Default; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;10;1m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Blue text on white background + dim + italic to.fg_color = finalcut::FColor::Blue; @@ -474,10 +506,10 @@ void FOptiAttrTest::ansiTest() to.attr.bit.dim = true; to.attr.bit.italic = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;10;1m" CSI "34m" CSI "47m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Reset attributes + default background to.attr.bit.bold = false; @@ -485,238 +517,238 @@ void FOptiAttrTest::ansiTest() to.attr.bit.italic = false; to.bg_color = finalcut::FColor::Default; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" CSI "34m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Red text on black background to.fg_color = finalcut::FColor::Red; to.bg_color = finalcut::FColor::Black; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "31m" CSI "40m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // 256 color text and background to.fg_color = finalcut::FColor::SpringGreen3; to.bg_color = finalcut::FColor::NavyBlue; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "32m" CSI "44m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Bold on (with default colors) to.fg_color = finalcut::FColor::Default; to.bg_color = finalcut::FColor::Default; to.attr.bit.bold = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;10;1m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Bold off (with default colors) to.attr.bit.bold = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Dim on (with default colors) to.attr.bit.dim = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;10m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Dim off (with default colors) to.attr.bit.dim = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Italic on (with default colors) to.attr.bit.italic = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;10m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Italic off (with default colors) to.attr.bit.italic = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Underline on (with default colors) to.attr.bit.underline = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;10;4m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Underline off (with default colors) to.attr.bit.underline = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Blink on (with default colors) to.attr.bit.blink = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;10;5m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Blink off (with default colors) to.attr.bit.blink = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Reverse on (with default colors) to.attr.bit.reverse = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;10;7m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Reverse off (with default colors) to.attr.bit.reverse = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Standout on (with default colors) to.attr.bit.standout = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;10;7m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Standout off (with default colors) to.attr.bit.standout = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Invisible on (with default colors) to.attr.bit.invisible = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;10;8m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Invisible off (with default colors) to.attr.bit.invisible = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Protect on (with default colors) to.attr.bit.protect = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;10m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Protect off (with default colors) to.attr.bit.protect = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Crossed out on (with default colors) to.attr.bit.crossed_out = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;10m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Crossed out off (with default colors) to.attr.bit.crossed_out = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Double underline on (with default colors) to.attr.bit.dbl_underline = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;10m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Double underline off (with default colors) to.attr.bit.dbl_underline = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Alternate character set on (with default colors) to.attr.bit.alt_charset = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;10;11m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Alternate character set off (with default colors) to.attr.bit.alt_charset = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "10m" CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // PC character set on (with default colors) to.attr.bit.pc_charset = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;10m" CSI "11m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // PC character set off (with default colors) to.attr.bit.pc_charset = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" CSI "10m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Turn on all attributes (with default colors) to.attr.bit.pc_charset = true; @@ -734,133 +766,133 @@ void FOptiAttrTest::ansiTest() to.attr.bit.alt_charset = true; to.attr.bit.pc_charset = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;10;7;4;7;5;1;8;11m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Cyan text on blue background to.fg_color = finalcut::FColor::Cyan; to.bg_color = finalcut::FColor::Blue; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "36m" CSI "44m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Bold off to.attr.bit.bold = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;10;7;5;8;11m" CSI "36m" CSI "44m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Dim off to.attr.bit.dim = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;10;7;5;8;11m" CSI "36m" CSI "44m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Italic off to.attr.bit.italic = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;10;7;5;8;11m" CSI "36m" CSI "44m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Underline off to.attr.bit.underline = false; CPPUNIT_ASSERT ( from == to ); // because of noColorVideo = 3 - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Blink off to.attr.bit.blink = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;10;7;8;11m" CSI "36m" CSI "44m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Reverse off to.attr.bit.reverse = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;10;8;11m" CSI "36m" CSI "44m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Standout off to.attr.bit.standout = false; CPPUNIT_ASSERT ( from == to ); // because of noColorVideo = 3 - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Invisible off to.attr.bit.invisible = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;10;11m" CSI "36m" CSI "44m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Protect off to.attr.bit.protect = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;10;11m" CSI "36m" CSI "44m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Crossed out off to.attr.bit.crossed_out = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;10;11m" CSI "36m" CSI "44m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Double underline off to.attr.bit.dbl_underline = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;10;11m" CSI "36m" CSI "44m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Alternate character set off to.attr.bit.alt_charset = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;10m" CSI "11m" CSI "36m" CSI "44m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // PC character set off to.attr.bit.pc_charset = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" CSI "10m" CSI "36m" CSI "44m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Green text color to.fg_color = finalcut::FColor::Green; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), CSI "32m" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), CSI "32m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Default text color to.fg_color = finalcut::FColor::Default; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( printSequence(oa.changeAttribute(from, to)).c_str() + CPPUNIT_ASSERT_STRING ( printSequence(oa.changeAttribute(from, to)).c_str() , "Esc [ 3 9 m " ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); } //---------------------------------------------------------------------- @@ -917,7 +949,7 @@ void FOptiAttrTest::vt100Test() finalcut::FChar from{}; finalcut::FChar to{}; - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Default color + bold from.fg_color = finalcut::FColor::Default; @@ -926,10 +958,10 @@ void FOptiAttrTest::vt100Test() to.fg_color = finalcut::FColor::Default; to.bg_color = finalcut::FColor::Default; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;1m\017$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Blue text on white background + dim + italic to.fg_color = finalcut::FColor::Blue; @@ -937,10 +969,10 @@ void FOptiAttrTest::vt100Test() to.attr.bit.dim = true; to.attr.bit.italic = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;1m\017$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Reset attributes + default background to.attr.bit.bold = false; @@ -948,21 +980,21 @@ void FOptiAttrTest::vt100Test() to.attr.bit.italic = false; to.bg_color = finalcut::FColor::Default; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); // Red text on black background to.fg_color = finalcut::FColor::Red; to.bg_color = finalcut::FColor::Black; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , "" ); // 256 color text and background to.fg_color = finalcut::FColor::SpringGreen3; to.bg_color = finalcut::FColor::NavyBlue; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); // Bold on (with default colors) @@ -970,211 +1002,211 @@ void FOptiAttrTest::vt100Test() to.bg_color = finalcut::FColor::Default; to.attr.bit.bold = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;1m\017$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Bold off (with default colors) to.attr.bit.bold = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Dim on (with default colors) to.attr.bit.dim = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Dim off (with default colors) to.attr.bit.dim = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Italic on (with default colors) to.attr.bit.italic = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Italic off (with default colors) to.attr.bit.italic = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Underline on (with default colors) to.attr.bit.underline = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;4m\017$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Underline off (with default colors) to.attr.bit.underline = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Blink on (with default colors) to.attr.bit.blink = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;5m\017$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Blink off (with default colors) to.attr.bit.blink = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Reverse on (with default colors) to.attr.bit.reverse = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;7m\017$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Reverse off (with default colors) to.attr.bit.reverse = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Standout on (with default colors) to.attr.bit.standout = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;1;7m\017$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Standout off (with default colors) to.attr.bit.standout = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Invisible on (with default colors) to.attr.bit.invisible = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017$<2>" ); CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( to.encoded_char[0] == ' ' ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Invisible off (with default colors) to.attr.bit.invisible = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Protect on (with default colors) to.attr.bit.protect = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Protect off (with default colors) to.attr.bit.protect = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Crossed out on (with default colors) to.attr.bit.crossed_out = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Crossed out off (with default colors) to.attr.bit.crossed_out = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Double underline on (with default colors) to.attr.bit.dbl_underline = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Double underline off (with default colors) to.attr.bit.dbl_underline = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Alternate character set on (with default colors) to.attr.bit.alt_charset = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\016$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Alternate character set off (with default colors) to.attr.bit.alt_charset = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , "\017" CSI "0m$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // PC character set on (with default colors) to.attr.bit.pc_charset = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // PC character set off (with default colors) to.attr.bit.pc_charset = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Turn on all attributes (with default colors) to.attr.bit.pc_charset = true; @@ -1192,133 +1224,133 @@ void FOptiAttrTest::vt100Test() to.attr.bit.alt_charset = true; to.attr.bit.pc_charset = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;1;4;7;5m\016$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Cyan text on blue background to.fg_color = finalcut::FColor::Cyan; to.bg_color = finalcut::FColor::Blue; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); // Bold off to.attr.bit.bold = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m$<2>\016" CSI "4m$<2>" CSI "5m$<2>" CSI "7m$<2>" CSI "7m$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Dim off to.attr.bit.dim = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m$<2>\016" CSI "4m$<2>" CSI "5m$<2>" CSI "7m$<2>" CSI "7m$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Italic off to.attr.bit.italic = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Underline off to.attr.bit.underline = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "m$<2>\016" CSI "5m$<2>" CSI "7m$<2>" CSI "7m$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Blink off to.attr.bit.blink = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m$<2>\016" CSI "7m$<2>" CSI "7m$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Reverse off to.attr.bit.reverse = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m$<2>\016" CSI "7m$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Standout off to.attr.bit.standout = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "m$<2>\016" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Invisible off to.attr.bit.invisible = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m$<2>\016" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Protect off to.attr.bit.protect = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m$<2>\016" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Crossed out off to.attr.bit.crossed_out = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m$<2>\016" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Double underline off to.attr.bit.dbl_underline = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Alternate character set off to.attr.bit.alt_charset = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "\017" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // PC character set off to.attr.bit.pc_charset = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Green text color to.fg_color = finalcut::FColor::Green; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Default text color to.fg_color = finalcut::FColor::Default; CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); } //---------------------------------------------------------------------- @@ -1385,7 +1417,7 @@ void FOptiAttrTest::xtermTest() finalcut::FChar from{}; finalcut::FChar to{}; - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Default color + bold from.fg_color = finalcut::FColor::Default; @@ -1394,10 +1426,10 @@ void FOptiAttrTest::xtermTest() to.fg_color = finalcut::FColor::Default; to.bg_color = finalcut::FColor::Default; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(B" CSI "0;1m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Blue text on white background + dim + italic to.fg_color = finalcut::FColor::Blue; @@ -1405,11 +1437,11 @@ void FOptiAttrTest::xtermTest() to.attr.bit.dim = true; to.attr.bit.italic = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(B" CSI "0;1;2m" CSI "3m" CSI "34m" CSI "107m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Reset attributes + default background to.attr.bit.bold = false; @@ -1417,238 +1449,238 @@ void FOptiAttrTest::xtermTest() to.attr.bit.italic = false; to.bg_color = finalcut::FColor::Default; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" CSI "34m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Red text on black background to.fg_color = finalcut::FColor::Red; to.bg_color = finalcut::FColor::Black; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "31m" CSI "40m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // 256 color text and background to.fg_color = finalcut::FColor::SpringGreen3; to.bg_color = finalcut::FColor::NavyBlue; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "38;5;42m" CSI "48;5;17m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Bold on (with default colors) to.fg_color = finalcut::FColor::Default; to.bg_color = finalcut::FColor::Default; to.attr.bit.bold = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(B" CSI "0;1m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Bold off (with default colors) to.attr.bit.bold = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Dim on (with default colors) to.attr.bit.dim = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(B" CSI "0;2m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Dim off (with default colors) to.attr.bit.dim = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Italic on (with default colors) to.attr.bit.italic = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(B" CSI "0m" CSI "3m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Italic off (with default colors) to.attr.bit.italic = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Underline on (with default colors) to.attr.bit.underline = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(B" CSI "0;4m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Underline off (with default colors) to.attr.bit.underline = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Blink on (with default colors) to.attr.bit.blink = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(B" CSI "0;5m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Blink off (with default colors) to.attr.bit.blink = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Reverse on (with default colors) to.attr.bit.reverse = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(B" CSI "0;7m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Reverse off (with default colors) to.attr.bit.reverse = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Standout on (with default colors) to.attr.bit.standout = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(B" CSI "0;7m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Standout off (with default colors) to.attr.bit.standout = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Invisible on (with default colors) to.attr.bit.invisible = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(B" CSI "0;8m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Invisible off (with default colors) to.attr.bit.invisible = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Protect on (with default colors) to.attr.bit.protect = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(B" CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Protect off (with default colors) to.attr.bit.protect = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Crossed out on (with default colors) to.attr.bit.crossed_out = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(B" CSI "0m" CSI "9m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Crossed out off (with default colors) to.attr.bit.crossed_out = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Double underline on (with default colors) to.attr.bit.dbl_underline = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(B" CSI "0m" CSI "21m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Double underline off (with default colors) to.attr.bit.dbl_underline = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Alternate character set on (with default colors) to.attr.bit.alt_charset = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(0" CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Alternate character set off (with default colors) to.attr.bit.alt_charset = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(B" CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // PC character set on (with default colors) to.attr.bit.pc_charset = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(B" CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // PC character set off (with default colors) to.attr.bit.pc_charset = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Turn on all attributes (with default colors) to.attr.bit.pc_charset = true; @@ -1666,138 +1698,138 @@ void FOptiAttrTest::xtermTest() to.attr.bit.alt_charset = true; to.attr.bit.pc_charset = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(0" CSI "0;1;2;4;7;5;8m" CSI "3m" CSI "9m" CSI "21m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Cyan text on blue background to.fg_color = finalcut::FColor::Cyan; to.bg_color = finalcut::FColor::Blue; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "36m" CSI "44m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Bold off to.attr.bit.bold = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "22m" CSI "2m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Dim off to.attr.bit.dim = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "22m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Italic off to.attr.bit.italic = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "23m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Underline off to.attr.bit.underline = false; - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "24m" CSI "21m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Blink off to.attr.bit.blink = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "25m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Reverse off to.attr.bit.reverse = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "27m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Standout off to.attr.bit.standout = false; - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "27m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Invisible off to.attr.bit.invisible = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "28m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Protect off to.attr.bit.protect = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" CSI "36m" CSI "44m" ESC "(0" CSI "9m" CSI "21m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Crossed out off to.attr.bit.crossed_out = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "29m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Double underline off to.attr.bit.dbl_underline = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "24m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Alternate character set off to.attr.bit.alt_charset = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(B" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // PC character set off to.attr.bit.pc_charset = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" CSI "36m" CSI "44m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Green text color to.fg_color = finalcut::FColor::Green; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), CSI "32m" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), CSI "32m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Default text color to.fg_color = finalcut::FColor::Default; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( printSequence(oa.changeAttribute(from, to)).c_str() + CPPUNIT_ASSERT_STRING ( printSequence(oa.changeAttribute(from, to)).c_str() , "Esc [ 3 9 m " ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); } //---------------------------------------------------------------------- @@ -1854,7 +1886,7 @@ void FOptiAttrTest::rxvtTest() finalcut::FChar from{}; finalcut::FChar to{}; - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Default color + bold from.fg_color = finalcut::FColor::Default; @@ -1863,10 +1895,10 @@ void FOptiAttrTest::rxvtTest() to.fg_color = finalcut::FColor::Default; to.bg_color = finalcut::FColor::Default; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;1m\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Blue text on white background + dim + italic to.fg_color = finalcut::FColor::Blue; @@ -1874,10 +1906,10 @@ void FOptiAttrTest::rxvtTest() to.attr.bit.dim = true; to.attr.bit.italic = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;1m\017" CSI "34m" CSI "47m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Reset attributes + default background to.attr.bit.bold = false; @@ -1885,239 +1917,239 @@ void FOptiAttrTest::rxvtTest() to.attr.bit.italic = false; to.bg_color = finalcut::FColor::Default; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" CSI "34m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Red text on black background to.fg_color = finalcut::FColor::Red; to.bg_color = finalcut::FColor::Black; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "31m" CSI "40m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // 256 color text and background to.fg_color = finalcut::FColor::SpringGreen3; to.bg_color = finalcut::FColor::NavyBlue; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "32m" CSI "44m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Bold on (with default colors) to.fg_color = finalcut::FColor::Default; to.bg_color = finalcut::FColor::Default; to.attr.bit.bold = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;1m\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Bold off (with default colors) to.attr.bit.bold = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Dim on (with default colors) to.attr.bit.dim = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Dim off (with default colors) to.attr.bit.dim = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Italic on (with default colors) to.attr.bit.italic = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Italic off (with default colors) to.attr.bit.italic = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Underline on (with default colors) to.attr.bit.underline = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;4m\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Underline off (with default colors) to.attr.bit.underline = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Blink on (with default colors) to.attr.bit.blink = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;5m\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Blink off (with default colors) to.attr.bit.blink = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Reverse on (with default colors) to.attr.bit.reverse = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;7m\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Reverse off (with default colors) to.attr.bit.reverse = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Standout on (with default colors) to.attr.bit.standout = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;7m\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Standout off (with default colors) to.attr.bit.standout = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Invisible on (with default colors) to.attr.bit.invisible = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( to.encoded_char[0] == ' ' ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Invisible off (with default colors) to.attr.bit.invisible = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Protect on (with default colors) to.attr.bit.protect = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Protect off (with default colors) to.attr.bit.protect = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Crossed out on (with default colors) to.attr.bit.crossed_out = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017" CSI "9m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Crossed out off (with default colors) to.attr.bit.crossed_out = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Double underline on (with default colors) to.attr.bit.dbl_underline = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017" CSI "21m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Double underline off (with default colors) to.attr.bit.dbl_underline = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Alternate character set on (with default colors) to.attr.bit.alt_charset = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\016" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Alternate character set off (with default colors) to.attr.bit.alt_charset = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , "\017" CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // PC character set on (with default colors) to.attr.bit.pc_charset = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // PC character set off (with default colors) to.attr.bit.pc_charset = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Turn on all attributes (with default colors) to.attr.bit.pc_charset = true; @@ -2135,138 +2167,138 @@ void FOptiAttrTest::rxvtTest() to.attr.bit.alt_charset = true; to.attr.bit.pc_charset = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;1;4;7;5m\016" CSI "9m" CSI "21m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Cyan text on blue background to.fg_color = finalcut::FColor::Cyan; to.bg_color = finalcut::FColor::Blue; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "36m" CSI "44m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Bold off to.attr.bit.bold = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "22m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Dim off to.attr.bit.dim = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "22m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Italic off to.attr.bit.italic = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Underline off to.attr.bit.underline = false; - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "24m" CSI "21m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Blink off to.attr.bit.blink = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "25m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Reverse off to.attr.bit.reverse = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "27m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Standout off to.attr.bit.standout = false; - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "27m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Invisible off to.attr.bit.invisible = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "28m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Protect off to.attr.bit.protect = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" CSI "36m" CSI "44m\016" CSI "9m" CSI "21m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Crossed out off to.attr.bit.crossed_out = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "29m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Double underline off to.attr.bit.dbl_underline = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "24m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Alternate character set off to.attr.bit.alt_charset = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , "\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // PC character set off to.attr.bit.pc_charset = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" CSI "36m" CSI "44m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Green text color to.fg_color = finalcut::FColor::Green; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), CSI "32m" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), CSI "32m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Default text color to.fg_color = finalcut::FColor::Default; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( printSequence(oa.changeAttribute(from, to)).c_str() + CPPUNIT_ASSERT_STRING ( printSequence(oa.changeAttribute(from, to)).c_str() , "Esc [ 3 9 m " ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); } //---------------------------------------------------------------------- @@ -2324,7 +2356,7 @@ void FOptiAttrTest::linuxTest() finalcut::FChar from{}; finalcut::FChar to{}; - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Default color + bold from.fg_color = finalcut::FColor::Default; @@ -2333,10 +2365,10 @@ void FOptiAttrTest::linuxTest() to.fg_color = finalcut::FColor::Default; to.bg_color = finalcut::FColor::Default; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;1m\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Blue text on white background + dim + italic to.fg_color = finalcut::FColor::Blue; @@ -2344,10 +2376,10 @@ void FOptiAttrTest::linuxTest() to.attr.bit.dim = true; to.attr.bit.italic = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;1m\017" CSI "34;22m" CSI "47;5m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Reset attributes + default background to.attr.bit.bold = false; @@ -2355,239 +2387,239 @@ void FOptiAttrTest::linuxTest() to.attr.bit.italic = false; to.bg_color = finalcut::FColor::Default; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017" CSI "34;22m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Red text on black background to.fg_color = finalcut::FColor::Red; to.bg_color = finalcut::FColor::Black; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "31;22m" CSI "40;25m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // 256 color text and background to.fg_color = finalcut::FColor::SpringGreen3; to.bg_color = finalcut::FColor::NavyBlue; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "32;1m" CSI "44;25m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Bold on (with default colors) to.fg_color = finalcut::FColor::Default; to.bg_color = finalcut::FColor::Default; to.attr.bit.bold = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;1m\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Bold off (with default colors) to.attr.bit.bold = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Dim on (with default colors) to.attr.bit.dim = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Dim off (with default colors) to.attr.bit.dim = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Italic on (with default colors) to.attr.bit.italic = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Italic off (with default colors) to.attr.bit.italic = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Underline on (with default colors) to.attr.bit.underline = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Underline off (with default colors) to.attr.bit.underline = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Blink on (with default colors) to.attr.bit.blink = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;5m\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Blink off (with default colors) to.attr.bit.blink = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Reverse on (with default colors) to.attr.bit.reverse = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;7m\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Reverse off (with default colors) to.attr.bit.reverse = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Standout on (with default colors) to.attr.bit.standout = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;7m\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Standout off (with default colors) to.attr.bit.standout = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Invisible on (with default colors) to.attr.bit.invisible = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( to.encoded_char[0] == ' ' ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Invisible off (with default colors) to.attr.bit.invisible = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\17" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Protect on (with default colors) to.attr.bit.protect = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Protect off (with default colors) to.attr.bit.protect = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Crossed out on (with default colors) to.attr.bit.crossed_out = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Crossed out off (with default colors) to.attr.bit.crossed_out = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Double underline on (with default colors) to.attr.bit.dbl_underline = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Double underline off (with default colors) to.attr.bit.dbl_underline = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Alternate character set on (with default colors) to.attr.bit.alt_charset = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\016" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Alternate character set off (with default colors) to.attr.bit.alt_charset = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , "\017" CSI "0m\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // PC character set on (with default colors) to.attr.bit.pc_charset = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017" CSI "11m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // PC character set off (with default colors) to.attr.bit.pc_charset = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017" CSI "10m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Turn on all attributes (with default colors) to.attr.bit.pc_charset = true; @@ -2605,132 +2637,132 @@ void FOptiAttrTest::linuxTest() to.attr.bit.alt_charset = true; to.attr.bit.pc_charset = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;1;7;5m\016" CSI "11m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Cyan text on blue background to.fg_color = finalcut::FColor::Cyan; to.bg_color = finalcut::FColor::Blue; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "36;22m" CSI "44;25m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Bold off to.attr.bit.bold = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "22m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Dim off to.attr.bit.dim = false; CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Italic off to.attr.bit.italic = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Underline off to.attr.bit.underline = false; CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Blink off to.attr.bit.blink = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "25m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Reverse off to.attr.bit.reverse = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "27m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Standout off to.attr.bit.standout = false; - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "27m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Invisible off to.attr.bit.invisible = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Protect off to.attr.bit.protect = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Crossed out off to.attr.bit.crossed_out = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Double underline off to.attr.bit.dbl_underline = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Alternate character set off to.attr.bit.alt_charset = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , "\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // PC character set off to.attr.bit.pc_charset = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017" CSI "10m" CSI "36;22m" CSI "44;25m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Green text color to.fg_color = finalcut::FColor::Green; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), CSI "32;22m" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), CSI "32;22m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Default text color to.fg_color = finalcut::FColor::Default; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( printSequence(oa.changeAttribute(from, to)).c_str() + CPPUNIT_ASSERT_STRING ( printSequence(oa.changeAttribute(from, to)).c_str() , "Esc [ 3 9 m " ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); } //---------------------------------------------------------------------- @@ -2805,7 +2837,7 @@ void FOptiAttrTest::puttyTest() finalcut::FChar from{}; finalcut::FChar to{}; - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Default color + bold from.fg_color = finalcut::FColor::Default; @@ -2814,10 +2846,10 @@ void FOptiAttrTest::puttyTest() to.fg_color = finalcut::FColor::Default; to.bg_color = finalcut::FColor::Default; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;1m\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Blue text on white background + dim + italic to.fg_color = finalcut::FColor::Blue; @@ -2825,10 +2857,10 @@ void FOptiAttrTest::puttyTest() to.attr.bit.dim = true; to.attr.bit.italic = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;1;2m\017" CSI "34m" CSI "107m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Reset attributes + default background to.attr.bit.bold = false; @@ -2836,239 +2868,239 @@ void FOptiAttrTest::puttyTest() to.attr.bit.italic = false; to.bg_color = finalcut::FColor::Default; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" CSI "39;49m" CSI "34m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Red text on black background to.fg_color = finalcut::FColor::Red; to.bg_color = finalcut::FColor::Black; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "31m" CSI "40m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // 256 color text and background to.fg_color = finalcut::FColor::SpringGreen3; to.bg_color = finalcut::FColor::NavyBlue; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "38;5;42m" CSI "48;5;17m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Bold on (with default colors) to.fg_color = finalcut::FColor::Default; to.bg_color = finalcut::FColor::Default; to.attr.bit.bold = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;1m\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Bold off (with default colors) to.attr.bit.bold = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Dim on (with default colors) to.attr.bit.dim = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;2m\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Dim off (with default colors) to.attr.bit.dim = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Italic on (with default colors) to.attr.bit.italic = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Italic off (with default colors) to.attr.bit.italic = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Underline on (with default colors) to.attr.bit.underline = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;4m\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Underline off (with default colors) to.attr.bit.underline = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Blink on (with default colors) to.attr.bit.blink = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;5m\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Blink off (with default colors) to.attr.bit.blink = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Reverse on (with default colors) to.attr.bit.reverse = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;7m\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Reverse off (with default colors) to.attr.bit.reverse = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Standout on (with default colors) to.attr.bit.standout = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;1;7m\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Standout off (with default colors) to.attr.bit.standout = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Invisible on (with default colors) to.attr.bit.invisible = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( to.encoded_char[0] == ' ' ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Invisible off (with default colors) to.attr.bit.invisible = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Protect on (with default colors) to.attr.bit.protect = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Protect off (with default colors) to.attr.bit.protect = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Crossed out on (with default colors) to.attr.bit.crossed_out = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017" CSI "9m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Crossed out off (with default colors) to.attr.bit.crossed_out = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Double underline on (with default colors) to.attr.bit.dbl_underline = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017" CSI "21m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Double underline off (with default colors) to.attr.bit.dbl_underline = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Alternate character set on (with default colors) to.attr.bit.alt_charset = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\016" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Alternate character set off (with default colors) to.attr.bit.alt_charset = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , "\017" CSI "0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // PC character set on (with default colors) to.attr.bit.pc_charset = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017" CSI "11m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // PC character set off (with default colors) to.attr.bit.pc_charset = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" CSI "10m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Turn on all attributes (with default colors) to.attr.bit.pc_charset = true; @@ -3086,138 +3118,138 @@ void FOptiAttrTest::puttyTest() to.attr.bit.alt_charset = true; to.attr.bit.pc_charset = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;1;2;4;7;5m\016" CSI "9m" CSI "21m" CSI "11m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Cyan text on blue background to.fg_color = finalcut::FColor::Cyan; to.bg_color = finalcut::FColor::Blue; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "36m" CSI "44m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Bold off to.attr.bit.bold = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "22m" CSI "2m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Dim off to.attr.bit.dim = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "22m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Italic off to.attr.bit.italic = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Underline off to.attr.bit.underline = false; - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "24m" CSI "21m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Blink off to.attr.bit.blink = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "25m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Reverse off to.attr.bit.reverse = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "27m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Standout off to.attr.bit.standout = false; - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "27m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Invisible off to.attr.bit.invisible = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "28m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Protect off to.attr.bit.protect = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" CSI "36m" CSI "44m" "\016" CSI "11m" CSI "9m" CSI "21m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Crossed out off to.attr.bit.crossed_out = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "29m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Double underline off to.attr.bit.dbl_underline = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "24m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Alternate character set off to.attr.bit.alt_charset = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , "\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // PC character set off to.attr.bit.pc_charset = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m" CSI "10m" CSI "36m" CSI "44m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Green text color to.fg_color = finalcut::FColor::Green; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), CSI "32m" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), CSI "32m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Default text color to.fg_color = finalcut::FColor::Default; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( printSequence(oa.changeAttribute(from, to)).c_str() + CPPUNIT_ASSERT_STRING ( printSequence(oa.changeAttribute(from, to)).c_str() , "Esc [ 3 9 ; 4 9 m Esc [ 4 4 m " ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); } //---------------------------------------------------------------------- @@ -3275,7 +3307,7 @@ void FOptiAttrTest::teratermTest() finalcut::FChar from{}; finalcut::FChar to{}; - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Default color + bold from.fg_color = finalcut::FColor::Default; @@ -3284,10 +3316,10 @@ void FOptiAttrTest::teratermTest() to.fg_color = finalcut::FColor::Default; to.bg_color = finalcut::FColor::Default; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;1m\017$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Blue text on white background + dim + italic to.fg_color = finalcut::FColor::Blue; @@ -3295,11 +3327,11 @@ void FOptiAttrTest::teratermTest() to.attr.bit.dim = true; to.attr.bit.italic = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017$<2>" CSI "38;5;4m" CSI "48;5;15m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Reset attributes + default background to.attr.bit.bold = false; @@ -3307,239 +3339,239 @@ void FOptiAttrTest::teratermTest() to.attr.bit.italic = false; to.bg_color = finalcut::FColor::Default; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" CSI "39;49m" CSI "38;5;4m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Red text on black background to.fg_color = finalcut::FColor::Red; to.bg_color = finalcut::FColor::Black; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "38;5;1m" CSI "48;5;0m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // 256 color text and background to.fg_color = finalcut::FColor::SpringGreen3; to.bg_color = finalcut::FColor::NavyBlue; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "38;5;10m" CSI "48;5;4m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Bold on (with default colors) to.fg_color = finalcut::FColor::Default; to.bg_color = finalcut::FColor::Default; to.attr.bit.bold = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;1m\017$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Bold off (with default colors) to.attr.bit.bold = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Dim on (with default colors) to.attr.bit.dim = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Dim off (with default colors) to.attr.bit.dim = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Italic on (with default colors) to.attr.bit.italic = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Italic off (with default colors) to.attr.bit.italic = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Underline on (with default colors) to.attr.bit.underline = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;4m\017$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Underline off (with default colors) to.attr.bit.underline = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Blink on (with default colors) to.attr.bit.blink = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;5m\017$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Blink off (with default colors) to.attr.bit.blink = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Reverse on (with default colors) to.attr.bit.reverse = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;7m\017$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Reverse off (with default colors) to.attr.bit.reverse = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Standout on (with default colors) to.attr.bit.standout = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;1;7m\017$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Standout off (with default colors) to.attr.bit.standout = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Invisible on (with default colors) to.attr.bit.invisible = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017$<2>" ); CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( to.encoded_char[0] == ' ' ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Invisible off (with default colors) to.attr.bit.invisible = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Protect on (with default colors) to.attr.bit.protect = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Protect off (with default colors) to.attr.bit.protect = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Crossed out on (with default colors) to.attr.bit.crossed_out = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017$<2>" CSI "9m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Crossed out off (with default colors) to.attr.bit.crossed_out = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Double underline on (with default colors) to.attr.bit.dbl_underline = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017$<2>" CSI "21m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Double underline off (with default colors) to.attr.bit.dbl_underline = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Alternate character set on (with default colors) to.attr.bit.alt_charset = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\016$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Alternate character set off (with default colors) to.attr.bit.alt_charset = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , "\017" CSI "0m$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // PC character set on (with default colors) to.attr.bit.pc_charset = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m\017$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // PC character set off (with default colors) to.attr.bit.pc_charset = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Turn on all attributes (with default colors) to.attr.bit.pc_charset = true; @@ -3557,129 +3589,129 @@ void FOptiAttrTest::teratermTest() to.attr.bit.alt_charset = true; to.attr.bit.pc_charset = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0;1;4;7;5m\016$<2>" CSI "9m" CSI "21m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Cyan text on blue background to.fg_color = finalcut::FColor::Cyan; to.bg_color = finalcut::FColor::Blue; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "38;5;6m" CSI "48;5;4m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Bold off to.attr.bit.bold = false; CPPUNIT_ASSERT ( from == to ); // because of noColorVideo = 41 - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Dim off to.attr.bit.dim = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "22m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Italic off to.attr.bit.italic = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Underline off to.attr.bit.underline = false; - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "24m" CSI "21m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Blink off to.attr.bit.blink = false; CPPUNIT_ASSERT ( from == to ); // because of noColorVideo = 41 - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Reverse off to.attr.bit.reverse = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "27m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Standout off to.attr.bit.standout = false; CPPUNIT_ASSERT ( from == to ); // because of noColorVideo = 41 - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Invisible off to.attr.bit.invisible = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "28m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Protect off to.attr.bit.protect = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" CSI "38;5;6m" CSI "48;5;4m" "\016" CSI "9m" CSI "21m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Crossed out off to.attr.bit.crossed_out = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "29m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Double underline off to.attr.bit.dbl_underline = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "24m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Alternate character set off to.attr.bit.alt_charset = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , "\017" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // PC character set off to.attr.bit.pc_charset = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "0m$<2>" CSI "38;5;6m" CSI "48;5;4m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Green text color to.fg_color = finalcut::FColor::Green; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), CSI "38;5;2m" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), CSI "38;5;2m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Default text color to.fg_color = finalcut::FColor::Default; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( printSequence(oa.changeAttribute(from, to)).c_str() + CPPUNIT_ASSERT_STRING ( printSequence(oa.changeAttribute(from, to)).c_str() , "Esc [ 3 9 ; 4 9 m Esc [ 4 8 ; 5 ; 4 m " ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); } //---------------------------------------------------------------------- @@ -3746,7 +3778,7 @@ void FOptiAttrTest::ibmColorTest() finalcut::FChar from{}; finalcut::FChar to{}; - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Default color + bold from.fg_color = finalcut::FColor::Default; @@ -3755,9 +3787,9 @@ void FOptiAttrTest::ibmColorTest() to.fg_color = finalcut::FColor::Default; to.bg_color = finalcut::FColor::Default; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Blue text on white background + dim + italic to.fg_color = finalcut::FColor::Blue; @@ -3765,10 +3797,10 @@ void FOptiAttrTest::ibmColorTest() to.attr.bit.dim = true; to.attr.bit.italic = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "31m" CSI "107m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Reset attributes + default background to.attr.bit.bold = false; @@ -3776,214 +3808,214 @@ void FOptiAttrTest::ibmColorTest() to.attr.bit.italic = false; to.bg_color = finalcut::FColor::Default; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "32;40m" CSI "31m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Red text on black background to.fg_color = finalcut::FColor::Red; to.bg_color = finalcut::FColor::Black; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "34m" CSI "40m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // 256 color text and background to.fg_color = finalcut::FColor::SpringGreen3; to.bg_color = finalcut::FColor::NavyBlue; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "32m" CSI "41m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Bold on (with default colors) to.fg_color = finalcut::FColor::Default; to.bg_color = finalcut::FColor::Default; to.attr.bit.bold = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "32;40m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Bold off (with default colors) to.attr.bit.bold = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Dim on (with default colors) to.attr.bit.dim = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Dim off (with default colors) to.attr.bit.dim = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Italic on (with default colors) to.attr.bit.italic = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Italic off (with default colors) to.attr.bit.italic = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Underline on (with default colors) to.attr.bit.underline = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Underline off (with default colors) to.attr.bit.underline = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Blink on (with default colors) to.attr.bit.blink = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Blink off (with default colors) to.attr.bit.blink = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Reverse on (with default colors) to.attr.bit.reverse = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Reverse off (with default colors) to.attr.bit.reverse = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Standout on (with default colors) to.attr.bit.standout = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Standout off (with default colors) to.attr.bit.standout = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Invisible on (with default colors) to.attr.bit.invisible = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); CPPUNIT_ASSERT ( to.encoded_char[0] == ' ' ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Invisible off (with default colors) to.attr.bit.invisible = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Protect on (with default colors) to.attr.bit.protect = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Protect off (with default colors) to.attr.bit.protect = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Crossed out on (with default colors) to.attr.bit.crossed_out = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Crossed out off (with default colors) to.attr.bit.crossed_out = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Double underline on (with default colors) to.attr.bit.dbl_underline = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Double underline off (with default colors) to.attr.bit.dbl_underline = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Alternate character set on (with default colors) to.attr.bit.alt_charset = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Alternate character set off (with default colors) to.attr.bit.alt_charset = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // PC character set on (with default colors) to.attr.bit.pc_charset = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // PC character set off (with default colors) to.attr.bit.pc_charset = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Turn on all attributes (with default colors) to.attr.bit.pc_charset = true; @@ -4001,121 +4033,121 @@ void FOptiAttrTest::ibmColorTest() to.attr.bit.alt_charset = true; to.attr.bit.pc_charset = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Cyan text on blue background to.fg_color = finalcut::FColor::Cyan; to.bg_color = finalcut::FColor::Blue; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "33m" CSI "41m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Bold off to.attr.bit.bold = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Dim off to.attr.bit.dim = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Italic off to.attr.bit.italic = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Underline off to.attr.bit.underline = false; CPPUNIT_ASSERT ( from == to ); // because of noColorVideo = 3 - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Blink off to.attr.bit.blink = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Reverse off to.attr.bit.reverse = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Standout off to.attr.bit.standout = false; CPPUNIT_ASSERT ( from == to ); // because of noColorVideo = 3 - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Invisible off to.attr.bit.invisible = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Protect off to.attr.bit.protect = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Crossed out off to.attr.bit.crossed_out = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Double underline off to.attr.bit.dbl_underline = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Alternate character set off to.attr.bit.alt_charset = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // PC character set off to.attr.bit.pc_charset = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Green text color to.fg_color = finalcut::FColor::Green; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , CSI "32m" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Default text color to.fg_color = finalcut::FColor::Default; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( printSequence(oa.changeAttribute(from, to)).c_str() + CPPUNIT_ASSERT_STRING ( printSequence(oa.changeAttribute(from, to)).c_str() , "Esc [ 3 2 ; 4 0 m Esc [ 4 1 m " ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); } //---------------------------------------------------------------------- @@ -4185,7 +4217,7 @@ void FOptiAttrTest::wyse50Test() finalcut::FChar from{}; finalcut::FChar to{}; - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Default color + bold from.fg_color = finalcut::FColor::Default; @@ -4194,10 +4226,10 @@ void FOptiAttrTest::wyse50Test() to.fg_color = finalcut::FColor::Default; to.bg_color = finalcut::FColor::Default; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(" ESC "cD" ESC "G4" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Blue text on white background + dim + italic to.fg_color = finalcut::FColor::Blue; @@ -4205,10 +4237,10 @@ void FOptiAttrTest::wyse50Test() to.attr.bit.dim = true; to.attr.bit.italic = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(" ESC "cD" ESC "Gt" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Reset attributes + default background to.attr.bit.bold = false; @@ -4216,237 +4248,237 @@ void FOptiAttrTest::wyse50Test() to.attr.bit.italic = false; to.bg_color = finalcut::FColor::Default; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(" ESC "H\003" ESC "G0" ESC "cD" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Red text on black background to.fg_color = finalcut::FColor::Red; to.bg_color = finalcut::FColor::Black; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // 256 color text and background to.fg_color = finalcut::FColor::SpringGreen3; to.bg_color = finalcut::FColor::NavyBlue; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Bold on (with default colors) to.fg_color = finalcut::FColor::Default; to.bg_color = finalcut::FColor::Default; to.attr.bit.bold = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(" ESC "cD" ESC "G4" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Bold off (with default colors) to.attr.bit.bold = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(" ESC "H\003" ESC "G0" ESC "cD" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Dim on (with default colors) to.attr.bit.dim = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(" ESC "cD" ESC "Gp" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Dim off (with default colors) to.attr.bit.dim = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(" ESC "H\003" ESC "G0" ESC "cD" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Italic on (with default colors) to.attr.bit.italic = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(" ESC "cD" ESC "G0" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Italic off (with default colors) to.attr.bit.italic = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(" ESC "H\003" ESC "G0" ESC "cD" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Underline on (with default colors) to.attr.bit.underline = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(" ESC "cD" ESC "G8" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Underline off (with default colors) to.attr.bit.underline = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(" ESC "H\003" ESC "G0" ESC "cD" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Blink on (with default colors) to.attr.bit.blink = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(" ESC "cD" ESC "G2" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Blink off (with default colors) to.attr.bit.blink = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(" ESC "H\003" ESC "G0" ESC "cD" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Reverse on (with default colors) to.attr.bit.reverse = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(" ESC "cD" ESC "G4" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Reverse off (with default colors) to.attr.bit.reverse = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(" ESC "H\003" ESC "G0" ESC "cD" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Standout on (with default colors) to.attr.bit.standout = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(" ESC "cD" ESC "Gt" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Standout off (with default colors) to.attr.bit.standout = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(" ESC "H\003" ESC "G0" ESC "cD" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Invisible on (with default colors) to.attr.bit.invisible = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(" ESC "cD" ESC "G1" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Invisible off (with default colors) to.attr.bit.invisible = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(" ESC "H\003" ESC "G0" ESC "cD" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Protect on (with default colors) to.attr.bit.protect = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC ")" ESC "cD" ESC "G0" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Protect off (with default colors) to.attr.bit.protect = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(" ESC "H\003" ESC "G0" ESC "cD" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Crossed out on (with default colors) to.attr.bit.crossed_out = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(" ESC "cD" ESC "G0" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Crossed out off (with default colors) to.attr.bit.crossed_out = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(" ESC "H\003" ESC "G0" ESC "cD" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Double underline on (with default colors) to.attr.bit.dbl_underline = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(" ESC "cD" ESC "G0" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Double underline off (with default colors) to.attr.bit.dbl_underline = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(" ESC "H\003" ESC "G0" ESC "cD" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Alternate character set on (with default colors) to.attr.bit.alt_charset = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(" ESC "cE" ESC "G0" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Alternate character set off (with default colors) to.attr.bit.alt_charset = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "cD" ESC "(" ESC "H\003" ESC "G0" ESC "cD" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // PC character set on (with default colors) to.attr.bit.pc_charset = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(" ESC "cD" ESC "G0" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // PC character set off (with default colors) to.attr.bit.pc_charset = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(" ESC "H\003" ESC "G0" ESC "cD" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Turn on all attributes (with default colors) to.attr.bit.pc_charset = true; @@ -4464,143 +4496,143 @@ void FOptiAttrTest::wyse50Test() to.attr.bit.alt_charset = true; to.attr.bit.pc_charset = true; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC ")" ESC "cE" ESC "G\177" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Cyan text on blue background to.fg_color = finalcut::FColor::Cyan; to.bg_color = finalcut::FColor::Blue; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Bold off to.attr.bit.bold = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(" ESC "H\003" ESC "G0" ESC "cD" ESC "cE" ESC "Gp" ESC "G8" ESC "G2" ESC "G2" ESC "Gt" ESC "G1" ESC ")" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Dim off to.attr.bit.dim = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(" ESC "H\003" ESC "G0" ESC "cD" ESC "cE" ESC "G8" ESC "G2" ESC "G2" ESC "Gt" ESC "G1" ESC ")" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Italic off to.attr.bit.italic = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Underline off to.attr.bit.underline = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "G0" ESC "cE" ESC "G2" ESC "G2" ESC "Gt" ESC "G1" ESC ")" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Blink off to.attr.bit.blink = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(" ESC "H\003" ESC "G0" ESC "cD" ESC "cE" ESC "G2" ESC "Gt" ESC "G1" ESC ")" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Reverse off to.attr.bit.reverse = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(" ESC "H\003" ESC "G0" ESC "cD" ESC "cE" ESC "Gt" ESC "G1" ESC ")" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Standout off to.attr.bit.standout = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "G0" ESC "cE" ESC "G1" ESC ")" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Invisible off to.attr.bit.invisible = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(" ESC "H\003" ESC "G0" ESC "cD" ESC "cE" ESC ")" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Protect off to.attr.bit.protect = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(" ESC "H\003" ESC "G0" ESC "cD" ESC "cE" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Crossed out off to.attr.bit.crossed_out = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(" ESC "H\003" ESC "G0" ESC "cD" ESC "cE" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Double underline off to.attr.bit.dbl_underline = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Alternate character set off to.attr.bit.alt_charset = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), ESC "cD" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), ESC "cD" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // PC character set off to.attr.bit.pc_charset = false; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to) + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to) , ESC "(" ESC "H\003" ESC "G0" ESC "cD" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Green text color to.fg_color = finalcut::FColor::Green; CPPUNIT_ASSERT ( from != to ); - CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), "" ); + CPPUNIT_ASSERT_STRING ( oa.changeAttribute(from, to), "" ); CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); // Default text color to.fg_color = finalcut::FColor::Default; CPPUNIT_ASSERT ( from == to ); - CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 ); + CPPUNIT_ASSERT ( oa.changeAttribute(from, to).empty() ); } //----------------------------------------------------------------------