Adding Windows Terminal detection

This commit is contained in:
Markus Gans 2020-08-30 22:47:24 +02:00
parent 28080abb3e
commit fdd7ff98ec
17 changed files with 457 additions and 324 deletions

View File

@ -1,3 +1,6 @@
2020-08-30 Markus Gans <guru.mail@muenster.de>
* Adding Windows Terminal detection
2020-08-15 Markus Gans <guru.mail@muenster.de>
* The call of the function setNonBlockingRead() resulted in
a high CPU load in idle mode.

View File

@ -527,7 +527,7 @@ void classname::cb_methode (FWidget* w, int* i, double* d, ...)
We use the `addCallback()` method of the `FWidget` class to connect
to other widget objects.
(1) For calling functions or static methods via a pointer:
1. For calling functions or static methods via a pointer:
```cpp
template<typename Function
@ -539,7 +539,7 @@ void FWidget::addCallback ( const FString& cb_signal
{...}
```
(2) For calling functions or static methods via a reference:
2. For calling functions or static methods via a reference:
```cpp
template<typename Function
@ -551,7 +551,7 @@ void FWidget::addCallback ( const FString& cb_signal
{...}
```
(3) For calling a member method of a specific instance:
3. For calling a member method of a specific instance:
```cpp
template<typename Object
@ -566,7 +566,7 @@ void FWidget::addCallback ( const FString& cb_signal
{...}
```
(4) For calling a std::bind call wrapper or a lambda expression:
4. For calling a std::bind call wrapper or a lambda expression:
```cpp
template<typename Function
, typename ClassObject<Function>::type = nullptr
@ -577,7 +577,7 @@ void FWidget::addCallback ( const FString& cb_signal
{...}
```
(5) For calling a std::bind call wrapper to a specific instance:
5. For calling a std::bind call wrapper to a specific instance:
```cpp
template<typename Object
@ -592,7 +592,7 @@ void FWidget::addCallback ( const FString& cb_signal
{...}
```
(6) For calling a lambda function that has been stored in a variable
6. For calling a lambda function that has been stored in a variable
with the keyword auto:
```cpp
@ -609,7 +609,7 @@ With `delCallback(...)` you can remove a connection to a signal handler
or a widget instance. Alternatively, you can use `delCallbacks()` to
remove all existing callbacks from an object.
(1) To delete functions or static methods callbacks via a pointer:
1. To delete functions or static methods callbacks via a pointer:
```cpp
template<typename FunctionPtr
@ -618,7 +618,7 @@ void FWidget::delCallback (FunctionPtr&& cb_func_ptr)
{...}
```
(2) To delete functions or static methods callbacks via a reference:
2. To delete functions or static methods callbacks via a reference:
```cpp
template<typename Function
@ -627,7 +627,7 @@ void FWidget::delCallback (Function& cb_function)
{...}
```
(3) To delete all callbacks from a specific instance:
3. To delete all callbacks from a specific instance:
```cpp
template<typename Object
@ -636,14 +636,14 @@ void FWidget::delCallback (Object&& cb_instance)
{...}
```
(4) To delete all callbacks of a signal:
4. To delete all callbacks of a signal:
```cpp
void delCallback (const FString& cb_signal)
{...}
```
(5) To delete all callbacks of a signal and specific instance:
5. To delete all callbacks of a signal and specific instance:
```cpp
template<typename Object
@ -652,7 +652,7 @@ void delCallback (const FString& cb_signal, Object&& cb_instance)
{...}
```
(6) To delete all callbacks from a widget:
6. To delete all callbacks from a widget:
```cpp
void delCallback()

View File

@ -630,14 +630,16 @@ void FMenuItem::createDialogList (FMenu* winmenu) const
win_item->addCallback
(
"clicked",
std::move(win_item), &FMenuItem::cb_switchToDialog,
static_cast<std::remove_reference<decltype(win_item)>::type>(win_item),
&FMenuItem::cb_switchToDialog,
win
);
win->addCallback
(
"destroy",
std::move(win_item), &FMenuItem::cb_destroyDialog,
static_cast<std::remove_reference<decltype(win_item)>::type>(win_item),
&FMenuItem::cb_destroyDialog,
win
);

View File

@ -641,7 +641,7 @@ double FString::toDouble() const
wchar_t* p{};
const double ret = std::wcstod(string, &p);
if ( p != nullptr && *p != '\0' )
if ( p != nullptr && *p != L'\0' )
throw std::invalid_argument ("no valid floating point value");
if ( errno == ERANGE )

View File

@ -458,18 +458,18 @@ bool FTerm::isMonochron()
return data->isMonochron();
}
//----------------------------------------------------------------------
bool FTerm::isXTerminal()
{
return term_detection->isXTerminal();
}
//----------------------------------------------------------------------
bool FTerm::isAnsiTerminal()
{
return term_detection->isAnsiTerminal();
}
//----------------------------------------------------------------------
bool FTerm::isXTerminal()
{
return term_detection->isXTerminal();
}
//----------------------------------------------------------------------
bool FTerm::isRxvtTerminal()
{
@ -482,18 +482,6 @@ bool FTerm::isUrxvtTerminal()
return term_detection->isUrxvtTerminal();
}
//----------------------------------------------------------------------
bool FTerm::isMltermTerminal()
{
return term_detection->isMltermTerminal();
}
//----------------------------------------------------------------------
bool FTerm::isPuttyTerminal()
{
return term_detection->isPuttyTerminal();
}
//----------------------------------------------------------------------
bool FTerm::isKdeTerminal()
{
@ -507,9 +495,15 @@ bool FTerm::isGnomeTerminal()
}
//----------------------------------------------------------------------
bool FTerm::isKtermTerminal()
bool FTerm::isPuttyTerminal()
{
return term_detection->isKtermTerminal();
return term_detection->isPuttyTerminal();
}
//----------------------------------------------------------------------
bool FTerm::isWindowsTerminal()
{
return term_detection->isWindowsTerminal();
}
//----------------------------------------------------------------------
@ -518,12 +512,6 @@ bool FTerm::isTeraTerm()
return term_detection->isTeraTerm();
}
//----------------------------------------------------------------------
bool FTerm::isSunTerminal()
{
return term_detection->isSunTerminal();
}
//----------------------------------------------------------------------
bool FTerm::isCygwinTerminal()
{
@ -560,6 +548,12 @@ bool FTerm::isOpenBSDTerm()
return term_detection->isOpenBSDTerm();
}
//----------------------------------------------------------------------
bool FTerm::isSunTerminal()
{
return term_detection->isSunTerminal();
}
//----------------------------------------------------------------------
bool FTerm::isScreenTerm()
{
@ -572,6 +566,18 @@ bool FTerm::isTmuxTerm()
return term_detection->isTmuxTerm();
}
//----------------------------------------------------------------------
bool FTerm::isKtermTerminal()
{
return term_detection->isKtermTerminal();
}
//----------------------------------------------------------------------
bool FTerm::isMltermTerminal()
{
return term_detection->isMltermTerminal();
}
//----------------------------------------------------------------------
bool FTerm::isNewFont()
{

View File

@ -860,7 +860,10 @@ inline const char* FTermDetection::secDA_Analysis_0 (const char current_termtype
const char* new_termtype = current_termtype;
if ( secondary_da.terminal_id_version == 115 )
if ( secondary_da.terminal_id_version == 10
&& secondary_da.terminal_id_hardware == 1 )
terminal_type.win_terminal = true; // Windows Terminal >= 1.2
else if ( secondary_da.terminal_id_version == 115 )
terminal_type.kde_konsole = true;
else if ( secondary_da.terminal_id_version == 136 )
terminal_type.putty = true; // PuTTY

View File

@ -729,7 +729,7 @@ inline bool FTextView::isPrintable (wchar_t ch) const
const bool utf8 = ( FTerm::getEncoding() == fc::UTF8 ) ? true : false;
if ( (utf8 && std::iswprint(std::wint_t(ch)))
|| (!utf8 && std::isprint(ch)) )
|| (!utf8 && std::isprint(char(ch))) )
return true;
return false;

View File

@ -669,7 +669,7 @@ bool FWindow::zoomWindow()
}
//----------------------------------------------------------------------
void FWindow::switchToPrevWindow (FWidget* widget)
void FWindow::switchToPrevWindow (const FWidget* widget)
{
// switch to previous window

View File

@ -159,7 +159,7 @@ class FCallback
void addCallback ( const FString& cb_signal
, Object&& cb_instance
, Function&& cb_member
, Args&&... args);
, Args&&... args) noexcept;
template<typename Object
, typename Function
, typename ObjectPointer<Object>::type = nullptr
@ -168,41 +168,42 @@ class FCallback
void addCallback ( const FString& cb_signal
, Object&& cb_instance
, Function&& cb_function
, Args&&... args);
, Args&&... args) noexcept;
template<typename Function
, typename ClassObject<Function>::type = nullptr
, typename... Args>
void addCallback ( const FString& cb_signal
, Function&& cb_function
, Args&&... args);
, Args&&... args) noexcept;
template<typename Function
, typename ClassObject<Function>::type = nullptr
, typename... Args>
void addCallback ( const FString& cb_signal
, Function& cb_function
, Args&&... args);
, Args&&... args) noexcept;
template<typename Function
, typename FunctionReference<Function>::type = nullptr
, typename... Args>
void addCallback ( const FString& cb_signal
, Function& cb_function
, Args&&... args);
, Args&&... args) noexcept;
template<typename Function
, typename FunctionPointer<Function>::type = nullptr
, typename... Args>
void addCallback ( const FString& cb_signal
, Function&& cb_function
, Args&&... args);
, Args&&... args) noexcept;
template<typename Object
, typename ObjectPointer<Object>::type = nullptr>
void delCallback (Object&& cb_instance);
void delCallback (Object&& cb_instance) noexcept;
void delCallback (const FString& cb_signal);
template<typename Object
, typename ObjectPointer<Object>::type = nullptr>
void delCallback (const FString& cb_signal, Object&& cb_instance);
void delCallback ( const FString& cb_signal
, Object&& cb_instance ) noexcept;
template<typename FunctionPtr
, typename FunctionPointer<FunctionPtr>::type = nullptr>
void delCallback (FunctionPtr&& cb_func_ptr);
void delCallback (FunctionPtr&& cb_func_ptr) noexcept;
template<typename Function
, typename FunctionReference<Function>::type = nullptr>
void delCallback (const Function& cb_function);
@ -235,7 +236,7 @@ template<typename Object
inline void FCallback::addCallback ( const FString& cb_signal
, Object&& cb_instance
, Function&& cb_member
, Args&&... args)
, Args&&... args) noexcept
{
// Add a member function pointer as callback
@ -256,7 +257,7 @@ template<typename Object
inline void FCallback::addCallback ( const FString& cb_signal
, Object&& cb_instance
, Function&& cb_function
, Args&&... args)
, Args&&... args) noexcept
{
// Add a function object to an instance as callback
@ -271,7 +272,7 @@ template<typename Function
, typename... Args>
inline void FCallback::addCallback ( const FString& cb_signal
, Function&& cb_function
, Args&&... args)
, Args&&... args) noexcept
{
// Add a function object as callback
@ -287,7 +288,7 @@ template<typename Function
, typename... Args>
inline void FCallback::addCallback ( const FString& cb_signal
, Function& cb_function
, Args&&... args)
, Args&&... args) noexcept
{
// Add a function object reference as callback
@ -302,7 +303,7 @@ template<typename Function
, typename... Args>
inline void FCallback::addCallback ( const FString& cb_signal
, Function& cb_function
, Args&&... args)
, Args&&... args) noexcept
{
// Add a function reference as callback
@ -318,7 +319,7 @@ template<typename Function
, typename... Args>
inline void FCallback::addCallback ( const FString& cb_signal
, Function&& cb_function
, Args&&... args)
, Args&&... args) noexcept
{
// Add a function pointer as callback
@ -332,7 +333,7 @@ inline void FCallback::addCallback ( const FString& cb_signal
//----------------------------------------------------------------------
template<typename Object
, typename FCallback::ObjectPointer<Object>::type>
inline void FCallback::delCallback (Object&& cb_instance)
inline void FCallback::delCallback (Object&& cb_instance) noexcept
{
// Deletes entries with the given instance from the callback list
@ -353,7 +354,8 @@ inline void FCallback::delCallback (Object&& cb_instance)
//----------------------------------------------------------------------
template<typename Object
, typename FCallback::ObjectPointer<Object>::type>
inline void FCallback::delCallback (const FString& cb_signal, Object&& cb_instance)
inline void FCallback::delCallback ( const FString& cb_signal
, Object&& cb_instance ) noexcept
{
// Deletes entries with the given signal and instance
// from the callback list
@ -376,7 +378,7 @@ inline void FCallback::delCallback (const FString& cb_signal, Object&& cb_instan
//----------------------------------------------------------------------
template<typename FunctionPtr
, typename FCallback::FunctionPointer<FunctionPtr>::type>
inline void FCallback::delCallback (FunctionPtr&& cb_func_ptr)
inline void FCallback::delCallback (FunctionPtr&& cb_func_ptr) noexcept
{
// Deletes entries with the given function pointer
// from the callback list

View File

@ -221,25 +221,26 @@ class FTerm final
static bool hasVT100();
static bool hasASCII();
static bool isMonochron();
static bool isXTerminal();
static bool isAnsiTerminal();
static bool isXTerminal();
static bool isRxvtTerminal();
static bool isUrxvtTerminal();
static bool isMltermTerminal();
static bool isPuttyTerminal();
static bool isKdeTerminal();
static bool isGnomeTerminal();
static bool isKtermTerminal();
static bool isPuttyTerminal();
static bool isWindowsTerminal();
static bool isTeraTerm();
static bool isSunTerminal();
static bool isCygwinTerminal();
static bool isMinttyTerm();
static bool isLinuxTerm();
static bool isFreeBSDTerm();
static bool isNetBSDTerm();
static bool isOpenBSDTerm();
static bool isSunTerminal();
static bool isScreenTerm();
static bool isTmuxTerm();
static bool isKtermTerminal();
static bool isMltermTerminal();
static bool isNewFont();
static bool isInitialized();
static bool isCursorHideable();

View File

@ -58,12 +58,11 @@ class FTermDetection final
uInt8 xterm : 1;
uInt8 rxvt : 1;
uInt8 urxvt : 1;
uInt8 mlterm : 1;
uInt8 putty : 1;
uInt8 kde_konsole : 1;
uInt8 gnome_terminal : 1;
uInt8 putty : 1;
uInt8 win_terminal : 1;
// byte #1
uInt8 kterm : 1;
uInt8 tera_term : 1;
uInt8 cygwin : 1;
uInt8 mintty : 1;
@ -71,11 +70,13 @@ class FTermDetection final
uInt8 freebsd_con : 1;
uInt8 netbsd_con : 1;
uInt8 openbsd_con : 1;
// byte #2
uInt8 sun_con : 1;
// byte #2
uInt8 screen : 1;
uInt8 tmux : 1;
uInt8 : 5; // padding bits
uInt8 kterm : 1;
uInt8 mlterm : 1;
uInt8 : 4; // padding bits
} FTerminalType;
// Constructors
@ -109,11 +110,10 @@ class FTermDetection final
static bool isXTerminal();
static bool isRxvtTerminal();
static bool isUrxvtTerminal();
static bool isMltermTerminal();
static bool isPuttyTerminal();
static bool isKdeTerminal();
static bool isGnomeTerminal();
static bool isKtermTerminal();
static bool isPuttyTerminal();
static bool isWindowsTerminal();
static bool isTeraTerm();
static bool isCygwinTerminal();
static bool isMinttyTerm();
@ -124,6 +124,8 @@ class FTermDetection final
static bool isSunTerminal();
static bool isScreenTerm();
static bool isTmuxTerm();
static bool isKtermTerminal();
static bool isMltermTerminal();
static bool canDisplay256Colors();
static bool hasTerminalDetection();
static bool hasSetCursorStyleSupport();
@ -133,11 +135,10 @@ class FTermDetection final
static void setXTerminal (bool);
static void setRxvtTerminal (bool);
static void setUrxvtTerminal (bool);
static void setMltermTerminal (bool);
static void setPuttyTerminal (bool);
static void setKdeTerminal (bool);
static void setGnomeTerminal (bool);
static void setKtermTerminal (bool);
static void setPuttyTerminal (bool);
static void setWindowsTerminal (bool);
static void setTeraTerm (bool);
static void setCygwinTerminal (bool);
static void setMinttyTerm (bool);
@ -148,6 +149,8 @@ class FTermDetection final
static void setSunTerminal (bool);
static void setScreenTerm (bool);
static void setTmuxTerm (bool);
static void setKtermTerminal (bool);
static void setMltermTerminal (bool);
static void setTerminalDetection (bool);
static void setTtyTypeFileName (const char[]);
@ -301,6 +304,10 @@ inline bool FTermDetection::isMltermTerminal()
inline bool FTermDetection::isPuttyTerminal()
{ return terminal_type.putty; }
//----------------------------------------------------------------------
inline bool FTermDetection::isWindowsTerminal()
{ return terminal_type.win_terminal; }
//----------------------------------------------------------------------
inline bool FTermDetection::isKdeTerminal()
{ return terminal_type.kde_konsole; }
@ -381,6 +388,10 @@ inline void FTermDetection::setMltermTerminal (bool enable)
inline void FTermDetection::setPuttyTerminal (bool enable)
{ terminal_type.putty = enable; }
//----------------------------------------------------------------------
inline void FTermDetection::setWindowsTerminal (bool enable)
{ terminal_type.win_terminal = enable; }
//----------------------------------------------------------------------
inline void FTermDetection::setKdeTerminal (bool enable)
{ terminal_type.kde_konsole = enable; }

View File

@ -48,6 +48,8 @@
#error "Only <final/final.h> can be included directly."
#endif
#include <sys/time.h> // need for timeval (cygwin)
#include <queue>
#include <string>
#include <utility>

View File

@ -318,9 +318,9 @@ class FWidget : public FVTerm, public FObject
virtual bool close();
void clearStatusbarMessage();
template<typename... Args>
void addCallback (const FString&, Args&&...);
void addCallback (const FString&, Args&&...) noexcept;
template<typename... Args>
void delCallback (Args&&...);
void delCallback (Args&&...) noexcept;
void emitCallback (const FString&) const;
void addAccelerator (FKey);
virtual void addAccelerator (FKey, FWidget*);
@ -985,14 +985,14 @@ inline void FWidget::clearStatusbarMessage()
//----------------------------------------------------------------------
template<typename... Args>
inline void FWidget::addCallback (const FString& cb_signal, Args&&... args)
inline void FWidget::addCallback (const FString& cb_signal, Args&&... args) noexcept
{
callback_impl.addCallback (cb_signal, std::forward<Args>(args)...);
}
//----------------------------------------------------------------------
template<typename... Args>
inline void FWidget::delCallback (Args&&... args)
inline void FWidget::delCallback (Args&&... args) noexcept
{
callback_impl.delCallback(std::forward<Args>(args)...);
}

View File

@ -143,7 +143,7 @@ class FWindow : public FWidget
static bool lowerWindow (FWidget*);
bool lowerWindow ();
bool zoomWindow ();
static void switchToPrevWindow (FWidget*);
static void switchToPrevWindow (const FWidget*);
static bool activatePrevWindow();
void setShadowSize (const FSize&) override;

View File

@ -53,12 +53,11 @@ class ConEmu
xterm,
rxvt,
urxvt,
mlterm,
putty,
kde_konsole,
gnome_terminal,
newer_vte_terminal,
kterm,
putty,
win_terminal,
tera_term,
cygwin,
mintty,
@ -68,7 +67,9 @@ class ConEmu
openbsd_con,
sun_con,
screen,
tmux
tmux,
kterm,
mlterm
};
// Constructors
@ -634,12 +635,11 @@ inline const char* ConEmu::getAnswerback (console con)
0, // XTerm
0, // Rxvt
0, // Urxvt
0, // mlterm - Multi Lingual TERMinal
C_STR("PuTTY"), // PuTTY
0, // KDE Konsole
0, // GNOME Terminal
0, // VTE Terminal >= 0.53.0
0, // kterm,
C_STR("PuTTY"), // PuTTY
C_STR("\005"), // Windows Terminal
0, // Tera Term
0, // Cygwin
0, // Mintty
@ -649,7 +649,9 @@ inline const char* ConEmu::getAnswerback (console con)
0, // OpenBSD console
0, // Sun console
0, // screen
0 // tmux
0, // tmux
0, // kterm,
0 // mlterm - Multi Lingual TERMinal
};
return Answerback[con];
@ -664,12 +666,11 @@ inline const char* ConEmu::getDSR (console con)
C_STR("\033[0n"), // XTerm
C_STR("\033[0n"), // Rxvt
C_STR("\033[0n"), // Urxvt
C_STR("\033[0n"), // mlterm - Multi Lingual TERMinal
C_STR("\033[0n"), // PuTTY
C_STR("\033[0n"), // KDE Konsole
C_STR("\033[0n"), // GNOME Terminal
C_STR("\033[0n"), // VTE Terminal >= 0.53.0
C_STR("\033[0n"), // kterm,
C_STR("\033[0n"), // PuTTY
C_STR("\033[0n"), // Windows Terminal >= 1.2
C_STR("\033[0n"), // Tera Term
0, // Cygwin
C_STR("\033[0n"), // Mintty
@ -679,7 +680,9 @@ inline const char* ConEmu::getDSR (console con)
C_STR("\033[0n"), // OpenBSD console
0, // Sun console
C_STR("\033[0n"), // screen
C_STR("\033[0n") // tmux
C_STR("\033[0n"), // tmux
C_STR("\033[0n"), // kterm
C_STR("\033[0n") // mlterm - Multi Lingual TERMinal
};
return DSR[con];
@ -694,12 +697,11 @@ inline const char* ConEmu::getDECID (console con)
C_STR("\033[?63;1;2;6;4;6;9;15;22c"), // XTerm
C_STR("\033[?1;2c"), // Rxvt
C_STR("\033[?1;2c"), // Urxvt
C_STR("\033[?63;1;2;3;4;7;29c"), // mlterm - Multi Lingual TERMinal
C_STR("\033[?6c"), // PuTTY
C_STR("\033[?1;2c"), // KDE Konsole
C_STR("\033[?62;c"), // GNOME Terminal
C_STR("\033[?65;1;9c"), // VTE Terminal >= 0.53.0
C_STR("\033[?1;2c"), // kterm,
C_STR("\033[?6c"), // PuTTY
0, // Windows Terminal
C_STR("\033[?1;2c"), // Tera Term
0, // Cygwin
C_STR("\033[?1;2;6;22c"), // Mintty
@ -709,7 +711,9 @@ inline const char* ConEmu::getDECID (console con)
0, // OpenBSD console
0, // Sun console
C_STR("\033[?1;2c"), // screen
0 // tmux
0, // tmux
C_STR("\033[?1;2c"), // kterm
C_STR("\033[?63;1;2;3;4;7;29c") // mlterm - Multi Lingual TERMinal
};
return DECID[con];
@ -724,12 +728,11 @@ inline const char* ConEmu::getDA (console con)
C_STR("\033[?63;1;2;6;4;6;9;15;22c"), // XTerm
C_STR("\033[?1;2c"), // Rxvt
C_STR("\033[?1;2c"), // Urxvt
C_STR("\033[?63;1;2;3;4;7;29c"), // mlterm - Multi Lingual TERMinal
C_STR("\033[?6c"), // PuTTY
C_STR("\033[?1;2c"), // KDE Konsole
C_STR("\033[?62;c"), // GNOME Terminal
C_STR("\033[?65;1;9c"), // VTE Terminal >= 0.53.0
C_STR("\033[?1;2c"), // kterm,
C_STR("\033[?6c"), // PuTTY
C_STR("\033[?1;0c"), // Windows Terminal >= 1.2
C_STR("\033[?1;2c"), // Tera Term
C_STR("\033[?6c"), // Cygwin
C_STR("\033[?1;2;6;22c"), // Mintty
@ -739,7 +742,9 @@ inline const char* ConEmu::getDA (console con)
C_STR("\033[?62;6c"), // OpenBSD console
0, // Sun console
C_STR("\033[?1;2c"), // screen
C_STR("\033[?1;2c") // tmux
C_STR("\033[?1;2c"), // tmux
C_STR("\033[?1;2c"), // kterm
C_STR("\033[?63;1;2;3;4;7;29c") // mlterm - Multi Lingual TERMinal
};
return DA[con];
@ -754,12 +759,11 @@ inline const char* ConEmu::getDA1 (console con)
0, // XTerm
C_STR("\033[?1;2c"), // Rxvt
C_STR("\033[?1;2c"), // Urxvt
C_STR("\033[?63;1;2;3;4;7;29c"), // mlterm - Multi Lingual TERMinal
C_STR("\033[?6c"), // PuTTY
C_STR("\033[?1;2c"), // KDE Konsole
C_STR("\033[?62;c"), // GNOME Terminal
C_STR("\033[?65;1;9c"), // VTE Terminal >= 0.53.0
0, // kterm,
C_STR("\033[?6c"), // PuTTY
0, // Windows Terminal
C_STR("\033[?1;2c"), // Tera Term
C_STR("\033[?6c"), // Cygwin
C_STR("\033[?1;2;6;22c"), // Mintty
@ -769,7 +773,9 @@ inline const char* ConEmu::getDA1 (console con)
0, // OpenBSD console
0, // Sun console
0, // screen
0 // tmux
0, // tmux
0, // kterm
C_STR("\033[?63;1;2;3;4;7;29c") // mlterm - Multi Lingual TERMinal
};
return DA1[con];
@ -784,12 +790,11 @@ inline const char* ConEmu::getSEC_DA (console con)
C_STR("\033[>19;312;0c"), // XTerm
C_STR("\033[>82;20710;0c"), // Rxvt
C_STR("\033[>85;95;0c"), // Urxvt
C_STR("\033[>24;279;0c"), // mlterm - Multi Lingual TERMinal
C_STR("\033[>0;136;0c"), // PuTTY
C_STR("\033[>0;115;0c"), // KDE Konsole
C_STR("\033[>1;5202;0c"), // GNOME Terminal
C_STR("\033[>65;5300;1c"), // VTE Terminal >= 0.53.0
C_STR("\033[?1;2c"), // kterm,
C_STR("\033[>0;136;0c"), // PuTTY
C_STR("\033[>0;10;1c"), // Windows Terminal >= 1.2
C_STR("\033[>32;278;0c"), // Tera Term
C_STR("\033[>67;200502;0c"), // Cygwin
C_STR("\033[>77;20402;0c"), // Mintty
@ -799,7 +804,9 @@ inline const char* ConEmu::getSEC_DA (console con)
C_STR("\033[>24;20;0c"), // OpenBSD console
0, // Sun console
C_STR("\033[>83;40201;0c"), // screen
C_STR("\033[>84;0;0c") // tmux
C_STR("\033[>84;0;0c"), // tmux
C_STR("\033[?1;2c"), // kterm
C_STR("\033[>24;279;0c") // mlterm - Multi Lingual TERMinal
};
return SEC_DA[con];
@ -968,17 +975,18 @@ inline void ConEmu::parseTerminalBuffer (std::size_t length, console con)
write (fd_master, "\033]lbash\033\\", 9);
else if ( con != ansi
&& con != rxvt
&& con != mlterm
&& con != kde_konsole
&& con != kterm
&& con != cygwin
&& con != win_terminal
&& con != mintty
&& con != linux_con
&& con != freebsd_con
&& con != netbsd_con
&& con != openbsd_con
&& con != sun_con
&& con != tmux )
&& con != tmux
&& con != kterm
&& con != mlterm )
write (fd_master, "\033]lTITLE\033\\", 10);
i += 5;
@ -996,8 +1004,8 @@ inline void ConEmu::parseTerminalBuffer (std::size_t length, console con)
if ( con != ansi
&& con != rxvt
&& con != kde_konsole
&& con != kterm
&& con != cygwin
&& con != win_terminal
&& con != mintty
&& con != linux_con
&& con != freebsd_con
@ -1005,7 +1013,8 @@ inline void ConEmu::parseTerminalBuffer (std::size_t length, console con)
&& con != openbsd_con
&& con != sun_con
&& con != screen
&& con != tmux )
&& con != tmux
&& con != kterm )
{
int n = buffer[i + 4] - '0';
write (fd_master, "\033]4;", 4);
@ -1031,8 +1040,8 @@ inline void ConEmu::parseTerminalBuffer (std::size_t length, console con)
if ( con != ansi
&& con != rxvt
&& con != kde_konsole
&& con != kterm
&& con != cygwin
&& con != win_terminal
&& con != mintty
&& con != linux_con
&& con != freebsd_con
@ -1040,7 +1049,8 @@ inline void ConEmu::parseTerminalBuffer (std::size_t length, console con)
&& con != openbsd_con
&& con != sun_con
&& con != screen
&& con != tmux )
&& con != tmux
&& con != kterm )
{
int n = (buffer[i + 4] - '0') * 10
+ (buffer[i + 5] - '0');
@ -1069,8 +1079,8 @@ inline void ConEmu::parseTerminalBuffer (std::size_t length, console con)
if ( con != ansi
&& con != rxvt
&& con != kde_konsole
&& con != kterm
&& con != cygwin
&& con != win_terminal
&& con != mintty
&& con != linux_con
&& con != freebsd_con
@ -1078,7 +1088,8 @@ inline void ConEmu::parseTerminalBuffer (std::size_t length, console con)
&& con != openbsd_con
&& con != sun_con
&& con != screen
&& con != tmux )
&& con != tmux
&& con != kterm )
{
int n = (buffer[i + 4] - '0') * 100
+ (buffer[i + 5] - '0') * 10

View File

@ -202,6 +202,12 @@ void FStringStreamTest::fileTest()
{
std::ofstream file_stream(filename, std::ofstream::out);
if ( ! file_stream.is_open() )
{
throw std::iostream::failure("Failed to open \"" + filename + "\"");
}
ss << "FStringStream file test\n";
file_stream << ss.str();

View File

@ -68,12 +68,11 @@ class FTermDetectionTest : public CPPUNIT_NS::TestFixture, test::ConEmu
void xtermTest();
void rxvtTest();
void urxvtTest();
void mltermTest();
void puttyTest();
void kdeKonsoleTest();
void gnomeTerminalTest();
void newerVteTerminalTest();
void ktermTest();
void puttyTest();
void windowsTerminalTest();
void teraTermTest();
void cygwinTest();
void minttyTest();
@ -84,6 +83,8 @@ class FTermDetectionTest : public CPPUNIT_NS::TestFixture, test::ConEmu
void sunTest();
void screenTest();
void tmuxTest();
void ktermTest();
void mltermTest();
void ttytypeTest();
private:
@ -96,12 +97,11 @@ class FTermDetectionTest : public CPPUNIT_NS::TestFixture, test::ConEmu
CPPUNIT_TEST (xtermTest);
CPPUNIT_TEST (rxvtTest);
CPPUNIT_TEST (urxvtTest);
CPPUNIT_TEST (mltermTest);
CPPUNIT_TEST (puttyTest);
CPPUNIT_TEST (kdeKonsoleTest);
CPPUNIT_TEST (gnomeTerminalTest);
CPPUNIT_TEST (newerVteTerminalTest);
CPPUNIT_TEST (ktermTest);
CPPUNIT_TEST (puttyTest);
CPPUNIT_TEST (windowsTerminalTest);
CPPUNIT_TEST (teraTermTest);
CPPUNIT_TEST (cygwinTest);
CPPUNIT_TEST (minttyTest);
@ -112,6 +112,8 @@ class FTermDetectionTest : public CPPUNIT_NS::TestFixture, test::ConEmu
CPPUNIT_TEST (sunTest);
CPPUNIT_TEST (screenTest);
CPPUNIT_TEST (tmuxTest);
CPPUNIT_TEST (ktermTest);
CPPUNIT_TEST (mltermTest);
CPPUNIT_TEST (ttytypeTest);
// End of test suite definition
@ -162,11 +164,10 @@ void FTermDetectionTest::ansiTest()
CPPUNIT_ASSERT ( detect.isAnsiTerminal() );
CPPUNIT_ASSERT ( ! detect.isRxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isUrxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.isPuttyTerminal() );
CPPUNIT_ASSERT ( ! detect.isKdeTerminal() );
CPPUNIT_ASSERT ( ! detect.isGnomeTerminal() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isPuttyTerminal() );
CPPUNIT_ASSERT ( ! detect.isWindowsTerminal() );
CPPUNIT_ASSERT ( ! detect.isTeraTerm() );
CPPUNIT_ASSERT ( ! detect.isCygwinTerminal() );
CPPUNIT_ASSERT ( ! detect.isMinttyTerm() );
@ -177,6 +178,8 @@ void FTermDetectionTest::ansiTest()
CPPUNIT_ASSERT ( ! detect.isSunTerminal() );
CPPUNIT_ASSERT ( ! detect.isScreenTerm() );
CPPUNIT_ASSERT ( ! detect.isTmuxTerm() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( ! detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() );
@ -231,11 +234,10 @@ void FTermDetectionTest::xtermTest()
CPPUNIT_ASSERT ( ! detect.isAnsiTerminal() );
CPPUNIT_ASSERT ( ! detect.isRxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isUrxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.isPuttyTerminal() );
CPPUNIT_ASSERT ( ! detect.isKdeTerminal() );
CPPUNIT_ASSERT ( ! detect.isGnomeTerminal() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isPuttyTerminal() );
CPPUNIT_ASSERT ( ! detect.isWindowsTerminal() );
CPPUNIT_ASSERT ( ! detect.isTeraTerm() );
CPPUNIT_ASSERT ( ! detect.isCygwinTerminal() );
CPPUNIT_ASSERT ( ! detect.isMinttyTerm() );
@ -246,6 +248,8 @@ void FTermDetectionTest::xtermTest()
CPPUNIT_ASSERT ( ! detect.isSunTerminal() );
CPPUNIT_ASSERT ( ! detect.isScreenTerm() );
CPPUNIT_ASSERT ( ! detect.isTmuxTerm() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( detect.hasSetCursorStyleSupport() );
@ -292,11 +296,10 @@ void FTermDetectionTest::rxvtTest()
CPPUNIT_ASSERT ( ! detect.isAnsiTerminal() );
CPPUNIT_ASSERT ( detect.isRxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isUrxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.isPuttyTerminal() );
CPPUNIT_ASSERT ( ! detect.isKdeTerminal() );
CPPUNIT_ASSERT ( ! detect.isGnomeTerminal() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isPuttyTerminal() );
CPPUNIT_ASSERT ( ! detect.isWindowsTerminal() );
CPPUNIT_ASSERT ( ! detect.isTeraTerm() );
CPPUNIT_ASSERT ( ! detect.isCygwinTerminal() );
CPPUNIT_ASSERT ( ! detect.isMinttyTerm() );
@ -307,6 +310,8 @@ void FTermDetectionTest::rxvtTest()
CPPUNIT_ASSERT ( ! detect.isSunTerminal() );
CPPUNIT_ASSERT ( ! detect.isScreenTerm() );
CPPUNIT_ASSERT ( ! detect.isTmuxTerm() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() );
@ -354,11 +359,10 @@ void FTermDetectionTest::urxvtTest()
CPPUNIT_ASSERT ( ! detect.isAnsiTerminal() );
CPPUNIT_ASSERT ( detect.isRxvtTerminal() );
CPPUNIT_ASSERT ( detect.isUrxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.isPuttyTerminal() );
CPPUNIT_ASSERT ( ! detect.isKdeTerminal() );
CPPUNIT_ASSERT ( ! detect.isGnomeTerminal() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isPuttyTerminal() );
CPPUNIT_ASSERT ( ! detect.isWindowsTerminal() );
CPPUNIT_ASSERT ( ! detect.isTeraTerm() );
CPPUNIT_ASSERT ( ! detect.isCygwinTerminal() );
CPPUNIT_ASSERT ( ! detect.isMinttyTerm() );
@ -369,6 +373,8 @@ void FTermDetectionTest::urxvtTest()
CPPUNIT_ASSERT ( ! detect.isSunTerminal() );
CPPUNIT_ASSERT ( ! detect.isScreenTerm() );
CPPUNIT_ASSERT ( ! detect.isTmuxTerm() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() );
@ -387,137 +393,6 @@ void FTermDetectionTest::urxvtTest()
}
}
//----------------------------------------------------------------------
void FTermDetectionTest::mltermTest()
{
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect;
data.setTermType("mlterm");
detect.setTerminalDetection(true);
pid_t pid = forkConEmu();
if ( isConEmuChildProcess(pid) )
{
setenv ("TERM", "mlterm", 1);
setenv ("MLTERM", "3.8.4", 1);
setenv ("COLORFGBG", "default;default", 1);
unsetenv("TERMCAP");
unsetenv("COLORTERM");
unsetenv("VTE_VERSION");
unsetenv("XTERM_VERSION");
unsetenv("ROXTERM_ID");
unsetenv("KONSOLE_DBUS_SESSION");
unsetenv("KONSOLE_DCOP");
unsetenv("TMUX");
detect.detect();
CPPUNIT_ASSERT ( ! detect.isXTerminal() );
CPPUNIT_ASSERT ( ! detect.isAnsiTerminal() );
CPPUNIT_ASSERT ( ! detect.isRxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isUrxvtTerminal() );
CPPUNIT_ASSERT ( detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.isPuttyTerminal() );
CPPUNIT_ASSERT ( ! detect.isKdeTerminal() );
CPPUNIT_ASSERT ( ! detect.isGnomeTerminal() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isTeraTerm() );
CPPUNIT_ASSERT ( ! detect.isCygwinTerminal() );
CPPUNIT_ASSERT ( ! detect.isMinttyTerm() );
CPPUNIT_ASSERT ( ! detect.isLinuxTerm() );
CPPUNIT_ASSERT ( ! detect.isFreeBSDTerm() );
CPPUNIT_ASSERT ( ! detect.isNetBSDTerm() );
CPPUNIT_ASSERT ( ! detect.isOpenBSDTerm() );
CPPUNIT_ASSERT ( ! detect.isSunTerminal() );
CPPUNIT_ASSERT ( ! detect.isScreenTerm() );
CPPUNIT_ASSERT ( ! detect.isTmuxTerm() );
CPPUNIT_ASSERT ( detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() );
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), "mlterm-256color" );
setenv ("TERM", "mlterm", 1);
unsetenv("COLORFGBG");
detect.detect();
CPPUNIT_ASSERT ( detect.canDisplay256Colors() );
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), "xterm-256color" );
printConEmuDebug();
closeConEmuStdStreams();
exit(EXIT_SUCCESS);
}
else // Parent
{
// Start the terminal emulation
startConEmuTerminal (ConEmu::mlterm);
if ( waitpid(pid, 0, WUNTRACED) != pid )
std::cerr << "waitpid error" << std::endl;
}
}
//----------------------------------------------------------------------
void FTermDetectionTest::puttyTest()
{
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect;
data.setTermType("xterm");
detect.setTerminalDetection(true);
pid_t pid = forkConEmu();
if ( isConEmuChildProcess(pid) )
{
setenv ("TERM", "xterm", 1);
unsetenv("TERMCAP");
unsetenv("COLORTERM");
unsetenv("COLORFGBG");
unsetenv("VTE_VERSION");
unsetenv("XTERM_VERSION");
unsetenv("ROXTERM_ID");
unsetenv("KONSOLE_DBUS_SESSION");
unsetenv("KONSOLE_DCOP");
unsetenv("TMUX");
detect.detect();
CPPUNIT_ASSERT ( detect.isXTerminal() );
CPPUNIT_ASSERT ( ! detect.isAnsiTerminal() );
CPPUNIT_ASSERT ( ! detect.isRxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isUrxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( detect.isPuttyTerminal() );
CPPUNIT_ASSERT ( ! detect.isKdeTerminal() );
CPPUNIT_ASSERT ( ! detect.isGnomeTerminal() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isTeraTerm() );
CPPUNIT_ASSERT ( ! detect.isCygwinTerminal() );
CPPUNIT_ASSERT ( ! detect.isMinttyTerm() );
CPPUNIT_ASSERT ( ! detect.isLinuxTerm() );
CPPUNIT_ASSERT ( ! detect.isFreeBSDTerm() );
CPPUNIT_ASSERT ( ! detect.isNetBSDTerm() );
CPPUNIT_ASSERT ( ! detect.isOpenBSDTerm() );
CPPUNIT_ASSERT ( ! detect.isSunTerminal() );
CPPUNIT_ASSERT ( ! detect.isScreenTerm() );
CPPUNIT_ASSERT ( ! detect.isTmuxTerm() );
CPPUNIT_ASSERT ( detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() );
enableConEmuDebug(true);
printConEmuDebug();
closeConEmuStdStreams();
exit(EXIT_SUCCESS);
}
else // Parent
{
// Start the terminal emulation
startConEmuTerminal (ConEmu::putty);
if ( waitpid(pid, 0, WUNTRACED) != pid )
std::cerr << "waitpid error" << std::endl;
}
}
//----------------------------------------------------------------------
void FTermDetectionTest::kdeKonsoleTest()
{
@ -546,11 +421,10 @@ void FTermDetectionTest::kdeKonsoleTest()
CPPUNIT_ASSERT ( ! detect.isAnsiTerminal() );
CPPUNIT_ASSERT ( ! detect.isRxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isUrxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.isPuttyTerminal() );
CPPUNIT_ASSERT ( detect.isKdeTerminal() );
CPPUNIT_ASSERT ( ! detect.isGnomeTerminal() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isPuttyTerminal() );
CPPUNIT_ASSERT ( ! detect.isWindowsTerminal() );
CPPUNIT_ASSERT ( ! detect.isTeraTerm() );
CPPUNIT_ASSERT ( ! detect.isCygwinTerminal() );
CPPUNIT_ASSERT ( ! detect.isMinttyTerm() );
@ -561,6 +435,8 @@ void FTermDetectionTest::kdeKonsoleTest()
CPPUNIT_ASSERT ( ! detect.isSunTerminal() );
CPPUNIT_ASSERT ( ! detect.isScreenTerm() );
CPPUNIT_ASSERT ( ! detect.isTmuxTerm() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() );
@ -608,11 +484,10 @@ void FTermDetectionTest::gnomeTerminalTest()
CPPUNIT_ASSERT ( ! detect.isAnsiTerminal() );
CPPUNIT_ASSERT ( ! detect.isRxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isUrxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.isPuttyTerminal() );
CPPUNIT_ASSERT ( ! detect.isKdeTerminal() );
CPPUNIT_ASSERT ( detect.isGnomeTerminal() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isPuttyTerminal() );
CPPUNIT_ASSERT ( ! detect.isWindowsTerminal() );
CPPUNIT_ASSERT ( ! detect.isTeraTerm() );
CPPUNIT_ASSERT ( ! detect.isCygwinTerminal() );
CPPUNIT_ASSERT ( ! detect.isMinttyTerm() );
@ -623,6 +498,8 @@ void FTermDetectionTest::gnomeTerminalTest()
CPPUNIT_ASSERT ( ! detect.isSunTerminal() );
CPPUNIT_ASSERT ( ! detect.isScreenTerm() );
CPPUNIT_ASSERT ( ! detect.isTmuxTerm() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( detect.hasSetCursorStyleSupport() );
@ -670,11 +547,10 @@ void FTermDetectionTest::newerVteTerminalTest()
CPPUNIT_ASSERT ( ! detect.isAnsiTerminal() );
CPPUNIT_ASSERT ( ! detect.isRxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isUrxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.isPuttyTerminal() );
CPPUNIT_ASSERT ( ! detect.isKdeTerminal() );
CPPUNIT_ASSERT ( detect.isGnomeTerminal() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isPuttyTerminal() );
CPPUNIT_ASSERT ( ! detect.isWindowsTerminal() );
CPPUNIT_ASSERT ( ! detect.isTeraTerm() );
CPPUNIT_ASSERT ( ! detect.isCygwinTerminal() );
CPPUNIT_ASSERT ( ! detect.isMinttyTerm() );
@ -685,6 +561,8 @@ void FTermDetectionTest::newerVteTerminalTest()
CPPUNIT_ASSERT ( ! detect.isSunTerminal() );
CPPUNIT_ASSERT ( ! detect.isScreenTerm() );
CPPUNIT_ASSERT ( ! detect.isTmuxTerm() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( detect.hasSetCursorStyleSupport() );
@ -704,18 +582,18 @@ void FTermDetectionTest::newerVteTerminalTest()
}
//----------------------------------------------------------------------
void FTermDetectionTest::ktermTest()
void FTermDetectionTest::puttyTest()
{
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect;
data.setTermType("kterm");
data.setTermType("xterm");
detect.setTerminalDetection(true);
pid_t pid = forkConEmu();
if ( isConEmuChildProcess(pid) )
{
setenv ("TERM", "kterm", 1);
setenv ("TERM", "xterm", 1);
unsetenv("TERMCAP");
unsetenv("COLORTERM");
unsetenv("COLORFGBG");
@ -725,18 +603,16 @@ void FTermDetectionTest::ktermTest()
unsetenv("KONSOLE_DBUS_SESSION");
unsetenv("KONSOLE_DCOP");
unsetenv("TMUX");
detect.detect();
CPPUNIT_ASSERT ( ! detect.isXTerminal() );
CPPUNIT_ASSERT ( detect.isXTerminal() );
CPPUNIT_ASSERT ( ! detect.isAnsiTerminal() );
CPPUNIT_ASSERT ( ! detect.isRxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isUrxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.isPuttyTerminal() );
CPPUNIT_ASSERT ( ! detect.isKdeTerminal() );
CPPUNIT_ASSERT ( ! detect.isGnomeTerminal() );
CPPUNIT_ASSERT ( detect.isKtermTerminal() );
CPPUNIT_ASSERT ( detect.isPuttyTerminal() );
CPPUNIT_ASSERT ( ! detect.isWindowsTerminal() );
CPPUNIT_ASSERT ( ! detect.isTeraTerm() );
CPPUNIT_ASSERT ( ! detect.isCygwinTerminal() );
CPPUNIT_ASSERT ( ! detect.isMinttyTerm() );
@ -747,16 +623,76 @@ void FTermDetectionTest::ktermTest()
CPPUNIT_ASSERT ( ! detect.isSunTerminal() );
CPPUNIT_ASSERT ( ! detect.isScreenTerm() );
CPPUNIT_ASSERT ( ! detect.isTmuxTerm() );
CPPUNIT_ASSERT ( ! detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( ! detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() );
// Test fallback to vt100 without TERM environment variable
unsetenv("TERM");
detect.setKtermTerminal(false);
enableConEmuDebug(true);
printConEmuDebug();
closeConEmuStdStreams();
exit(EXIT_SUCCESS);
}
else // Parent
{
// Start the terminal emulation
startConEmuTerminal (ConEmu::putty);
if ( waitpid(pid, 0, WUNTRACED) != pid )
std::cerr << "waitpid error" << std::endl;
}
}
//----------------------------------------------------------------------
void FTermDetectionTest::windowsTerminalTest()
{
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect;
data.setTermType("xterm");
detect.setTerminalDetection(true);
pid_t pid = forkConEmu();
if ( isConEmuChildProcess(pid) )
{
setenv ("TERM", "xterm-256color", 1);
unsetenv("TERMCAP");
unsetenv("COLORTERM");
unsetenv("COLORFGBG");
unsetenv("VTE_VERSION");
unsetenv("XTERM_VERSION");
unsetenv("ROXTERM_ID");
unsetenv("KONSOLE_DBUS_SESSION");
unsetenv("KONSOLE_DCOP");
unsetenv("TMUX");
setenv ("WT_PROFILE_ID", "{61c54cbd-c2a6-5271-96e7-009a87ff44bf}", 1);
setenv ("WT_SESSION", "4dc413a1-5ed9-46d4-b4e0-5a2fec7acb44", 1);
detect.detect();
CPPUNIT_ASSERT ( detect.isXTerminal() );
CPPUNIT_ASSERT ( ! detect.isAnsiTerminal() );
CPPUNIT_ASSERT ( ! detect.isRxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isUrxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isKdeTerminal() );
CPPUNIT_ASSERT ( ! detect.isGnomeTerminal() );
CPPUNIT_ASSERT ( ! detect.isPuttyTerminal() );
CPPUNIT_ASSERT ( detect.isWindowsTerminal() );
CPPUNIT_ASSERT ( ! detect.isTeraTerm() );
CPPUNIT_ASSERT ( ! detect.isCygwinTerminal() );
CPPUNIT_ASSERT ( ! detect.isMinttyTerm() );
CPPUNIT_ASSERT ( ! detect.isLinuxTerm() );
CPPUNIT_ASSERT ( ! detect.isFreeBSDTerm() );
CPPUNIT_ASSERT ( ! detect.isNetBSDTerm() );
CPPUNIT_ASSERT ( ! detect.isOpenBSDTerm() );
CPPUNIT_ASSERT ( ! detect.isSunTerminal() );
CPPUNIT_ASSERT ( ! detect.isScreenTerm() );
CPPUNIT_ASSERT ( ! detect.isTmuxTerm() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), "vt100" );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() );
printConEmuDebug();
closeConEmuStdStreams();
@ -765,7 +701,7 @@ void FTermDetectionTest::ktermTest()
else // Parent
{
// Start the terminal emulation
startConEmuTerminal (ConEmu::kterm);
startConEmuTerminal (ConEmu::win_terminal);
if ( waitpid(pid, 0, WUNTRACED) != pid )
std::cerr << "waitpid error" << std::endl;
@ -801,11 +737,10 @@ void FTermDetectionTest::teraTermTest()
CPPUNIT_ASSERT ( ! detect.isAnsiTerminal() );
CPPUNIT_ASSERT ( ! detect.isRxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isUrxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.isPuttyTerminal() );
CPPUNIT_ASSERT ( ! detect.isKdeTerminal() );
CPPUNIT_ASSERT ( ! detect.isGnomeTerminal() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isPuttyTerminal() );
CPPUNIT_ASSERT ( ! detect.isWindowsTerminal() );
CPPUNIT_ASSERT ( detect.isTeraTerm() );
CPPUNIT_ASSERT ( ! detect.isCygwinTerminal() );
CPPUNIT_ASSERT ( ! detect.isMinttyTerm() );
@ -816,6 +751,8 @@ void FTermDetectionTest::teraTermTest()
CPPUNIT_ASSERT ( ! detect.isSunTerminal() );
CPPUNIT_ASSERT ( ! detect.isScreenTerm() );
CPPUNIT_ASSERT ( ! detect.isTmuxTerm() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() );
@ -863,11 +800,10 @@ void FTermDetectionTest::cygwinTest()
CPPUNIT_ASSERT ( ! detect.isAnsiTerminal() );
CPPUNIT_ASSERT ( ! detect.isRxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isUrxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.isPuttyTerminal() );
CPPUNIT_ASSERT ( ! detect.isKdeTerminal() );
CPPUNIT_ASSERT ( ! detect.isGnomeTerminal() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isPuttyTerminal() );
CPPUNIT_ASSERT ( ! detect.isWindowsTerminal() );
CPPUNIT_ASSERT ( ! detect.isTeraTerm() );
CPPUNIT_ASSERT ( detect.isCygwinTerminal() );
CPPUNIT_ASSERT ( ! detect.isMinttyTerm() );
@ -878,6 +814,8 @@ void FTermDetectionTest::cygwinTest()
CPPUNIT_ASSERT ( ! detect.isSunTerminal() );
CPPUNIT_ASSERT ( ! detect.isScreenTerm() );
CPPUNIT_ASSERT ( ! detect.isTmuxTerm() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() );
@ -925,11 +863,10 @@ void FTermDetectionTest::minttyTest()
CPPUNIT_ASSERT ( ! detect.isAnsiTerminal() );
CPPUNIT_ASSERT ( ! detect.isRxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isUrxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.isPuttyTerminal() );
CPPUNIT_ASSERT ( ! detect.isKdeTerminal() );
CPPUNIT_ASSERT ( ! detect.isGnomeTerminal() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isPuttyTerminal() );
CPPUNIT_ASSERT ( ! detect.isWindowsTerminal() );
CPPUNIT_ASSERT ( ! detect.isTeraTerm() );
CPPUNIT_ASSERT ( ! detect.isCygwinTerminal() );
CPPUNIT_ASSERT ( detect.isMinttyTerm() );
@ -940,6 +877,8 @@ void FTermDetectionTest::minttyTest()
CPPUNIT_ASSERT ( ! detect.isSunTerminal() );
CPPUNIT_ASSERT ( ! detect.isScreenTerm() );
CPPUNIT_ASSERT ( ! detect.isTmuxTerm() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( detect.hasSetCursorStyleSupport() );
@ -987,11 +926,10 @@ void FTermDetectionTest::linuxTest()
CPPUNIT_ASSERT ( ! detect.isAnsiTerminal() );
CPPUNIT_ASSERT ( ! detect.isRxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isUrxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.isPuttyTerminal() );
CPPUNIT_ASSERT ( ! detect.isKdeTerminal() );
CPPUNIT_ASSERT ( ! detect.isGnomeTerminal() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isPuttyTerminal() );
CPPUNIT_ASSERT ( ! detect.isWindowsTerminal() );
CPPUNIT_ASSERT ( ! detect.isTeraTerm() );
CPPUNIT_ASSERT ( ! detect.isCygwinTerminal() );
CPPUNIT_ASSERT ( ! detect.isMinttyTerm() );
@ -1002,6 +940,8 @@ void FTermDetectionTest::linuxTest()
CPPUNIT_ASSERT ( ! detect.isSunTerminal() );
CPPUNIT_ASSERT ( ! detect.isScreenTerm() );
CPPUNIT_ASSERT ( ! detect.isTmuxTerm() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() );
@ -1057,11 +997,10 @@ void FTermDetectionTest::freebsdTest()
CPPUNIT_ASSERT ( ! detect.isAnsiTerminal() );
CPPUNIT_ASSERT ( ! detect.isRxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isUrxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.isPuttyTerminal() );
CPPUNIT_ASSERT ( ! detect.isKdeTerminal() );
CPPUNIT_ASSERT ( ! detect.isGnomeTerminal() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isPuttyTerminal() );
CPPUNIT_ASSERT ( ! detect.isWindowsTerminal() );
CPPUNIT_ASSERT ( ! detect.isTeraTerm() );
CPPUNIT_ASSERT ( ! detect.isCygwinTerminal() );
CPPUNIT_ASSERT ( ! detect.isMinttyTerm() );
@ -1072,6 +1011,8 @@ void FTermDetectionTest::freebsdTest()
CPPUNIT_ASSERT ( ! detect.isSunTerminal() );
CPPUNIT_ASSERT ( ! detect.isScreenTerm() );
CPPUNIT_ASSERT ( ! detect.isTmuxTerm() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() );
@ -1129,11 +1070,10 @@ void FTermDetectionTest::netbsdTest()
CPPUNIT_ASSERT ( ! detect.isAnsiTerminal() );
CPPUNIT_ASSERT ( ! detect.isRxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isUrxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.isPuttyTerminal() );
CPPUNIT_ASSERT ( ! detect.isKdeTerminal() );
CPPUNIT_ASSERT ( ! detect.isGnomeTerminal() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isPuttyTerminal() );
CPPUNIT_ASSERT ( ! detect.isWindowsTerminal() );
CPPUNIT_ASSERT ( ! detect.isTeraTerm() );
CPPUNIT_ASSERT ( ! detect.isCygwinTerminal() );
CPPUNIT_ASSERT ( ! detect.isMinttyTerm() );
@ -1144,6 +1084,8 @@ void FTermDetectionTest::netbsdTest()
CPPUNIT_ASSERT ( ! detect.isSunTerminal() );
CPPUNIT_ASSERT ( ! detect.isScreenTerm() );
CPPUNIT_ASSERT ( ! detect.isTmuxTerm() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() );
@ -1199,11 +1141,10 @@ void FTermDetectionTest::openbsdTest()
CPPUNIT_ASSERT ( ! detect.isAnsiTerminal() );
CPPUNIT_ASSERT ( ! detect.isRxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isUrxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.isPuttyTerminal() );
CPPUNIT_ASSERT ( ! detect.isKdeTerminal() );
CPPUNIT_ASSERT ( ! detect.isGnomeTerminal() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isPuttyTerminal() );
CPPUNIT_ASSERT ( ! detect.isWindowsTerminal() );
CPPUNIT_ASSERT ( ! detect.isTeraTerm() );
CPPUNIT_ASSERT ( ! detect.isCygwinTerminal() );
CPPUNIT_ASSERT ( ! detect.isMinttyTerm() );
@ -1214,6 +1155,8 @@ void FTermDetectionTest::openbsdTest()
CPPUNIT_ASSERT ( ! detect.isSunTerminal() );
CPPUNIT_ASSERT ( ! detect.isScreenTerm() );
CPPUNIT_ASSERT ( ! detect.isTmuxTerm() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() );
@ -1267,11 +1210,10 @@ void FTermDetectionTest::sunTest()
CPPUNIT_ASSERT ( ! detect.isAnsiTerminal() );
CPPUNIT_ASSERT ( ! detect.isRxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isUrxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.isPuttyTerminal() );
CPPUNIT_ASSERT ( ! detect.isKdeTerminal() );
CPPUNIT_ASSERT ( ! detect.isGnomeTerminal() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isPuttyTerminal() );
CPPUNIT_ASSERT ( ! detect.isWindowsTerminal() );
CPPUNIT_ASSERT ( ! detect.isTeraTerm() );
CPPUNIT_ASSERT ( ! detect.isCygwinTerminal() );
CPPUNIT_ASSERT ( ! detect.isMinttyTerm() );
@ -1282,6 +1224,8 @@ void FTermDetectionTest::sunTest()
CPPUNIT_ASSERT ( detect.isSunTerminal() );
CPPUNIT_ASSERT ( ! detect.isScreenTerm() );
CPPUNIT_ASSERT ( ! detect.isTmuxTerm() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( ! detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() );
@ -1336,11 +1280,10 @@ void FTermDetectionTest::screenTest()
CPPUNIT_ASSERT ( ! detect.isAnsiTerminal() );
CPPUNIT_ASSERT ( ! detect.isRxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isUrxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.isPuttyTerminal() );
CPPUNIT_ASSERT ( ! detect.isKdeTerminal() );
CPPUNIT_ASSERT ( ! detect.isGnomeTerminal() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isPuttyTerminal() );
CPPUNIT_ASSERT ( ! detect.isWindowsTerminal() );
CPPUNIT_ASSERT ( ! detect.isTeraTerm() );
CPPUNIT_ASSERT ( ! detect.isCygwinTerminal() );
CPPUNIT_ASSERT ( ! detect.isMinttyTerm() );
@ -1351,6 +1294,8 @@ void FTermDetectionTest::screenTest()
CPPUNIT_ASSERT ( ! detect.isSunTerminal() );
CPPUNIT_ASSERT ( detect.isScreenTerm() );
CPPUNIT_ASSERT ( ! detect.isTmuxTerm() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() );
@ -1405,11 +1350,10 @@ void FTermDetectionTest::tmuxTest()
CPPUNIT_ASSERT ( ! detect.isAnsiTerminal() );
CPPUNIT_ASSERT ( ! detect.isRxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isUrxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.isPuttyTerminal() );
CPPUNIT_ASSERT ( ! detect.isKdeTerminal() );
CPPUNIT_ASSERT ( ! detect.isGnomeTerminal() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isPuttyTerminal() );
CPPUNIT_ASSERT ( ! detect.isWindowsTerminal() );
CPPUNIT_ASSERT ( ! detect.isTeraTerm() );
CPPUNIT_ASSERT ( ! detect.isCygwinTerminal() );
CPPUNIT_ASSERT ( ! detect.isMinttyTerm() );
@ -1419,7 +1363,9 @@ void FTermDetectionTest::tmuxTest()
CPPUNIT_ASSERT ( ! detect.isOpenBSDTerm() );
CPPUNIT_ASSERT ( ! detect.isSunTerminal() );
CPPUNIT_ASSERT ( detect.isScreenTerm() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( detect.isTmuxTerm() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() );
@ -1444,6 +1390,146 @@ void FTermDetectionTest::tmuxTest()
}
}
//----------------------------------------------------------------------
void FTermDetectionTest::ktermTest()
{
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect;
data.setTermType("kterm");
detect.setTerminalDetection(true);
pid_t pid = forkConEmu();
if ( isConEmuChildProcess(pid) )
{
setenv ("TERM", "kterm", 1);
unsetenv("TERMCAP");
unsetenv("COLORTERM");
unsetenv("COLORFGBG");
unsetenv("VTE_VERSION");
unsetenv("XTERM_VERSION");
unsetenv("ROXTERM_ID");
unsetenv("KONSOLE_DBUS_SESSION");
unsetenv("KONSOLE_DCOP");
unsetenv("TMUX");
detect.detect();
CPPUNIT_ASSERT ( ! detect.isXTerminal() );
CPPUNIT_ASSERT ( ! detect.isAnsiTerminal() );
CPPUNIT_ASSERT ( ! detect.isRxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isUrxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isKdeTerminal() );
CPPUNIT_ASSERT ( ! detect.isGnomeTerminal() );
CPPUNIT_ASSERT ( ! detect.isPuttyTerminal() );
CPPUNIT_ASSERT ( ! detect.isWindowsTerminal() );
CPPUNIT_ASSERT ( ! detect.isTeraTerm() );
CPPUNIT_ASSERT ( ! detect.isCygwinTerminal() );
CPPUNIT_ASSERT ( ! detect.isMinttyTerm() );
CPPUNIT_ASSERT ( ! detect.isLinuxTerm() );
CPPUNIT_ASSERT ( ! detect.isFreeBSDTerm() );
CPPUNIT_ASSERT ( ! detect.isNetBSDTerm() );
CPPUNIT_ASSERT ( ! detect.isOpenBSDTerm() );
CPPUNIT_ASSERT ( ! detect.isSunTerminal() );
CPPUNIT_ASSERT ( ! detect.isScreenTerm() );
CPPUNIT_ASSERT ( ! detect.isTmuxTerm() );
CPPUNIT_ASSERT ( detect.isKtermTerminal() );
CPPUNIT_ASSERT ( ! detect.isMltermTerminal() );
CPPUNIT_ASSERT ( ! detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( ! detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() );
// Test fallback to vt100 without TERM environment variable
unsetenv("TERM");
detect.setKtermTerminal(false);
detect.detect();
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), "vt100" );
printConEmuDebug();
closeConEmuStdStreams();
exit(EXIT_SUCCESS);
}
else // Parent
{
// Start the terminal emulation
startConEmuTerminal (ConEmu::kterm);
if ( waitpid(pid, 0, WUNTRACED) != pid )
std::cerr << "waitpid error" << std::endl;
}
}
//----------------------------------------------------------------------
void FTermDetectionTest::mltermTest()
{
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
finalcut::FTermDetection detect;
data.setTermType("mlterm");
detect.setTerminalDetection(true);
pid_t pid = forkConEmu();
if ( isConEmuChildProcess(pid) )
{
setenv ("TERM", "mlterm", 1);
setenv ("MLTERM", "3.8.4", 1);
setenv ("COLORFGBG", "default;default", 1);
unsetenv("TERMCAP");
unsetenv("COLORTERM");
unsetenv("VTE_VERSION");
unsetenv("XTERM_VERSION");
unsetenv("ROXTERM_ID");
unsetenv("KONSOLE_DBUS_SESSION");
unsetenv("KONSOLE_DCOP");
unsetenv("TMUX");
detect.detect();
CPPUNIT_ASSERT ( ! detect.isXTerminal() );
CPPUNIT_ASSERT ( ! detect.isAnsiTerminal() );
CPPUNIT_ASSERT ( ! detect.isRxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isUrxvtTerminal() );
CPPUNIT_ASSERT ( ! detect.isKdeTerminal() );
CPPUNIT_ASSERT ( ! detect.isGnomeTerminal() );
CPPUNIT_ASSERT ( ! detect.isPuttyTerminal() );
CPPUNIT_ASSERT ( ! detect.isWindowsTerminal() );
CPPUNIT_ASSERT ( ! detect.isTeraTerm() );
CPPUNIT_ASSERT ( ! detect.isCygwinTerminal() );
CPPUNIT_ASSERT ( ! detect.isMinttyTerm() );
CPPUNIT_ASSERT ( ! detect.isLinuxTerm() );
CPPUNIT_ASSERT ( ! detect.isFreeBSDTerm() );
CPPUNIT_ASSERT ( ! detect.isNetBSDTerm() );
CPPUNIT_ASSERT ( ! detect.isOpenBSDTerm() );
CPPUNIT_ASSERT ( ! detect.isSunTerminal() );
CPPUNIT_ASSERT ( ! detect.isScreenTerm() );
CPPUNIT_ASSERT ( ! detect.isTmuxTerm() );
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
CPPUNIT_ASSERT ( detect.isMltermTerminal() );
CPPUNIT_ASSERT ( detect.canDisplay256Colors() );
CPPUNIT_ASSERT ( detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() );
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), "mlterm-256color" );
setenv ("TERM", "mlterm", 1);
unsetenv("COLORFGBG");
detect.detect();
CPPUNIT_ASSERT ( detect.canDisplay256Colors() );
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), "xterm-256color" );
printConEmuDebug();
closeConEmuStdStreams();
exit(EXIT_SUCCESS);
}
else // Parent
{
// Start the terminal emulation
startConEmuTerminal (ConEmu::mlterm);
if ( waitpid(pid, 0, WUNTRACED) != pid )
std::cerr << "waitpid error" << std::endl;
}
}
//----------------------------------------------------------------------
void FTermDetectionTest::ttytypeTest()
{