2018-09-14 22:42:56 +02:00
|
|
|
/***********************************************************************
|
2018-10-03 22:23:55 +02:00
|
|
|
* ftermdetection-test.cpp - FTermDetection unit tests *
|
2018-09-14 22:42:56 +02:00
|
|
|
* *
|
|
|
|
* This file is part of the Final Cut widget toolkit *
|
|
|
|
* *
|
2019-05-27 00:50:11 +02:00
|
|
|
* Copyright 2018-2019 Markus Gans *
|
2018-09-14 22:42:56 +02:00
|
|
|
* *
|
|
|
|
* The Final Cut is free software; you can redistribute it and/or *
|
|
|
|
* modify it under the terms of the GNU Lesser General Public License *
|
|
|
|
* as published by the Free Software Foundation; either version 3 of *
|
|
|
|
* the License, or (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* The Final Cut is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU Lesser General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU Lesser General Public *
|
|
|
|
* License along with this program. If not, see *
|
|
|
|
* <http://www.gnu.org/licenses/>. *
|
|
|
|
***********************************************************************/
|
|
|
|
|
|
|
|
#include <cppunit/BriefTestProgressListener.h>
|
|
|
|
#include <cppunit/CompilerOutputter.h>
|
|
|
|
#include <cppunit/extensions/HelperMacros.h>
|
|
|
|
#include <cppunit/TestFixture.h>
|
|
|
|
#include <cppunit/TestResult.h>
|
|
|
|
#include <cppunit/TestResultCollector.h>
|
|
|
|
#include <cppunit/TestRunner.h>
|
|
|
|
|
2018-09-15 01:54:02 +02:00
|
|
|
#include <sys/wait.h>
|
2018-09-14 22:42:56 +02:00
|
|
|
#include <sys/mman.h>
|
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
#include <conemu.h>
|
2018-10-24 08:51:38 +02:00
|
|
|
#include <final/final.h>
|
|
|
|
|
2018-09-16 19:33:40 +02:00
|
|
|
#define CPPUNIT_ASSERT_CSTRING(expected, actual) \
|
|
|
|
check_c_string (expected, actual, CPPUNIT_SOURCELINE())
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2018-09-16 19:33:40 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void check_c_string ( const char* s1
|
|
|
|
, const char* s2
|
|
|
|
, CppUnit::SourceLine sourceLine )
|
|
|
|
{
|
|
|
|
if ( s1 == 0 && s2 == 0 ) // Strings are equal
|
|
|
|
return;
|
|
|
|
|
|
|
|
if ( s1 && s2 && std::strcmp (s1, s2) == 0 ) // Strings are equal
|
|
|
|
return;
|
|
|
|
|
|
|
|
::CppUnit::Asserter::fail ("Strings are not equal", sourceLine);
|
|
|
|
}
|
|
|
|
|
2018-09-14 22:42:56 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// class FTermDetectionTest
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
class FTermDetectionTest : public CPPUNIT_NS::TestFixture, test::ConEmu
|
2018-09-14 22:42:56 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
FTermDetectionTest();
|
|
|
|
~FTermDetectionTest();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void classNameTest();
|
|
|
|
void ansiTest();
|
|
|
|
void xtermTest();
|
|
|
|
void rxvtTest();
|
|
|
|
void urxvtTest();
|
|
|
|
void mltermTest();
|
|
|
|
void puttyTest();
|
|
|
|
void kdeKonsoleTest();
|
|
|
|
void gnomeTerminalTest();
|
2018-10-09 16:04:21 +02:00
|
|
|
void newerVteTerminalTest();
|
2018-09-14 22:42:56 +02:00
|
|
|
void ktermTest();
|
|
|
|
void teraTermTest();
|
|
|
|
void cygwinTest();
|
|
|
|
void minttyTest();
|
|
|
|
void linuxTest();
|
|
|
|
void freebsdTest();
|
|
|
|
void netbsdTest();
|
|
|
|
void openbsdTest();
|
|
|
|
void sunTest();
|
|
|
|
void screenTest();
|
|
|
|
void tmuxTest();
|
2018-09-16 19:33:40 +02:00
|
|
|
void ttytypeTest();
|
2018-09-14 22:42:56 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
// Adds code needed to register the test suite
|
|
|
|
CPPUNIT_TEST_SUITE (FTermDetectionTest);
|
|
|
|
|
|
|
|
// Add a methods to the test suite
|
|
|
|
CPPUNIT_TEST (classNameTest);
|
|
|
|
CPPUNIT_TEST (ansiTest);
|
|
|
|
CPPUNIT_TEST (xtermTest);
|
|
|
|
CPPUNIT_TEST (rxvtTest);
|
|
|
|
CPPUNIT_TEST (urxvtTest);
|
|
|
|
CPPUNIT_TEST (mltermTest);
|
|
|
|
CPPUNIT_TEST (puttyTest);
|
|
|
|
CPPUNIT_TEST (kdeKonsoleTest);
|
|
|
|
CPPUNIT_TEST (gnomeTerminalTest);
|
2018-10-09 16:04:21 +02:00
|
|
|
CPPUNIT_TEST (newerVteTerminalTest);
|
2018-09-14 22:42:56 +02:00
|
|
|
CPPUNIT_TEST (ktermTest);
|
|
|
|
CPPUNIT_TEST (teraTermTest);
|
|
|
|
CPPUNIT_TEST (cygwinTest);
|
|
|
|
CPPUNIT_TEST (minttyTest);
|
|
|
|
CPPUNIT_TEST (linuxTest);
|
|
|
|
CPPUNIT_TEST (freebsdTest);
|
|
|
|
CPPUNIT_TEST (netbsdTest);
|
|
|
|
CPPUNIT_TEST (openbsdTest);
|
|
|
|
CPPUNIT_TEST (sunTest);
|
|
|
|
CPPUNIT_TEST (screenTest);
|
|
|
|
CPPUNIT_TEST (tmuxTest);
|
2018-09-16 19:33:40 +02:00
|
|
|
CPPUNIT_TEST (ttytypeTest);
|
2018-09-14 22:42:56 +02:00
|
|
|
|
|
|
|
// End of test suite definition
|
|
|
|
CPPUNIT_TEST_SUITE_END();
|
|
|
|
};
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
FTermDetectionTest::FTermDetectionTest()
|
2019-06-19 16:28:55 +02:00
|
|
|
{ }
|
2018-09-14 22:42:56 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
FTermDetectionTest::~FTermDetectionTest()
|
2019-06-19 16:28:55 +02:00
|
|
|
{ }
|
2018-09-14 22:42:56 +02:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FTermDetectionTest::classNameTest()
|
|
|
|
{
|
2018-09-20 23:59:01 +02:00
|
|
|
finalcut::FTermDetection d;
|
2018-09-14 22:42:56 +02:00
|
|
|
const char* const classname = d.getClassName();
|
|
|
|
CPPUNIT_ASSERT ( std::strcmp(classname, "FTermDetection") == 0 );
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FTermDetectionTest::ansiTest()
|
|
|
|
{
|
2019-05-27 00:50:11 +02:00
|
|
|
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
|
2018-09-20 23:59:01 +02:00
|
|
|
finalcut::FTermDetection detect;
|
2018-10-01 22:27:54 +02:00
|
|
|
setenv ("TERM", "ansi", 1);
|
2019-07-14 23:05:54 +02:00
|
|
|
data.setTermType(C_STR("ansi"));
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
pid_t pid = forkConEmu();
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
if ( isConEmuChildProcess(pid) )
|
2018-09-14 22:42:56 +02:00
|
|
|
{
|
|
|
|
setenv ("TERM", "ansi", 1);
|
2018-09-16 19:33:40 +02:00
|
|
|
unsetenv("TERMCAP");
|
2018-09-14 22:42:56 +02:00
|
|
|
unsetenv("COLORTERM");
|
2018-09-18 06:04:27 +02:00
|
|
|
unsetenv("COLORFGBG");
|
2018-09-14 22:42:56 +02:00
|
|
|
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() );
|
2018-09-16 19:33:40 +02:00
|
|
|
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), C_STR("ansi") );
|
|
|
|
|
|
|
|
// Test fallback to vt100 without TERM environment variable
|
|
|
|
unsetenv("TERM");
|
|
|
|
detect.setAnsiTerminal(false);
|
|
|
|
detect.detect();
|
|
|
|
CPPUNIT_ASSERT ( ! detect.isAnsiTerminal() );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), C_STR("vt100") );
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
printConEmuDebug();
|
|
|
|
closeConEmuStdStreams();
|
2018-09-15 01:54:02 +02:00
|
|
|
exit(EXIT_SUCCESS);
|
2018-09-14 22:42:56 +02:00
|
|
|
}
|
|
|
|
else // Parent
|
|
|
|
{
|
2019-06-19 16:28:55 +02:00
|
|
|
// Start the terminal emulation
|
|
|
|
startConEmuTerminal (ConEmu::ansi);
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2018-09-18 03:37:44 +02:00
|
|
|
if ( waitpid(pid, 0, WUNTRACED) != pid )
|
2018-09-16 19:33:40 +02:00
|
|
|
std::cerr << "waitpid error" << std::endl;
|
2018-09-14 22:42:56 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FTermDetectionTest::xtermTest()
|
|
|
|
{
|
2019-05-27 00:50:11 +02:00
|
|
|
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
|
2018-09-20 23:59:01 +02:00
|
|
|
finalcut::FTermDetection detect;
|
2019-07-14 23:05:54 +02:00
|
|
|
data.setTermType(C_STR("xterm"));
|
2018-09-14 22:42:56 +02:00
|
|
|
detect.setTerminalDetection(true);
|
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
pid_t pid = forkConEmu();
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
if ( isConEmuChildProcess(pid) )
|
2018-09-14 22:42:56 +02:00
|
|
|
{
|
|
|
|
setenv ("TERM", "xterm", 1);
|
|
|
|
setenv ("XTERM_VERSION", "XTerm(312)", 1);
|
2018-09-16 19:33:40 +02:00
|
|
|
unsetenv("TERMCAP");
|
2018-09-14 22:42:56 +02:00
|
|
|
unsetenv("COLORTERM");
|
2018-09-18 06:04:27 +02:00
|
|
|
unsetenv("COLORFGBG");
|
2018-09-14 22:42:56 +02:00
|
|
|
unsetenv("VTE_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() );
|
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
printConEmuDebug();
|
|
|
|
closeConEmuStdStreams();
|
2018-09-15 01:54:02 +02:00
|
|
|
exit(EXIT_SUCCESS);
|
2018-09-14 22:42:56 +02:00
|
|
|
}
|
|
|
|
else // Parent
|
|
|
|
{
|
2019-06-19 16:28:55 +02:00
|
|
|
// Start the terminal emulation
|
|
|
|
startConEmuTerminal (ConEmu::xterm);
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2018-09-18 03:37:44 +02:00
|
|
|
if ( waitpid(pid, 0, WUNTRACED) != pid )
|
2018-09-16 19:33:40 +02:00
|
|
|
std::cerr << "waitpid error" << std::endl;
|
2018-09-14 22:42:56 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FTermDetectionTest::rxvtTest()
|
|
|
|
{
|
2019-05-27 00:50:11 +02:00
|
|
|
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
|
2018-09-20 23:59:01 +02:00
|
|
|
finalcut::FTermDetection detect;
|
2019-07-14 23:05:54 +02:00
|
|
|
data.setTermType(C_STR("rxvt-cygwin-native"));
|
2018-09-14 22:42:56 +02:00
|
|
|
detect.setTerminalDetection(true);
|
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
pid_t pid = forkConEmu();
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
if ( isConEmuChildProcess(pid) )
|
2018-09-14 22:42:56 +02:00
|
|
|
{
|
|
|
|
setenv ("TERM", "rxvt-cygwin-native", 1);
|
|
|
|
setenv ("COLORTERM", "rxvt-xpm", 1);
|
2018-09-18 06:04:27 +02:00
|
|
|
setenv ("COLORFGBG", "default;default", 1);
|
2018-09-16 19:33:40 +02:00
|
|
|
unsetenv("TERMCAP");
|
2018-09-14 22:42:56 +02:00
|
|
|
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() );
|
2018-09-18 06:04:27 +02:00
|
|
|
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), C_STR("rxvt-cygwin-native") );
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
printConEmuDebug();
|
|
|
|
closeConEmuStdStreams();
|
2018-09-15 01:54:02 +02:00
|
|
|
exit(EXIT_SUCCESS);
|
2018-09-14 22:42:56 +02:00
|
|
|
}
|
|
|
|
else // Parent
|
|
|
|
{
|
2019-06-19 16:28:55 +02:00
|
|
|
// Start the terminal emulation
|
|
|
|
startConEmuTerminal (ConEmu::rxvt);
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2018-09-18 03:37:44 +02:00
|
|
|
if ( waitpid(pid, 0, WUNTRACED) != pid )
|
2018-09-16 19:33:40 +02:00
|
|
|
std::cerr << "waitpid error" << std::endl;
|
2018-09-14 22:42:56 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FTermDetectionTest::urxvtTest()
|
|
|
|
{
|
2019-05-27 00:50:11 +02:00
|
|
|
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
|
2018-09-20 23:59:01 +02:00
|
|
|
finalcut::FTermDetection detect;
|
2019-07-14 23:05:54 +02:00
|
|
|
data.setTermType(C_STR("rxvt-unicode-256color"));
|
2018-09-14 22:42:56 +02:00
|
|
|
detect.setTerminalDetection(true);
|
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
pid_t pid = forkConEmu();
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
if ( isConEmuChildProcess(pid) )
|
2018-09-14 22:42:56 +02:00
|
|
|
{
|
|
|
|
setenv ("TERM", "rxvt-unicode-256color", 1);
|
|
|
|
setenv ("COLORTERM", "rxvt-xpm", 1);
|
2018-09-18 06:04:27 +02:00
|
|
|
setenv ("COLORFGBG", "default;default;0", 1);
|
2018-09-16 19:33:40 +02:00
|
|
|
unsetenv("TERMCAP");
|
2018-09-14 22:42:56 +02:00
|
|
|
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() );
|
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
printConEmuDebug();
|
|
|
|
closeConEmuStdStreams();
|
2018-09-15 01:54:02 +02:00
|
|
|
exit(EXIT_SUCCESS);
|
2018-09-14 22:42:56 +02:00
|
|
|
}
|
|
|
|
else // Parent
|
|
|
|
{
|
2019-06-19 16:28:55 +02:00
|
|
|
// Start the terminal emulation
|
|
|
|
startConEmuTerminal (ConEmu::urxvt);
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2018-09-18 03:37:44 +02:00
|
|
|
if ( waitpid(pid, 0, WUNTRACED) != pid )
|
2018-09-16 19:33:40 +02:00
|
|
|
std::cerr << "waitpid error" << std::endl;
|
2018-09-14 22:42:56 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FTermDetectionTest::mltermTest()
|
|
|
|
{
|
2019-05-27 00:50:11 +02:00
|
|
|
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
|
2018-09-20 23:59:01 +02:00
|
|
|
finalcut::FTermDetection detect;
|
2019-07-14 23:05:54 +02:00
|
|
|
data.setTermType(C_STR("mlterm"));
|
2018-09-14 22:42:56 +02:00
|
|
|
detect.setTerminalDetection(true);
|
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
pid_t pid = forkConEmu();
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
if ( isConEmuChildProcess(pid) )
|
2018-09-14 22:42:56 +02:00
|
|
|
{
|
|
|
|
setenv ("TERM", "mlterm", 1);
|
|
|
|
setenv ("MLTERM", "3.8.4", 1);
|
2018-09-18 06:04:27 +02:00
|
|
|
setenv ("COLORFGBG", "default;default", 1);
|
2018-09-16 19:33:40 +02:00
|
|
|
unsetenv("TERMCAP");
|
2018-09-14 22:42:56 +02:00
|
|
|
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() );
|
2018-09-18 06:04:27 +02:00
|
|
|
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), C_STR("mlterm-256color") );
|
|
|
|
|
|
|
|
setenv ("TERM", "mlterm", 1);
|
|
|
|
unsetenv("COLORFGBG");
|
|
|
|
detect.detect();
|
|
|
|
CPPUNIT_ASSERT ( detect.canDisplay256Colors() );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), C_STR("xterm-256color") );
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
printConEmuDebug();
|
|
|
|
closeConEmuStdStreams();
|
2018-09-15 01:54:02 +02:00
|
|
|
exit(EXIT_SUCCESS);
|
2018-09-14 22:42:56 +02:00
|
|
|
}
|
|
|
|
else // Parent
|
|
|
|
{
|
2019-06-19 16:28:55 +02:00
|
|
|
// Start the terminal emulation
|
|
|
|
startConEmuTerminal (ConEmu::mlterm);
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2018-09-18 03:37:44 +02:00
|
|
|
if ( waitpid(pid, 0, WUNTRACED) != pid )
|
2018-09-16 19:33:40 +02:00
|
|
|
std::cerr << "waitpid error" << std::endl;
|
2018-09-14 22:42:56 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FTermDetectionTest::puttyTest()
|
|
|
|
{
|
2019-05-27 00:50:11 +02:00
|
|
|
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
|
2018-09-20 23:59:01 +02:00
|
|
|
finalcut::FTermDetection detect;
|
2019-07-14 23:05:54 +02:00
|
|
|
data.setTermType(C_STR("xterm"));
|
2018-09-14 22:42:56 +02:00
|
|
|
detect.setTerminalDetection(true);
|
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
pid_t pid = forkConEmu();
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
if ( isConEmuChildProcess(pid) )
|
2018-09-14 22:42:56 +02:00
|
|
|
{
|
|
|
|
setenv ("TERM", "xterm", 1);
|
2018-09-16 19:33:40 +02:00
|
|
|
unsetenv("TERMCAP");
|
2018-09-14 22:42:56 +02:00
|
|
|
unsetenv("COLORTERM");
|
2018-09-18 06:04:27 +02:00
|
|
|
unsetenv("COLORFGBG");
|
2018-09-14 22:42:56 +02:00
|
|
|
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() );
|
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
enableConEmuDebug(true);
|
|
|
|
printConEmuDebug();
|
|
|
|
closeConEmuStdStreams();
|
2018-09-15 01:54:02 +02:00
|
|
|
exit(EXIT_SUCCESS);
|
2018-09-14 22:42:56 +02:00
|
|
|
}
|
|
|
|
else // Parent
|
|
|
|
{
|
2019-06-19 16:28:55 +02:00
|
|
|
// Start the terminal emulation
|
|
|
|
startConEmuTerminal (ConEmu::putty);
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2018-09-18 03:37:44 +02:00
|
|
|
if ( waitpid(pid, 0, WUNTRACED) != pid )
|
2018-09-16 19:33:40 +02:00
|
|
|
std::cerr << "waitpid error" << std::endl;
|
2018-09-14 22:42:56 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FTermDetectionTest::kdeKonsoleTest()
|
|
|
|
{
|
2019-05-27 00:50:11 +02:00
|
|
|
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
|
2018-09-20 23:59:01 +02:00
|
|
|
finalcut::FTermDetection detect;
|
2019-07-14 23:05:54 +02:00
|
|
|
data.setTermType(C_STR("xterm-256color"));
|
2018-09-14 22:42:56 +02:00
|
|
|
detect.setTerminalDetection(true);
|
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
pid_t pid = forkConEmu();
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
if ( isConEmuChildProcess(pid) )
|
2018-09-14 22:42:56 +02:00
|
|
|
{
|
|
|
|
setenv ("TERM", "xterm-256color", 1);
|
|
|
|
setenv ("COLORTERM", "truecolor", 1);
|
|
|
|
setenv ("KONSOLE_DBUS_SERVICE", "DCOPRef(konsole-11768,konsole)", 1);
|
|
|
|
setenv ("KONSOLE_DCOP", ":1.77", 1);
|
2018-09-18 06:04:27 +02:00
|
|
|
unsetenv("COLORFGBG");
|
2018-09-16 19:33:40 +02:00
|
|
|
unsetenv("TERMCAP");
|
2018-09-14 22:42:56 +02:00
|
|
|
unsetenv("VTE_VERSION");
|
|
|
|
unsetenv("XTERM_VERSION");
|
|
|
|
unsetenv("ROXTERM_ID");
|
|
|
|
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() );
|
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
printConEmuDebug();
|
|
|
|
closeConEmuStdStreams();
|
2018-09-15 01:54:02 +02:00
|
|
|
exit(EXIT_SUCCESS);
|
2018-09-14 22:42:56 +02:00
|
|
|
}
|
|
|
|
else // Parent
|
|
|
|
{
|
2019-06-19 16:28:55 +02:00
|
|
|
// Start the terminal emulation
|
|
|
|
startConEmuTerminal (ConEmu::kde_konsole);
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2018-09-18 03:37:44 +02:00
|
|
|
if ( waitpid(pid, 0, WUNTRACED) != pid )
|
2018-09-16 19:33:40 +02:00
|
|
|
std::cerr << "waitpid error" << std::endl;
|
2018-09-14 22:42:56 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FTermDetectionTest::gnomeTerminalTest()
|
|
|
|
{
|
2019-05-27 00:50:11 +02:00
|
|
|
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
|
2018-09-20 23:59:01 +02:00
|
|
|
finalcut::FTermDetection detect;
|
2019-07-14 23:05:54 +02:00
|
|
|
data.setTermType(C_STR("xterm-256color"));
|
2018-09-14 22:42:56 +02:00
|
|
|
detect.setTerminalDetection(true);
|
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
pid_t pid = forkConEmu();
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
if ( isConEmuChildProcess(pid) )
|
2018-09-14 22:42:56 +02:00
|
|
|
{
|
|
|
|
setenv ("TERM", "xterm-256color", 1);
|
|
|
|
setenv ("COLORTERM", "truecolor", 1);
|
|
|
|
setenv ("VTE_VERSION", "5202", 1);
|
2018-09-18 06:04:27 +02:00
|
|
|
unsetenv("COLORFGBG");
|
2018-09-16 19:33:40 +02:00
|
|
|
unsetenv("TERMCAP");
|
2018-09-14 22:42:56 +02:00
|
|
|
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() );
|
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
printConEmuDebug();
|
|
|
|
closeConEmuStdStreams();
|
2018-09-15 01:54:02 +02:00
|
|
|
exit(EXIT_SUCCESS);
|
2018-09-14 22:42:56 +02:00
|
|
|
}
|
|
|
|
else // Parent
|
|
|
|
{
|
2019-06-19 16:28:55 +02:00
|
|
|
// Start the terminal emulation
|
|
|
|
startConEmuTerminal (ConEmu::gnome_terminal);
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2018-09-18 03:37:44 +02:00
|
|
|
if ( waitpid(pid, 0, WUNTRACED) != pid )
|
2018-09-16 19:33:40 +02:00
|
|
|
std::cerr << "waitpid error" << std::endl;
|
2018-09-14 22:42:56 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-09 16:04:21 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FTermDetectionTest::newerVteTerminalTest()
|
|
|
|
{
|
2019-05-27 00:50:11 +02:00
|
|
|
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
|
2018-10-09 16:04:21 +02:00
|
|
|
finalcut::FTermDetection detect;
|
2019-07-14 23:05:54 +02:00
|
|
|
data.setTermType(C_STR("xterm-256color"));
|
2018-10-09 16:04:21 +02:00
|
|
|
detect.setTerminalDetection(true);
|
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
pid_t pid = forkConEmu();
|
2018-10-09 16:04:21 +02:00
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
if ( isConEmuChildProcess(pid) )
|
2018-10-09 16:04:21 +02:00
|
|
|
{
|
|
|
|
setenv ("TERM", "xterm-256color", 1);
|
|
|
|
setenv ("COLORTERM", "truecolor", 1);
|
|
|
|
setenv ("VTE_VERSION", "5300", 1);
|
|
|
|
unsetenv("COLORFGBG");
|
|
|
|
unsetenv("TERMCAP");
|
|
|
|
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() );
|
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
printConEmuDebug();
|
|
|
|
closeConEmuStdStreams();
|
2018-10-09 16:04:21 +02:00
|
|
|
exit(EXIT_SUCCESS);
|
|
|
|
}
|
|
|
|
else // Parent
|
|
|
|
{
|
2019-06-19 16:28:55 +02:00
|
|
|
// Start the terminal emulation
|
|
|
|
startConEmuTerminal (ConEmu::newer_vte_terminal);
|
2018-10-09 16:04:21 +02:00
|
|
|
|
|
|
|
if ( waitpid(pid, 0, WUNTRACED) != pid )
|
|
|
|
std::cerr << "waitpid error" << std::endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-09-14 22:42:56 +02:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FTermDetectionTest::ktermTest()
|
|
|
|
{
|
2019-05-27 00:50:11 +02:00
|
|
|
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
|
2018-09-20 23:59:01 +02:00
|
|
|
finalcut::FTermDetection detect;
|
2019-07-14 23:05:54 +02:00
|
|
|
data.setTermType(C_STR("kterm"));
|
2018-09-14 22:42:56 +02:00
|
|
|
detect.setTerminalDetection(true);
|
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
pid_t pid = forkConEmu();
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
if ( isConEmuChildProcess(pid) )
|
2018-09-14 22:42:56 +02:00
|
|
|
{
|
|
|
|
setenv ("TERM", "kterm", 1);
|
2018-09-16 19:33:40 +02:00
|
|
|
unsetenv("TERMCAP");
|
2018-09-14 22:42:56 +02:00
|
|
|
unsetenv("COLORTERM");
|
2018-09-18 06:04:27 +02:00
|
|
|
unsetenv("COLORFGBG");
|
2018-09-14 22:42:56 +02:00
|
|
|
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() );
|
|
|
|
|
2018-09-16 19:33:40 +02:00
|
|
|
// Test fallback to vt100 without TERM environment variable
|
|
|
|
unsetenv("TERM");
|
|
|
|
detect.setKtermTerminal(false);
|
|
|
|
detect.detect();
|
|
|
|
CPPUNIT_ASSERT ( ! detect.isKtermTerminal() );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), C_STR("vt100") );
|
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
printConEmuDebug();
|
|
|
|
closeConEmuStdStreams();
|
2018-09-15 01:54:02 +02:00
|
|
|
exit(EXIT_SUCCESS);
|
2018-09-14 22:42:56 +02:00
|
|
|
}
|
|
|
|
else // Parent
|
|
|
|
{
|
2019-06-19 16:28:55 +02:00
|
|
|
// Start the terminal emulation
|
|
|
|
startConEmuTerminal (ConEmu::kterm);
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2018-09-18 03:37:44 +02:00
|
|
|
if ( waitpid(pid, 0, WUNTRACED) != pid )
|
2018-09-16 19:33:40 +02:00
|
|
|
std::cerr << "waitpid error" << std::endl;
|
2018-09-14 22:42:56 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FTermDetectionTest::teraTermTest()
|
|
|
|
{
|
2019-05-27 00:50:11 +02:00
|
|
|
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
|
2018-09-20 23:59:01 +02:00
|
|
|
finalcut::FTermDetection detect;
|
2019-07-14 23:05:54 +02:00
|
|
|
data.setTermType(C_STR("xterm"));
|
2018-09-14 22:42:56 +02:00
|
|
|
detect.setTerminalDetection(true);
|
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
pid_t pid = forkConEmu();
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
if ( isConEmuChildProcess(pid) )
|
2018-09-14 22:42:56 +02:00
|
|
|
{
|
|
|
|
setenv ("TERM", "xterm", 1);
|
2018-09-16 19:33:40 +02:00
|
|
|
unsetenv("TERMCAP");
|
2018-09-14 22:42:56 +02:00
|
|
|
unsetenv("COLORTERM");
|
2018-09-18 06:04:27 +02:00
|
|
|
unsetenv("COLORFGBG");
|
2018-09-14 22:42:56 +02:00
|
|
|
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() );
|
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
printConEmuDebug();
|
|
|
|
closeConEmuStdStreams();
|
2018-09-15 01:54:02 +02:00
|
|
|
exit(EXIT_SUCCESS);
|
2018-09-14 22:42:56 +02:00
|
|
|
}
|
|
|
|
else // Parent
|
|
|
|
{
|
2019-06-19 16:28:55 +02:00
|
|
|
// Start the terminal emulation
|
|
|
|
startConEmuTerminal (ConEmu::tera_term);
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2018-09-18 03:37:44 +02:00
|
|
|
if ( waitpid(pid, 0, WUNTRACED) != pid )
|
2018-09-16 19:33:40 +02:00
|
|
|
std::cerr << "waitpid error" << std::endl;
|
2018-09-14 22:42:56 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FTermDetectionTest::cygwinTest()
|
|
|
|
{
|
2019-05-27 00:50:11 +02:00
|
|
|
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
|
2018-09-20 23:59:01 +02:00
|
|
|
finalcut::FTermDetection detect;
|
2019-07-14 23:05:54 +02:00
|
|
|
data.setTermType(C_STR("cygwin"));
|
2018-09-14 22:42:56 +02:00
|
|
|
detect.setTerminalDetection(true);
|
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
pid_t pid = forkConEmu();
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
if ( isConEmuChildProcess(pid) )
|
2018-09-14 22:42:56 +02:00
|
|
|
{
|
|
|
|
setenv ("TERM", "cygwin", 1);
|
2018-09-16 19:33:40 +02:00
|
|
|
unsetenv("TERMCAP");
|
2018-09-14 22:42:56 +02:00
|
|
|
unsetenv("COLORTERM");
|
2018-09-18 06:04:27 +02:00
|
|
|
unsetenv("COLORFGBG");
|
2018-09-14 22:42:56 +02:00
|
|
|
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() );
|
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
printConEmuDebug();
|
|
|
|
closeConEmuStdStreams();
|
2018-09-15 01:54:02 +02:00
|
|
|
exit(EXIT_SUCCESS);
|
2018-09-14 22:42:56 +02:00
|
|
|
}
|
|
|
|
else // Parent
|
|
|
|
{
|
2019-06-19 16:28:55 +02:00
|
|
|
// Start the terminal emulation
|
|
|
|
startConEmuTerminal (ConEmu::cygwin);
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2018-09-18 03:37:44 +02:00
|
|
|
if ( waitpid(pid, 0, WUNTRACED) != pid )
|
2018-09-16 19:33:40 +02:00
|
|
|
std::cerr << "waitpid error" << std::endl;
|
2018-09-14 22:42:56 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FTermDetectionTest::minttyTest()
|
|
|
|
{
|
2019-05-27 00:50:11 +02:00
|
|
|
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
|
2018-09-20 23:59:01 +02:00
|
|
|
finalcut::FTermDetection detect;
|
2019-07-14 23:05:54 +02:00
|
|
|
data.setTermType(C_STR("xterm-256color"));
|
2018-09-14 22:42:56 +02:00
|
|
|
detect.setTerminalDetection(true);
|
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
pid_t pid = forkConEmu();
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
if ( isConEmuChildProcess(pid) )
|
2018-09-14 22:42:56 +02:00
|
|
|
{
|
|
|
|
setenv ("TERM", "xterm-256color", 1);
|
2018-09-16 19:33:40 +02:00
|
|
|
unsetenv("TERMCAP");
|
2018-09-14 22:42:56 +02:00
|
|
|
unsetenv("COLORTERM");
|
2018-09-18 06:04:27 +02:00
|
|
|
unsetenv("COLORFGBG");
|
2018-09-14 22:42:56 +02:00
|
|
|
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() );
|
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
printConEmuDebug();
|
|
|
|
closeConEmuStdStreams();
|
2018-09-15 01:54:02 +02:00
|
|
|
exit(EXIT_SUCCESS);
|
2018-09-14 22:42:56 +02:00
|
|
|
}
|
|
|
|
else // Parent
|
|
|
|
{
|
2019-06-19 16:28:55 +02:00
|
|
|
// Start the terminal emulation
|
|
|
|
startConEmuTerminal (ConEmu::mintty);
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2018-09-18 03:37:44 +02:00
|
|
|
if ( waitpid(pid, 0, WUNTRACED) != pid )
|
2018-09-16 19:33:40 +02:00
|
|
|
std::cerr << "waitpid error" << std::endl;
|
2018-09-14 22:42:56 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FTermDetectionTest::linuxTest()
|
|
|
|
{
|
2019-05-27 00:50:11 +02:00
|
|
|
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
|
2018-09-20 23:59:01 +02:00
|
|
|
finalcut::FTermDetection detect;
|
2019-07-14 23:05:54 +02:00
|
|
|
data.setTermType(C_STR("linux"));
|
2018-09-14 22:42:56 +02:00
|
|
|
detect.setTerminalDetection(true);
|
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
pid_t pid = forkConEmu();
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
if ( isConEmuChildProcess(pid) )
|
2018-09-14 22:42:56 +02:00
|
|
|
{
|
|
|
|
setenv ("TERM", "linux", 1);
|
2018-09-16 19:33:40 +02:00
|
|
|
unsetenv("TERMCAP");
|
2018-09-14 22:42:56 +02:00
|
|
|
unsetenv("COLORTERM");
|
2018-09-18 06:04:27 +02:00
|
|
|
unsetenv("COLORFGBG");
|
2018-09-14 22:42:56 +02:00
|
|
|
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() );
|
|
|
|
|
2018-09-16 19:33:40 +02:00
|
|
|
// Test fallback to vt100 without TERM environment variable
|
|
|
|
unsetenv("TERM");
|
|
|
|
detect.setLinuxTerm(false);
|
|
|
|
detect.detect();
|
|
|
|
CPPUNIT_ASSERT ( ! detect.isLinuxTerm() );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), C_STR("vt100") );
|
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
printConEmuDebug();
|
|
|
|
closeConEmuStdStreams();
|
2018-09-15 01:54:02 +02:00
|
|
|
exit(EXIT_SUCCESS);
|
2018-09-14 22:42:56 +02:00
|
|
|
}
|
|
|
|
else // Parent
|
|
|
|
{
|
2019-06-19 16:28:55 +02:00
|
|
|
// Start the terminal emulation
|
|
|
|
startConEmuTerminal (ConEmu::linux_con);
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2018-09-18 03:37:44 +02:00
|
|
|
if ( waitpid(pid, 0, WUNTRACED) != pid )
|
2018-09-16 19:33:40 +02:00
|
|
|
std::cerr << "waitpid error" << std::endl;
|
2018-09-14 22:42:56 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FTermDetectionTest::freebsdTest()
|
|
|
|
{
|
2019-05-27 00:50:11 +02:00
|
|
|
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
|
2018-09-20 23:59:01 +02:00
|
|
|
finalcut::FTermDetection detect;
|
2019-07-14 23:05:54 +02:00
|
|
|
data.setTermType(C_STR("xterm"));
|
2018-09-14 22:42:56 +02:00
|
|
|
detect.setTerminalDetection(true);
|
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
pid_t pid = forkConEmu();
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
if ( isConEmuChildProcess(pid) )
|
2018-09-14 22:42:56 +02:00
|
|
|
{
|
|
|
|
setenv ("TERM", "xterm", 1);
|
2018-09-16 19:33:40 +02:00
|
|
|
unsetenv("TERMCAP");
|
2018-09-14 22:42:56 +02:00
|
|
|
unsetenv("COLORTERM");
|
2018-09-18 06:04:27 +02:00
|
|
|
unsetenv("COLORFGBG");
|
2018-09-14 22:42:56 +02:00
|
|
|
unsetenv("VTE_VERSION");
|
|
|
|
unsetenv("XTERM_VERSION");
|
|
|
|
unsetenv("ROXTERM_ID");
|
|
|
|
unsetenv("KONSOLE_DBUS_SESSION");
|
|
|
|
unsetenv("KONSOLE_DCOP");
|
|
|
|
unsetenv("TMUX");
|
|
|
|
|
|
|
|
detect.detect();
|
|
|
|
detect.setFreeBSDTerm (true); // Fake FreeBSD Console detection
|
|
|
|
|
|
|
|
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() );
|
|
|
|
|
2018-09-16 19:33:40 +02:00
|
|
|
// Test fallback to vt100 without TERM environment variable
|
|
|
|
unsetenv("TERM");
|
|
|
|
detect.setXTerminal (false);
|
|
|
|
detect.setFreeBSDTerm(false);
|
|
|
|
detect.detect();
|
|
|
|
CPPUNIT_ASSERT ( ! detect.isXTerminal() );
|
|
|
|
CPPUNIT_ASSERT ( ! detect.isFreeBSDTerm() );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), C_STR("vt100") );
|
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
printConEmuDebug();
|
|
|
|
closeConEmuStdStreams();
|
2018-09-15 01:54:02 +02:00
|
|
|
exit(EXIT_SUCCESS);
|
2018-09-14 22:42:56 +02:00
|
|
|
}
|
|
|
|
else // Parent
|
|
|
|
{
|
2019-06-19 16:28:55 +02:00
|
|
|
// Start the terminal emulation
|
|
|
|
startConEmuTerminal (ConEmu::freebsd_con);
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2018-09-18 03:37:44 +02:00
|
|
|
if ( waitpid(pid, 0, WUNTRACED) != pid )
|
2018-09-16 19:33:40 +02:00
|
|
|
std::cerr << "waitpid error" << std::endl;
|
2018-09-14 22:42:56 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FTermDetectionTest::netbsdTest()
|
|
|
|
{
|
2019-05-27 00:50:11 +02:00
|
|
|
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
|
2018-09-20 23:59:01 +02:00
|
|
|
finalcut::FTermDetection detect;
|
2019-07-14 23:05:54 +02:00
|
|
|
data.setTermType(C_STR("wsvt25"));
|
2018-09-14 22:42:56 +02:00
|
|
|
detect.setTerminalDetection(true);
|
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
pid_t pid = forkConEmu();
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
if ( isConEmuChildProcess(pid) )
|
2018-09-14 22:42:56 +02:00
|
|
|
{
|
|
|
|
setenv ("TERM", "wsvt25", 1);
|
2018-09-16 19:33:40 +02:00
|
|
|
unsetenv("TERMCAP");
|
2018-09-14 22:42:56 +02:00
|
|
|
unsetenv("COLORTERM");
|
2018-09-18 06:04:27 +02:00
|
|
|
unsetenv("COLORFGBG");
|
2018-09-14 22:42:56 +02:00
|
|
|
unsetenv("VTE_VERSION");
|
|
|
|
unsetenv("XTERM_VERSION");
|
|
|
|
unsetenv("ROXTERM_ID");
|
|
|
|
unsetenv("KONSOLE_DBUS_SESSION");
|
|
|
|
unsetenv("KONSOLE_DCOP");
|
|
|
|
unsetenv("TMUX");
|
|
|
|
|
|
|
|
detect.detect();
|
|
|
|
detect.setNetBSDTerm (true); // Fake NetBSD Console detection
|
|
|
|
|
|
|
|
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() );
|
|
|
|
|
2018-09-16 19:33:40 +02:00
|
|
|
// Test fallback to vt100 without TERM environment variable
|
|
|
|
unsetenv("TERM");
|
|
|
|
detect.setNetBSDTerm(false);
|
|
|
|
detect.detect();
|
|
|
|
CPPUNIT_ASSERT ( ! detect.isFreeBSDTerm() );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), C_STR("vt100") );
|
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
printConEmuDebug();
|
|
|
|
closeConEmuStdStreams();
|
2018-09-15 01:54:02 +02:00
|
|
|
exit(EXIT_SUCCESS);
|
2018-09-14 22:42:56 +02:00
|
|
|
}
|
|
|
|
else // Parent
|
|
|
|
{
|
2019-06-19 16:28:55 +02:00
|
|
|
// Start the terminal emulation
|
|
|
|
startConEmuTerminal (ConEmu::netbsd_con);
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2018-09-18 03:37:44 +02:00
|
|
|
if ( waitpid(pid, 0, WUNTRACED) != pid )
|
2018-09-16 19:33:40 +02:00
|
|
|
std::cerr << "waitpid error" << std::endl;
|
2018-09-14 22:42:56 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FTermDetectionTest::openbsdTest()
|
|
|
|
{
|
2019-05-27 00:50:11 +02:00
|
|
|
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
|
2018-09-20 23:59:01 +02:00
|
|
|
finalcut::FTermDetection detect;
|
2019-07-14 23:05:54 +02:00
|
|
|
data.setTermType(C_STR("vt220"));
|
2018-09-14 22:42:56 +02:00
|
|
|
detect.setTerminalDetection(true);
|
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
pid_t pid = forkConEmu();
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
if ( isConEmuChildProcess(pid) )
|
2018-09-14 22:42:56 +02:00
|
|
|
{
|
|
|
|
setenv ("TERM", "vt220", 1);
|
2018-09-16 19:33:40 +02:00
|
|
|
unsetenv("TERMCAP");
|
2018-09-14 22:42:56 +02:00
|
|
|
unsetenv("COLORTERM");
|
2018-09-18 06:04:27 +02:00
|
|
|
unsetenv("COLORFGBG");
|
2018-09-14 22:42:56 +02:00
|
|
|
unsetenv("VTE_VERSION");
|
|
|
|
unsetenv("XTERM_VERSION");
|
|
|
|
unsetenv("ROXTERM_ID");
|
|
|
|
unsetenv("KONSOLE_DBUS_SESSION");
|
|
|
|
unsetenv("KONSOLE_DCOP");
|
|
|
|
unsetenv("TMUX");
|
|
|
|
|
|
|
|
detect.detect();
|
|
|
|
detect.setOpenBSDTerm (true); // Fake OpenBSD Console detection
|
|
|
|
|
|
|
|
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() );
|
|
|
|
|
2018-09-16 19:33:40 +02:00
|
|
|
// Test fallback to vt100 without TERM environment variable
|
|
|
|
unsetenv("TERM");
|
|
|
|
detect.setOpenBSDTerm(false);
|
|
|
|
detect.detect();
|
|
|
|
CPPUNIT_ASSERT ( ! detect.isOpenBSDTerm() );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), C_STR("vt100") );
|
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
printConEmuDebug();
|
|
|
|
closeConEmuStdStreams();
|
2018-09-15 01:54:02 +02:00
|
|
|
exit(EXIT_SUCCESS);
|
2018-09-14 22:42:56 +02:00
|
|
|
}
|
|
|
|
else // Parent
|
|
|
|
{
|
2019-06-19 16:28:55 +02:00
|
|
|
// Start the terminal emulation
|
|
|
|
startConEmuTerminal (ConEmu::openbsd_con);
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2018-09-18 03:37:44 +02:00
|
|
|
if ( waitpid(pid, 0, WUNTRACED) != pid )
|
2018-09-16 19:33:40 +02:00
|
|
|
std::cerr << "waitpid error" << std::endl;
|
2018-09-14 22:42:56 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FTermDetectionTest::sunTest()
|
|
|
|
{
|
2019-05-27 00:50:11 +02:00
|
|
|
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
|
2018-09-20 23:59:01 +02:00
|
|
|
finalcut::FTermDetection detect;
|
2019-07-14 23:05:54 +02:00
|
|
|
data.setTermType(C_STR("sun-color"));
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
pid_t pid = forkConEmu();
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
if ( isConEmuChildProcess(pid) )
|
2018-09-14 22:42:56 +02:00
|
|
|
{
|
|
|
|
setenv ("TERM", "sun-color", 1);
|
2018-09-16 19:33:40 +02:00
|
|
|
unsetenv("TERMCAP");
|
2018-09-14 22:42:56 +02:00
|
|
|
unsetenv("COLORTERM");
|
2018-09-18 06:04:27 +02:00
|
|
|
unsetenv("COLORFGBG");
|
2018-09-14 22:42:56 +02:00
|
|
|
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() );
|
|
|
|
|
2018-09-16 19:33:40 +02:00
|
|
|
// Test fallback to vt100 without TERM environment variable
|
|
|
|
unsetenv("TERM");
|
|
|
|
detect.setSunTerminal(false);
|
|
|
|
detect.detect();
|
|
|
|
CPPUNIT_ASSERT ( ! detect.isSunTerminal() );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), C_STR("vt100") );
|
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
printConEmuDebug();
|
|
|
|
closeConEmuStdStreams();
|
2018-09-15 01:54:02 +02:00
|
|
|
exit(EXIT_SUCCESS);
|
2018-09-14 22:42:56 +02:00
|
|
|
}
|
|
|
|
else // Parent
|
|
|
|
{
|
2019-06-19 16:28:55 +02:00
|
|
|
// Start the terminal emulation
|
|
|
|
startConEmuTerminal (ConEmu::sun_con);
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2018-09-18 03:37:44 +02:00
|
|
|
if ( waitpid(pid, 0, WUNTRACED) != pid )
|
2018-09-16 19:33:40 +02:00
|
|
|
std::cerr << "waitpid error" << std::endl;
|
2018-09-14 22:42:56 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FTermDetectionTest::screenTest()
|
|
|
|
{
|
2019-05-27 00:50:11 +02:00
|
|
|
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
|
2018-09-20 23:59:01 +02:00
|
|
|
finalcut::FTermDetection detect;
|
2019-07-14 23:05:54 +02:00
|
|
|
data.setTermType(C_STR("screen"));
|
2018-09-14 22:42:56 +02:00
|
|
|
detect.setTerminalDetection(true);
|
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
pid_t pid = forkConEmu();
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
if ( isConEmuChildProcess(pid) )
|
2018-09-14 22:42:56 +02:00
|
|
|
{
|
|
|
|
setenv ("TERM", "screen", 1);
|
|
|
|
setenv ("TERMCAP", "SC|screen|VT 100/ANSI X3.64 virtual terminal:...", 1);
|
|
|
|
unsetenv("COLORTERM");
|
2018-09-18 06:04:27 +02:00
|
|
|
unsetenv("COLORFGBG");
|
2018-09-14 22:42:56 +02:00
|
|
|
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() );
|
2018-09-18 06:04:27 +02:00
|
|
|
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), C_STR("screen") );
|
|
|
|
|
|
|
|
setenv ("XTERM_VERSION", "XTerm(312)", 1);
|
|
|
|
detect.detect();
|
|
|
|
CPPUNIT_ASSERT ( detect.canDisplay256Colors() );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), C_STR("screen-256color") );
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
printConEmuDebug();
|
|
|
|
closeConEmuStdStreams();
|
2018-09-15 01:54:02 +02:00
|
|
|
exit(EXIT_SUCCESS);
|
2018-09-14 22:42:56 +02:00
|
|
|
}
|
|
|
|
else // Parent
|
|
|
|
{
|
2019-06-19 16:28:55 +02:00
|
|
|
// Start the terminal emulation
|
|
|
|
startConEmuTerminal (ConEmu::screen);
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2018-09-18 03:37:44 +02:00
|
|
|
if ( waitpid(pid, 0, WUNTRACED) != pid )
|
2018-09-16 19:33:40 +02:00
|
|
|
std::cerr << "waitpid error" << std::endl;
|
2018-09-14 22:42:56 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FTermDetectionTest::tmuxTest()
|
|
|
|
{
|
2019-05-27 00:50:11 +02:00
|
|
|
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
|
2018-09-20 23:59:01 +02:00
|
|
|
finalcut::FTermDetection detect;
|
2019-07-14 23:05:54 +02:00
|
|
|
data.setTermType(C_STR("screen"));
|
2018-09-14 22:42:56 +02:00
|
|
|
detect.setTerminalDetection(true);
|
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
pid_t pid = forkConEmu();
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
if ( isConEmuChildProcess(pid) )
|
2018-09-14 22:42:56 +02:00
|
|
|
{
|
|
|
|
setenv ("TERM", "screen", 1);
|
|
|
|
setenv ("TMUX", "/tmp/tmux-1000/default,7844,0", 1);
|
|
|
|
setenv ("TMUX_PANE", "%0", 1);
|
2018-09-16 19:33:40 +02:00
|
|
|
unsetenv("TERMCAP");
|
2018-09-14 22:42:56 +02:00
|
|
|
unsetenv("COLORTERM");
|
2018-09-18 06:04:27 +02:00
|
|
|
unsetenv("COLORFGBG");
|
2018-09-14 22:42:56 +02:00
|
|
|
unsetenv("VTE_VERSION");
|
|
|
|
unsetenv("XTERM_VERSION");
|
|
|
|
unsetenv("ROXTERM_ID");
|
|
|
|
unsetenv("KONSOLE_DBUS_SESSION");
|
|
|
|
unsetenv("KONSOLE_DCOP");
|
|
|
|
|
|
|
|
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() );
|
2018-09-18 06:04:27 +02:00
|
|
|
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), C_STR("screen") );
|
|
|
|
|
|
|
|
setenv ("VTE_VERSION", "3801", 1);
|
|
|
|
detect.detect();
|
|
|
|
CPPUNIT_ASSERT ( detect.canDisplay256Colors() );
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), C_STR("screen-256color") );
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
printConEmuDebug();
|
|
|
|
closeConEmuStdStreams();
|
2018-09-15 01:54:02 +02:00
|
|
|
exit(EXIT_SUCCESS);
|
2018-09-14 22:42:56 +02:00
|
|
|
}
|
|
|
|
else // Parent
|
|
|
|
{
|
|
|
|
// Start the terminal simulation
|
2019-06-19 16:28:55 +02:00
|
|
|
startConEmuTerminal (ConEmu::tmux);
|
2018-09-14 22:42:56 +02:00
|
|
|
|
2018-09-18 03:37:44 +02:00
|
|
|
if ( waitpid(pid, 0, WUNTRACED) != pid )
|
2018-09-16 19:33:40 +02:00
|
|
|
std::cerr << "waitpid error" << std::endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
void FTermDetectionTest::ttytypeTest()
|
|
|
|
{
|
2018-09-18 06:04:27 +02:00
|
|
|
// Test without TERM environment variable
|
|
|
|
|
2018-09-18 03:09:14 +02:00
|
|
|
if ( mkdir("new-root-dir", 0755) == -1 )
|
|
|
|
if ( errno != EEXIST )
|
2018-09-16 19:33:40 +02:00
|
|
|
return;
|
|
|
|
|
2018-09-18 03:09:14 +02:00
|
|
|
if ( mkdir("new-root-dir/etc", 0755) == -1 )
|
|
|
|
if ( errno != EEXIST )
|
2018-09-16 19:33:40 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
// Write a own /etc/ttytype file
|
|
|
|
std::ofstream ttytype ("new-root-dir/etc/ttytype");
|
|
|
|
|
|
|
|
if ( ! ttytype.is_open() )
|
|
|
|
{
|
|
|
|
rmdir("new-root-dir/etc");
|
|
|
|
rmdir("new-root-dir");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ttytype << "linux" << "\t" << "tty1" << std::endl;
|
|
|
|
ttytype << "linux" << "\t" << "tty2" << std::endl;
|
|
|
|
ttytype << "linux" << "\t" << "tty3" << std::endl;
|
|
|
|
ttytype << "linux" << "\t" << "tty4" << std::endl;
|
|
|
|
ttytype << "linux" << "\t" << "tty5" << std::endl;
|
|
|
|
ttytype << "linux" << "\t" << "tty6" << std::endl;
|
|
|
|
ttytype << "vt100" << "\t" << "ttyp0" << std::endl;
|
|
|
|
ttytype << "vt100" << "\t" << "ttyp1" << std::endl;
|
|
|
|
ttytype << "vt100" << "\t" << "ttyp2" << std::endl;
|
|
|
|
ttytype << "vt100" << "\t" << "ttyp3" << std::endl;
|
|
|
|
ttytype << "vt100" << "\t" << "ttyp4" << std::endl;
|
|
|
|
ttytype << "vt100" << "\t" << "ttyp5" << std::endl;
|
|
|
|
ttytype << "vt100" << "\t" << "ttyp6" << std::endl;
|
|
|
|
ttytype.close();
|
|
|
|
|
2019-05-27 00:50:11 +02:00
|
|
|
finalcut::FTermData& data = *finalcut::FTerm::getFTermData();
|
2018-09-20 23:59:01 +02:00
|
|
|
finalcut::FTermDetection detect;
|
2018-09-16 19:33:40 +02:00
|
|
|
detect.setTerminalDetection(true);
|
|
|
|
detect.setTtyTypeFileName(C_STR("new-root-dir/etc/ttytype"));
|
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
pid_t pid = forkConEmu();
|
2018-09-16 19:33:40 +02:00
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
if ( isConEmuChildProcess(pid) )
|
2018-09-16 19:33:40 +02:00
|
|
|
{
|
|
|
|
unsetenv("TERM");
|
|
|
|
unsetenv("TERMCAP");
|
|
|
|
unsetenv("COLORTERM");
|
2018-09-18 06:04:27 +02:00
|
|
|
unsetenv("COLORFGBG");
|
2018-09-16 19:33:40 +02:00
|
|
|
unsetenv("VTE_VERSION");
|
|
|
|
unsetenv("XTERM_VERSION");
|
|
|
|
unsetenv("ROXTERM_ID");
|
|
|
|
unsetenv("KONSOLE_DBUS_SESSION");
|
|
|
|
unsetenv("KONSOLE_DCOP");
|
|
|
|
unsetenv("TMUX");
|
|
|
|
|
|
|
|
// Test /dev/tty3 with linux
|
2018-10-01 22:27:54 +02:00
|
|
|
data.setTermFileName(C_STR("/dev/tty3"));
|
2018-09-16 19:33:40 +02:00
|
|
|
detect.detect();
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), C_STR("linux") );
|
|
|
|
|
|
|
|
// Test /dev/ttyp0 with vt100
|
2018-10-01 22:27:54 +02:00
|
|
|
data.setTermFileName(C_STR("/dev/ttyp0"));
|
2018-09-16 19:33:40 +02:00
|
|
|
detect.detect();
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), C_STR("vt100") );
|
|
|
|
|
|
|
|
// Test non-existent /dev/tty8 with fallback to vt100
|
2018-10-01 22:27:54 +02:00
|
|
|
data.setTermFileName(C_STR("/dev/tty8"));
|
2018-09-16 19:33:40 +02:00
|
|
|
detect.detect();
|
|
|
|
CPPUNIT_ASSERT_CSTRING ( detect.getTermType(), C_STR("vt100") );
|
|
|
|
|
2019-06-19 16:28:55 +02:00
|
|
|
printConEmuDebug();
|
|
|
|
closeConEmuStdStreams();
|
2018-09-16 19:33:40 +02:00
|
|
|
exit(EXIT_SUCCESS);
|
|
|
|
}
|
|
|
|
else // Parent
|
|
|
|
{
|
2019-06-19 16:28:55 +02:00
|
|
|
// Start the terminal emulation
|
|
|
|
startConEmuTerminal (ConEmu::ansi);
|
2018-09-16 19:33:40 +02:00
|
|
|
|
2018-09-18 03:37:44 +02:00
|
|
|
if ( waitpid(pid, 0, WUNTRACED) != pid )
|
2018-09-16 19:33:40 +02:00
|
|
|
std::cerr << "waitpid error" << std::endl;
|
2018-09-14 22:42:56 +02:00
|
|
|
}
|
2018-09-16 19:33:40 +02:00
|
|
|
|
|
|
|
unlink("new-root-dir/etc/ttytype");
|
|
|
|
rmdir("new-root-dir/etc");
|
|
|
|
rmdir("new-root-dir");
|
2018-09-14 22:42:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Put the test suite in the registry
|
|
|
|
CPPUNIT_TEST_SUITE_REGISTRATION (FTermDetectionTest);
|
|
|
|
|
|
|
|
// The general unit test main part
|
|
|
|
#include <main-test.inc>
|