FKeyboardTest fixes

This commit is contained in:
Markus Gans 2018-07-23 01:48:29 +02:00
parent a4be4da63d
commit 885993c3bd
3 changed files with 37 additions and 23 deletions

View File

@ -501,7 +501,10 @@ int FKeyboard::keyCorrection (const int& keycode)
int key_correction; int key_correction;
#if defined(__linux__) #if defined(__linux__)
if ( linux )
key_correction = linux->modifierKeyCorrection(keycode); key_correction = linux->modifierKeyCorrection(keycode);
else
key_correction = key;
#else #else
key_correction = key; key_correction = key;
#endif #endif

View File

@ -244,6 +244,7 @@ class FKeyboardTest : public CPPUNIT_NS::TestFixture
// End of test suite definition // End of test suite definition
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
void init();
void input (std::string); void input (std::string);
void processInput(); void processInput();
void clear(); void clear();
@ -264,24 +265,7 @@ FKeyboardTest::FKeyboardTest()
, key_released(0) , key_released(0)
, keyboard(0) , keyboard(0)
{ {
keyboard = new FKeyboard(); init();
FApplication* object = reinterpret_cast<FApplication*>(this);
void (FApplication::*method1)()
= reinterpret_cast<void(FApplication::*)()>(&FKeyboardTest::keyPressed);
void (FApplication::*method2)()
= reinterpret_cast<void(FApplication::*)()>(&FKeyboardTest::keyReleased);
void (FApplication::*method3)()
= reinterpret_cast<void(FApplication::*)()>(&FKeyboardTest::escapeKeyPressed);
FKeyboardCommand key_cmd1 (object, method1);
FKeyboardCommand key_cmd2 (object, method2);
FKeyboardCommand key_cmd3 (object, method3);
keyboard->setPressCommand (key_cmd1);
keyboard->setReleaseCommand (key_cmd2);
keyboard->setEscPressedCommand (key_cmd3);
keyboard->setKeypressTimeout (100000); // 100 ms
keyboard->enableUTF8();
keyboard->enableMouseSequences();
keyboard->setTermcapMap (reinterpret_cast<fc::fkeymap*>(test::Fkey));
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -389,6 +373,29 @@ void FKeyboardTest::inputTest()
clear(); clear();
} }
//----------------------------------------------------------------------
void FKeyboardTest::init()
{
keyboard = new FKeyboard();
FApplication* object = reinterpret_cast<FApplication*>(this);
void (FApplication::*method1)()
= reinterpret_cast<void(FApplication::*)()>(&FKeyboardTest::keyPressed);
void (FApplication::*method2)()
= reinterpret_cast<void(FApplication::*)()>(&FKeyboardTest::keyReleased);
void (FApplication::*method3)()
= reinterpret_cast<void(FApplication::*)()>(&FKeyboardTest::escapeKeyPressed);
FKeyboardCommand key_cmd1 (object, method1);
FKeyboardCommand key_cmd2 (object, method2);
FKeyboardCommand key_cmd3 (object, method3);
keyboard->setPressCommand (key_cmd1);
keyboard->setReleaseCommand (key_cmd2);
keyboard->setEscPressedCommand (key_cmd3);
keyboard->setKeypressTimeout (100000); // 100 ms
keyboard->enableUTF8();
keyboard->enableMouseSequences();
keyboard->setTermcapMap (reinterpret_cast<fc::fkeymap*>(test::Fkey));
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FKeyboardTest::input (std::string s) void FKeyboardTest::input (std::string s)
{ {
@ -402,11 +409,15 @@ void FKeyboardTest::input (std::string s)
while ( iter != s.end() ) while ( iter != s.end() )
{ {
char c = *iter; char c = *iter;
ioctl (FTermios::getStdIn(), TIOCSTI, &c);
if ( ioctl (FTermios::getStdIn(), TIOCSTI, &c) < 0 )
break;
++iter; ++iter;
} }
ioctl (FTermios::getStdIn(), TIOCSTI, &EOT); if ( ioctl (FTermios::getStdIn(), TIOCSTI, &EOT) < 0 )
return;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -4035,8 +4035,8 @@ void FOptiAttrTest::wyse50Test()
ESC "G0" ESC "cD"), // Exit crossed out ESC "G0" ESC "cD"), // Exit crossed out
0, // Enter double underline 0, // Enter double underline
0, // Exit double underline 0, // Exit double underline
C_STR("%?%p8%t\E)%e\E(%;" C_STR("%?%p8%t\033)%e\033(%;"
"%?%p9%t\EcE%e\EcD%;\EG%'0'" "%?%p9%t\033cE%e\033cD%;\033G%'0'"
"%?%p2%t%{8}%|%;" "%?%p2%t%{8}%|%;"
"%?%p1%p3%|%p6%|%t%{4}%|%;" "%?%p1%p3%|%p6%|%t%{4}%|%;"
"%?%p4%t%{2}%|%;" "%?%p4%t%{2}%|%;"