2018-04-02 22:04:29 +02:00
|
|
|
/***********************************************************************
|
2018-10-03 22:23:55 +02:00
|
|
|
* foptiattr_test.cpp - FOptiAttr unit tests *
|
2018-04-02 22:04:29 +02:00
|
|
|
* *
|
|
|
|
* This file is part of the Final Cut widget toolkit *
|
|
|
|
* *
|
2019-07-21 23:31:21 +02:00
|
|
|
* Copyright 2018-2019 Markus Gans *
|
2018-04-02 22:04:29 +02:00
|
|
|
* *
|
|
|
|
* The Final Cut is free software; you can redistribute it and/or *
|
|
|
|
* modify it under the terms of the GNU Lesser General Public License *
|
|
|
|
* as published by the Free Software Foundation; either version 3 of *
|
|
|
|
* the License, or (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* The Final Cut is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU Lesser General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU Lesser General Public *
|
|
|
|
* License along with this program. If not, see *
|
|
|
|
* <http://www.gnu.org/licenses/>. *
|
|
|
|
***********************************************************************/
|
|
|
|
|
|
|
|
#include <cppunit/BriefTestProgressListener.h>
|
|
|
|
#include <cppunit/CompilerOutputter.h>
|
|
|
|
#include <cppunit/extensions/HelperMacros.h>
|
|
|
|
#include <cppunit/TestFixture.h>
|
|
|
|
#include <cppunit/TestResult.h>
|
|
|
|
#include <cppunit/TestResultCollector.h>
|
|
|
|
#include <cppunit/TestRunner.h>
|
|
|
|
|
|
|
|
#include <cppunit/SourceLine.h>
|
|
|
|
#include <cppunit/TestAssert.h>
|
|
|
|
|
|
|
|
#include <iomanip>
|
2019-08-06 23:45:28 +02:00
|
|
|
#include <string>
|
2018-04-02 22:04:29 +02:00
|
|
|
#include <final/final.h>
|
|
|
|
|
|
|
|
|
|
|
|
#define CPPUNIT_ASSERT_CSTRING(expected, actual) \
|
|
|
|
check_c_string (expected, actual, CPPUNIT_SOURCELINE())
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void check_c_string ( const char* s1
|
|
|
|
, const char* s2
|
|
|
|
, CppUnit::SourceLine sourceLine )
|
|
|
|
{
|
2018-04-02 23:14:58 +02:00
|
|
|
if ( s1 == 0 && s2 == 0 ) // Strings are equal
|
2018-04-02 22:04:29 +02:00
|
|
|
return;
|
|
|
|
|
2018-04-02 23:14:58 +02:00
|
|
|
if ( s1 && s2 && std::strcmp (s1, s2) == 0 ) // Strings are equal
|
|
|
|
return;
|
2018-04-02 22:04:29 +02:00
|
|
|
|
|
|
|
::CppUnit::Asserter::fail ("Strings are not equal", sourceLine);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// class FOptiAttrTest
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
class FOptiAttrTest : public CPPUNIT_NS::TestFixture
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
FOptiAttrTest()
|
|
|
|
{ }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void classNameTest();
|
|
|
|
void noArgumentTest();
|
2018-04-15 19:55:50 +02:00
|
|
|
void vga2ansiTest();
|
|
|
|
void fakeReverseTest();
|
2018-04-02 22:04:29 +02:00
|
|
|
void ansiTest();
|
2018-04-05 01:27:03 +02:00
|
|
|
void vt100Test();
|
2018-04-08 16:32:02 +02:00
|
|
|
void xtermTest();
|
|
|
|
void rxvtTest();
|
2018-04-12 00:34:25 +02:00
|
|
|
void linuxTest();
|
|
|
|
void cygwinTest();
|
|
|
|
void puttyTest();
|
|
|
|
void teratermTest();
|
2018-04-13 00:08:03 +02:00
|
|
|
void ibmColorTest();
|
2018-04-15 19:55:50 +02:00
|
|
|
void wyse50Test();
|
2018-04-02 22:04:29 +02:00
|
|
|
|
|
|
|
private:
|
2018-09-15 02:25:30 +02:00
|
|
|
std::string printSequence (const std::string&);
|
2018-04-02 22:04:29 +02:00
|
|
|
|
|
|
|
// Adds code needed to register the test suite
|
|
|
|
CPPUNIT_TEST_SUITE (FOptiAttrTest);
|
|
|
|
|
|
|
|
// Add a methods to the test suite
|
|
|
|
CPPUNIT_TEST (classNameTest);
|
|
|
|
CPPUNIT_TEST (noArgumentTest);
|
2018-04-15 19:55:50 +02:00
|
|
|
CPPUNIT_TEST (vga2ansiTest);
|
|
|
|
CPPUNIT_TEST (fakeReverseTest);
|
2018-04-02 22:04:29 +02:00
|
|
|
CPPUNIT_TEST (ansiTest);
|
2018-04-05 01:27:03 +02:00
|
|
|
CPPUNIT_TEST (vt100Test);
|
2018-04-08 16:32:02 +02:00
|
|
|
CPPUNIT_TEST (xtermTest);
|
|
|
|
CPPUNIT_TEST (rxvtTest);
|
2018-04-12 00:34:25 +02:00
|
|
|
CPPUNIT_TEST (linuxTest);
|
|
|
|
CPPUNIT_TEST (cygwinTest);
|
|
|
|
CPPUNIT_TEST (puttyTest);
|
|
|
|
CPPUNIT_TEST (teratermTest);
|
2018-04-13 00:08:03 +02:00
|
|
|
CPPUNIT_TEST (ibmColorTest);
|
2018-04-15 19:55:50 +02:00
|
|
|
CPPUNIT_TEST (wyse50Test);
|
2018-04-02 22:04:29 +02:00
|
|
|
|
|
|
|
// End of test suite definition
|
|
|
|
CPPUNIT_TEST_SUITE_END();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FOptiAttrTest::classNameTest()
|
|
|
|
{
|
2018-09-20 23:59:01 +02:00
|
|
|
finalcut::FOptiAttr opti_attr;
|
2019-10-05 23:20:07 +02:00
|
|
|
const finalcut::FString& classname = opti_attr.getClassName();
|
|
|
|
CPPUNIT_ASSERT ( classname == "FOptiAttr");
|
2018-04-02 22:04:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FOptiAttrTest::noArgumentTest()
|
|
|
|
{
|
2019-10-08 04:37:19 +02:00
|
|
|
finalcut::FChar* ch = new finalcut::FChar();
|
2018-09-20 23:59:01 +02:00
|
|
|
finalcut::FOptiAttr oa;
|
2018-04-02 22:04:29 +02:00
|
|
|
oa.initialize();
|
|
|
|
|
|
|
|
// isNormal test
|
|
|
|
CPPUNIT_ASSERT ( ! oa.isNormal(ch) );
|
2018-09-20 23:59:01 +02:00
|
|
|
ch->fg_color = finalcut::fc::Default;
|
2018-04-02 22:04:29 +02:00
|
|
|
CPPUNIT_ASSERT ( ! oa.isNormal(ch) );
|
2018-09-20 23:59:01 +02:00
|
|
|
ch->bg_color = finalcut::fc::Default;
|
2018-04-02 22:04:29 +02:00
|
|
|
CPPUNIT_ASSERT ( oa.isNormal(ch) );
|
2018-04-02 23:14:58 +02:00
|
|
|
|
|
|
|
// Null test
|
2019-10-08 04:37:19 +02:00
|
|
|
finalcut::FChar* ch_null = nullptr;
|
2018-04-02 23:14:58 +02:00
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(ch, ch) == 0 );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(ch, ch_null), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(ch_null, ch), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(ch_null, ch_null), C_STR("") );
|
2018-04-02 22:04:29 +02:00
|
|
|
delete ch;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2018-04-15 19:55:50 +02:00
|
|
|
void FOptiAttrTest::vga2ansiTest()
|
2018-04-02 22:04:29 +02:00
|
|
|
{
|
2018-09-20 23:59:01 +02:00
|
|
|
finalcut::FOptiAttr oa;
|
2018-04-02 22:04:29 +02:00
|
|
|
CPPUNIT_ASSERT (oa.vga2ansi(0) == 0);
|
|
|
|
CPPUNIT_ASSERT (oa.vga2ansi(1) == 4);
|
|
|
|
CPPUNIT_ASSERT (oa.vga2ansi(2) == 2);
|
|
|
|
CPPUNIT_ASSERT (oa.vga2ansi(3) == 6);
|
|
|
|
CPPUNIT_ASSERT (oa.vga2ansi(4) == 1);
|
|
|
|
CPPUNIT_ASSERT (oa.vga2ansi(5) == 5);
|
|
|
|
CPPUNIT_ASSERT (oa.vga2ansi(6) == 3);
|
|
|
|
CPPUNIT_ASSERT (oa.vga2ansi(7) == 7);
|
|
|
|
CPPUNIT_ASSERT (oa.vga2ansi(8) == 8);
|
|
|
|
CPPUNIT_ASSERT (oa.vga2ansi(9) == 12);
|
|
|
|
CPPUNIT_ASSERT (oa.vga2ansi(10) == 10);
|
|
|
|
CPPUNIT_ASSERT (oa.vga2ansi(11) == 14);
|
|
|
|
CPPUNIT_ASSERT (oa.vga2ansi(12) == 9);
|
|
|
|
CPPUNIT_ASSERT (oa.vga2ansi(13) == 13);
|
|
|
|
CPPUNIT_ASSERT (oa.vga2ansi(14) == 11);
|
|
|
|
CPPUNIT_ASSERT (oa.vga2ansi(15) == 15);
|
|
|
|
}
|
|
|
|
|
2018-04-15 19:55:50 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FOptiAttrTest::fakeReverseTest()
|
|
|
|
{
|
2018-09-20 23:59:01 +02:00
|
|
|
finalcut::FOptiAttr oa;
|
2018-04-15 19:55:50 +02:00
|
|
|
oa.setDefaultColorSupport(); // ANSI default color
|
|
|
|
oa.setMaxColor (8);
|
2018-06-25 00:14:53 +02:00
|
|
|
oa.setNoColorVideo (4); // Avoid reverse (4)
|
2018-04-15 19:55:50 +02:00
|
|
|
oa.set_enter_bold_mode (0);
|
|
|
|
oa.set_exit_bold_mode (0);
|
|
|
|
oa.set_enter_dim_mode (0);
|
|
|
|
oa.set_exit_dim_mode (0);
|
|
|
|
oa.set_enter_italics_mode (0);
|
|
|
|
oa.set_exit_italics_mode (0);
|
|
|
|
oa.set_enter_underline_mode (0);
|
|
|
|
oa.set_exit_underline_mode (0);
|
|
|
|
oa.set_enter_blink_mode (0);
|
|
|
|
oa.set_exit_blink_mode (0);
|
|
|
|
oa.set_enter_reverse_mode (0);
|
|
|
|
oa.set_exit_reverse_mode (0);
|
|
|
|
oa.set_enter_standout_mode (0);
|
|
|
|
oa.set_exit_standout_mode (0);
|
|
|
|
oa.set_enter_secure_mode (0);
|
|
|
|
oa.set_exit_secure_mode (0);
|
|
|
|
oa.set_enter_protected_mode (0);
|
|
|
|
oa.set_exit_protected_mode (0);
|
|
|
|
oa.set_enter_crossed_out_mode (0);
|
|
|
|
oa.set_exit_crossed_out_mode (0);
|
|
|
|
oa.set_enter_dbl_underline_mode (0);
|
|
|
|
oa.set_exit_dbl_underline_mode (0);
|
|
|
|
oa.set_set_attributes (0);
|
|
|
|
oa.set_exit_attribute_mode (0);
|
|
|
|
oa.set_enter_alt_charset_mode (0);
|
|
|
|
oa.set_exit_alt_charset_mode (0);
|
|
|
|
oa.set_enter_pc_charset_mode (0);
|
|
|
|
oa.set_exit_pc_charset_mode (0);
|
|
|
|
oa.set_a_foreground_color (C_STR(CSI "3%p1%dm"));
|
|
|
|
oa.set_a_background_color (C_STR(CSI "4%p1%dm"));
|
|
|
|
oa.set_foreground_color (0);
|
|
|
|
oa.set_background_color (0);
|
|
|
|
oa.set_term_color_pair (0);
|
|
|
|
oa.set_orig_pair (0);
|
|
|
|
oa.set_orig_orig_colors (0);
|
|
|
|
oa.initialize();
|
|
|
|
|
2019-10-08 04:37:19 +02:00
|
|
|
finalcut::FChar* from = new finalcut::FChar();
|
|
|
|
finalcut::FChar* to = new finalcut::FChar();
|
2018-04-15 19:55:50 +02:00
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
2018-11-07 22:30:59 +01:00
|
|
|
|
2018-04-15 19:55:50 +02:00
|
|
|
// Gray text on blue background
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::LightGray;
|
|
|
|
to->bg_color = finalcut::fc::Blue;
|
2018-04-15 19:55:50 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "37m" CSI "44m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Reverse on
|
|
|
|
to->attr.bit.reverse = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "34m" CSI "47m") );
|
2018-09-20 23:59:01 +02:00
|
|
|
CPPUNIT_ASSERT ( from->fg_color == finalcut::fc::LightGray );
|
|
|
|
CPPUNIT_ASSERT ( from->bg_color == finalcut::fc::Blue );
|
2018-04-15 19:55:50 +02:00
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
|
|
|
|
// Gray text on red background
|
2018-09-20 23:59:01 +02:00
|
|
|
to->bg_color = finalcut::fc::Red;
|
2018-04-15 19:55:50 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "31m" CSI "47m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Reverse off
|
|
|
|
to->attr.bit.reverse = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "37m" CSI "41m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
delete to;
|
|
|
|
delete from;
|
|
|
|
}
|
|
|
|
|
2018-04-02 22:04:29 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FOptiAttrTest::ansiTest()
|
|
|
|
{
|
2018-04-08 16:32:02 +02:00
|
|
|
// Simulate an ansi terminal
|
|
|
|
|
2018-09-20 23:59:01 +02:00
|
|
|
finalcut::FOptiAttr oa;
|
2018-04-02 22:47:39 +02:00
|
|
|
oa.setDefaultColorSupport(); // ANSI default color
|
2018-04-02 22:04:29 +02:00
|
|
|
oa.setMaxColor (8);
|
2018-06-25 00:14:53 +02:00
|
|
|
oa.setNoColorVideo (3); // Avoid standout (1) + underline mode (2)
|
2018-04-02 22:04:29 +02:00
|
|
|
oa.set_enter_bold_mode (C_STR(CSI "1m"));
|
|
|
|
oa.set_exit_bold_mode (C_STR(CSI "0m"));
|
|
|
|
oa.set_enter_dim_mode (0);
|
|
|
|
oa.set_exit_dim_mode (C_STR(CSI "0m"));
|
|
|
|
oa.set_enter_italics_mode (0);
|
|
|
|
oa.set_exit_italics_mode (0);
|
|
|
|
oa.set_enter_underline_mode (C_STR(CSI "4m"));
|
|
|
|
oa.set_exit_underline_mode (C_STR(CSI "1m"));
|
|
|
|
oa.set_enter_blink_mode (C_STR(CSI "5m"));
|
|
|
|
oa.set_exit_blink_mode (C_STR(CSI "0m"));
|
|
|
|
oa.set_enter_reverse_mode (C_STR(CSI "7m"));
|
|
|
|
oa.set_exit_reverse_mode (C_STR(CSI "0m"));
|
|
|
|
oa.set_enter_standout_mode (C_STR(CSI "7m"));
|
|
|
|
oa.set_exit_standout_mode (C_STR(CSI "m"));
|
|
|
|
oa.set_enter_secure_mode (C_STR(CSI "8m"));
|
|
|
|
oa.set_exit_secure_mode (C_STR(CSI "0m"));
|
|
|
|
oa.set_enter_protected_mode (0);
|
|
|
|
oa.set_exit_protected_mode (C_STR(CSI "0m"));
|
|
|
|
oa.set_enter_crossed_out_mode (0);
|
|
|
|
oa.set_exit_crossed_out_mode (C_STR(CSI "0m"));
|
|
|
|
oa.set_enter_dbl_underline_mode (0);
|
|
|
|
oa.set_exit_dbl_underline_mode (0);
|
|
|
|
oa.set_set_attributes (C_STR(CSI "0;10"
|
|
|
|
"%?%p1%t;7%;"
|
|
|
|
"%?%p2%t;4%;"
|
|
|
|
"%?%p3%t;7%;"
|
|
|
|
"%?%p4%t;5%;"
|
|
|
|
"%?%p6%t;1%;"
|
|
|
|
"%?%p7%t;8%;"
|
|
|
|
"%?%p9%t;11%;m"));
|
|
|
|
oa.set_exit_attribute_mode (C_STR(CSI "0m"));
|
|
|
|
oa.set_enter_alt_charset_mode (C_STR(CSI "11m"));
|
|
|
|
oa.set_exit_alt_charset_mode (C_STR(CSI "10m"));
|
|
|
|
oa.set_enter_pc_charset_mode (C_STR(CSI "11m"));
|
|
|
|
oa.set_exit_pc_charset_mode (C_STR(CSI "10m"));
|
|
|
|
oa.set_a_foreground_color (C_STR(CSI "3%p1%dm"));
|
|
|
|
oa.set_a_background_color (C_STR(CSI "4%p1%dm"));
|
|
|
|
oa.set_foreground_color (0);
|
|
|
|
oa.set_background_color (0);
|
|
|
|
oa.set_term_color_pair (0);
|
|
|
|
oa.set_orig_pair (C_STR(CSI "39;49m"));
|
|
|
|
oa.set_orig_orig_colors (0);
|
|
|
|
oa.initialize();
|
|
|
|
|
2019-10-08 04:37:19 +02:00
|
|
|
finalcut::FChar* from = new finalcut::FChar();
|
|
|
|
finalcut::FChar* to = new finalcut::FChar();
|
2018-04-02 22:04:29 +02:00
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Default color + bold
|
2018-09-20 23:59:01 +02:00
|
|
|
from->fg_color = finalcut::fc::Default;
|
|
|
|
from->bg_color = finalcut::fc::Default;
|
2018-04-02 22:04:29 +02:00
|
|
|
to->attr.bit.bold = true;
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Default;
|
|
|
|
to->bg_color = finalcut::fc::Default;
|
2018-04-02 22:04:29 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;10;1m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Blue text on white background + dim + italic
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Blue;
|
|
|
|
to->bg_color = finalcut::fc::White;
|
2018-04-02 22:04:29 +02:00
|
|
|
to->attr.bit.dim = true;
|
|
|
|
to->attr.bit.italic = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;10;1m" CSI "34m" CSI "47m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Reset attributes + default background
|
|
|
|
to->attr.bit.bold = false;
|
|
|
|
to->attr.bit.dim = false;
|
|
|
|
to->attr.bit.italic = false;
|
2018-09-20 23:59:01 +02:00
|
|
|
to->bg_color = finalcut::fc::Default;
|
2018-04-02 22:04:29 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m" CSI "34m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Red text on black background
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Red;
|
|
|
|
to->bg_color = finalcut::fc::Black;
|
2018-04-02 22:04:29 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "31m" CSI "40m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// 256 color text and background
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::SpringGreen3;
|
|
|
|
to->bg_color = finalcut::fc::NavyBlue;
|
2018-04-02 22:04:29 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "32m" CSI "44m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Bold on (with default colors)
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Default;
|
|
|
|
to->bg_color = finalcut::fc::Default;
|
2018-04-02 22:04:29 +02:00
|
|
|
to->attr.bit.bold = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;10;1m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Bold off (with default colors)
|
|
|
|
to->attr.bit.bold = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Dim on (with default colors)
|
|
|
|
to->attr.bit.dim = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;10m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Dim off (with default colors)
|
|
|
|
to->attr.bit.dim = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Italic on (with default colors)
|
|
|
|
to->attr.bit.italic = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;10m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Italic off (with default colors)
|
|
|
|
to->attr.bit.italic = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Underline on (with default colors)
|
|
|
|
to->attr.bit.underline = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;10;4m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Underline off (with default colors)
|
|
|
|
to->attr.bit.underline = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Blink on (with default colors)
|
|
|
|
to->attr.bit.blink = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;10;5m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Blink off (with default colors)
|
|
|
|
to->attr.bit.blink = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Reverse on (with default colors)
|
|
|
|
to->attr.bit.reverse = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;10;7m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Reverse off (with default colors)
|
|
|
|
to->attr.bit.reverse = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Standout on (with default colors)
|
|
|
|
to->attr.bit.standout = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;10;7m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Standout off (with default colors)
|
|
|
|
to->attr.bit.standout = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Invisible on (with default colors)
|
|
|
|
to->attr.bit.invisible = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;10;8m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Invisible off (with default colors)
|
|
|
|
to->attr.bit.invisible = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Protect on (with default colors)
|
|
|
|
to->attr.bit.protect = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;10m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Protect off (with default colors)
|
|
|
|
to->attr.bit.protect = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Crossed out on (with default colors)
|
|
|
|
to->attr.bit.crossed_out = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;10m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Crossed out off (with default colors)
|
|
|
|
to->attr.bit.crossed_out = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Double underline on (with default colors)
|
|
|
|
to->attr.bit.dbl_underline = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;10m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Double underline off (with default colors)
|
|
|
|
to->attr.bit.dbl_underline = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Alternate character set on (with default colors)
|
|
|
|
to->attr.bit.alt_charset = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;10;11m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Alternate character set off (with default colors)
|
|
|
|
to->attr.bit.alt_charset = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
2018-04-08 16:32:02 +02:00
|
|
|
, C_STR(CSI "10m" CSI "0m") );
|
2018-04-02 22:04:29 +02:00
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// PC character set on (with default colors)
|
|
|
|
to->attr.bit.pc_charset = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;10m" CSI "11m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// PC character set off (with default colors)
|
|
|
|
to->attr.bit.pc_charset = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m" CSI "10m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Turn on all attributes (with default colors)
|
|
|
|
to->attr.bit.pc_charset = true;
|
|
|
|
to->attr.bit.bold = true;
|
|
|
|
to->attr.bit.dim = true;
|
|
|
|
to->attr.bit.italic = true;
|
|
|
|
to->attr.bit.underline = true;
|
|
|
|
to->attr.bit.blink = true;
|
|
|
|
to->attr.bit.reverse = true;
|
|
|
|
to->attr.bit.standout = true;
|
|
|
|
to->attr.bit.invisible = true;
|
|
|
|
to->attr.bit.protect = true;
|
|
|
|
to->attr.bit.crossed_out = true;
|
|
|
|
to->attr.bit.dbl_underline = true;
|
|
|
|
to->attr.bit.alt_charset = true;
|
|
|
|
to->attr.bit.pc_charset = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;10;7;4;7;5;1;8;11m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Cyan text on blue background
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Cyan;
|
|
|
|
to->bg_color = finalcut::fc::Blue;
|
2018-04-02 22:04:29 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "36m" CSI "44m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Bold off
|
|
|
|
to->attr.bit.bold = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
2018-04-08 16:32:02 +02:00
|
|
|
, C_STR(CSI "0;10;7;5;8;11m" CSI "36m" CSI "44m") );
|
2018-04-02 22:04:29 +02:00
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Dim off
|
|
|
|
to->attr.bit.dim = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
2018-04-08 16:32:02 +02:00
|
|
|
, C_STR(CSI "0;10;7;5;8;11m" CSI "36m" CSI "44m") );
|
2018-04-02 22:04:29 +02:00
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Italic off
|
|
|
|
to->attr.bit.italic = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
2018-04-08 16:32:02 +02:00
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;10;7;5;8;11m"
|
|
|
|
CSI "36m" CSI "44m") );
|
2018-04-02 22:04:29 +02:00
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Underline off
|
|
|
|
to->attr.bit.underline = false;
|
|
|
|
CPPUNIT_ASSERT ( *from == *to ); // because of noColorVideo = 3
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Blink off
|
|
|
|
to->attr.bit.blink = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
2018-04-08 16:32:02 +02:00
|
|
|
, C_STR(CSI "0;10;7;8;11m" CSI "36m" CSI "44m") );
|
2018-04-02 22:04:29 +02:00
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Reverse off
|
|
|
|
to->attr.bit.reverse = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
2018-04-08 16:32:02 +02:00
|
|
|
, C_STR(CSI "0;10;8;11m" CSI "36m" CSI "44m") );
|
2018-04-02 22:04:29 +02:00
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Standout off
|
|
|
|
to->attr.bit.standout = false;
|
|
|
|
CPPUNIT_ASSERT ( *from == *to ); // because of noColorVideo = 3
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Invisible off
|
|
|
|
to->attr.bit.invisible = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
2018-04-08 16:32:02 +02:00
|
|
|
, C_STR(CSI "0;10;11m" CSI "36m" CSI "44m") );
|
2018-04-02 22:04:29 +02:00
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Protect off
|
|
|
|
to->attr.bit.protect = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
2018-04-08 16:32:02 +02:00
|
|
|
, C_STR(CSI "0;10;11m" CSI "36m" CSI "44m") );
|
2018-04-02 22:04:29 +02:00
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Crossed out off
|
|
|
|
to->attr.bit.crossed_out = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
2018-04-08 16:32:02 +02:00
|
|
|
, C_STR(CSI "0;10;11m" CSI "36m" CSI "44m") );
|
2018-04-02 22:04:29 +02:00
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Double underline off
|
|
|
|
to->attr.bit.dbl_underline = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
2018-04-08 16:32:02 +02:00
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;10;11m" CSI "36m" CSI "44m") );
|
2018-04-02 22:04:29 +02:00
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Alternate character set off
|
|
|
|
to->attr.bit.alt_charset = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
2018-04-08 16:32:02 +02:00
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;10m" CSI "11m" CSI "36m" CSI "44m") );
|
2018-04-02 22:04:29 +02:00
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// PC character set off
|
|
|
|
to->attr.bit.pc_charset = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m" CSI "10m" CSI "36m" CSI "44m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Green text color
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Green;
|
2018-04-02 22:04:29 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR(CSI "32m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Default text color
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Default;
|
2018-04-02 22:04:29 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( printSequence(oa.changeAttribute(from, to)).c_str()
|
|
|
|
, C_STR("Esc [ 3 9 m ") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
delete to;
|
|
|
|
delete from;
|
|
|
|
}
|
|
|
|
|
2018-04-05 01:27:03 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FOptiAttrTest::vt100Test()
|
|
|
|
{
|
2018-04-08 16:32:02 +02:00
|
|
|
// Simulate a vt100 terminal
|
|
|
|
|
2018-09-20 23:59:01 +02:00
|
|
|
finalcut::FOptiAttr oa;
|
2018-04-15 19:55:50 +02:00
|
|
|
oa.unsetDefaultColorSupport(); // No ANSI default color
|
2018-04-05 01:27:03 +02:00
|
|
|
oa.setMaxColor (1);
|
2018-06-25 00:14:53 +02:00
|
|
|
oa.setNoColorVideo (0);
|
2018-04-05 01:27:03 +02:00
|
|
|
oa.set_enter_bold_mode (C_STR(CSI "1m$<2>"));
|
|
|
|
oa.set_exit_bold_mode (C_STR(CSI "0m$<2>"));
|
|
|
|
oa.set_enter_dim_mode (0);
|
|
|
|
oa.set_exit_dim_mode (C_STR(CSI "0m$<2>"));
|
|
|
|
oa.set_enter_italics_mode (0);
|
|
|
|
oa.set_exit_italics_mode (0);
|
|
|
|
oa.set_enter_underline_mode (C_STR(CSI "4m$<2>"));
|
|
|
|
oa.set_exit_underline_mode (C_STR(CSI "m$<2>"));
|
|
|
|
oa.set_enter_blink_mode (C_STR(CSI "5m$<2>"));
|
|
|
|
oa.set_exit_blink_mode (C_STR(CSI "0m$<2>"));
|
|
|
|
oa.set_enter_reverse_mode (C_STR(CSI "7m$<2>"));
|
|
|
|
oa.set_exit_reverse_mode (C_STR(CSI "0m$<2>"));
|
|
|
|
oa.set_enter_standout_mode (C_STR(CSI "7m$<2>"));
|
|
|
|
oa.set_exit_standout_mode (C_STR(CSI "m$<2>"));
|
|
|
|
oa.set_enter_secure_mode (0);
|
|
|
|
oa.set_exit_secure_mode (C_STR(CSI "0m$<2>"));
|
|
|
|
oa.set_enter_protected_mode (0);
|
|
|
|
oa.set_exit_protected_mode (C_STR(CSI "0m$<2>"));
|
|
|
|
oa.set_enter_crossed_out_mode (0);
|
|
|
|
oa.set_exit_crossed_out_mode (C_STR(CSI "0m$<2>"));
|
|
|
|
oa.set_enter_dbl_underline_mode (0);
|
|
|
|
oa.set_exit_dbl_underline_mode (0);
|
|
|
|
oa.set_set_attributes (C_STR(CSI "0"
|
|
|
|
"%?%p1%p6%|%t;1%;"
|
|
|
|
"%?%p2%t;4%;"
|
|
|
|
"%?%p1%p3%|%t;7%;"
|
|
|
|
"%?%p4%t;5%;m"
|
|
|
|
"%?%p9%t\016%e\017%;$<2>"));
|
|
|
|
oa.set_exit_attribute_mode (C_STR(CSI "0m$<2>"));
|
|
|
|
oa.set_enter_alt_charset_mode (C_STR("\016"));
|
|
|
|
oa.set_exit_alt_charset_mode (C_STR("\017"));
|
|
|
|
oa.set_enter_pc_charset_mode (0);
|
|
|
|
oa.set_exit_pc_charset_mode (0);
|
|
|
|
oa.set_a_foreground_color (C_STR(CSI "3%p1%dm"));
|
|
|
|
oa.set_a_background_color (C_STR(CSI "4%p1%dm"));
|
|
|
|
oa.set_foreground_color (0);
|
|
|
|
oa.set_background_color (0);
|
|
|
|
oa.set_term_color_pair (0);
|
|
|
|
oa.set_orig_pair (0);
|
|
|
|
oa.set_orig_orig_colors (0);
|
|
|
|
oa.initialize();
|
|
|
|
|
2019-10-08 04:37:19 +02:00
|
|
|
finalcut::FChar* from = new finalcut::FChar();
|
|
|
|
finalcut::FChar* to = new finalcut::FChar();
|
2018-04-05 01:27:03 +02:00
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Default color + bold
|
2018-09-20 23:59:01 +02:00
|
|
|
from->fg_color = finalcut::fc::Default;
|
|
|
|
from->bg_color = finalcut::fc::Default;
|
2018-04-05 01:27:03 +02:00
|
|
|
to->attr.bit.bold = true;
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Default;
|
|
|
|
to->bg_color = finalcut::fc::Default;
|
2018-04-05 01:27:03 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;1m\017$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Blue text on white background + dim + italic
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Blue;
|
|
|
|
to->bg_color = finalcut::fc::White;
|
2018-04-05 01:27:03 +02:00
|
|
|
to->attr.bit.dim = true;
|
|
|
|
to->attr.bit.italic = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;1m\017$<2>") );
|
2018-04-15 19:55:50 +02:00
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
2018-04-05 01:27:03 +02:00
|
|
|
|
|
|
|
// Reset attributes + default background
|
|
|
|
to->attr.bit.bold = false;
|
|
|
|
to->attr.bit.dim = false;
|
|
|
|
to->attr.bit.italic = false;
|
2018-09-20 23:59:01 +02:00
|
|
|
to->bg_color = finalcut::fc::Default;
|
2018-04-05 01:27:03 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m$<2>" ) );
|
|
|
|
|
|
|
|
// Red text on black background
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Red;
|
|
|
|
to->bg_color = finalcut::fc::Black;
|
2018-04-05 01:27:03 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR("") );
|
|
|
|
|
|
|
|
// 256 color text and background
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::SpringGreen3;
|
|
|
|
to->bg_color = finalcut::fc::NavyBlue;
|
2018-04-05 01:27:03 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
|
|
|
|
|
|
|
|
// Bold on (with default colors)
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Default;
|
|
|
|
to->bg_color = finalcut::fc::Default;
|
2018-04-05 01:27:03 +02:00
|
|
|
to->attr.bit.bold = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;1m\017$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Bold off (with default colors)
|
|
|
|
to->attr.bit.bold = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Dim on (with default colors)
|
|
|
|
to->attr.bit.dim = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Dim off (with default colors)
|
|
|
|
to->attr.bit.dim = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Italic on (with default colors)
|
|
|
|
to->attr.bit.italic = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Italic off (with default colors)
|
|
|
|
to->attr.bit.italic = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Underline on (with default colors)
|
|
|
|
to->attr.bit.underline = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;4m\017$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Underline off (with default colors)
|
|
|
|
to->attr.bit.underline = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Blink on (with default colors)
|
|
|
|
to->attr.bit.blink = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;5m\017$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Blink off (with default colors)
|
|
|
|
to->attr.bit.blink = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Reverse on (with default colors)
|
|
|
|
to->attr.bit.reverse = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;7m\017$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Reverse off (with default colors)
|
|
|
|
to->attr.bit.reverse = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Standout on (with default colors)
|
|
|
|
to->attr.bit.standout = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;1;7m\017$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Standout off (with default colors)
|
|
|
|
to->attr.bit.standout = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Invisible on (with default colors)
|
|
|
|
to->attr.bit.invisible = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017$<2>") );
|
2019-01-03 08:31:48 +01:00
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
2019-10-08 04:50:43 +02:00
|
|
|
CPPUNIT_ASSERT ( to->encoded_char == ' ' );
|
2018-04-05 01:27:03 +02:00
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Invisible off (with default colors)
|
|
|
|
to->attr.bit.invisible = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Protect on (with default colors)
|
|
|
|
to->attr.bit.protect = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Protect off (with default colors)
|
|
|
|
to->attr.bit.protect = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Crossed out on (with default colors)
|
|
|
|
to->attr.bit.crossed_out = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Crossed out off (with default colors)
|
|
|
|
to->attr.bit.crossed_out = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Double underline on (with default colors)
|
|
|
|
to->attr.bit.dbl_underline = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Double underline off (with default colors)
|
|
|
|
to->attr.bit.dbl_underline = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Alternate character set on (with default colors)
|
|
|
|
to->attr.bit.alt_charset = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\016$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Alternate character set off (with default colors)
|
|
|
|
to->attr.bit.alt_charset = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
2018-04-08 16:32:02 +02:00
|
|
|
, C_STR("\017" CSI "0m$<2>") );
|
2018-04-05 01:27:03 +02:00
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// PC character set on (with default colors)
|
|
|
|
to->attr.bit.pc_charset = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// PC character set off (with default colors)
|
|
|
|
to->attr.bit.pc_charset = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Turn on all attributes (with default colors)
|
|
|
|
to->attr.bit.pc_charset = true;
|
|
|
|
to->attr.bit.bold = true;
|
|
|
|
to->attr.bit.dim = true;
|
|
|
|
to->attr.bit.italic = true;
|
|
|
|
to->attr.bit.underline = true;
|
|
|
|
to->attr.bit.blink = true;
|
|
|
|
to->attr.bit.reverse = true;
|
|
|
|
to->attr.bit.standout = true;
|
|
|
|
to->attr.bit.invisible = true;
|
|
|
|
to->attr.bit.protect = true;
|
|
|
|
to->attr.bit.crossed_out = true;
|
|
|
|
to->attr.bit.dbl_underline = true;
|
|
|
|
to->attr.bit.alt_charset = true;
|
|
|
|
to->attr.bit.pc_charset = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;1;4;7;5m\016$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Cyan text on blue background
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Cyan;
|
|
|
|
to->bg_color = finalcut::fc::Blue;
|
2018-04-05 01:27:03 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
|
|
|
|
// Bold off
|
|
|
|
to->attr.bit.bold = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m$<2>\016" CSI "4m$<2>"
|
|
|
|
CSI "5m$<2>" CSI "7m$<2>" CSI "7m$<2>") );
|
2018-04-15 19:55:50 +02:00
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
2018-04-05 01:27:03 +02:00
|
|
|
|
|
|
|
// Dim off
|
|
|
|
to->attr.bit.dim = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m$<2>\016" CSI "4m$<2>"
|
|
|
|
CSI "5m$<2>" CSI "7m$<2>" CSI "7m$<2>") );
|
2018-04-15 19:55:50 +02:00
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
2018-04-05 01:27:03 +02:00
|
|
|
|
|
|
|
// Italic off
|
|
|
|
to->attr.bit.italic = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
2018-04-15 19:55:50 +02:00
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
2018-04-05 01:27:03 +02:00
|
|
|
|
|
|
|
// Underline off
|
|
|
|
to->attr.bit.underline = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "m$<2>\016" CSI "5m$<2>"
|
|
|
|
CSI "7m$<2>" CSI "7m$<2>") );
|
2018-04-15 19:55:50 +02:00
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
2018-04-05 01:27:03 +02:00
|
|
|
|
|
|
|
// Blink off
|
|
|
|
to->attr.bit.blink = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m$<2>\016" CSI "7m$<2>"
|
|
|
|
CSI "7m$<2>") );
|
2018-04-15 19:55:50 +02:00
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
2018-04-05 01:27:03 +02:00
|
|
|
|
|
|
|
// Reverse off
|
|
|
|
to->attr.bit.reverse = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m$<2>\016" CSI "7m$<2>") );
|
2018-04-15 19:55:50 +02:00
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
2018-04-05 01:27:03 +02:00
|
|
|
|
|
|
|
// Standout off
|
|
|
|
to->attr.bit.standout = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "m$<2>\016") );
|
2018-04-15 19:55:50 +02:00
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
2018-04-05 01:27:03 +02:00
|
|
|
|
|
|
|
// Invisible off
|
|
|
|
to->attr.bit.invisible = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
2018-04-15 19:55:50 +02:00
|
|
|
|
2018-04-05 01:27:03 +02:00
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m$<2>\016") );
|
2018-04-15 19:55:50 +02:00
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
2018-04-05 01:27:03 +02:00
|
|
|
|
|
|
|
// Protect off
|
|
|
|
to->attr.bit.protect = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m$<2>\016") );
|
2018-04-15 19:55:50 +02:00
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
2018-04-05 01:27:03 +02:00
|
|
|
|
|
|
|
// Crossed out off
|
|
|
|
to->attr.bit.crossed_out = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m$<2>\016") );
|
2018-04-15 19:55:50 +02:00
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
2018-04-05 01:27:03 +02:00
|
|
|
|
|
|
|
// Double underline off
|
|
|
|
to->attr.bit.dbl_underline = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
2018-04-15 19:55:50 +02:00
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
2018-04-05 01:27:03 +02:00
|
|
|
|
|
|
|
// Alternate character set off
|
|
|
|
to->attr.bit.alt_charset = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("\017") );
|
2018-04-15 19:55:50 +02:00
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
2018-04-05 01:27:03 +02:00
|
|
|
|
|
|
|
// PC character set off
|
|
|
|
to->attr.bit.pc_charset = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
2018-04-15 19:55:50 +02:00
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
2018-04-05 01:27:03 +02:00
|
|
|
|
|
|
|
// Green text color
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Green;
|
2018-04-05 01:27:03 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
2018-04-15 19:55:50 +02:00
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
2018-04-05 01:27:03 +02:00
|
|
|
|
|
|
|
// Default text color
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Default;
|
2018-04-15 19:55:50 +02:00
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
2018-04-08 16:32:02 +02:00
|
|
|
|
|
|
|
delete to;
|
|
|
|
delete from;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FOptiAttrTest::xtermTest()
|
|
|
|
{
|
|
|
|
// Simulate an xterm-256color terminal
|
|
|
|
|
2018-09-20 23:59:01 +02:00
|
|
|
finalcut::FOptiAttr oa;
|
2018-04-08 16:32:02 +02:00
|
|
|
oa.setDefaultColorSupport(); // ANSI default color
|
|
|
|
oa.setMaxColor (256);
|
2018-06-25 00:14:53 +02:00
|
|
|
oa.setNoColorVideo (0);
|
2018-04-08 16:32:02 +02:00
|
|
|
oa.set_enter_bold_mode (C_STR(CSI "1m"));
|
|
|
|
oa.set_exit_bold_mode (C_STR(CSI "22m"));
|
|
|
|
oa.set_enter_dim_mode (C_STR(CSI "2m"));
|
|
|
|
oa.set_exit_dim_mode (C_STR(CSI "22m"));
|
|
|
|
oa.set_enter_italics_mode (C_STR(CSI "3m"));
|
|
|
|
oa.set_exit_italics_mode (C_STR(CSI "23m"));
|
|
|
|
oa.set_enter_underline_mode (C_STR(CSI "4m"));
|
|
|
|
oa.set_exit_underline_mode (C_STR(CSI "24m"));
|
|
|
|
oa.set_enter_blink_mode (C_STR(CSI "5m"));
|
|
|
|
oa.set_exit_blink_mode (C_STR(CSI "25m"));
|
|
|
|
oa.set_enter_reverse_mode (C_STR(CSI "7m"));
|
|
|
|
oa.set_exit_reverse_mode (C_STR(CSI "27m"));
|
|
|
|
oa.set_enter_standout_mode (C_STR(CSI "7m"));
|
|
|
|
oa.set_exit_standout_mode (C_STR(CSI "27m"));
|
|
|
|
oa.set_enter_secure_mode (C_STR(CSI "8m"));
|
|
|
|
oa.set_exit_secure_mode (C_STR(CSI "28m"));
|
|
|
|
oa.set_enter_protected_mode (0);
|
|
|
|
oa.set_exit_protected_mode (C_STR(CSI "0m"));
|
|
|
|
oa.set_enter_crossed_out_mode (C_STR(CSI "9m"));
|
|
|
|
oa.set_exit_crossed_out_mode (C_STR(CSI "29m"));
|
|
|
|
oa.set_enter_dbl_underline_mode (C_STR(CSI "21m"));
|
|
|
|
oa.set_exit_dbl_underline_mode (C_STR(CSI "24m"));
|
|
|
|
oa.set_set_attributes (C_STR("%?%p9%t" ESC "(0"
|
|
|
|
"%e" ESC "(B%;" CSI "0"
|
|
|
|
"%?%p6%t;1%;"
|
|
|
|
"%?%p5%t;2%;"
|
|
|
|
"%?%p2%t;4%;"
|
|
|
|
"%?%p1%p3%|%t;7%;"
|
|
|
|
"%?%p4%t;5%;"
|
|
|
|
"%?%p7%t;8%;m"));
|
|
|
|
oa.set_exit_attribute_mode (C_STR(CSI "0m"));
|
|
|
|
oa.set_enter_alt_charset_mode (C_STR(ESC "(0"));
|
|
|
|
oa.set_exit_alt_charset_mode (C_STR(ESC "(B"));
|
|
|
|
oa.set_enter_pc_charset_mode (0);
|
|
|
|
oa.set_exit_pc_charset_mode (0);
|
|
|
|
oa.set_a_foreground_color (C_STR(CSI "%?%p1%{8}%<"
|
|
|
|
"%t3%p1%d"
|
|
|
|
"%e%p1%{16}%<"
|
|
|
|
"%t9%p1%{8}%-%d"
|
|
|
|
"%e38;5;%p1%d%;m"));
|
|
|
|
oa.set_a_background_color (C_STR(CSI "%?%p1%{8}%<"
|
|
|
|
"%t4%p1%d"
|
|
|
|
"%e%p1%{16}%<"
|
|
|
|
"%t10%p1%{8}%-%d"
|
|
|
|
"%e48;5;%p1%d%;m"));
|
|
|
|
oa.set_foreground_color (0);
|
|
|
|
oa.set_background_color (0);
|
|
|
|
oa.set_term_color_pair (0);
|
|
|
|
oa.set_orig_pair (C_STR(CSI "39;49m"));
|
|
|
|
oa.set_orig_orig_colors (0);
|
|
|
|
oa.initialize();
|
|
|
|
|
2019-10-08 04:37:19 +02:00
|
|
|
finalcut::FChar* from = new finalcut::FChar();
|
|
|
|
finalcut::FChar* to = new finalcut::FChar();
|
2018-04-08 16:32:02 +02:00
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Default color + bold
|
2018-09-20 23:59:01 +02:00
|
|
|
from->fg_color = finalcut::fc::Default;
|
|
|
|
from->bg_color = finalcut::fc::Default;
|
2018-04-08 16:32:02 +02:00
|
|
|
to->attr.bit.bold = true;
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Default;
|
|
|
|
to->bg_color = finalcut::fc::Default;
|
2018-04-08 16:32:02 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(B" CSI "0;1m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Blue text on white background + dim + italic
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Blue;
|
|
|
|
to->bg_color = finalcut::fc::White;
|
2018-04-08 16:32:02 +02:00
|
|
|
to->attr.bit.dim = true;
|
|
|
|
to->attr.bit.italic = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(B" CSI "0;1;2m" CSI "3m"
|
|
|
|
CSI "34m" CSI "107m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Reset attributes + default background
|
|
|
|
to->attr.bit.bold = false;
|
|
|
|
to->attr.bit.dim = false;
|
|
|
|
to->attr.bit.italic = false;
|
2018-09-20 23:59:01 +02:00
|
|
|
to->bg_color = finalcut::fc::Default;
|
2018-04-08 16:32:02 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m" CSI "34m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Red text on black background
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Red;
|
|
|
|
to->bg_color = finalcut::fc::Black;
|
2018-04-08 16:32:02 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "31m" CSI "40m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// 256 color text and background
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::SpringGreen3;
|
|
|
|
to->bg_color = finalcut::fc::NavyBlue;
|
2018-04-08 16:32:02 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "38;5;42m" CSI "48;5;17m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Bold on (with default colors)
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Default;
|
|
|
|
to->bg_color = finalcut::fc::Default;
|
2018-04-08 16:32:02 +02:00
|
|
|
to->attr.bit.bold = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(B" CSI "0;1m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Bold off (with default colors)
|
|
|
|
to->attr.bit.bold = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Dim on (with default colors)
|
|
|
|
to->attr.bit.dim = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(B" CSI "0;2m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Dim off (with default colors)
|
|
|
|
to->attr.bit.dim = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Italic on (with default colors)
|
|
|
|
to->attr.bit.italic = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(B" CSI "0m" CSI "3m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Italic off (with default colors)
|
|
|
|
to->attr.bit.italic = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Underline on (with default colors)
|
|
|
|
to->attr.bit.underline = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(B" CSI "0;4m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Underline off (with default colors)
|
|
|
|
to->attr.bit.underline = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Blink on (with default colors)
|
|
|
|
to->attr.bit.blink = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(B" CSI "0;5m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Blink off (with default colors)
|
|
|
|
to->attr.bit.blink = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Reverse on (with default colors)
|
|
|
|
to->attr.bit.reverse = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(B" CSI "0;7m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Reverse off (with default colors)
|
|
|
|
to->attr.bit.reverse = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Standout on (with default colors)
|
|
|
|
to->attr.bit.standout = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(B" CSI "0;7m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Standout off (with default colors)
|
|
|
|
to->attr.bit.standout = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Invisible on (with default colors)
|
|
|
|
to->attr.bit.invisible = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(B" CSI "0;8m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Invisible off (with default colors)
|
|
|
|
to->attr.bit.invisible = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Protect on (with default colors)
|
|
|
|
to->attr.bit.protect = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(B" CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Protect off (with default colors)
|
|
|
|
to->attr.bit.protect = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Crossed out on (with default colors)
|
|
|
|
to->attr.bit.crossed_out = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(B" CSI "0m" CSI "9m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Crossed out off (with default colors)
|
|
|
|
to->attr.bit.crossed_out = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Double underline on (with default colors)
|
|
|
|
to->attr.bit.dbl_underline = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(B" CSI "0m" CSI "21m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Double underline off (with default colors)
|
|
|
|
to->attr.bit.dbl_underline = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Alternate character set on (with default colors)
|
|
|
|
to->attr.bit.alt_charset = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(0" CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Alternate character set off (with default colors)
|
|
|
|
to->attr.bit.alt_charset = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(B" CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// PC character set on (with default colors)
|
|
|
|
to->attr.bit.pc_charset = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(B" CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// PC character set off (with default colors)
|
|
|
|
to->attr.bit.pc_charset = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Turn on all attributes (with default colors)
|
|
|
|
to->attr.bit.pc_charset = true;
|
|
|
|
to->attr.bit.bold = true;
|
|
|
|
to->attr.bit.dim = true;
|
|
|
|
to->attr.bit.italic = true;
|
|
|
|
to->attr.bit.underline = true;
|
|
|
|
to->attr.bit.blink = true;
|
|
|
|
to->attr.bit.reverse = true;
|
|
|
|
to->attr.bit.standout = true;
|
|
|
|
to->attr.bit.invisible = true;
|
|
|
|
to->attr.bit.protect = true;
|
|
|
|
to->attr.bit.crossed_out = true;
|
|
|
|
to->attr.bit.dbl_underline = true;
|
|
|
|
to->attr.bit.alt_charset = true;
|
|
|
|
to->attr.bit.pc_charset = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(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 );
|
|
|
|
|
|
|
|
// Cyan text on blue background
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Cyan;
|
|
|
|
to->bg_color = finalcut::fc::Blue;
|
2018-04-08 16:32:02 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "36m" CSI "44m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Bold off
|
|
|
|
to->attr.bit.bold = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "22m" CSI "2m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Dim off
|
|
|
|
to->attr.bit.dim = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "22m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Italic off
|
|
|
|
to->attr.bit.italic = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "23m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Underline off
|
|
|
|
to->attr.bit.underline = false;
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "24m" CSI "21m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
|
|
|
|
// Blink off
|
|
|
|
to->attr.bit.blink = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "25m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Reverse off
|
|
|
|
to->attr.bit.reverse = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "27m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Standout off
|
|
|
|
to->attr.bit.standout = false;
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "27m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Invisible off
|
|
|
|
to->attr.bit.invisible = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "28m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Protect off
|
|
|
|
to->attr.bit.protect = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m" CSI "36m" CSI "44m" ESC "(0" CSI "9m" CSI "21m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Crossed out off
|
|
|
|
to->attr.bit.crossed_out = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "29m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Double underline off
|
|
|
|
to->attr.bit.dbl_underline = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "24m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Alternate character set off
|
|
|
|
to->attr.bit.alt_charset = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(B") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// PC character set off
|
|
|
|
to->attr.bit.pc_charset = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m" CSI "36m" CSI "44m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Green text color
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Green;
|
2018-04-08 16:32:02 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR(CSI "32m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Default text color
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Default;
|
2018-04-08 16:32:02 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( printSequence(oa.changeAttribute(from, to)).c_str()
|
|
|
|
, C_STR("Esc [ 3 9 m ") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
delete to;
|
|
|
|
delete from;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FOptiAttrTest::rxvtTest()
|
|
|
|
{
|
|
|
|
// Simulate an rxvt terminal
|
|
|
|
|
2018-09-20 23:59:01 +02:00
|
|
|
finalcut::FOptiAttr oa;
|
2018-04-08 16:32:02 +02:00
|
|
|
oa.setDefaultColorSupport(); // ANSI default color
|
|
|
|
oa.setMaxColor (8);
|
2018-06-25 00:14:53 +02:00
|
|
|
oa.setNoColorVideo (0);
|
2018-04-08 16:32:02 +02:00
|
|
|
oa.set_enter_bold_mode (C_STR(CSI "1m"));
|
|
|
|
oa.set_exit_bold_mode (C_STR(CSI "22m"));
|
|
|
|
oa.set_enter_dim_mode (0);
|
|
|
|
oa.set_exit_dim_mode (C_STR(CSI "22m"));
|
|
|
|
oa.set_enter_italics_mode (0);
|
|
|
|
oa.set_exit_italics_mode (0);
|
|
|
|
oa.set_enter_underline_mode (C_STR(CSI "4m"));
|
|
|
|
oa.set_exit_underline_mode (C_STR(CSI "24m"));
|
|
|
|
oa.set_enter_blink_mode (C_STR(CSI "5m"));
|
|
|
|
oa.set_exit_blink_mode (C_STR(CSI "25m"));
|
|
|
|
oa.set_enter_reverse_mode (C_STR(CSI "7m"));
|
|
|
|
oa.set_exit_reverse_mode (C_STR(CSI "27m"));
|
|
|
|
oa.set_enter_standout_mode (C_STR(CSI "7m"));
|
|
|
|
oa.set_exit_standout_mode (C_STR(CSI "27m"));
|
|
|
|
oa.set_enter_secure_mode (0);
|
|
|
|
oa.set_exit_secure_mode (C_STR(CSI "28m"));
|
|
|
|
oa.set_enter_protected_mode (0);
|
|
|
|
oa.set_exit_protected_mode (C_STR(CSI "0m"));
|
|
|
|
oa.set_enter_crossed_out_mode (C_STR(CSI "9m"));
|
|
|
|
oa.set_exit_crossed_out_mode (C_STR(CSI "29m"));
|
|
|
|
oa.set_enter_dbl_underline_mode (C_STR(CSI "21m"));
|
|
|
|
oa.set_exit_dbl_underline_mode (C_STR(CSI "24m"));
|
|
|
|
oa.set_set_attributes (C_STR(CSI "0"
|
|
|
|
"%?%p6%t;1%;"
|
|
|
|
"%?%p2%t;4%;"
|
|
|
|
"%?%p1%p3%|%t;7%;"
|
|
|
|
"%?%p4%t;5%;m"
|
|
|
|
"%?%p9%t\016%e\017%;"));
|
|
|
|
oa.set_exit_attribute_mode (C_STR(CSI "0m"));
|
|
|
|
oa.set_enter_alt_charset_mode (C_STR("\016"));
|
|
|
|
oa.set_exit_alt_charset_mode (C_STR("\017"));
|
|
|
|
oa.set_enter_pc_charset_mode (0);
|
|
|
|
oa.set_exit_pc_charset_mode (0);
|
|
|
|
oa.set_a_foreground_color (C_STR(CSI "3%p1%dm"));
|
|
|
|
oa.set_a_background_color (C_STR(CSI "4%p1%dm"));
|
|
|
|
oa.set_foreground_color (0);
|
|
|
|
oa.set_background_color (0);
|
|
|
|
oa.set_term_color_pair (0);
|
|
|
|
oa.set_orig_pair (C_STR(CSI "39;49m"));
|
|
|
|
oa.set_orig_orig_colors (0);
|
|
|
|
oa.initialize();
|
|
|
|
|
2019-10-08 04:37:19 +02:00
|
|
|
finalcut::FChar* from = new finalcut::FChar();
|
|
|
|
finalcut::FChar* to = new finalcut::FChar();
|
2018-04-08 16:32:02 +02:00
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Default color + bold
|
2018-09-20 23:59:01 +02:00
|
|
|
from->fg_color = finalcut::fc::Default;
|
|
|
|
from->bg_color = finalcut::fc::Default;
|
2018-04-08 16:32:02 +02:00
|
|
|
to->attr.bit.bold = true;
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Default;
|
|
|
|
to->bg_color = finalcut::fc::Default;
|
2018-04-08 16:32:02 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;1m\017") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Blue text on white background + dim + italic
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Blue;
|
|
|
|
to->bg_color = finalcut::fc::White;
|
2018-04-08 16:32:02 +02:00
|
|
|
to->attr.bit.dim = true;
|
|
|
|
to->attr.bit.italic = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;1m\017" CSI "34m" CSI "47m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Reset attributes + default background
|
|
|
|
to->attr.bit.bold = false;
|
|
|
|
to->attr.bit.dim = false;
|
|
|
|
to->attr.bit.italic = false;
|
2018-09-20 23:59:01 +02:00
|
|
|
to->bg_color = finalcut::fc::Default;
|
2018-04-08 16:32:02 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m" CSI "34m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Red text on black background
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Red;
|
|
|
|
to->bg_color = finalcut::fc::Black;
|
2018-04-08 16:32:02 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "31m" CSI "40m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// 256 color text and background
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::SpringGreen3;
|
|
|
|
to->bg_color = finalcut::fc::NavyBlue;
|
2018-04-08 16:32:02 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "32m" CSI "44m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Bold on (with default colors)
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Default;
|
|
|
|
to->bg_color = finalcut::fc::Default;
|
2018-04-08 16:32:02 +02:00
|
|
|
to->attr.bit.bold = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;1m\017") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Bold off (with default colors)
|
|
|
|
to->attr.bit.bold = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Dim on (with default colors)
|
|
|
|
to->attr.bit.dim = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Dim off (with default colors)
|
|
|
|
to->attr.bit.dim = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Italic on (with default colors)
|
|
|
|
to->attr.bit.italic = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Italic off (with default colors)
|
|
|
|
to->attr.bit.italic = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Underline on (with default colors)
|
|
|
|
to->attr.bit.underline = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;4m\017") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Underline off (with default colors)
|
|
|
|
to->attr.bit.underline = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Blink on (with default colors)
|
|
|
|
to->attr.bit.blink = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;5m\017") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Blink off (with default colors)
|
|
|
|
to->attr.bit.blink = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Reverse on (with default colors)
|
|
|
|
to->attr.bit.reverse = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;7m\017") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Reverse off (with default colors)
|
|
|
|
to->attr.bit.reverse = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Standout on (with default colors)
|
|
|
|
to->attr.bit.standout = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;7m\017") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Standout off (with default colors)
|
|
|
|
to->attr.bit.standout = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Invisible on (with default colors)
|
|
|
|
to->attr.bit.invisible = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017") );
|
2019-01-03 08:31:48 +01:00
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
2019-10-08 04:50:43 +02:00
|
|
|
CPPUNIT_ASSERT ( to->encoded_char == ' ' );
|
2018-04-08 16:32:02 +02:00
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Invisible off (with default colors)
|
|
|
|
to->attr.bit.invisible = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Protect on (with default colors)
|
|
|
|
to->attr.bit.protect = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Protect off (with default colors)
|
|
|
|
to->attr.bit.protect = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Crossed out on (with default colors)
|
|
|
|
to->attr.bit.crossed_out = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017" CSI "9m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Crossed out off (with default colors)
|
|
|
|
to->attr.bit.crossed_out = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Double underline on (with default colors)
|
|
|
|
to->attr.bit.dbl_underline = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017" CSI "21m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Double underline off (with default colors)
|
|
|
|
to->attr.bit.dbl_underline = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Alternate character set on (with default colors)
|
|
|
|
to->attr.bit.alt_charset = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\016") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Alternate character set off (with default colors)
|
|
|
|
to->attr.bit.alt_charset = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR("\017" CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// PC character set on (with default colors)
|
|
|
|
to->attr.bit.pc_charset = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// PC character set off (with default colors)
|
|
|
|
to->attr.bit.pc_charset = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Turn on all attributes (with default colors)
|
|
|
|
to->attr.bit.pc_charset = true;
|
|
|
|
to->attr.bit.bold = true;
|
|
|
|
to->attr.bit.dim = true;
|
|
|
|
to->attr.bit.italic = true;
|
|
|
|
to->attr.bit.underline = true;
|
|
|
|
to->attr.bit.blink = true;
|
|
|
|
to->attr.bit.reverse = true;
|
|
|
|
to->attr.bit.standout = true;
|
|
|
|
to->attr.bit.invisible = true;
|
|
|
|
to->attr.bit.protect = true;
|
|
|
|
to->attr.bit.crossed_out = true;
|
|
|
|
to->attr.bit.dbl_underline = true;
|
|
|
|
to->attr.bit.alt_charset = true;
|
|
|
|
to->attr.bit.pc_charset = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;1;4;7;5m\016"
|
|
|
|
CSI "9m" CSI "21m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Cyan text on blue background
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Cyan;
|
|
|
|
to->bg_color = finalcut::fc::Blue;
|
2018-04-08 16:32:02 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "36m" CSI "44m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Bold off
|
|
|
|
to->attr.bit.bold = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "22m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Dim off
|
|
|
|
to->attr.bit.dim = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "22m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Italic off
|
|
|
|
to->attr.bit.italic = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Underline off
|
|
|
|
to->attr.bit.underline = false;
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "24m" CSI "21m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
|
|
|
|
// Blink off
|
|
|
|
to->attr.bit.blink = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "25m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Reverse off
|
|
|
|
to->attr.bit.reverse = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "27m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Standout off
|
|
|
|
to->attr.bit.standout = false;
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "27m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Invisible off
|
|
|
|
to->attr.bit.invisible = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "28m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Protect off
|
|
|
|
to->attr.bit.protect = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m" CSI "36m" CSI "44m\016" CSI "9m" CSI "21m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Crossed out off
|
|
|
|
to->attr.bit.crossed_out = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "29m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Double underline off
|
|
|
|
to->attr.bit.dbl_underline = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "24m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Alternate character set off
|
|
|
|
to->attr.bit.alt_charset = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR("\017") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// PC character set off
|
|
|
|
to->attr.bit.pc_charset = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m" CSI "36m" CSI "44m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Green text color
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Green;
|
2018-04-08 16:32:02 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR(CSI "32m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Default text color
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Default;
|
2018-04-08 16:32:02 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( printSequence(oa.changeAttribute(from, to)).c_str()
|
|
|
|
, C_STR("Esc [ 3 9 m ") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
2018-04-12 00:34:25 +02:00
|
|
|
|
|
|
|
delete to;
|
|
|
|
delete from;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FOptiAttrTest::linuxTest()
|
|
|
|
{
|
|
|
|
// Simulate a Linux terminal with 16 colors
|
|
|
|
|
2018-09-20 23:59:01 +02:00
|
|
|
finalcut::FOptiAttr oa;
|
2018-04-12 00:34:25 +02:00
|
|
|
oa.setDefaultColorSupport(); // ANSI default color
|
|
|
|
oa.setMaxColor (16);
|
2018-06-25 00:14:53 +02:00
|
|
|
oa.setNoColorVideo (18);
|
2018-04-12 00:34:25 +02:00
|
|
|
oa.set_enter_bold_mode (C_STR(CSI "1m"));
|
|
|
|
oa.set_exit_bold_mode (C_STR(CSI "22m"));
|
|
|
|
oa.set_enter_dim_mode (0);
|
|
|
|
oa.set_exit_dim_mode (0);
|
|
|
|
oa.set_enter_italics_mode (0);
|
|
|
|
oa.set_exit_italics_mode (0);
|
|
|
|
oa.set_enter_underline_mode (0);
|
|
|
|
oa.set_exit_underline_mode (0);
|
|
|
|
oa.set_enter_blink_mode (C_STR(CSI "5m"));
|
|
|
|
oa.set_exit_blink_mode (C_STR(CSI "25m"));
|
|
|
|
oa.set_enter_reverse_mode (C_STR(CSI "7m"));
|
|
|
|
oa.set_exit_reverse_mode (C_STR(CSI "27m"));
|
|
|
|
oa.set_enter_standout_mode (C_STR(CSI "7m"));
|
|
|
|
oa.set_exit_standout_mode (C_STR(CSI "27m"));
|
|
|
|
oa.set_enter_secure_mode (0);
|
|
|
|
oa.set_exit_secure_mode (0);
|
|
|
|
oa.set_enter_protected_mode (0);
|
|
|
|
oa.set_exit_protected_mode (0);
|
|
|
|
oa.set_enter_crossed_out_mode (0);
|
|
|
|
oa.set_exit_crossed_out_mode (0);
|
|
|
|
oa.set_enter_dbl_underline_mode (0);
|
|
|
|
oa.set_exit_dbl_underline_mode (0);
|
|
|
|
oa.set_set_attributes (C_STR(CSI "0"
|
|
|
|
"%?%p6%|%t;1%;"
|
|
|
|
"%?%p1%p3%|%t;7%;"
|
|
|
|
"%?%p4%t;5%;m"
|
|
|
|
"%?%p9%t\016%e\017%;"));
|
|
|
|
oa.set_exit_attribute_mode (C_STR(CSI "0m\017"));
|
|
|
|
oa.set_enter_alt_charset_mode (C_STR("\016"));
|
|
|
|
oa.set_exit_alt_charset_mode (C_STR("\017"));
|
|
|
|
oa.set_enter_pc_charset_mode (C_STR(CSI "11m"));
|
|
|
|
oa.set_exit_pc_charset_mode (C_STR(CSI "10m"));
|
|
|
|
oa.set_a_foreground_color (C_STR(CSI "3%p1%{8}%m%d"
|
|
|
|
"%?%p1%{7}%>%t;1%e;22%;m"));
|
|
|
|
oa.set_a_background_color (C_STR(CSI "4%p1%{8}%m%d"
|
|
|
|
"%?%p1%{7}%>%t;5%e;25%;m"));
|
|
|
|
oa.set_foreground_color (0);
|
|
|
|
oa.set_background_color (0);
|
|
|
|
oa.set_term_color_pair (0);
|
|
|
|
oa.set_orig_pair (C_STR(CSI "39;49;25m"));
|
|
|
|
oa.set_orig_orig_colors (C_STR(OSC "R"));
|
|
|
|
oa.initialize();
|
|
|
|
|
2019-10-08 04:37:19 +02:00
|
|
|
finalcut::FChar* from = new finalcut::FChar();
|
|
|
|
finalcut::FChar* to = new finalcut::FChar();
|
2018-04-12 00:34:25 +02:00
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Default color + bold
|
2018-09-20 23:59:01 +02:00
|
|
|
from->fg_color = finalcut::fc::Default;
|
|
|
|
from->bg_color = finalcut::fc::Default;
|
2018-04-12 00:34:25 +02:00
|
|
|
to->attr.bit.bold = true;
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Default;
|
|
|
|
to->bg_color = finalcut::fc::Default;
|
2018-04-12 00:34:25 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;1m\017") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Blue text on white background + dim + italic
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Blue;
|
|
|
|
to->bg_color = finalcut::fc::White;
|
2018-04-12 00:34:25 +02:00
|
|
|
to->attr.bit.dim = true;
|
|
|
|
to->attr.bit.italic = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;1m\017" CSI "34;22m" CSI "47;5m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Reset attributes + default background
|
|
|
|
to->attr.bit.bold = false;
|
|
|
|
to->attr.bit.dim = false;
|
|
|
|
to->attr.bit.italic = false;
|
2018-09-20 23:59:01 +02:00
|
|
|
to->bg_color = finalcut::fc::Default;
|
2018-04-12 00:34:25 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017" CSI "34;22m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Red text on black background
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Red;
|
|
|
|
to->bg_color = finalcut::fc::Black;
|
2018-04-12 00:34:25 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "31;22m" CSI "40;25m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// 256 color text and background
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::SpringGreen3;
|
|
|
|
to->bg_color = finalcut::fc::NavyBlue;
|
2018-04-12 00:34:25 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "32;1m" CSI "44;25m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Bold on (with default colors)
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Default;
|
|
|
|
to->bg_color = finalcut::fc::Default;
|
2018-04-12 00:34:25 +02:00
|
|
|
to->attr.bit.bold = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;1m\017") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Bold off (with default colors)
|
|
|
|
to->attr.bit.bold = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Dim on (with default colors)
|
|
|
|
to->attr.bit.dim = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Dim off (with default colors)
|
|
|
|
to->attr.bit.dim = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Italic on (with default colors)
|
|
|
|
to->attr.bit.italic = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Italic off (with default colors)
|
|
|
|
to->attr.bit.italic = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Underline on (with default colors)
|
|
|
|
to->attr.bit.underline = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Underline off (with default colors)
|
|
|
|
to->attr.bit.underline = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Blink on (with default colors)
|
|
|
|
to->attr.bit.blink = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;5m\017") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Blink off (with default colors)
|
|
|
|
to->attr.bit.blink = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Reverse on (with default colors)
|
|
|
|
to->attr.bit.reverse = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;7m\017") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Reverse off (with default colors)
|
|
|
|
to->attr.bit.reverse = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Standout on (with default colors)
|
|
|
|
to->attr.bit.standout = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;7m\017") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Standout off (with default colors)
|
|
|
|
to->attr.bit.standout = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Invisible on (with default colors)
|
|
|
|
to->attr.bit.invisible = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017") );
|
2019-01-03 08:31:48 +01:00
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
2019-10-08 04:50:43 +02:00
|
|
|
CPPUNIT_ASSERT ( to->encoded_char == ' ' );
|
2018-04-12 00:34:25 +02:00
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Invisible off (with default colors)
|
|
|
|
to->attr.bit.invisible = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\17") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Protect on (with default colors)
|
|
|
|
to->attr.bit.protect = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Protect off (with default colors)
|
|
|
|
to->attr.bit.protect = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Crossed out on (with default colors)
|
|
|
|
to->attr.bit.crossed_out = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Crossed out off (with default colors)
|
|
|
|
to->attr.bit.crossed_out = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Double underline on (with default colors)
|
|
|
|
to->attr.bit.dbl_underline = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Double underline off (with default colors)
|
|
|
|
to->attr.bit.dbl_underline = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Alternate character set on (with default colors)
|
|
|
|
to->attr.bit.alt_charset = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\016") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Alternate character set off (with default colors)
|
|
|
|
to->attr.bit.alt_charset = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR("\017" CSI "0m\017") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// PC character set on (with default colors)
|
|
|
|
to->attr.bit.pc_charset = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017" CSI "11m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// PC character set off (with default colors)
|
|
|
|
to->attr.bit.pc_charset = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017" CSI "10m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Turn on all attributes (with default colors)
|
|
|
|
to->attr.bit.pc_charset = true;
|
|
|
|
to->attr.bit.bold = true;
|
|
|
|
to->attr.bit.dim = true;
|
|
|
|
to->attr.bit.italic = true;
|
|
|
|
to->attr.bit.underline = true;
|
|
|
|
to->attr.bit.blink = true;
|
|
|
|
to->attr.bit.reverse = true;
|
|
|
|
to->attr.bit.standout = true;
|
|
|
|
to->attr.bit.invisible = true;
|
|
|
|
to->attr.bit.protect = true;
|
|
|
|
to->attr.bit.crossed_out = true;
|
|
|
|
to->attr.bit.dbl_underline = true;
|
|
|
|
to->attr.bit.alt_charset = true;
|
|
|
|
to->attr.bit.pc_charset = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;1;7;5m\016"
|
|
|
|
CSI "11m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Cyan text on blue background
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Cyan;
|
|
|
|
to->bg_color = finalcut::fc::Blue;
|
2018-04-12 00:34:25 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "36;22m" CSI "44;25m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Bold off
|
|
|
|
to->attr.bit.bold = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "22m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Dim off
|
|
|
|
to->attr.bit.dim = false;
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Italic off
|
|
|
|
to->attr.bit.italic = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Underline off
|
|
|
|
to->attr.bit.underline = false;
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Blink off
|
|
|
|
to->attr.bit.blink = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "25m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Reverse off
|
|
|
|
to->attr.bit.reverse = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "27m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Standout off
|
|
|
|
to->attr.bit.standout = false;
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "27m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Invisible off
|
|
|
|
to->attr.bit.invisible = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Protect off
|
|
|
|
to->attr.bit.protect = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Crossed out off
|
|
|
|
to->attr.bit.crossed_out = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Double underline off
|
|
|
|
to->attr.bit.dbl_underline = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Alternate character set off
|
|
|
|
to->attr.bit.alt_charset = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR("\017") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// PC character set off
|
|
|
|
to->attr.bit.pc_charset = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017" CSI "10m" CSI "36;22m" CSI "44;25m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Green text color
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Green;
|
2018-04-12 00:34:25 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR(CSI "32;22m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Default text color
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Default;
|
2018-04-12 00:34:25 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( printSequence(oa.changeAttribute(from, to)).c_str()
|
|
|
|
, C_STR("Esc [ 3 9 m ") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
delete to;
|
|
|
|
delete from;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FOptiAttrTest::cygwinTest()
|
|
|
|
{
|
|
|
|
// Simulate a CygWin terminal
|
|
|
|
|
|
|
|
linuxTest();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FOptiAttrTest::puttyTest()
|
|
|
|
{
|
|
|
|
// Simulate a putty-256color terminal
|
|
|
|
|
2018-09-20 23:59:01 +02:00
|
|
|
finalcut::FOptiAttr oa;
|
2018-04-12 00:34:25 +02:00
|
|
|
oa.unsetDefaultColorSupport(); // No ANSI default color
|
|
|
|
oa.setMaxColor (256);
|
2018-06-25 00:14:53 +02:00
|
|
|
oa.setNoColorVideo (0);
|
2018-04-12 00:34:25 +02:00
|
|
|
oa.set_enter_bold_mode (C_STR(CSI "1m"));
|
|
|
|
oa.set_exit_bold_mode (C_STR(CSI "22m"));
|
|
|
|
oa.set_enter_dim_mode (C_STR(CSI "2m"));
|
|
|
|
oa.set_exit_dim_mode (C_STR(CSI "22m"));
|
|
|
|
oa.set_enter_italics_mode (0);
|
|
|
|
oa.set_exit_italics_mode (0);
|
|
|
|
oa.set_enter_underline_mode (C_STR(CSI "4m"));
|
|
|
|
oa.set_exit_underline_mode (C_STR(CSI "24m"));
|
|
|
|
oa.set_enter_blink_mode (C_STR(CSI "5m"));
|
|
|
|
oa.set_exit_blink_mode (C_STR(CSI "25m"));
|
|
|
|
oa.set_enter_reverse_mode (C_STR(CSI "7m"));
|
|
|
|
oa.set_exit_reverse_mode (C_STR(CSI "27m"));
|
|
|
|
oa.set_enter_standout_mode (C_STR(CSI "7m"));
|
|
|
|
oa.set_exit_standout_mode (C_STR(CSI "27m"));
|
|
|
|
oa.set_enter_secure_mode (0);
|
|
|
|
oa.set_exit_secure_mode (C_STR(CSI "28m"));
|
|
|
|
oa.set_enter_protected_mode (0);
|
|
|
|
oa.set_exit_protected_mode (C_STR(CSI "0m"));
|
|
|
|
oa.set_enter_crossed_out_mode (C_STR(CSI "9m"));
|
|
|
|
oa.set_exit_crossed_out_mode (C_STR(CSI "29m"));
|
|
|
|
oa.set_enter_dbl_underline_mode (C_STR(CSI "21m"));
|
|
|
|
oa.set_exit_dbl_underline_mode (C_STR(CSI "24m"));
|
|
|
|
oa.set_set_attributes (C_STR(CSI "0"
|
|
|
|
"%?%p1%p6%|%t;1%;"
|
|
|
|
"%?%p5%t;2%;"
|
|
|
|
"%?%p2%t;4%;"
|
|
|
|
"%?%p1%p3%|%t;7%;"
|
|
|
|
"%?%p4%t;5%;m"
|
|
|
|
"%?%p9%t\016%e\017%;"));
|
|
|
|
oa.set_exit_attribute_mode (C_STR(CSI "0m"));
|
|
|
|
oa.set_enter_alt_charset_mode (C_STR("\016"));
|
|
|
|
oa.set_exit_alt_charset_mode (C_STR("\017"));
|
|
|
|
oa.set_enter_pc_charset_mode (C_STR(CSI "11m"));
|
|
|
|
oa.set_exit_pc_charset_mode (C_STR(CSI "10m"));
|
|
|
|
oa.set_a_foreground_color (C_STR(CSI "%?%p1%{8}%<"
|
|
|
|
"%t3%p1%d"
|
|
|
|
"%e%p1%{16}%<"
|
|
|
|
"%t9%p1%{8}%-%d"
|
|
|
|
"%e38;5;%p1%d%;m"));
|
|
|
|
oa.set_a_background_color (C_STR(CSI "%?%p1%{8}%<"
|
|
|
|
"%t4%p1%d"
|
|
|
|
"%e%p1%{16}%<"
|
|
|
|
"%t10%p1%{8}%-%d"
|
|
|
|
"%e48;5;%p1%d%;m"));
|
|
|
|
oa.set_foreground_color (0);
|
|
|
|
oa.set_background_color (0);
|
|
|
|
oa.set_term_color_pair (0);
|
|
|
|
oa.set_orig_pair (C_STR(CSI "39;49m"));
|
|
|
|
oa.set_orig_orig_colors (C_STR(OSC "R"));
|
|
|
|
oa.initialize();
|
|
|
|
|
|
|
|
|
2019-10-08 04:37:19 +02:00
|
|
|
finalcut::FChar* from = new finalcut::FChar();
|
|
|
|
finalcut::FChar* to = new finalcut::FChar();
|
2018-04-12 00:34:25 +02:00
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Default color + bold
|
2018-09-20 23:59:01 +02:00
|
|
|
from->fg_color = finalcut::fc::Default;
|
|
|
|
from->bg_color = finalcut::fc::Default;
|
2018-04-12 00:34:25 +02:00
|
|
|
to->attr.bit.bold = true;
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Default;
|
|
|
|
to->bg_color = finalcut::fc::Default;
|
2018-04-12 00:34:25 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;1m\017") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Blue text on white background + dim + italic
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Blue;
|
|
|
|
to->bg_color = finalcut::fc::White;
|
2018-04-12 00:34:25 +02:00
|
|
|
to->attr.bit.dim = true;
|
|
|
|
to->attr.bit.italic = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;1;2m\017"
|
|
|
|
CSI "34m" CSI "107m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Reset attributes + default background
|
|
|
|
to->attr.bit.bold = false;
|
|
|
|
to->attr.bit.dim = false;
|
|
|
|
to->attr.bit.italic = false;
|
2018-09-20 23:59:01 +02:00
|
|
|
to->bg_color = finalcut::fc::Default;
|
2018-04-12 00:34:25 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m" CSI "39;49m" CSI "34m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Red text on black background
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Red;
|
|
|
|
to->bg_color = finalcut::fc::Black;
|
2018-04-12 00:34:25 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "31m" CSI "40m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// 256 color text and background
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::SpringGreen3;
|
|
|
|
to->bg_color = finalcut::fc::NavyBlue;
|
2018-04-12 00:34:25 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "38;5;42m" CSI "48;5;17m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Bold on (with default colors)
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Default;
|
|
|
|
to->bg_color = finalcut::fc::Default;
|
2018-04-12 00:34:25 +02:00
|
|
|
to->attr.bit.bold = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;1m\017") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Bold off (with default colors)
|
|
|
|
to->attr.bit.bold = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Dim on (with default colors)
|
|
|
|
to->attr.bit.dim = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;2m\017") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Dim off (with default colors)
|
|
|
|
to->attr.bit.dim = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Italic on (with default colors)
|
|
|
|
to->attr.bit.italic = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Italic off (with default colors)
|
|
|
|
to->attr.bit.italic = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Underline on (with default colors)
|
|
|
|
to->attr.bit.underline = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;4m\017") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Underline off (with default colors)
|
|
|
|
to->attr.bit.underline = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Blink on (with default colors)
|
|
|
|
to->attr.bit.blink = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;5m\017") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Blink off (with default colors)
|
|
|
|
to->attr.bit.blink = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Reverse on (with default colors)
|
|
|
|
to->attr.bit.reverse = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;7m\017") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Reverse off (with default colors)
|
|
|
|
to->attr.bit.reverse = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Standout on (with default colors)
|
|
|
|
to->attr.bit.standout = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;1;7m\017") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Standout off (with default colors)
|
|
|
|
to->attr.bit.standout = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Invisible on (with default colors)
|
|
|
|
to->attr.bit.invisible = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017") );
|
2019-01-03 08:31:48 +01:00
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
2019-10-08 04:50:43 +02:00
|
|
|
CPPUNIT_ASSERT ( to->encoded_char == ' ' );
|
2018-04-12 00:34:25 +02:00
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Invisible off (with default colors)
|
|
|
|
to->attr.bit.invisible = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Protect on (with default colors)
|
|
|
|
to->attr.bit.protect = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Protect off (with default colors)
|
|
|
|
to->attr.bit.protect = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Crossed out on (with default colors)
|
|
|
|
to->attr.bit.crossed_out = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017" CSI "9m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Crossed out off (with default colors)
|
|
|
|
to->attr.bit.crossed_out = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Double underline on (with default colors)
|
|
|
|
to->attr.bit.dbl_underline = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017" CSI "21m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Double underline off (with default colors)
|
|
|
|
to->attr.bit.dbl_underline = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Alternate character set on (with default colors)
|
|
|
|
to->attr.bit.alt_charset = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\016") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Alternate character set off (with default colors)
|
|
|
|
to->attr.bit.alt_charset = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR("\017" CSI "0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// PC character set on (with default colors)
|
|
|
|
to->attr.bit.pc_charset = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017" CSI "11m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// PC character set off (with default colors)
|
|
|
|
to->attr.bit.pc_charset = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m" CSI "10m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Turn on all attributes (with default colors)
|
|
|
|
to->attr.bit.pc_charset = true;
|
|
|
|
to->attr.bit.bold = true;
|
|
|
|
to->attr.bit.dim = true;
|
|
|
|
to->attr.bit.italic = true;
|
|
|
|
to->attr.bit.underline = true;
|
|
|
|
to->attr.bit.blink = true;
|
|
|
|
to->attr.bit.reverse = true;
|
|
|
|
to->attr.bit.standout = true;
|
|
|
|
to->attr.bit.invisible = true;
|
|
|
|
to->attr.bit.protect = true;
|
|
|
|
to->attr.bit.crossed_out = true;
|
|
|
|
to->attr.bit.dbl_underline = true;
|
|
|
|
to->attr.bit.alt_charset = true;
|
|
|
|
to->attr.bit.pc_charset = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(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 );
|
|
|
|
|
|
|
|
// Cyan text on blue background
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Cyan;
|
|
|
|
to->bg_color = finalcut::fc::Blue;
|
2018-04-12 00:34:25 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "36m" CSI "44m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Bold off
|
|
|
|
to->attr.bit.bold = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "22m" CSI "2m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Dim off
|
|
|
|
to->attr.bit.dim = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "22m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Italic off
|
|
|
|
to->attr.bit.italic = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Underline off
|
|
|
|
to->attr.bit.underline = false;
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "24m" CSI "21m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
|
|
|
|
// Blink off
|
|
|
|
to->attr.bit.blink = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "25m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Reverse off
|
|
|
|
to->attr.bit.reverse = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "27m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Standout off
|
|
|
|
to->attr.bit.standout = false;
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "27m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Invisible off
|
|
|
|
to->attr.bit.invisible = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "28m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Protect off
|
|
|
|
to->attr.bit.protect = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m" CSI "36m" CSI "44m" "\016"
|
|
|
|
CSI "11m" CSI "9m" CSI "21m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Crossed out off
|
|
|
|
to->attr.bit.crossed_out = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "29m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Double underline off
|
|
|
|
to->attr.bit.dbl_underline = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "24m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Alternate character set off
|
|
|
|
to->attr.bit.alt_charset = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR("\017") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// PC character set off
|
|
|
|
to->attr.bit.pc_charset = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m" CSI "10m" CSI "36m" CSI "44m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Green text color
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Green;
|
2018-04-12 00:34:25 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR(CSI "32m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Default text color
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Default;
|
2018-04-12 00:34:25 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( printSequence(oa.changeAttribute(from, to)).c_str()
|
|
|
|
, C_STR("Esc [ 3 9 ; 4 9 m Esc [ 4 4 m ") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
delete to;
|
|
|
|
delete from;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FOptiAttrTest::teratermTest()
|
|
|
|
{
|
|
|
|
// Simulate a Tera Term terminal
|
|
|
|
|
2018-09-20 23:59:01 +02:00
|
|
|
finalcut::FOptiAttr oa;
|
2018-04-12 00:34:25 +02:00
|
|
|
oa.unsetDefaultColorSupport(); // No ANSI default color
|
|
|
|
oa.setMaxColor (16);
|
2018-06-25 00:14:53 +02:00
|
|
|
oa.setNoColorVideo (41); // Avoid standout (1) + blink (8) + bold (32)
|
2018-04-12 00:34:25 +02:00
|
|
|
oa.set_enter_bold_mode (C_STR(CSI "1m"));
|
|
|
|
oa.set_exit_bold_mode (C_STR(CSI "22m"));
|
|
|
|
oa.set_enter_dim_mode (0);
|
|
|
|
oa.set_exit_dim_mode (C_STR(CSI "22m"));
|
|
|
|
oa.set_enter_italics_mode (0);
|
|
|
|
oa.set_exit_italics_mode (0);
|
|
|
|
oa.set_enter_underline_mode (C_STR(CSI "4m"));
|
|
|
|
oa.set_exit_underline_mode (C_STR(CSI "24m"));
|
|
|
|
oa.set_enter_blink_mode (C_STR(CSI "5m"));
|
|
|
|
oa.set_exit_blink_mode (C_STR(CSI "25m"));
|
|
|
|
oa.set_enter_reverse_mode (C_STR(CSI "7m"));
|
|
|
|
oa.set_exit_reverse_mode (C_STR(CSI "27m"));
|
|
|
|
oa.set_enter_standout_mode (C_STR(CSI "7m"));
|
|
|
|
oa.set_exit_standout_mode (C_STR(CSI "27m"));
|
|
|
|
oa.set_enter_secure_mode (0);
|
|
|
|
oa.set_exit_secure_mode (C_STR(CSI "28m"));
|
|
|
|
oa.set_enter_protected_mode (0);
|
|
|
|
oa.set_exit_protected_mode (C_STR(CSI "0m$<2>"));
|
|
|
|
oa.set_enter_crossed_out_mode (C_STR(CSI "9m"));
|
|
|
|
oa.set_exit_crossed_out_mode (C_STR(CSI "29m"));
|
|
|
|
oa.set_enter_dbl_underline_mode (C_STR(CSI "21m"));
|
|
|
|
oa.set_exit_dbl_underline_mode (C_STR(CSI "24m"));
|
|
|
|
oa.set_set_attributes (C_STR(CSI "0"
|
|
|
|
"%?%p1%p6%|%t;1%;"
|
|
|
|
"%?%p2%t;4%;"
|
|
|
|
"%?%p1%p3%|%t;7%;"
|
|
|
|
"%?%p4%t;5%;m"
|
|
|
|
"%?%p9%t\016%e\017%;$<2>"));
|
|
|
|
oa.set_exit_attribute_mode (C_STR(CSI "0m$<2>"));
|
|
|
|
oa.set_enter_alt_charset_mode (C_STR("\016"));
|
|
|
|
oa.set_exit_alt_charset_mode (C_STR("\017"));
|
|
|
|
oa.set_enter_pc_charset_mode (0);
|
|
|
|
oa.set_exit_pc_charset_mode (0);
|
|
|
|
oa.set_a_foreground_color (C_STR(CSI "38;5;%p1%dm"));
|
|
|
|
oa.set_a_background_color (C_STR(CSI "48;5;%p1%dm"));
|
|
|
|
oa.set_foreground_color (0);
|
|
|
|
oa.set_background_color (0);
|
|
|
|
oa.set_term_color_pair (0);
|
|
|
|
oa.set_orig_pair (C_STR(CSI "39;49m"));
|
|
|
|
oa.set_orig_orig_colors (0);
|
|
|
|
oa.initialize();
|
|
|
|
|
|
|
|
|
2019-10-08 04:37:19 +02:00
|
|
|
finalcut::FChar* from = new finalcut::FChar();
|
|
|
|
finalcut::FChar* to = new finalcut::FChar();
|
2018-04-12 00:34:25 +02:00
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Default color + bold
|
2018-09-20 23:59:01 +02:00
|
|
|
from->fg_color = finalcut::fc::Default;
|
|
|
|
from->bg_color = finalcut::fc::Default;
|
2018-04-12 00:34:25 +02:00
|
|
|
to->attr.bit.bold = true;
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Default;
|
|
|
|
to->bg_color = finalcut::fc::Default;
|
2018-04-12 00:34:25 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;1m\017$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Blue text on white background + dim + italic
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Blue;
|
|
|
|
to->bg_color = finalcut::fc::White;
|
2018-04-12 00:34:25 +02:00
|
|
|
to->attr.bit.dim = true;
|
|
|
|
to->attr.bit.italic = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017$<2>" CSI "38;5;4m"
|
|
|
|
CSI "48;5;15m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Reset attributes + default background
|
|
|
|
to->attr.bit.bold = false;
|
|
|
|
to->attr.bit.dim = false;
|
|
|
|
to->attr.bit.italic = false;
|
2018-09-20 23:59:01 +02:00
|
|
|
to->bg_color = finalcut::fc::Default;
|
2018-04-12 00:34:25 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m$<2>" CSI "39;49m"
|
|
|
|
CSI "38;5;4m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Red text on black background
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Red;
|
|
|
|
to->bg_color = finalcut::fc::Black;
|
2018-04-12 00:34:25 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "38;5;1m" CSI "48;5;0m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// 256 color text and background
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::SpringGreen3;
|
|
|
|
to->bg_color = finalcut::fc::NavyBlue;
|
2018-04-12 00:34:25 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "38;5;10m" CSI "48;5;4m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Bold on (with default colors)
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Default;
|
|
|
|
to->bg_color = finalcut::fc::Default;
|
2018-04-12 00:34:25 +02:00
|
|
|
to->attr.bit.bold = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;1m\017$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Bold off (with default colors)
|
|
|
|
to->attr.bit.bold = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Dim on (with default colors)
|
|
|
|
to->attr.bit.dim = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Dim off (with default colors)
|
|
|
|
to->attr.bit.dim = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Italic on (with default colors)
|
|
|
|
to->attr.bit.italic = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Italic off (with default colors)
|
|
|
|
to->attr.bit.italic = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Underline on (with default colors)
|
|
|
|
to->attr.bit.underline = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;4m\017$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Underline off (with default colors)
|
|
|
|
to->attr.bit.underline = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Blink on (with default colors)
|
|
|
|
to->attr.bit.blink = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;5m\017$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Blink off (with default colors)
|
|
|
|
to->attr.bit.blink = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Reverse on (with default colors)
|
|
|
|
to->attr.bit.reverse = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;7m\017$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Reverse off (with default colors)
|
|
|
|
to->attr.bit.reverse = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Standout on (with default colors)
|
|
|
|
to->attr.bit.standout = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;1;7m\017$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Standout off (with default colors)
|
|
|
|
to->attr.bit.standout = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Invisible on (with default colors)
|
|
|
|
to->attr.bit.invisible = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017$<2>") );
|
2019-01-03 08:31:48 +01:00
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
2019-10-08 04:50:43 +02:00
|
|
|
CPPUNIT_ASSERT ( to->encoded_char == ' ' );
|
2018-04-12 00:34:25 +02:00
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Invisible off (with default colors)
|
|
|
|
to->attr.bit.invisible = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Protect on (with default colors)
|
|
|
|
to->attr.bit.protect = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Protect off (with default colors)
|
|
|
|
to->attr.bit.protect = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Crossed out on (with default colors)
|
|
|
|
to->attr.bit.crossed_out = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017$<2>" CSI "9m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Crossed out off (with default colors)
|
|
|
|
to->attr.bit.crossed_out = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Double underline on (with default colors)
|
|
|
|
to->attr.bit.dbl_underline = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017$<2>" CSI "21m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Double underline off (with default colors)
|
|
|
|
to->attr.bit.dbl_underline = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Alternate character set on (with default colors)
|
|
|
|
to->attr.bit.alt_charset = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\016$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Alternate character set off (with default colors)
|
|
|
|
to->attr.bit.alt_charset = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR("\017" CSI "0m$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// PC character set on (with default colors)
|
|
|
|
to->attr.bit.pc_charset = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m\017$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// PC character set off (with default colors)
|
|
|
|
to->attr.bit.pc_charset = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m$<2>") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Turn on all attributes (with default colors)
|
|
|
|
to->attr.bit.pc_charset = true;
|
|
|
|
to->attr.bit.bold = true;
|
|
|
|
to->attr.bit.dim = true;
|
|
|
|
to->attr.bit.italic = true;
|
|
|
|
to->attr.bit.underline = true;
|
|
|
|
to->attr.bit.blink = true;
|
|
|
|
to->attr.bit.reverse = true;
|
|
|
|
to->attr.bit.standout = true;
|
|
|
|
to->attr.bit.invisible = true;
|
|
|
|
to->attr.bit.protect = true;
|
|
|
|
to->attr.bit.crossed_out = true;
|
|
|
|
to->attr.bit.dbl_underline = true;
|
|
|
|
to->attr.bit.alt_charset = true;
|
|
|
|
to->attr.bit.pc_charset = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0;1;4;7;5m\016$<2>"
|
|
|
|
CSI "9m" CSI "21m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Cyan text on blue background
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Cyan;
|
|
|
|
to->bg_color = finalcut::fc::Blue;
|
2018-04-12 00:34:25 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "38;5;6m" CSI "48;5;4m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Bold off
|
|
|
|
to->attr.bit.bold = false;
|
|
|
|
CPPUNIT_ASSERT ( *from == *to ); // because of noColorVideo = 41
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Dim off
|
|
|
|
to->attr.bit.dim = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "22m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Italic off
|
|
|
|
to->attr.bit.italic = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Underline off
|
|
|
|
to->attr.bit.underline = false;
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "24m" CSI "21m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Blink off
|
|
|
|
to->attr.bit.blink = false;
|
|
|
|
CPPUNIT_ASSERT ( *from == *to ); // because of noColorVideo = 41
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Reverse off
|
|
|
|
to->attr.bit.reverse = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "27m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Standout off
|
|
|
|
to->attr.bit.standout = false;
|
|
|
|
CPPUNIT_ASSERT ( *from == *to ); // because of noColorVideo = 41
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Invisible off
|
|
|
|
to->attr.bit.invisible = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "28m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Protect off
|
|
|
|
to->attr.bit.protect = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(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 );
|
|
|
|
|
|
|
|
// Crossed out off
|
|
|
|
to->attr.bit.crossed_out = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "29m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Double underline off
|
|
|
|
to->attr.bit.dbl_underline = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "24m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Alternate character set off
|
|
|
|
to->attr.bit.alt_charset = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR("\017") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// PC character set off
|
|
|
|
to->attr.bit.pc_charset = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "0m$<2>" CSI "38;5;6m"
|
|
|
|
CSI "48;5;4m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Green text color
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Green;
|
2018-04-12 00:34:25 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR(CSI "38;5;2m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Default text color
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Default;
|
2018-04-12 00:34:25 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( printSequence(oa.changeAttribute(from, to)).c_str()
|
|
|
|
, 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 );
|
2018-04-13 00:08:03 +02:00
|
|
|
|
|
|
|
delete to;
|
|
|
|
delete from;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FOptiAttrTest::ibmColorTest()
|
|
|
|
{
|
|
|
|
// Simulate IBM color definitions
|
|
|
|
|
2018-09-20 23:59:01 +02:00
|
|
|
finalcut::FOptiAttr oa;
|
2018-04-13 00:08:03 +02:00
|
|
|
oa.unsetDefaultColorSupport(); // No ANSI default color
|
|
|
|
oa.setMaxColor (8);
|
2018-06-25 00:14:53 +02:00
|
|
|
oa.setNoColorVideo (3); // Avoid standout (1) + underline mode (2)
|
2018-04-13 00:08:03 +02:00
|
|
|
oa.set_enter_bold_mode (0);
|
|
|
|
oa.set_exit_bold_mode (0);
|
|
|
|
oa.set_enter_dim_mode (0);
|
|
|
|
oa.set_exit_dim_mode (0);
|
|
|
|
oa.set_enter_italics_mode (0);
|
|
|
|
oa.set_exit_italics_mode (0);
|
|
|
|
oa.set_enter_underline_mode (0);
|
|
|
|
oa.set_exit_underline_mode (0);
|
|
|
|
oa.set_enter_blink_mode (0);
|
|
|
|
oa.set_exit_blink_mode (0);
|
|
|
|
oa.set_enter_reverse_mode (0);
|
|
|
|
oa.set_exit_reverse_mode (0);
|
|
|
|
oa.set_enter_standout_mode (0);
|
|
|
|
oa.set_exit_standout_mode (0);
|
|
|
|
oa.set_enter_secure_mode (0);
|
|
|
|
oa.set_exit_secure_mode (0);
|
|
|
|
oa.set_enter_protected_mode (0);
|
|
|
|
oa.set_exit_protected_mode (0);
|
|
|
|
oa.set_enter_crossed_out_mode (0);
|
|
|
|
oa.set_exit_crossed_out_mode (0);
|
|
|
|
oa.set_enter_dbl_underline_mode (0);
|
|
|
|
oa.set_exit_dbl_underline_mode (0);
|
|
|
|
oa.set_set_attributes (0);
|
|
|
|
oa.set_exit_attribute_mode (0);
|
|
|
|
oa.set_enter_alt_charset_mode (0);
|
|
|
|
oa.set_exit_alt_charset_mode (0);
|
|
|
|
oa.set_enter_pc_charset_mode (0);
|
|
|
|
oa.set_exit_pc_charset_mode (0);
|
|
|
|
oa.set_a_foreground_color (0);
|
|
|
|
oa.set_a_background_color (0);
|
|
|
|
oa.set_foreground_color (C_STR(CSI "%?%p1%{0}%=%t30m"
|
|
|
|
"%e%p1%{1}%=%t31m"
|
|
|
|
"%e%p1%{2}%=%t32m"
|
|
|
|
"%e%p1%{3}%=%t33m"
|
|
|
|
"%e%p1%{4}%=%t34m"
|
|
|
|
"%e%p1%{5}%=%t35m"
|
|
|
|
"%e%p1%{6}%=%t36m"
|
|
|
|
"%e%p1%{7}%=%t97m%;"));
|
|
|
|
oa.set_background_color (C_STR(CSI "%?%p1%{0}%=%t40m"
|
|
|
|
"%e%p1%{1}%=%t41m"
|
|
|
|
"%e%p1%{2}%=%t42m"
|
|
|
|
"%e%p1%{3}%=%t43m"
|
|
|
|
"%e%p1%{4}%=%t44m"
|
|
|
|
"%e%p1%{5}%=%t45m"
|
|
|
|
"%e%p1%{6}%=%t46m"
|
|
|
|
"%e%p1%{7}%=%t107m%;"));
|
|
|
|
oa.set_term_color_pair (0);
|
|
|
|
oa.set_orig_pair (C_STR(CSI "32;40m"));
|
|
|
|
oa.set_orig_orig_colors (0);
|
|
|
|
oa.initialize();
|
|
|
|
|
|
|
|
|
2019-10-08 04:37:19 +02:00
|
|
|
finalcut::FChar* from = new finalcut::FChar();
|
|
|
|
finalcut::FChar* to = new finalcut::FChar();
|
2018-04-13 00:08:03 +02:00
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Default color + bold
|
2018-09-20 23:59:01 +02:00
|
|
|
from->fg_color = finalcut::fc::Default;
|
|
|
|
from->bg_color = finalcut::fc::Default;
|
2018-04-13 00:08:03 +02:00
|
|
|
to->attr.bit.bold = true;
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Default;
|
|
|
|
to->bg_color = finalcut::fc::Default;
|
2018-04-13 00:08:03 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Blue text on white background + dim + italic
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Blue;
|
|
|
|
to->bg_color = finalcut::fc::White;
|
2018-04-13 00:08:03 +02:00
|
|
|
to->attr.bit.dim = true;
|
|
|
|
to->attr.bit.italic = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "31m" CSI "107m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Reset attributes + default background
|
|
|
|
to->attr.bit.bold = false;
|
|
|
|
to->attr.bit.dim = false;
|
|
|
|
to->attr.bit.italic = false;
|
2018-09-20 23:59:01 +02:00
|
|
|
to->bg_color = finalcut::fc::Default;
|
2018-04-13 00:08:03 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "32;40m" CSI "31m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Red text on black background
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Red;
|
|
|
|
to->bg_color = finalcut::fc::Black;
|
2018-04-13 00:08:03 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "34m" CSI "40m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// 256 color text and background
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::SpringGreen3;
|
|
|
|
to->bg_color = finalcut::fc::NavyBlue;
|
2018-04-13 00:08:03 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "32m" CSI "41m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Bold on (with default colors)
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Default;
|
|
|
|
to->bg_color = finalcut::fc::Default;
|
2018-04-13 00:08:03 +02:00
|
|
|
to->attr.bit.bold = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "32;40m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Bold off (with default colors)
|
|
|
|
to->attr.bit.bold = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Dim on (with default colors)
|
|
|
|
to->attr.bit.dim = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Dim off (with default colors)
|
|
|
|
to->attr.bit.dim = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Italic on (with default colors)
|
|
|
|
to->attr.bit.italic = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Italic off (with default colors)
|
|
|
|
to->attr.bit.italic = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Underline on (with default colors)
|
|
|
|
to->attr.bit.underline = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Underline off (with default colors)
|
|
|
|
to->attr.bit.underline = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Blink on (with default colors)
|
|
|
|
to->attr.bit.blink = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Blink off (with default colors)
|
|
|
|
to->attr.bit.blink = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Reverse on (with default colors)
|
|
|
|
to->attr.bit.reverse = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Reverse off (with default colors)
|
|
|
|
to->attr.bit.reverse = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Standout on (with default colors)
|
|
|
|
to->attr.bit.standout = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Standout off (with default colors)
|
|
|
|
to->attr.bit.standout = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Invisible on (with default colors)
|
|
|
|
to->attr.bit.invisible = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
2019-01-03 08:31:48 +01:00
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
2019-10-08 04:50:43 +02:00
|
|
|
CPPUNIT_ASSERT ( to->encoded_char == ' ' );
|
2018-04-13 00:08:03 +02:00
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Invisible off (with default colors)
|
|
|
|
to->attr.bit.invisible = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Protect on (with default colors)
|
|
|
|
to->attr.bit.protect = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Protect off (with default colors)
|
|
|
|
to->attr.bit.protect = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Crossed out on (with default colors)
|
|
|
|
to->attr.bit.crossed_out = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Crossed out off (with default colors)
|
|
|
|
to->attr.bit.crossed_out = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Double underline on (with default colors)
|
|
|
|
to->attr.bit.dbl_underline = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Double underline off (with default colors)
|
|
|
|
to->attr.bit.dbl_underline = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Alternate character set on (with default colors)
|
|
|
|
to->attr.bit.alt_charset = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Alternate character set off (with default colors)
|
|
|
|
to->attr.bit.alt_charset = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// PC character set on (with default colors)
|
|
|
|
to->attr.bit.pc_charset = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// PC character set off (with default colors)
|
|
|
|
to->attr.bit.pc_charset = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Turn on all attributes (with default colors)
|
|
|
|
to->attr.bit.pc_charset = true;
|
|
|
|
to->attr.bit.bold = true;
|
|
|
|
to->attr.bit.dim = true;
|
|
|
|
to->attr.bit.italic = true;
|
|
|
|
to->attr.bit.underline = true;
|
|
|
|
to->attr.bit.blink = true;
|
|
|
|
to->attr.bit.reverse = true;
|
|
|
|
to->attr.bit.standout = true;
|
|
|
|
to->attr.bit.invisible = true;
|
|
|
|
to->attr.bit.protect = true;
|
|
|
|
to->attr.bit.crossed_out = true;
|
|
|
|
to->attr.bit.dbl_underline = true;
|
|
|
|
to->attr.bit.alt_charset = true;
|
|
|
|
to->attr.bit.pc_charset = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Cyan text on blue background
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Cyan;
|
|
|
|
to->bg_color = finalcut::fc::Blue;
|
2018-04-13 00:08:03 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "33m" CSI "41m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Bold off
|
|
|
|
to->attr.bit.bold = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Dim off
|
|
|
|
to->attr.bit.dim = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Italic off
|
|
|
|
to->attr.bit.italic = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Underline off
|
|
|
|
to->attr.bit.underline = false;
|
|
|
|
CPPUNIT_ASSERT ( *from == *to ); // because of noColorVideo = 3
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Blink off
|
|
|
|
to->attr.bit.blink = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Reverse off
|
|
|
|
to->attr.bit.reverse = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Standout off
|
|
|
|
to->attr.bit.standout = false;
|
|
|
|
CPPUNIT_ASSERT ( *from == *to ); // because of noColorVideo = 3
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Invisible off
|
|
|
|
to->attr.bit.invisible = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Protect off
|
|
|
|
to->attr.bit.protect = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Crossed out off
|
|
|
|
to->attr.bit.crossed_out = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Double underline off
|
|
|
|
to->attr.bit.dbl_underline = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Alternate character set off
|
|
|
|
to->attr.bit.alt_charset = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// PC character set off
|
|
|
|
to->attr.bit.pc_charset = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Green text color
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Green;
|
2018-04-13 00:08:03 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(CSI "32m") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Default text color
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Default;
|
2018-04-13 00:08:03 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( printSequence(oa.changeAttribute(from, to)).c_str()
|
|
|
|
, C_STR("Esc [ 3 2 ; 4 0 m Esc [ 4 1 m ") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
2018-04-05 01:27:03 +02:00
|
|
|
|
|
|
|
delete to;
|
|
|
|
delete from;
|
|
|
|
}
|
|
|
|
|
2018-04-15 19:55:50 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FOptiAttrTest::wyse50Test()
|
|
|
|
{
|
|
|
|
// Simulate an Wyse-50 terminal
|
|
|
|
|
2018-09-20 23:59:01 +02:00
|
|
|
finalcut::FOptiAttr oa;
|
|
|
|
finalcut::FOptiAttr::termEnv optiattr_env =
|
2018-06-25 00:14:53 +02:00
|
|
|
{
|
|
|
|
0, // Enter bold
|
|
|
|
C_STR(ESC "(" ESC "H\003"
|
|
|
|
ESC "G0" ESC "cD"), // Exit bold
|
|
|
|
C_STR(ESC "Gp"), // Enter dim
|
|
|
|
C_STR(ESC "(" ESC "H\003"
|
|
|
|
ESC "G0" ESC "cD"), // Exit dim
|
|
|
|
0, // Enter italics
|
|
|
|
0, // Exit italics
|
|
|
|
C_STR(ESC "G8"), // Enter underline
|
|
|
|
C_STR(ESC "G0"), // Exit underline
|
|
|
|
C_STR(ESC "G2"), // Enter blink
|
|
|
|
C_STR(ESC "(" ESC "H\003"
|
|
|
|
ESC "G0" ESC "cD"), // Exit blink
|
|
|
|
C_STR(ESC "G2"), // Enter reverse
|
|
|
|
C_STR(ESC "(" ESC "H\003"
|
|
|
|
ESC "G0" ESC "cD"), // Exit reverse
|
|
|
|
C_STR(ESC "Gt"), // Enter standout
|
|
|
|
C_STR(ESC "G0"), // Exit standout
|
|
|
|
C_STR(ESC "G1"), // Enter secure
|
|
|
|
C_STR(ESC "(" ESC "H\003"
|
|
|
|
ESC "G0" ESC "cD"), // Exit secure
|
|
|
|
C_STR(ESC ")"), // Enter protected
|
|
|
|
C_STR(ESC "(" ESC "H\003"
|
|
|
|
ESC "G0" ESC "cD"), // Exit protected
|
|
|
|
0, // Enter crossed out
|
|
|
|
C_STR(ESC "(" ESC "H\003"
|
|
|
|
ESC "G0" ESC "cD"), // Exit crossed out
|
|
|
|
0, // Enter double underline
|
|
|
|
0, // Exit double underline
|
2018-07-23 01:48:29 +02:00
|
|
|
C_STR("%?%p8%t\033)%e\033(%;"
|
|
|
|
"%?%p9%t\033cE%e\033cD%;\033G%'0'"
|
2018-06-25 00:14:53 +02:00
|
|
|
"%?%p2%t%{8}%|%;"
|
|
|
|
"%?%p1%p3%|%p6%|%t%{4}%|%;"
|
|
|
|
"%?%p4%t%{2}%|%;"
|
|
|
|
"%?%p1%p5%|%t%'@'%|%;"
|
|
|
|
"%?%p7%t%{1}%|%;%c"), // Set attributes
|
|
|
|
C_STR(ESC "(" ESC "H\003"
|
|
|
|
ESC "G0" ESC "cD"), // Exit attribute
|
|
|
|
C_STR(ESC "cE"), // Enter alt charset
|
|
|
|
C_STR(ESC "cD"), // Exit alt charset
|
|
|
|
0, // Enter pc charset
|
|
|
|
0, // Exit pc charset
|
|
|
|
0, // Ansi foreground color
|
|
|
|
0, // Ansi background color
|
|
|
|
0, // Foreground color
|
|
|
|
0, // Background color
|
|
|
|
0, // Term color pair
|
|
|
|
0, // Orig pair
|
2019-09-08 02:04:24 +02:00
|
|
|
0, // Orig orig colors
|
|
|
|
1, // Max color
|
|
|
|
0, // No color video
|
|
|
|
false // No ANSI default color
|
2018-06-25 00:14:53 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
oa.setTermEnvironment(optiattr_env);
|
|
|
|
|
2019-10-08 04:37:19 +02:00
|
|
|
finalcut::FChar* from = new finalcut::FChar();
|
|
|
|
finalcut::FChar* to = new finalcut::FChar();
|
2018-04-15 19:55:50 +02:00
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Default color + bold
|
2018-09-20 23:59:01 +02:00
|
|
|
from->fg_color = finalcut::fc::Default;
|
|
|
|
from->bg_color = finalcut::fc::Default;
|
2018-04-15 19:55:50 +02:00
|
|
|
to->attr.bit.bold = true;
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Default;
|
|
|
|
to->bg_color = finalcut::fc::Default;
|
2018-04-15 19:55:50 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(" ESC "cD" ESC "G4") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Blue text on white background + dim + italic
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Blue;
|
|
|
|
to->bg_color = finalcut::fc::White;
|
2018-04-15 19:55:50 +02:00
|
|
|
to->attr.bit.dim = true;
|
|
|
|
to->attr.bit.italic = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(" ESC "cD" ESC "Gt") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Reset attributes + default background
|
|
|
|
to->attr.bit.bold = false;
|
|
|
|
to->attr.bit.dim = false;
|
|
|
|
to->attr.bit.italic = false;
|
2018-09-20 23:59:01 +02:00
|
|
|
to->bg_color = finalcut::fc::Default;
|
2018-04-15 19:55:50 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(" ESC "H\003" ESC "G0" ESC "cD") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Red text on black background
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Red;
|
|
|
|
to->bg_color = finalcut::fc::Black;
|
2018-04-15 19:55:50 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// 256 color text and background
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::SpringGreen3;
|
|
|
|
to->bg_color = finalcut::fc::NavyBlue;
|
2018-04-15 19:55:50 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Bold on (with default colors)
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Default;
|
|
|
|
to->bg_color = finalcut::fc::Default;
|
2018-04-15 19:55:50 +02:00
|
|
|
to->attr.bit.bold = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(" ESC "cD" ESC "G4") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Bold off (with default colors)
|
|
|
|
to->attr.bit.bold = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(" ESC "H\003" ESC "G0" ESC "cD") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Dim on (with default colors)
|
|
|
|
to->attr.bit.dim = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(" ESC "cD" ESC "Gp") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Dim off (with default colors)
|
|
|
|
to->attr.bit.dim = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(" ESC "H\003" ESC "G0" ESC "cD") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Italic on (with default colors)
|
|
|
|
to->attr.bit.italic = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(" ESC "cD" ESC "G0") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Italic off (with default colors)
|
|
|
|
to->attr.bit.italic = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(" ESC "H\003" ESC "G0" ESC "cD") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Underline on (with default colors)
|
|
|
|
to->attr.bit.underline = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(" ESC "cD" ESC "G8") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Underline off (with default colors)
|
|
|
|
to->attr.bit.underline = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(" ESC "H\003" ESC "G0" ESC "cD") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Blink on (with default colors)
|
|
|
|
to->attr.bit.blink = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(" ESC "cD" ESC "G2") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Blink off (with default colors)
|
|
|
|
to->attr.bit.blink = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(" ESC "H\003" ESC "G0" ESC "cD") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Reverse on (with default colors)
|
|
|
|
to->attr.bit.reverse = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(" ESC "cD" ESC "G4") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Reverse off (with default colors)
|
|
|
|
to->attr.bit.reverse = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(" ESC "H\003" ESC "G0" ESC "cD") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Standout on (with default colors)
|
|
|
|
to->attr.bit.standout = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(" ESC "cD" ESC "Gt") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Standout off (with default colors)
|
|
|
|
to->attr.bit.standout = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(" ESC "H\003" ESC "G0" ESC "cD") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Invisible on (with default colors)
|
|
|
|
to->attr.bit.invisible = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(" ESC "cD" ESC "G1") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Invisible off (with default colors)
|
|
|
|
to->attr.bit.invisible = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(" ESC "H\003" ESC "G0" ESC "cD") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Protect on (with default colors)
|
|
|
|
to->attr.bit.protect = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC ")" ESC "cD" ESC "G0") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Protect off (with default colors)
|
|
|
|
to->attr.bit.protect = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(" ESC "H\003" ESC "G0" ESC "cD") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Crossed out on (with default colors)
|
|
|
|
to->attr.bit.crossed_out = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(" ESC "cD" ESC "G0") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Crossed out off (with default colors)
|
|
|
|
to->attr.bit.crossed_out = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(" ESC "H\003" ESC "G0" ESC "cD") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Double underline on (with default colors)
|
|
|
|
to->attr.bit.dbl_underline = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(" ESC "cD" ESC "G0") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Double underline off (with default colors)
|
|
|
|
to->attr.bit.dbl_underline = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(" ESC "H\003" ESC "G0" ESC "cD") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Alternate character set on (with default colors)
|
|
|
|
to->attr.bit.alt_charset = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(" ESC "cE" ESC "G0") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Alternate character set off (with default colors)
|
|
|
|
to->attr.bit.alt_charset = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "cD" ESC "(" ESC "H\003" ESC "G0"
|
|
|
|
ESC "cD") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// PC character set on (with default colors)
|
|
|
|
to->attr.bit.pc_charset = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(" ESC "cD" ESC "G0") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// PC character set off (with default colors)
|
|
|
|
to->attr.bit.pc_charset = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(" ESC "H\003" ESC "G0" ESC "cD") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Turn on all attributes (with default colors)
|
|
|
|
to->attr.bit.pc_charset = true;
|
|
|
|
to->attr.bit.bold = true;
|
|
|
|
to->attr.bit.dim = true;
|
|
|
|
to->attr.bit.italic = true;
|
|
|
|
to->attr.bit.underline = true;
|
|
|
|
to->attr.bit.blink = true;
|
|
|
|
to->attr.bit.reverse = true;
|
|
|
|
to->attr.bit.standout = true;
|
|
|
|
to->attr.bit.invisible = true;
|
|
|
|
to->attr.bit.protect = true;
|
|
|
|
to->attr.bit.crossed_out = true;
|
|
|
|
to->attr.bit.dbl_underline = true;
|
|
|
|
to->attr.bit.alt_charset = true;
|
|
|
|
to->attr.bit.pc_charset = true;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC ")" ESC "cE" ESC "G\177") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Cyan text on blue background
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Cyan;
|
|
|
|
to->bg_color = finalcut::fc::Blue;
|
2018-04-15 19:55:50 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Bold off
|
|
|
|
to->attr.bit.bold = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(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 );
|
|
|
|
|
|
|
|
// Dim off
|
|
|
|
to->attr.bit.dim = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(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 );
|
|
|
|
|
|
|
|
// Italic off
|
|
|
|
to->attr.bit.italic = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Underline off
|
|
|
|
to->attr.bit.underline = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "G0" ESC "cE" ESC "G2" ESC "G2"
|
|
|
|
ESC "Gt" ESC "G1" ESC ")" ) );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Blink off
|
|
|
|
to->attr.bit.blink = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(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 );
|
|
|
|
|
|
|
|
// Reverse off
|
|
|
|
to->attr.bit.reverse = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(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 );
|
|
|
|
|
|
|
|
// Standout off
|
|
|
|
to->attr.bit.standout = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "G0" ESC "cE" ESC "G1" ESC ")") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Invisible off
|
|
|
|
to->attr.bit.invisible = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(" ESC "H\003" ESC "G0" ESC "cD"
|
|
|
|
ESC "cE" ESC ")" ) );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Protect off
|
|
|
|
to->attr.bit.protect = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(" ESC "H\003" ESC "G0" ESC "cD"
|
|
|
|
ESC "cE") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Crossed out off
|
|
|
|
to->attr.bit.crossed_out = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(" ESC "H\003" ESC "G0" ESC "cD"
|
|
|
|
ESC "cE") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Double underline off
|
|
|
|
to->attr.bit.dbl_underline = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Alternate character set off
|
|
|
|
to->attr.bit.alt_charset = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR(ESC "cD") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// PC character set off
|
|
|
|
to->attr.bit.pc_charset = false;
|
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to)
|
|
|
|
, C_STR(ESC "(" ESC "H\003" ESC "G0" ESC "cD") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Green text color
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Green;
|
2018-04-15 19:55:50 +02:00
|
|
|
CPPUNIT_ASSERT ( *from != *to );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(from, to), C_STR("") );
|
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
// Default text color
|
2018-09-20 23:59:01 +02:00
|
|
|
to->fg_color = finalcut::fc::Default;
|
2018-04-15 19:55:50 +02:00
|
|
|
CPPUNIT_ASSERT ( *from == *to );
|
|
|
|
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
|
|
|
|
|
|
|
|
delete to;
|
|
|
|
delete from;
|
|
|
|
}
|
|
|
|
|
2018-04-02 22:04:29 +02:00
|
|
|
//----------------------------------------------------------------------
|
2018-09-15 02:25:30 +02:00
|
|
|
std::string FOptiAttrTest::printSequence (const std::string& s)
|
2018-04-02 22:04:29 +02:00
|
|
|
{
|
2018-09-15 02:25:30 +02:00
|
|
|
std::string sequence;
|
|
|
|
const std::string ctrl_character[] =
|
|
|
|
{
|
|
|
|
"NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL",
|
|
|
|
"BS", "Tab", "LF", "VT", "FF", "CR", "SO", "SI",
|
|
|
|
"DLE", "DC1", "DC2", "DC3", "DC4", "NAK", "SYN", "ETB",
|
|
|
|
"CAN", "EM", "SUB", "Esc", "FS", "GS", "RS", "US",
|
|
|
|
"Space"
|
|
|
|
};
|
2018-04-02 22:04:29 +02:00
|
|
|
|
|
|
|
for (std::string::size_type i = 0; i < s.length(); ++i)
|
|
|
|
{
|
2018-09-15 02:25:30 +02:00
|
|
|
char ch = s[i];
|
|
|
|
|
|
|
|
if ( ch < 0x21 )
|
|
|
|
sequence += ctrl_character[uInt(ch)];
|
|
|
|
else
|
|
|
|
sequence += ch;
|
|
|
|
|
|
|
|
sequence += ' ';
|
2018-04-02 22:04:29 +02:00
|
|
|
}
|
|
|
|
|
2018-09-15 02:25:30 +02:00
|
|
|
return sequence;
|
2018-04-02 22:04:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Put the test suite in the registry
|
|
|
|
CPPUNIT_TEST_SUITE_REGISTRATION (FOptiAttrTest);
|
|
|
|
|
|
|
|
// The general unit test main part
|
|
|
|
#include <main-test.inc>
|