Convert FOptiMove from char[] to std::string

This commit is contained in:
Markus Gans 2021-05-22 23:21:30 +02:00
parent 795ebcdea8
commit f06ccc6495
6 changed files with 354 additions and 396 deletions

View File

@ -16,12 +16,12 @@ Describe clearly and precisely what the problem is.
Example: I have an issue when [...]
**Describe your desired solution**
**Your desired solution**
Describe clearly and concisely what you want to reach.
**Describe alternatives you have considered**
**Alternatives you have considered**
Describe clearly and concisely the other solutions you considered.

View File

@ -1,3 +1,6 @@
2021-05-22 Markus Gans <guru.mail@muenster.de>
* Convert FOptiMove from char[] to std::string
2021-05-13 Markus Gans <guru.mail@muenster.de>
* Prevent duplicate widget in the close widget list

View File

@ -42,6 +42,7 @@ FOptiMove::FOptiMove (int baud)
{
assert ( baud >= 0 );
move_buf.reserve(BUF_SIZE);
calculateCharDuration();
// ANSI set cursor address preset for undefined terminals
@ -481,7 +482,7 @@ void FOptiMove::check_boundaries ( int& xold, int& yold
}
//----------------------------------------------------------------------
const char* FOptiMove::moveCursor (int xold, int yold, int xnew, int ynew)
std::string FOptiMove::moveCursor (int xold, int yold, int xnew, int ynew)
{
int method{0};
int move_time{LONG_DURATION};
@ -494,7 +495,7 @@ const char* FOptiMove::moveCursor (int xold, int yold, int xnew, int ynew)
|| yold < 0
|| isWideMove (xold, yold, xnew, ynew) ) )
{
return ( move_time < LONG_DURATION ) ? move_buf : nullptr;
return ( move_time < LONG_DURATION ) ? move_buf : std::string{};
}
// Method 1: local movement
@ -523,7 +524,7 @@ const char* FOptiMove::moveCursor (int xold, int yold, int xnew, int ynew)
if ( move_time < LONG_DURATION )
return move_buf;
else
return nullptr;
return {};
}
@ -605,28 +606,21 @@ int FOptiMove::capDurationToLength (int duration) const
//----------------------------------------------------------------------
int FOptiMove::repeatedAppend ( const Capability& o
, int count
, char* dst ) const
, std::string& dst ) const
{
const std::size_t src_len = std::strlen(o.cap);
const std::size_t dst_len = ( dst != nullptr ) ? std::strlen(dst) : 0;
const std::size_t dst_len = dst.length();
int total{0};
if ( (dst_len + uInt(count) * src_len) < BUF_SIZE - 1 )
{
total += count * o.duration;
int cnt = count;
if ( dst )
while ( cnt > 0 )
{
dst += dst_len;
std::size_t free = BUF_SIZE - dst_len - 2;
int cnt = count;
while ( cnt-- > 0 )
{
std::strncpy (dst, o.cap, free);
dst += src_len;
free -= src_len;
}
cnt--;
dst.append(o.cap);
}
}
else
@ -636,15 +630,15 @@ int FOptiMove::repeatedAppend ( const Capability& o
}
//----------------------------------------------------------------------
int FOptiMove::relativeMove ( char move[]
int FOptiMove::relativeMove ( std::string& move
, int from_x, int from_y
, int to_x, int to_y ) const
{
int vtime{0};
int htime{0};
if ( move )
move[0] = '\0';
if ( ! move.empty() )
move.clear();
if ( to_y != from_y ) // vertical move
{
@ -656,41 +650,30 @@ int FOptiMove::relativeMove ( char move[]
if ( to_x != from_x ) // horizontal move
{
char hmove[BUF_SIZE]{};
std::string hmove{};
htime = horizontalMove (hmove, from_x, to_x);
if ( htime >= LONG_DURATION )
return LONG_DURATION;
if ( move )
{
if ( *move )
std::strncat (move, hmove, BUF_SIZE - std::strlen(move));
else
std::strncpy (move, hmove, BUF_SIZE);
move[BUF_SIZE - 1] = '\0';
}
if ( ! move.empty() )
move.append(hmove);
else
move = hmove;
}
return vtime + htime;
}
//----------------------------------------------------------------------
inline int FOptiMove::verticalMove (char move[], int from_y, int to_y) const
inline int FOptiMove::verticalMove (std::string& move, int from_y, int to_y) const
{
int vtime{LONG_DURATION};
if ( F_row_address.cap )
{
if ( move )
{
std::strncpy ( move
, FTermcap::encodeParameter(F_row_address.cap, to_y).data()
, BUF_SIZE );
move[BUF_SIZE - 1] = '\0';
}
// Move to fixed row position
move = FTermcap::encodeParameter(F_row_address.cap, to_y);
vtime = F_row_address.duration;
}
@ -703,74 +686,58 @@ inline int FOptiMove::verticalMove (char move[], int from_y, int to_y) const
}
//----------------------------------------------------------------------
inline void FOptiMove::downMove ( char move[], int& vtime
inline void FOptiMove::downMove ( std::string& move, int& vtime
, int from_y, int to_y ) const
{
const int num = to_y - from_y;
if ( F_parm_down_cursor.cap && F_parm_down_cursor.duration < vtime )
{
if ( move )
{
std::strncpy ( move
, FTermcap::encodeParameter(F_parm_down_cursor.cap, num).data()
, BUF_SIZE );
move[BUF_SIZE - 1] = '\0';
}
move = FTermcap::encodeParameter(F_parm_down_cursor.cap, num);
vtime = F_parm_down_cursor.duration;
}
if ( F_cursor_down.cap && (num * F_cursor_down.duration < vtime) )
{
if ( move )
move[0] = '\0';
if ( ! move.empty() )
move.clear();
vtime = repeatedAppend (F_cursor_down, num, move);
}
}
//----------------------------------------------------------------------
inline void FOptiMove::upMove ( char move[], int& vtime
inline void FOptiMove::upMove ( std::string& move, int& vtime
, int from_y, int to_y ) const
{
const int num = from_y - to_y;
if ( F_parm_up_cursor.cap && F_parm_up_cursor.duration < vtime )
{
if ( move )
{
std::strncpy ( move
, FTermcap::encodeParameter(F_parm_up_cursor.cap, num).data()
, BUF_SIZE );
move[BUF_SIZE - 1] = '\0';
}
move = FTermcap::encodeParameter(F_parm_up_cursor.cap, num);
vtime = F_parm_up_cursor.duration;
}
if ( F_cursor_up.cap && (num * F_cursor_up.duration < vtime) )
{
if ( move )
move[0] = '\0';
if ( ! move.empty() )
move.clear();
vtime = repeatedAppend (F_cursor_up, num, move);
}
}
//----------------------------------------------------------------------
inline int FOptiMove::horizontalMove (char hmove[], int from_x, int to_x) const
inline int FOptiMove::horizontalMove (std::string& hmove, int from_x, int to_x) const
{
int htime{LONG_DURATION};
if ( F_column_address.cap )
{
// Move to fixed column position1
std::strncat ( hmove
, FTermcap::encodeParameter(F_column_address.cap, to_x).data()
, BUF_SIZE - std::strlen(hmove) - 1 );
hmove[BUF_SIZE - 1] = '\0';
// Move to fixed column position
hmove = FTermcap::encodeParameter(F_column_address.cap, to_x);
htime = F_column_address.duration;
}
if ( to_x > from_x )
@ -782,25 +749,21 @@ inline int FOptiMove::horizontalMove (char hmove[], int from_x, int to_x) const
}
//----------------------------------------------------------------------
inline void FOptiMove::rightMove ( char hmove[], int& htime
inline void FOptiMove::rightMove ( std::string& hmove, int& htime
, int from_x, int to_x ) const
{
int num = to_x - from_x;
if ( F_parm_right_cursor.cap && F_parm_right_cursor.duration < htime )
{
std::strncpy ( hmove
, FTermcap::encodeParameter(F_parm_right_cursor.cap, num).data()
, BUF_SIZE - 1);
hmove[BUF_SIZE - 1] = '\0';
hmove = FTermcap::encodeParameter(F_parm_right_cursor.cap, num);
htime = F_parm_right_cursor.duration;
}
if ( F_cursor_right.cap )
{
std::array<char, BUF_SIZE> str{};
std::string str{};
int htime_r{0};
str[0] = '\0';
// try to use tab
if ( tabstop > 0 && F_tab.cap )
@ -814,7 +777,7 @@ inline void FOptiMove::rightMove ( char hmove[], int& htime
if ( tab_pos > to_x )
break;
htime_r += repeatedAppend (F_tab, 1, str.data());
htime_r += repeatedAppend (F_tab, 1, str);
if ( htime_r >= LONG_DURATION )
break;
@ -825,37 +788,32 @@ inline void FOptiMove::rightMove ( char hmove[], int& htime
num = to_x - pos;
}
htime_r += repeatedAppend (F_cursor_right, num, str.data());
htime_r += repeatedAppend (F_cursor_right, num, str);
if ( htime_r < htime )
{
std::strncpy (hmove, str.data(), BUF_SIZE);
hmove[BUF_SIZE - 1] = '\0';
hmove = str;
htime = htime_r;
}
}
}
//----------------------------------------------------------------------
inline void FOptiMove::leftMove ( char hmove[], int& htime
inline void FOptiMove::leftMove ( std::string& hmove, int& htime
, int from_x, int to_x ) const
{
int num = from_x - to_x;
if ( F_parm_left_cursor.cap && F_parm_left_cursor.duration < htime )
{
std::strncpy ( hmove
, FTermcap::encodeParameter(F_parm_left_cursor.cap, num).data()
, BUF_SIZE - 1);
hmove[BUF_SIZE - 1] = '\0';
hmove = FTermcap::encodeParameter(F_parm_left_cursor.cap, num);
htime = F_parm_left_cursor.duration;
}
if ( F_cursor_left.cap )
{
std::array<char, BUF_SIZE> str{};
std::string str{};
int htime_l{0};
str[0] = '\0';
// try to use backward tab
if ( tabstop > 0 && F_back_tab.cap )
@ -869,7 +827,7 @@ inline void FOptiMove::leftMove ( char hmove[], int& htime
if ( tab_pos < to_x )
break;
htime_l += repeatedAppend (F_back_tab, 1, str.data());
htime_l += repeatedAppend (F_back_tab, 1, str);
if ( htime_l >= LONG_DURATION )
break;
@ -880,12 +838,12 @@ inline void FOptiMove::leftMove ( char hmove[], int& htime
num = pos - to_x;
}
htime_l += repeatedAppend (F_cursor_left, num, str.data());
htime_l += repeatedAppend (F_cursor_left, num, str);
if ( htime_l < htime )
{
std::strncpy (hmove, str.data(), BUF_SIZE);
hmove[BUF_SIZE - 1] = '\0';
hmove = str;
htime = htime_l;
}
}
@ -914,9 +872,7 @@ inline bool FOptiMove::isMethod0Faster ( int& move_time
if ( ! move_xy.empty() )
{
std::strncpy ( static_cast<char*>(move_buf)
, move_xy.data(), BUF_SIZE - 1 );
move_buf[BUF_SIZE - 1] = '\0';
move_buf = move_xy;
move_time = F_cursor_address.duration;
return true;
}
@ -933,8 +889,8 @@ inline bool FOptiMove::isMethod1Faster ( int& move_time
if ( xold >= 0 && yold >= 0 )
{
std::array<char, BUF_SIZE> null_result{};
const int new_time = relativeMove (null_result.data(), xold, yold, xnew, ynew);
std::string null_result{};
const int new_time = relativeMove (null_result, xold, yold, xnew, ynew);
if ( new_time < LONG_DURATION && new_time < move_time )
{
@ -955,8 +911,8 @@ inline bool FOptiMove::isMethod2Faster ( int& move_time
if ( yold >= 0 && F_carriage_return.cap )
{
std::array<char, BUF_SIZE> null_result{};
const int new_time = relativeMove (null_result.data(), 0, yold, xnew, ynew);
std::string null_result{};
const int new_time = relativeMove (null_result, 0, yold, xnew, ynew);
if ( new_time < LONG_DURATION
&& F_carriage_return.duration + new_time < move_time )
@ -977,8 +933,8 @@ inline bool FOptiMove::isMethod3Faster ( int& move_time
if ( F_cursor_home.cap )
{
std::array<char, BUF_SIZE> null_result{};
const int new_time = relativeMove (null_result.data(), 0, 0, xnew, ynew);
std::string null_result{};
const int new_time = relativeMove (null_result, 0, 0, xnew, ynew);
if ( new_time < LONG_DURATION
&& F_cursor_home.duration + new_time < move_time )
@ -998,10 +954,9 @@ inline bool FOptiMove::isMethod4Faster ( int& move_time
// Test method 4: home-down + local movement
if ( F_cursor_to_ll.cap )
{
std::array<char, BUF_SIZE> null_result{};
const int new_time = relativeMove ( null_result.data()
, 0, int(screen_height) - 1
, xnew, ynew );
std::string null_result{};
int down = int(screen_height) - 1;
const int new_time = relativeMove (null_result, 0, down, xnew, ynew);
if ( new_time < LONG_DURATION
&& F_cursor_to_ll.duration + new_time < move_time )
@ -1025,10 +980,10 @@ inline bool FOptiMove::isMethod5Faster ( int& move_time
&& yold > 0
&& F_cursor_left.cap )
{
std::array<char, BUF_SIZE> null_result{};
const int new_time = relativeMove ( null_result.data()
, int(screen_width) - 1, yold - 1
, xnew, ynew );
std::string null_result{};
int x = int(screen_width) - 1;
int y = yold - 1;
const int new_time = relativeMove (null_result, x, y, xnew, ynew);
if ( new_time < LONG_DURATION
&& F_carriage_return.cap
@ -1037,7 +992,6 @@ inline bool FOptiMove::isMethod5Faster ( int& move_time
{
move_time = F_carriage_return.duration
+ F_cursor_left.duration + new_time;
return true;
}
}
@ -1050,52 +1004,55 @@ void FOptiMove::moveByMethod ( int method
, int xold, int yold
, int xnew, int ynew )
{
char* move_ptr = move_buf;
switch ( method )
{
case 1:
relativeMove (move_ptr, xold, yold, xnew, ynew);
relativeMove (move_buf, xold, yold, xnew, ynew);
break;
case 2:
if ( F_carriage_return.cap )
{
std::strncpy (move_ptr, F_carriage_return.cap, BUF_SIZE - 1);
move_ptr[BUF_SIZE - 1] ='\0';
move_ptr += F_carriage_return.length;
relativeMove (move_ptr, 0, yold, xnew, ynew);
move_buf = F_carriage_return.cap;
std::string s{};
relativeMove (s, 0, yold, xnew, ynew);
move_buf.append(s);
}
break;
case 3:
std::strncpy (move_ptr, F_cursor_home.cap, BUF_SIZE - 1);
move_ptr[BUF_SIZE - 1] ='\0';
move_ptr += F_cursor_home.length;
relativeMove (move_ptr, 0, 0, xnew, ynew);
move_buf = F_cursor_home.cap;
{
std::string s{};
relativeMove (s, 0, 0, xnew, ynew);
move_buf.append(s);
}
break;
case 4:
std::strncpy (move_ptr, F_cursor_to_ll.cap, BUF_SIZE - 1);
move_ptr[BUF_SIZE - 1] ='\0';
move_ptr += F_cursor_to_ll.length;
relativeMove (move_ptr, 0, int(screen_height) - 1, xnew, ynew);
move_buf = F_cursor_to_ll.cap;
{
std::string s{};
int down = int(screen_height) - 1;
relativeMove (s, 0, down, xnew, ynew);
move_buf.append(s);
}
break;
case 5:
move_buf[0] = '\0';
if ( xold >= 0 )
std::strncat ( move_ptr
, F_carriage_return.cap
, BUF_SIZE - std::strlen(move_ptr) - 1 );
move_buf = F_carriage_return.cap;
else
move_buf.clear();
std::strncat ( move_ptr
, F_cursor_left.cap
, BUF_SIZE - std::strlen(move_ptr) - 1);
move_ptr[BUF_SIZE - 1] ='\0';
move_ptr += std::strlen(move_buf);
relativeMove (move_ptr, int(screen_width) - 1, yold - 1, xnew, ynew);
move_buf.append(F_cursor_left.cap);
{
std::string s{};
int x = int(screen_width) - 1;
int y = yold - 1;
relativeMove (s, x, y, xnew, ynew);
move_buf.append(s);
}
break;
default:

View File

@ -178,7 +178,7 @@ class FListBox : public FWidget
FListBox (Iterator, Iterator, InsertConverter, FWidget* = nullptr);
template <typename Container
, typename LazyConverter>
FListBox (Container, LazyConverter, FWidget* = nullptr);
FListBox (Container, LazyConverter&&, FWidget* = nullptr);
// Disable copy constructor
FListBox (const FListBox&) = delete;
@ -235,10 +235,10 @@ class FListBox : public FWidget
template <typename Container
, typename LazyConverter>
void insert ( const Container&
, const LazyConverter& );
, LazyConverter&& );
template <typename Container
, typename LazyConverter>
void insert (Container*, const LazyConverter&);
void insert (Container*, LazyConverter&&);
void insert (const FListBoxItem&);
template <typename T
, typename DT = std::nullptr_t>
@ -417,12 +417,12 @@ inline FListBox::FListBox ( Iterator first
template <typename Container
, typename LazyConverter>
inline FListBox::FListBox ( Container container
, LazyConverter convert
, LazyConverter&& convert
, FWidget* parent )
: FWidget{parent}
{
init();
insert (container, convert);
insert (container, std::forward<LazyConverter>(convert));
}
//----------------------------------------------------------------------
@ -550,11 +550,11 @@ inline void FListBox::insert ( Iterator first
//----------------------------------------------------------------------
template <typename Container
, typename LazyConverter>
void FListBox::insert (const Container& container, const LazyConverter& converter)
void FListBox::insert (const Container& container, LazyConverter&& converter)
{
conv_type = ConvertType::Lazy;
source_container = makeFData(container);
lazy_inserter = converter;
lazy_inserter = std::move(converter);
const std::size_t size = container.size();
if ( size > 0 )
@ -566,9 +566,9 @@ void FListBox::insert (const Container& container, const LazyConverter& converte
//----------------------------------------------------------------------
template <typename Container
, typename LazyConverter>
void FListBox::insert (Container* container, const LazyConverter& converter)
void FListBox::insert (Container* container, LazyConverter&& converter)
{
insert (*container, converter);
insert (*container, std::forward<LazyConverter>(converter));
}
//----------------------------------------------------------------------

View File

@ -44,6 +44,7 @@
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include "final/fstring.h"
@ -143,7 +144,7 @@ class FOptiMove final
// Methods
void check_boundaries (int&, int&, int&, int&) const;
const char* moveCursor (int, int, int, int);
std::string moveCursor (int, int, int, int);
private:
struct Capability
@ -154,7 +155,7 @@ class FOptiMove final
};
// Constant
static constexpr std::size_t BUF_SIZE{512};
static constexpr std::string::size_type BUF_SIZE{512u};
// Constants
static constexpr int LONG_DURATION{INT_MAX};
@ -166,14 +167,14 @@ class FOptiMove final
void calculateCharDuration();
int capDuration (const char[], int) const;
int capDurationToLength (int) const;
int repeatedAppend (const Capability&, int, char*) const;
int relativeMove (char[], int, int, int, int) const;
int verticalMove (char[], int, int) const;
void downMove (char[], int&, int, int) const;
void upMove (char[], int&, int, int) const;
int horizontalMove (char[], int, int) const;
void rightMove (char[], int&, int, int) const;
void leftMove (char[], int&, int, int) const;
int repeatedAppend (const Capability&, int, std::string&) const;
int relativeMove (std::string&, int, int, int, int) const;
int verticalMove (std::string&, int, int) const;
void downMove (std::string&, int&, int, int) const;
void upMove (std::string&, int&, int, int) const;
int horizontalMove (std::string&, int, int) const;
void rightMove (std::string&, int&, int, int) const;
void leftMove (std::string&, int&, int, int) const;
bool isWideMove (int, int, int, int) const;
bool isMethod0Faster (int&, int, int);
@ -211,7 +212,7 @@ class FOptiMove final
int char_duration{1};
int baudrate{9600};
int tabstop{0};
char move_buf[BUF_SIZE]{'\0'};
std::string move_buf{};
bool automatic_left_margin{false};
bool eat_nl_glitch{false};

View File

@ -36,20 +36,17 @@
#include <final/final.h>
#define CPPUNIT_ASSERT_CSTRING(expected, actual) \
check_c_string (expected, actual, CPPUNIT_SOURCELINE())
#define CPPUNIT_ASSERT_STRING(expected, actual) \
check_string (expected, actual, CPPUNIT_SOURCELINE())
//----------------------------------------------------------------------
void check_c_string ( const char* s1
, const char* s2
, CppUnit::SourceLine sourceLine )
void check_string ( const std::string& s1
, const std::string& s2
, CppUnit::SourceLine sourceLine )
{
if ( s1 == 0 && s2 == 0 ) // Strings are equal
if ( s1 == s2 ) // Strings are equal
return;
if ( s1 && s2 && std::strcmp (s1, s2) == 0 ) // Strings are equal
return;
::CppUnit::Asserter::fail ("Strings are not equal", sourceLine);
}
@ -121,8 +118,8 @@ void FOptiMoveTest::classNameTest()
void FOptiMoveTest::noArgumentTest()
{
finalcut::FOptiMove om;
CPPUNIT_ASSERT_CSTRING (om.moveCursor (1, 1, 5, 5), CSI "6;6H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 9, 9), CSI "10;10H");
CPPUNIT_ASSERT_STRING (om.moveCursor (1, 1, 5, 5), CSI "6;6H");
CPPUNIT_ASSERT_STRING (om.moveCursor (5, 5, 9, 9), CSI "10;10H");
// Delete all presets
om.set_tabular (0);
@ -142,7 +139,7 @@ void FOptiMoveTest::noArgumentTest()
om.set_parm_right_cursor (0);
om.set_parm_left_cursor (0);
CPPUNIT_ASSERT (om.moveCursor (1, 1, 5, 5) == nullptr);
CPPUNIT_ASSERT (om.moveCursor (1, 1, 5, 5).empty());
}
//----------------------------------------------------------------------
@ -164,9 +161,9 @@ void FOptiMoveTest::homeTest()
om.set_parm_left_cursor (CSI "%p1%dD");
// Upper home (first line, first column)
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 10, 0, 0), CSI "H");
CPPUNIT_ASSERT_STRING (om.moveCursor (10, 10, 0, 0), CSI "H");
// Lower home (last line, first column)
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 10, 0, 23), CSI "X");
CPPUNIT_ASSERT_STRING (om.moveCursor (10, 10, 0, 23), CSI "X");
}
//----------------------------------------------------------------------
@ -191,8 +188,8 @@ void FOptiMoveTest::fromLeftToRightTest()
om.set_parm_right_cursor (CSI "%p1%dC");
om.set_parm_left_cursor (CSI "%p1%dD");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 2, 79, 1), "\r\b");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 2, 79, 2), "\r\b" ESC "D");
CPPUNIT_ASSERT_STRING (om.moveCursor (3, 2, 79, 1), "\r\b");
CPPUNIT_ASSERT_STRING (om.moveCursor (3, 2, 79, 2), "\r\b" ESC "D");
}
//----------------------------------------------------------------------
@ -218,39 +215,39 @@ void FOptiMoveTest::ansiTest()
om.set_parm_right_cursor (CSI "%p1%dC");
om.set_parm_left_cursor (CSI "%p1%dD");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (0, 0, 5, 5), CSI "6;6H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 0, 0), CSI "H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 1), "\r");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 2), "\r" CSI "B");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 10, 4), CSI "C");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 4, 9, 4), CSI "D");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 11, 4), CSI "12G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (11, 4, 9, 4), CSI "10G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (1, 0, 8, 0), "\t");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 1), CSI "B");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 1, 16, 0), CSI "A");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 2), CSI "3d");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 2, 16, 0), CSI "1d");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 2, 79, 2), CSI "80G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 75, 20), CSI "21;76H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (39, 0, 32, 0), CSI "Z");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 0, 8, 0), "\r\t");
CPPUNIT_ASSERT_STRING (om.moveCursor (0, 0, 5, 5), CSI "6;6H");
CPPUNIT_ASSERT_STRING (om.moveCursor (5, 5, 0, 0), CSI "H");
CPPUNIT_ASSERT_STRING (om.moveCursor (79, 1, 0, 1), "\r");
CPPUNIT_ASSERT_STRING (om.moveCursor (79, 1, 0, 2), "\r" CSI "B");
CPPUNIT_ASSERT_STRING (om.moveCursor (9, 4, 10, 4), CSI "C");
CPPUNIT_ASSERT_STRING (om.moveCursor (10, 4, 9, 4), CSI "D");
CPPUNIT_ASSERT_STRING (om.moveCursor (9, 4, 11, 4), CSI "12G");
CPPUNIT_ASSERT_STRING (om.moveCursor (11, 4, 9, 4), CSI "10G");
CPPUNIT_ASSERT_STRING (om.moveCursor (1, 0, 8, 0), "\t");
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 0, 16, 1), CSI "B");
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 1, 16, 0), CSI "A");
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 0, 16, 2), CSI "3d");
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 2, 16, 0), CSI "1d");
CPPUNIT_ASSERT_STRING (om.moveCursor (3, 2, 79, 2), CSI "80G");
CPPUNIT_ASSERT_STRING (om.moveCursor (5, 5, 75, 20), CSI "21;76H");
CPPUNIT_ASSERT_STRING (om.moveCursor (39, 0, 32, 0), CSI "Z");
CPPUNIT_ASSERT_STRING (om.moveCursor (10, 0, 8, 0), "\r\t");
// xold is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (99, 10, 79, 10), CSI "11;80H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (-3, 33, 50, 10), CSI "11;51H");
CPPUNIT_ASSERT_STRING (om.moveCursor (99, 10, 79, 10), CSI "11;80H");
CPPUNIT_ASSERT_STRING (om.moveCursor (-3, 33, 50, 10), CSI "11;51H");
// ynew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, 33, 23, 10), CSI "11;24H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, -3, 12, 10), CSI "11;13H");
CPPUNIT_ASSERT_STRING (om.moveCursor (23, 33, 23, 10), CSI "11;24H");
CPPUNIT_ASSERT_STRING (om.moveCursor (23, -3, 12, 10), CSI "11;13H");
// xnew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 22, 100, 22), CSI "80G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 22, -5, 22), "\r");
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 22, 100, 22), CSI "80G");
CPPUNIT_ASSERT_STRING (om.moveCursor (3, 22, -5, 22), "\r");
// ynew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 22, 53, 40), CSI "25d");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 2, 53, -3), CSI "1d");
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 22, 53, 40), CSI "25d");
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 2, 53, -3), CSI "1d");
}
//----------------------------------------------------------------------
@ -274,39 +271,39 @@ void FOptiMoveTest::vt100Test()
om.set_parm_right_cursor (CSI "%p1%dC");
om.set_parm_left_cursor (CSI "%p1%dD");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (0, 0, 5, 5), CSI "6;6H$<5>");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 0, 0), CSI "H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 1), "\r");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 2), "\r\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 10, 4), CSI "C$<2>");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 4, 9, 4), "\b");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 11, 4), CSI "2C");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (11, 4, 9, 4), "\b\b");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (1, 0, 8, 0), "\t");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 1), "\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 1, 16, 0), CSI "A$<2>");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 2), "\n\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 2, 16, 0), CSI "2A");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 2, 79, 2), CSI "76C");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 75, 20), CSI "21;76H$<5>");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (39, 0, 32, 0), CSI "7D");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 0, 8, 0), "\b\b");
CPPUNIT_ASSERT_STRING (om.moveCursor (0, 0, 5, 5), CSI "6;6H$<5>");
CPPUNIT_ASSERT_STRING (om.moveCursor (5, 5, 0, 0), CSI "H");
CPPUNIT_ASSERT_STRING (om.moveCursor (79, 1, 0, 1), "\r");
CPPUNIT_ASSERT_STRING (om.moveCursor (79, 1, 0, 2), "\r\n");
CPPUNIT_ASSERT_STRING (om.moveCursor (9, 4, 10, 4), CSI "C$<2>");
CPPUNIT_ASSERT_STRING (om.moveCursor (10, 4, 9, 4), "\b");
CPPUNIT_ASSERT_STRING (om.moveCursor (9, 4, 11, 4), CSI "2C");
CPPUNIT_ASSERT_STRING (om.moveCursor (11, 4, 9, 4), "\b\b");
CPPUNIT_ASSERT_STRING (om.moveCursor (1, 0, 8, 0), "\t");
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 0, 16, 1), "\n");
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 1, 16, 0), CSI "A$<2>");
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 0, 16, 2), "\n\n");
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 2, 16, 0), CSI "2A");
CPPUNIT_ASSERT_STRING (om.moveCursor (3, 2, 79, 2), CSI "76C");
CPPUNIT_ASSERT_STRING (om.moveCursor (5, 5, 75, 20), CSI "21;76H$<5>");
CPPUNIT_ASSERT_STRING (om.moveCursor (39, 0, 32, 0), CSI "7D");
CPPUNIT_ASSERT_STRING (om.moveCursor (10, 0, 8, 0), "\b\b");
// xold is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (99, 10, 79, 10), CSI "11;80H$<5>");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (-3, 33, 50, 10), CSI "11;51H$<5>");
CPPUNIT_ASSERT_STRING (om.moveCursor (99, 10, 79, 10), CSI "11;80H$<5>");
CPPUNIT_ASSERT_STRING (om.moveCursor (-3, 33, 50, 10), CSI "11;51H$<5>");
// ynew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, 33, 23, 10), CSI "11;24H$<5>");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, -3, 12, 10), CSI "11;13H$<5>");
CPPUNIT_ASSERT_STRING (om.moveCursor (23, 33, 23, 10), CSI "11;24H$<5>");
CPPUNIT_ASSERT_STRING (om.moveCursor (23, -3, 12, 10), CSI "11;13H$<5>");
// xnew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 22, 100, 22), CSI "26C");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 22, -5, 22), "\r");
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 22, 100, 22), CSI "26C");
CPPUNIT_ASSERT_STRING (om.moveCursor (3, 22, -5, 22), "\r");
// ynew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 22, 53, 40), "\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 2, 53, -3), CSI "2A");
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 22, 53, 40), "\n");
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 2, 53, -3), CSI "2A");
}
//----------------------------------------------------------------------
@ -333,39 +330,39 @@ void FOptiMoveTest::xtermTest()
om.set_parm_right_cursor (CSI "%p1%dC");
om.set_parm_left_cursor (CSI "%p1%dD");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (0, 0, 5, 5), CSI "6;6H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 0, 0), CSI "H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 1), "\r");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 2), "\r\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 10, 4), CSI "C");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 4, 9, 4), "\b");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 11, 4), CSI "12G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (11, 4, 9, 4), "\b\b");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (1, 0, 8, 0), "\t");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 1), "\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 1, 16, 0), CSI "A");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 2), "\n\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 2, 16, 0), CSI "1d");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 2, 79, 2), CSI "80G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 75, 20), CSI "21;76H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (39, 0, 32, 0), CSI "Z");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 0, 8, 0), "\r\t");
CPPUNIT_ASSERT_STRING (om.moveCursor (0, 0, 5, 5), CSI "6;6H");
CPPUNIT_ASSERT_STRING (om.moveCursor (5, 5, 0, 0), CSI "H");
CPPUNIT_ASSERT_STRING (om.moveCursor (79, 1, 0, 1), "\r");
CPPUNIT_ASSERT_STRING (om.moveCursor (79, 1, 0, 2), "\r\n");
CPPUNIT_ASSERT_STRING (om.moveCursor (9, 4, 10, 4), CSI "C");
CPPUNIT_ASSERT_STRING (om.moveCursor (10, 4, 9, 4), "\b");
CPPUNIT_ASSERT_STRING (om.moveCursor (9, 4, 11, 4), CSI "12G");
CPPUNIT_ASSERT_STRING (om.moveCursor (11, 4, 9, 4), "\b\b");
CPPUNIT_ASSERT_STRING (om.moveCursor (1, 0, 8, 0), "\t");
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 0, 16, 1), "\n");
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 1, 16, 0), CSI "A");
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 0, 16, 2), "\n\n");
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 2, 16, 0), CSI "1d");
CPPUNIT_ASSERT_STRING (om.moveCursor (3, 2, 79, 2), CSI "80G");
CPPUNIT_ASSERT_STRING (om.moveCursor (5, 5, 75, 20), CSI "21;76H");
CPPUNIT_ASSERT_STRING (om.moveCursor (39, 0, 32, 0), CSI "Z");
CPPUNIT_ASSERT_STRING (om.moveCursor (10, 0, 8, 0), "\r\t");
// xold is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (99, 10, 79, 10), CSI "11;80H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (-3, 33, 50, 10), CSI "11;51H");
CPPUNIT_ASSERT_STRING (om.moveCursor (99, 10, 79, 10), CSI "11;80H");
CPPUNIT_ASSERT_STRING (om.moveCursor (-3, 33, 50, 10), CSI "11;51H");
// ynew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, 33, 23, 10), CSI "11;24H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, -3, 12, 10), CSI "11;13H");
CPPUNIT_ASSERT_STRING (om.moveCursor (23, 33, 23, 10), CSI "11;24H");
CPPUNIT_ASSERT_STRING (om.moveCursor (23, -3, 12, 10), CSI "11;13H");
// xnew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 22, 100, 22), CSI "80G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 22, -5, 22), "\r");
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 22, 100, 22), CSI "80G");
CPPUNIT_ASSERT_STRING (om.moveCursor (3, 22, -5, 22), "\r");
// ynew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 23, 53, 40), "\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 2, 53, -3), CSI "1d");
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 23, 53, 40), "\n");
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 2, 53, -3), CSI "1d");
}
//----------------------------------------------------------------------
@ -391,39 +388,39 @@ void FOptiMoveTest::rxvtTest()
om.set_parm_right_cursor (CSI "%p1%dC");
om.set_parm_left_cursor (CSI "%p1%dD");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (0, 0, 5, 5), CSI "6;6H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 0, 0), CSI "H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 1), "\r");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 2), "\r\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 10, 4), CSI "C");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 4, 9, 4), "\b");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 11, 4), CSI "12G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (11, 4, 9, 4), "\b\b");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (1, 0, 8, 0), "\t");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 1), "\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 1, 16, 0), CSI "A");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 2), "\n\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 2, 16, 0), CSI "1d");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 2, 79, 2), CSI "80G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 75, 20), CSI "21;76H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (39, 0, 32, 0), CSI "33G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 0, 8, 0), "\b\b");
CPPUNIT_ASSERT_STRING (om.moveCursor (0, 0, 5, 5), CSI "6;6H");
CPPUNIT_ASSERT_STRING (om.moveCursor (5, 5, 0, 0), CSI "H");
CPPUNIT_ASSERT_STRING (om.moveCursor (79, 1, 0, 1), "\r");
CPPUNIT_ASSERT_STRING (om.moveCursor (79, 1, 0, 2), "\r\n");
CPPUNIT_ASSERT_STRING (om.moveCursor (9, 4, 10, 4), CSI "C");
CPPUNIT_ASSERT_STRING (om.moveCursor (10, 4, 9, 4), "\b");
CPPUNIT_ASSERT_STRING (om.moveCursor (9, 4, 11, 4), CSI "12G");
CPPUNIT_ASSERT_STRING (om.moveCursor (11, 4, 9, 4), "\b\b");
CPPUNIT_ASSERT_STRING (om.moveCursor (1, 0, 8, 0), "\t");
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 0, 16, 1), "\n");
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 1, 16, 0), CSI "A");
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 0, 16, 2), "\n\n");
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 2, 16, 0), CSI "1d");
CPPUNIT_ASSERT_STRING (om.moveCursor (3, 2, 79, 2), CSI "80G");
CPPUNIT_ASSERT_STRING (om.moveCursor (5, 5, 75, 20), CSI "21;76H");
CPPUNIT_ASSERT_STRING (om.moveCursor (39, 0, 32, 0), CSI "33G");
CPPUNIT_ASSERT_STRING (om.moveCursor (10, 0, 8, 0), "\b\b");
// xold is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (99, 10, 79, 10), CSI "11;80H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (-3, 33, 50, 10), CSI "11;51H");
CPPUNIT_ASSERT_STRING (om.moveCursor (99, 10, 79, 10), CSI "11;80H");
CPPUNIT_ASSERT_STRING (om.moveCursor (-3, 33, 50, 10), CSI "11;51H");
// ynew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, 33, 23, 10), CSI "11;24H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, -3, 12, 10), CSI "11;13H");
CPPUNIT_ASSERT_STRING (om.moveCursor (23, 33, 23, 10), CSI "11;24H");
CPPUNIT_ASSERT_STRING (om.moveCursor (23, -3, 12, 10), CSI "11;13H");
// xnew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 22, 100, 22), CSI "80G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 22, -5, 22), "\r");
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 22, 100, 22), CSI "80G");
CPPUNIT_ASSERT_STRING (om.moveCursor (3, 22, -5, 22), "\r");
// ynew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 23, 53, 40), "\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 2, 53, -3), CSI "1d");
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 23, 53, 40), "\n");
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 2, 53, -3), CSI "1d");
}
//----------------------------------------------------------------------
@ -450,39 +447,39 @@ void FOptiMoveTest::linuxTest()
om.set_parm_right_cursor (CSI "%p1%dC");
om.set_parm_left_cursor (CSI "%p1%dD");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (0, 0, 5, 5), CSI "6;6H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 0, 0), CSI "H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 1), "\r");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 2), "\r\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 10, 4), CSI "C");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 4, 9, 4), "\b");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 11, 4), CSI "12G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (11, 4, 9, 4), "\b\b");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (1, 0, 8, 0), "\t");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 1), "\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 1, 16, 0), CSI "A");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 2), "\n\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 2, 16, 0), CSI "1d");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 2, 79, 2), CSI "80G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 75, 20), CSI "21;76H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (39, 0, 32, 0), CSI "Z");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 0, 8, 0), "\r\t");
CPPUNIT_ASSERT_STRING (om.moveCursor (0, 0, 5, 5), CSI "6;6H");
CPPUNIT_ASSERT_STRING (om.moveCursor (5, 5, 0, 0), CSI "H");
CPPUNIT_ASSERT_STRING (om.moveCursor (79, 1, 0, 1), "\r");
CPPUNIT_ASSERT_STRING (om.moveCursor (79, 1, 0, 2), "\r\n");
CPPUNIT_ASSERT_STRING (om.moveCursor (9, 4, 10, 4), CSI "C");
CPPUNIT_ASSERT_STRING (om.moveCursor (10, 4, 9, 4), "\b");
CPPUNIT_ASSERT_STRING (om.moveCursor (9, 4, 11, 4), CSI "12G");
CPPUNIT_ASSERT_STRING (om.moveCursor (11, 4, 9, 4), "\b\b");
CPPUNIT_ASSERT_STRING (om.moveCursor (1, 0, 8, 0), "\t");
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 0, 16, 1), "\n");
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 1, 16, 0), CSI "A");
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 0, 16, 2), "\n\n");
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 2, 16, 0), CSI "1d");
CPPUNIT_ASSERT_STRING (om.moveCursor (3, 2, 79, 2), CSI "80G");
CPPUNIT_ASSERT_STRING (om.moveCursor (5, 5, 75, 20), CSI "21;76H");
CPPUNIT_ASSERT_STRING (om.moveCursor (39, 0, 32, 0), CSI "Z");
CPPUNIT_ASSERT_STRING (om.moveCursor (10, 0, 8, 0), "\r\t");
// xold is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (99, 10, 79, 10), CSI "11;80H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (-3, 33, 50, 10), CSI "11;51H");
CPPUNIT_ASSERT_STRING (om.moveCursor (99, 10, 79, 10), CSI "11;80H");
CPPUNIT_ASSERT_STRING (om.moveCursor (-3, 33, 50, 10), CSI "11;51H");
// ynew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, 33, 23, 10), CSI "11;24H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, -3, 12, 10), CSI "11;13H");
CPPUNIT_ASSERT_STRING (om.moveCursor (23, 33, 23, 10), CSI "11;24H");
CPPUNIT_ASSERT_STRING (om.moveCursor (23, -3, 12, 10), CSI "11;13H");
// xnew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 22, 100, 22), CSI "80G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 22, -5, 22), "\r");
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 22, 100, 22), CSI "80G");
CPPUNIT_ASSERT_STRING (om.moveCursor (3, 22, -5, 22), "\r");
// ynew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 23, 53, 40), "\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 2, 53, -3), CSI "1d");
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 23, 53, 40), "\n");
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 2, 53, -3), CSI "1d");
}
//----------------------------------------------------------------------
@ -508,41 +505,41 @@ void FOptiMoveTest::cygwinTest()
om.set_parm_right_cursor (CSI "%p1%dC");
om.set_parm_left_cursor (CSI "%p1%dD");
CPPUNIT_ASSERT_CSTRING ( printSequence(om.moveCursor (1, 2, 3, 4)).c_str()
CPPUNIT_ASSERT_STRING ( printSequence(om.moveCursor (1, 2, 3, 4)).c_str()
, "Esc [ 5 ; 4 H " );
CPPUNIT_ASSERT_CSTRING (om.moveCursor (0, 0, 5, 5), CSI "6;6H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 0, 0), CSI "H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 1), "\r");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 2), "\r" CSI "B");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 10, 4), CSI "C");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 4, 9, 4), "\b");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 11, 4), CSI "12G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (11, 4, 9, 4), "\b\b");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (1, 0, 8, 0), "\t");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 1), CSI "B");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 1, 16, 0), CSI "A");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 2), CSI "3d");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 2, 16, 0), CSI "1d");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 2, 79, 2), CSI "80G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 75, 20), CSI "21;76H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (39, 0, 32, 0), CSI "Z");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 0, 8, 0), "\r\t");
CPPUNIT_ASSERT_STRING (om.moveCursor (0, 0, 5, 5), CSI "6;6H");
CPPUNIT_ASSERT_STRING (om.moveCursor (5, 5, 0, 0), CSI "H");
CPPUNIT_ASSERT_STRING (om.moveCursor (79, 1, 0, 1), "\r");
CPPUNIT_ASSERT_STRING (om.moveCursor (79, 1, 0, 2), "\r" CSI "B");
CPPUNIT_ASSERT_STRING (om.moveCursor (9, 4, 10, 4), CSI "C");
CPPUNIT_ASSERT_STRING (om.moveCursor (10, 4, 9, 4), "\b");
CPPUNIT_ASSERT_STRING (om.moveCursor (9, 4, 11, 4), CSI "12G");
CPPUNIT_ASSERT_STRING (om.moveCursor (11, 4, 9, 4), "\b\b");
CPPUNIT_ASSERT_STRING (om.moveCursor (1, 0, 8, 0), "\t");
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 0, 16, 1), CSI "B");
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 1, 16, 0), CSI "A");
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 0, 16, 2), CSI "3d");
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 2, 16, 0), CSI "1d");
CPPUNIT_ASSERT_STRING (om.moveCursor (3, 2, 79, 2), CSI "80G");
CPPUNIT_ASSERT_STRING (om.moveCursor (5, 5, 75, 20), CSI "21;76H");
CPPUNIT_ASSERT_STRING (om.moveCursor (39, 0, 32, 0), CSI "Z");
CPPUNIT_ASSERT_STRING (om.moveCursor (10, 0, 8, 0), "\r\t");
// xold is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (99, 10, 79, 10), CSI "11;80H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (-3, 33, 50, 10), CSI "11;51H");
CPPUNIT_ASSERT_STRING (om.moveCursor (99, 10, 79, 10), CSI "11;80H");
CPPUNIT_ASSERT_STRING (om.moveCursor (-3, 33, 50, 10), CSI "11;51H");
// ynew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, 33, 23, 10), CSI "11;24H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, -3, 12, 10), CSI "11;13H");
CPPUNIT_ASSERT_STRING (om.moveCursor (23, 33, 23, 10), CSI "11;24H");
CPPUNIT_ASSERT_STRING (om.moveCursor (23, -3, 12, 10), CSI "11;13H");
// xnew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 22, 100, 22), CSI "80G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 22, -5, 22), "\r");
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 22, 100, 22), CSI "80G");
CPPUNIT_ASSERT_STRING (om.moveCursor (3, 22, -5, 22), "\r");
// ynew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 23, 53, 40), CSI "B");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 2, 53, -3), CSI "1d");
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 23, 53, 40), CSI "B");
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 2, 53, -3), CSI "1d");
}
//----------------------------------------------------------------------
@ -570,39 +567,39 @@ void FOptiMoveTest::puttyTest()
om.set_parm_right_cursor (CSI "%p1%dC");
om.set_parm_left_cursor (CSI "%p1%dD");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (0, 0, 5, 5), CSI "6;6H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 0, 0), CSI "H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 1), "\r");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 2), "\r" ESC "D");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 10, 4), CSI "C");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 4, 9, 4), "\b");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 11, 4), CSI "12G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (11, 4, 9, 4), "\b\b");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (1, 0, 8, 0), "\t");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 1), ESC "D");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 1, 16, 0), ESC "M");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 2), ESC "D" ESC "D");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 2, 16, 0), ESC "M" ESC "M");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 2, 79, 2), CSI "80G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 75, 20), CSI "21;76H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (39, 0, 32, 0), CSI "Z");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 0, 8, 0), "\r\t");
CPPUNIT_ASSERT_STRING (om.moveCursor (0, 0, 5, 5), CSI "6;6H");
CPPUNIT_ASSERT_STRING (om.moveCursor (5, 5, 0, 0), CSI "H");
CPPUNIT_ASSERT_STRING (om.moveCursor (79, 1, 0, 1), "\r");
CPPUNIT_ASSERT_STRING (om.moveCursor (79, 1, 0, 2), "\r" ESC "D");
CPPUNIT_ASSERT_STRING (om.moveCursor (9, 4, 10, 4), CSI "C");
CPPUNIT_ASSERT_STRING (om.moveCursor (10, 4, 9, 4), "\b");
CPPUNIT_ASSERT_STRING (om.moveCursor (9, 4, 11, 4), CSI "12G");
CPPUNIT_ASSERT_STRING (om.moveCursor (11, 4, 9, 4), "\b\b");
CPPUNIT_ASSERT_STRING (om.moveCursor (1, 0, 8, 0), "\t");
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 0, 16, 1), ESC "D");
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 1, 16, 0), ESC "M");
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 0, 16, 2), ESC "D" ESC "D");
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 2, 16, 0), ESC "M" ESC "M");
CPPUNIT_ASSERT_STRING (om.moveCursor (3, 2, 79, 2), CSI "80G");
CPPUNIT_ASSERT_STRING (om.moveCursor (5, 5, 75, 20), CSI "21;76H");
CPPUNIT_ASSERT_STRING (om.moveCursor (39, 0, 32, 0), CSI "Z");
CPPUNIT_ASSERT_STRING (om.moveCursor (10, 0, 8, 0), "\r\t");
// xold is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (99, 10, 79, 10), CSI "11;80H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (-3, 33, 50, 10), CSI "11;51H");
CPPUNIT_ASSERT_STRING (om.moveCursor (99, 10, 79, 10), CSI "11;80H");
CPPUNIT_ASSERT_STRING (om.moveCursor (-3, 33, 50, 10), CSI "11;51H");
// ynew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, 33, 23, 10), CSI "11;24H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, -3, 12, 10), CSI "11;13H");
CPPUNIT_ASSERT_STRING (om.moveCursor (23, 33, 23, 10), CSI "11;24H");
CPPUNIT_ASSERT_STRING (om.moveCursor (23, -3, 12, 10), CSI "11;13H");
// xnew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 22, 100, 22), CSI "80G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 22, -5, 22), "\r");
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 22, 100, 22), CSI "80G");
CPPUNIT_ASSERT_STRING (om.moveCursor (3, 22, -5, 22), "\r");
// ynew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 23, 53, 40), ESC "D");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 2, 53, -3), ESC "M" ESC "M");
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 23, 53, 40), ESC "D");
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 2, 53, -3), ESC "M" ESC "M");
}
//----------------------------------------------------------------------
@ -641,39 +638,39 @@ void FOptiMoveTest::teratermTest()
om.setTermEnvironment(optimove_env);
CPPUNIT_ASSERT_CSTRING (om.moveCursor (0, 0, 5, 5), CSI "6;6H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 0, 0), CSI "H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 1), "\r");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 2), "\r\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 10, 4), CSI "C");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 4, 9, 4), "\b");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 11, 4), CSI "12G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (11, 4, 9, 4), "\b\b");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (1, 0, 8, 0), "\t");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 1), "\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 1, 16, 0), CSI "A");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 2), "\n\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 2, 16, 0), CSI "1d");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 2, 79, 2), CSI "80G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 75, 20), CSI "21;76H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (39, 0, 32, 0), CSI "33G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 0, 8, 0), "\b\b");
CPPUNIT_ASSERT_STRING (om.moveCursor (0, 0, 5, 5), CSI "6;6H");
CPPUNIT_ASSERT_STRING (om.moveCursor (5, 5, 0, 0), CSI "H");
CPPUNIT_ASSERT_STRING (om.moveCursor (79, 1, 0, 1), "\r");
CPPUNIT_ASSERT_STRING (om.moveCursor (79, 1, 0, 2), "\r\n");
CPPUNIT_ASSERT_STRING (om.moveCursor (9, 4, 10, 4), CSI "C");
CPPUNIT_ASSERT_STRING (om.moveCursor (10, 4, 9, 4), "\b");
CPPUNIT_ASSERT_STRING (om.moveCursor (9, 4, 11, 4), CSI "12G");
CPPUNIT_ASSERT_STRING (om.moveCursor (11, 4, 9, 4), "\b\b");
CPPUNIT_ASSERT_STRING (om.moveCursor (1, 0, 8, 0), "\t");
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 0, 16, 1), "\n");
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 1, 16, 0), CSI "A");
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 0, 16, 2), "\n\n");
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 2, 16, 0), CSI "1d");
CPPUNIT_ASSERT_STRING (om.moveCursor (3, 2, 79, 2), CSI "80G");
CPPUNIT_ASSERT_STRING (om.moveCursor (5, 5, 75, 20), CSI "21;76H");
CPPUNIT_ASSERT_STRING (om.moveCursor (39, 0, 32, 0), CSI "33G");
CPPUNIT_ASSERT_STRING (om.moveCursor (10, 0, 8, 0), "\b\b");
// xold is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (99, 10, 79, 10), CSI "11;80H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (-3, 33, 50, 10), CSI "11;51H");
CPPUNIT_ASSERT_STRING (om.moveCursor (99, 10, 79, 10), CSI "11;80H");
CPPUNIT_ASSERT_STRING (om.moveCursor (-3, 33, 50, 10), CSI "11;51H");
// ynew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, 33, 23, 10), CSI "11;24H");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, -3, 12, 10), CSI "11;13H");
CPPUNIT_ASSERT_STRING (om.moveCursor (23, 33, 23, 10), CSI "11;24H");
CPPUNIT_ASSERT_STRING (om.moveCursor (23, -3, 12, 10), CSI "11;13H");
// xnew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 22, 100, 22), CSI "80G");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 22, -5, 22), "\r");
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 22, 100, 22), CSI "80G");
CPPUNIT_ASSERT_STRING (om.moveCursor (3, 22, -5, 22), "\r");
// ynew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 23, 53, 40), "\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 2, 53, -3), CSI "1d");
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 23, 53, 40), "\n");
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 2, 53, -3), CSI "1d");
}
@ -699,39 +696,39 @@ void FOptiMoveTest::wyse50Test()
// << printSequence(om.moveCursor (1, 2, 3, 4))
// << "\n";
CPPUNIT_ASSERT_CSTRING (om.moveCursor (0, 0, 5, 5), ESC "=%%");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 0, 0), "\036");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 1), "\r");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (79, 1, 0, 2), "\r\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 10, 4), "\f");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 4, 9, 4), "\b");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (9, 4, 11, 4), "\f\f");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (11, 4, 9, 4), "\b\b");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (1, 0, 8, 0), ESC "= (");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 1), "\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 1, 16, 0), "\v");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 0, 16, 2), "\n\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (16, 2, 16, 0), "\v\v");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 2, 79, 2), "\r\b\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (5, 5, 75, 20), ESC "=4k");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (39, 0, 32, 0), ESC "= @");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (10, 0, 8, 0), "\b\b");
CPPUNIT_ASSERT_STRING (om.moveCursor (0, 0, 5, 5), ESC "=%%");
CPPUNIT_ASSERT_STRING (om.moveCursor (5, 5, 0, 0), "\036");
CPPUNIT_ASSERT_STRING (om.moveCursor (79, 1, 0, 1), "\r");
CPPUNIT_ASSERT_STRING (om.moveCursor (79, 1, 0, 2), "\r\n");
CPPUNIT_ASSERT_STRING (om.moveCursor (9, 4, 10, 4), "\f");
CPPUNIT_ASSERT_STRING (om.moveCursor (10, 4, 9, 4), "\b");
CPPUNIT_ASSERT_STRING (om.moveCursor (9, 4, 11, 4), "\f\f");
CPPUNIT_ASSERT_STRING (om.moveCursor (11, 4, 9, 4), "\b\b");
CPPUNIT_ASSERT_STRING (om.moveCursor (1, 0, 8, 0), ESC "= (");
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 0, 16, 1), "\n");
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 1, 16, 0), "\v");
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 0, 16, 2), "\n\n");
CPPUNIT_ASSERT_STRING (om.moveCursor (16, 2, 16, 0), "\v\v");
CPPUNIT_ASSERT_STRING (om.moveCursor (3, 2, 79, 2), "\r\b\n");
CPPUNIT_ASSERT_STRING (om.moveCursor (5, 5, 75, 20), ESC "=4k");
CPPUNIT_ASSERT_STRING (om.moveCursor (39, 0, 32, 0), ESC "= @");
CPPUNIT_ASSERT_STRING (om.moveCursor (10, 0, 8, 0), "\b\b");
// xold is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (99, 10, 79, 10), ESC "=*o");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (-3, 33, 50, 10), ESC "=*R");
CPPUNIT_ASSERT_STRING (om.moveCursor (99, 10, 79, 10), ESC "=*o");
CPPUNIT_ASSERT_STRING (om.moveCursor (-3, 33, 50, 10), ESC "=*R");
// ynew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, 33, 23, 10), ESC "=*7");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (23, -3, 12, 10), ESC "=*,");
CPPUNIT_ASSERT_STRING (om.moveCursor (23, 33, 23, 10), ESC "=*7");
CPPUNIT_ASSERT_STRING (om.moveCursor (23, -3, 12, 10), ESC "=*,");
// xnew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 22, 100, 22), "\r\b\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (3, 22, -5, 22), "\r");
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 22, 100, 22), "\r\b\n");
CPPUNIT_ASSERT_STRING (om.moveCursor (3, 22, -5, 22), "\r");
// ynew is outside screen
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 23, 53, 40), "\n");
CPPUNIT_ASSERT_CSTRING (om.moveCursor (53, 2, 53, -3), "\v\v");
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 23, 53, 40), "\n");
CPPUNIT_ASSERT_STRING (om.moveCursor (53, 2, 53, -3), "\v\v");
}
//----------------------------------------------------------------------