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> 2020-08-15 Markus Gans <guru.mail@muenster.de>
* The call of the function setNonBlockingRead() resulted in * The call of the function setNonBlockingRead() resulted in
a high CPU load in idle mode. 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 We use the `addCallback()` method of the `FWidget` class to connect
to other widget objects. 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 ```cpp
template<typename Function 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 ```cpp
template<typename Function 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 ```cpp
template<typename Object 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 ```cpp
template<typename Function template<typename Function
, typename ClassObject<Function>::type = nullptr , 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 ```cpp
template<typename Object 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: with the keyword auto:
```cpp ```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 or a widget instance. Alternatively, you can use `delCallbacks()` to
remove all existing callbacks from an object. 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 ```cpp
template<typename FunctionPtr 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 ```cpp
template<typename Function 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 ```cpp
template<typename Object 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 ```cpp
void delCallback (const FString& cb_signal) 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 ```cpp
template<typename Object 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 ```cpp
void delCallback() void delCallback()

View File

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

View File

@ -641,7 +641,7 @@ double FString::toDouble() const
wchar_t* p{}; wchar_t* p{};
const double ret = std::wcstod(string, &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"); throw std::invalid_argument ("no valid floating point value");
if ( errno == ERANGE ) if ( errno == ERANGE )

View File

@ -458,18 +458,18 @@ bool FTerm::isMonochron()
return data->isMonochron(); return data->isMonochron();
} }
//----------------------------------------------------------------------
bool FTerm::isXTerminal()
{
return term_detection->isXTerminal();
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FTerm::isAnsiTerminal() bool FTerm::isAnsiTerminal()
{ {
return term_detection->isAnsiTerminal(); return term_detection->isAnsiTerminal();
} }
//----------------------------------------------------------------------
bool FTerm::isXTerminal()
{
return term_detection->isXTerminal();
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FTerm::isRxvtTerminal() bool FTerm::isRxvtTerminal()
{ {
@ -482,18 +482,6 @@ bool FTerm::isUrxvtTerminal()
return term_detection->isUrxvtTerminal(); return term_detection->isUrxvtTerminal();
} }
//----------------------------------------------------------------------
bool FTerm::isMltermTerminal()
{
return term_detection->isMltermTerminal();
}
//----------------------------------------------------------------------
bool FTerm::isPuttyTerminal()
{
return term_detection->isPuttyTerminal();
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FTerm::isKdeTerminal() 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(); return term_detection->isTeraTerm();
} }
//----------------------------------------------------------------------
bool FTerm::isSunTerminal()
{
return term_detection->isSunTerminal();
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FTerm::isCygwinTerminal() bool FTerm::isCygwinTerminal()
{ {
@ -560,6 +548,12 @@ bool FTerm::isOpenBSDTerm()
return term_detection->isOpenBSDTerm(); return term_detection->isOpenBSDTerm();
} }
//----------------------------------------------------------------------
bool FTerm::isSunTerminal()
{
return term_detection->isSunTerminal();
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FTerm::isScreenTerm() bool FTerm::isScreenTerm()
{ {
@ -572,6 +566,18 @@ bool FTerm::isTmuxTerm()
return term_detection->isTmuxTerm(); return term_detection->isTmuxTerm();
} }
//----------------------------------------------------------------------
bool FTerm::isKtermTerminal()
{
return term_detection->isKtermTerminal();
}
//----------------------------------------------------------------------
bool FTerm::isMltermTerminal()
{
return term_detection->isMltermTerminal();
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool FTerm::isNewFont() 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; 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; terminal_type.kde_konsole = true;
else if ( secondary_da.terminal_id_version == 136 ) else if ( secondary_da.terminal_id_version == 136 )
terminal_type.putty = true; // PuTTY 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; const bool utf8 = ( FTerm::getEncoding() == fc::UTF8 ) ? true : false;
if ( (utf8 && std::iswprint(std::wint_t(ch))) if ( (utf8 && std::iswprint(std::wint_t(ch)))
|| (!utf8 && std::isprint(ch)) ) || (!utf8 && std::isprint(char(ch))) )
return true; return true;
return false; 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 // switch to previous window

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -202,6 +202,12 @@ void FStringStreamTest::fileTest()
{ {
std::ofstream file_stream(filename, std::ofstream::out); 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"; ss << "FStringStream file test\n";
file_stream << ss.str(); file_stream << ss.str();

View File

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