From 38df0392356d4ac9effecdd2581c20fdc9444ef4 Mon Sep 17 00:00:00 2001 From: Markus Gans Date: Thu, 4 Jul 2019 15:26:26 +0200 Subject: [PATCH] Expanding the unit test for FTermLinux --- ChangeLog | 2 +- README.md | 66 +++-- build.sh | 1 + doc/class-diagram.txt | 67 +++-- src/ftermlinux.cpp | 8 +- src/include/final/fsystem.h | 17 +- src/include/final/fsystemimpl.h | 4 + test/ftermlinux-test.cpp | 486 ++++++++++++++++++++++++++++++-- 8 files changed, 561 insertions(+), 90 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7b4467b5..4c196acc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,5 @@ 2019-06-30 Markus Gans - * Expanding the Unit Test for FTermLinux + * Expanding the unit test for FTermLinux * Update the cp437 unicode map * Reducing the special cases for Solaris diff --git a/README.md b/README.md index 7d707369..88bd0194 100644 --- a/README.md +++ b/README.md @@ -152,47 +152,53 @@ Class digramm 1┌──────────────┐ ┌-----------┤ FTermFreeBSD │ : └──────────────┘ - : 1┌──────────────┐ ┌───────────┐ - ┌-----------┤ FTermOpenBSD │ ┌────┤ FKeyEvent │ - : └──────────────┘ │ └───────────┘ + : 1┌──────────────┐ + ┌-----------┤ FTermOpenBSD │ + : └──────────────┘ + : 1┌────────────────┐ ┌───────────┐ + ┌-----------┤ FTermDetection │ ┌────┤ FKeyEvent │ + : └────────────────┘ │ └───────────┘ : 1┌────────────────┐ │ ┌─────────────┐ - ┌-----------┤ FTermDetection │ ├────┤ FMouseEvent │ + ┌-----------┤ FTermcapQuirks │ ├────┤ FMouseEvent │ : └────────────────┘ │ └─────────────┘ : 1┌────────────────┐ │ ┌─────────────┐ - ┌-----------┤ FTermcapQuirks │ ├────┤ FWheelEvent │ - : └────────────────┘ │ └─────────────┘ - : 1┌────────────────┐ │ ┌─────────────┐ - ┌-----------┤ FTermXTerminal │ ├────┤ FFocusEvent │ + ┌-----------┤ FTermXTerminal │ ├────┤ FWheelEvent │ : └────────────────┘ │ └─────────────┘ : 1┌──────────┐ │ ┌─────────────┐ - ┌-----------┤ FTermcap │ ├────┤ FAccelEvent │ + ┌-----------┤ FTermcap │ ├────┤ FFocusEvent │ : └──────────┘ │ └─────────────┘ - : 1┌──────────┐ │ ┌──────────────┐ - ┌-----------┤ FTermios │ ├────┤ FResizeEvent │ - : └──────────┘ │ └──────────────┘ - : 1┌───────────────┐ │ ┌────────────┐ - ┌-----------┤ FColorPalette │ ├────┤ FShowEvent │ - : └───────────────┘ │ └────────────┘ + : 1┌──────────┐ │ ┌─────────────┐ + ┌-----------┤ FTermios │ ├────┤ FAccelEvent │ + : └──────────┘ │ └─────────────┘ + : 1┌───────────────┐ │ ┌──────────────┐ + ┌-----------┤ FColorPalette │ ├────┤ FResizeEvent │ + : └───────────────┘ │ └──────────────┘ : 1┌───────────┐ │ ┌────────────┐ - ┌-----------┤ FOptiMove │ ├────┤ FHideEvent │ + ┌-----------┤ FOptiMove │ ├────┤ FShowEvent │ + : └───────────┘ │ └────────────┘ + : 1┌───────────┐ │ ┌────────────┐ + ┌-----------┤ FOptiAttr │ ├────┤ FHideEvent │ : └───────────┘ │ └────────────┘ : 1┌───────────┐ │ ┌─────────────┐ - ┌-----------┤ FOptiAttr │ ├────┤ FCloseEvent │ + ┌-----------┤ FKeyboard │ ├────┤ FCloseEvent │ : └───────────┘ │ └─────────────┘ - : 1┌───────────┐ │ ┌─────────────┐ - ┌-----------┤ FKeyboard │ ├────┤ FTimerEvent │ - : └───────────┘ │ └─────────────┘ - : 1┌───────────────┐ │ - ┌-----------┤ FMouseControl │ │ ┌──────────────┐ - : └───────────────┘ │ ┌────┤ FApplication │ - : *┌─────────┐ │ │ └──────────────┘ - : ┌--------┤ FString │ │ │ ┌─────────┐ - : : └─────────┘ │ ├────┤ FButton │ - : : *┌────────┐ │ │ └─────────┘ - : ┌--------┤ FPoint │ │ │ ┌────────┐ - : : └────────┘ │ ├────┤ FLabel │ + : 1┌───────────────┐ │ ┌─────────────┐ + ┌-----------┤ FMouseControl │ ├────┤ FTimerEvent │ + : └───────────────┘ │ └─────────────┘ + : 1┌─────────┐ │ + ┌-----------┤ FSystem │ │ + : └─────────┘ │ + : *┌─────────┐ │ + : ┌--------┤ FString │ │ ┌──────────────┐ + : : └─────────┘ │ ┌────┤ FApplication │ + : : *┌────────┐ │ │ └──────────────┘ + : ┌--------┤ FPoint │ │ │ ┌─────────┐ + : : └────────┘ │ ├────┤ FButton │ + : : *┌───────┐ │ │ └─────────┘ + : ┌--------┤ FRect │ │ │ ┌────────┐ + : : └───────┘ │ ├────┤ FLabel │ : : *┌───────┐ │ │ └────────┘ - : ┌--------┤ FRect │ │ │ ┌───────────┐ + : ┌--------┤ FSize │ │ │ ┌───────────┐ : : └───────┘ │ ├────┤ FLineEdit │ :1 :1 │ │ └───────────┘ ┌─┴──┴──┐ │ │ ┌──────────────┐ ┌──────────────┐ diff --git a/build.sh b/build.sh index deeaebeb..22f260b4 100755 --- a/build.sh +++ b/build.sh @@ -139,6 +139,7 @@ if [ "$1" = "--unit-test" ] \ || [ "$1" = "--coverage" ] \ || [ "$1" = "coverage" ] then + rm test/*.log 2>/dev/null cd test && make check-TESTS cat ./*.log 2>/dev/null cd .. || exit diff --git a/doc/class-diagram.txt b/doc/class-diagram.txt index 200f4ace..5157f210 100644 --- a/doc/class-diagram.txt +++ b/doc/class-diagram.txt @@ -4,47 +4,53 @@ 1┌──────────────┐ ┌-----------┤ FTermFreeBSD │ : └──────────────┘ - : 1┌──────────────┐ ┌───────────┐ - ┌-----------┤ FTermOpenBSD │ ┌────┤ FKeyEvent │ - : └──────────────┘ │ └───────────┘ + : 1┌──────────────┐ + ┌-----------┤ FTermOpenBSD │ + : └──────────────┘ + : 1┌────────────────┐ ┌───────────┐ + ┌-----------┤ FTermDetection │ ┌────┤ FKeyEvent │ + : └────────────────┘ │ └───────────┘ : 1┌────────────────┐ │ ┌─────────────┐ - ┌-----------┤ FTermDetection │ ├────┤ FMouseEvent │ + ┌-----------┤ FTermcapQuirks │ ├────┤ FMouseEvent │ : └────────────────┘ │ └─────────────┘ : 1┌────────────────┐ │ ┌─────────────┐ - ┌-----------┤ FTermcapQuirks │ ├────┤ FWheelEvent │ - : └────────────────┘ │ └─────────────┘ - : 1┌────────────────┐ │ ┌─────────────┐ - ┌-----------┤ FTermXTerminal │ ├────┤ FFocusEvent │ + ┌-----------┤ FTermXTerminal │ ├────┤ FWheelEvent │ : └────────────────┘ │ └─────────────┘ : 1┌──────────┐ │ ┌─────────────┐ - ┌-----------┤ FTermcap │ ├────┤ FAccelEvent │ + ┌-----------┤ FTermcap │ ├────┤ FFocusEvent │ : └──────────┘ │ └─────────────┘ - : 1┌──────────┐ │ ┌──────────────┐ - ┌-----------┤ FTermios │ ├────┤ FResizeEvent │ - : └──────────┘ │ └──────────────┘ - : 1┌───────────────┐ │ ┌────────────┐ - ┌-----------┤ FColorPalette │ ├────┤ FShowEvent │ - : └───────────────┘ │ └────────────┘ + : 1┌──────────┐ │ ┌─────────────┐ + ┌-----------┤ FTermios │ ├────┤ FAccelEvent │ + : └──────────┘ │ └─────────────┘ + : 1┌───────────────┐ │ ┌──────────────┐ + ┌-----------┤ FColorPalette │ ├────┤ FResizeEvent │ + : └───────────────┘ │ └──────────────┘ : 1┌───────────┐ │ ┌────────────┐ - ┌-----------┤ FOptiMove │ ├────┤ FHideEvent │ + ┌-----------┤ FOptiMove │ ├────┤ FShowEvent │ + : └───────────┘ │ └────────────┘ + : 1┌───────────┐ │ ┌────────────┐ + ┌-----------┤ FOptiAttr │ ├────┤ FHideEvent │ : └───────────┘ │ └────────────┘ : 1┌───────────┐ │ ┌─────────────┐ - ┌-----------┤ FOptiAttr │ ├────┤ FCloseEvent │ + ┌-----------┤ FKeyboard │ ├────┤ FCloseEvent │ : └───────────┘ │ └─────────────┘ - : 1┌───────────┐ │ ┌─────────────┐ - ┌-----------┤ FKeyboard │ ├────┤ FTimerEvent │ - : └───────────┘ │ └─────────────┘ - : 1┌───────────────┐ │ - ┌-----------┤ FMouseControl │ │ ┌──────────────┐ - : └───────────────┘ │ ┌────┤ FApplication │ - : *┌─────────┐ │ │ └──────────────┘ - : ┌--------┤ FString │ │ │ ┌─────────┐ - : : └─────────┘ │ ├────┤ FButton │ - : : *┌────────┐ │ │ └─────────┘ - : ┌--------┤ FPoint │ │ │ ┌────────┐ - : : └────────┘ │ ├────┤ FLabel │ + : 1┌───────────────┐ │ ┌─────────────┐ + ┌-----------┤ FMouseControl │ ├────┤ FTimerEvent │ + : └───────────────┘ │ └─────────────┘ + : 1┌─────────┐ │ + ┌-----------┤ FSystem │ │ + : └─────────┘ │ + : *┌─────────┐ │ + : ┌--------┤ FString │ │ ┌──────────────┐ + : : └─────────┘ │ ┌────┤ FApplication │ + : : *┌────────┐ │ │ └──────────────┘ + : ┌--------┤ FPoint │ │ │ ┌─────────┐ + : : └────────┘ │ ├────┤ FButton │ + : : *┌───────┐ │ │ └─────────┘ + : ┌--------┤ FRect │ │ │ ┌────────┐ + : : └───────┘ │ ├────┤ FLabel │ : : *┌───────┐ │ │ └────────┘ - : ┌--------┤ FRect │ │ │ ┌───────────┐ + : ┌--------┤ FSize │ │ │ ┌───────────┐ : : └───────┘ │ ├────┤ FLineEdit │ :1 :1 │ │ └───────────┘ ┌─┴──┴──┐ │ │ ┌──────────────┐ ┌──────────────┐ @@ -100,4 +106,3 @@ └──────────┘ │ ┌────────────────┐* : └──┤ FRadioMenuItem ├---┘ └────────────────┘ - diff --git a/src/ftermlinux.cpp b/src/ftermlinux.cpp index d80b67cf..b575820e 100644 --- a/src/ftermlinux.cpp +++ b/src/ftermlinux.cpp @@ -252,6 +252,7 @@ void FTermLinux::finish() bool FTermLinux::loadVGAFont() { vga_font = true; + new_font = false; if ( FTerm::openConsole() == 0 ) { @@ -292,6 +293,7 @@ bool FTermLinux::loadVGAFont() bool FTermLinux::loadNewFont() { new_font = true; + vga_font = false; if ( FTerm::openConsole() == 0 ) { @@ -840,7 +842,7 @@ int FTermLinux::setBlinkAsIntensity (bool enable) if ( screen_font.charcount > 256 ) return -1; - if ( getuid() != 0 ) // Direct hardware access requires root privileges + if ( fsystem->getuid() != 0 ) // Direct hardware access requires root privileges return -2; if ( fd_tty < 0 ) @@ -1109,10 +1111,10 @@ FKey FTermLinux::shiftAltKeyCorrection (const FKey& key_id) return fc::Fmkey_sdown; // Shift+Meta+Down case fc::Fkey_left: - return fc::Fmkey_sright; // Shift+Meta+Left + return fc::Fmkey_sleft; // Shift+Meta+Left case fc::Fkey_right: - return fc::Fmkey_sleft; // Shift+Meta+Right + return fc::Fmkey_sright; // Shift+Meta+Right case fc::Fkey_ic: return fc::Fmkey_sic; // Shift+Meta+Ins diff --git a/src/include/final/fsystem.h b/src/include/final/fsystem.h index 8d3ea699..7d1ed7e6 100644 --- a/src/include/final/fsystem.h +++ b/src/include/final/fsystem.h @@ -58,15 +58,16 @@ class FSystem // Methods virtual uChar inPortByte (uShort) = 0; - virtual void outPortByte (uChar, uShort) = 0; - virtual int isTTY (int) = 0; - virtual int ioctl (int, uLong, ...) = 0; - virtual int open (const char*, int, ...) = 0; - virtual int close (int) = 0; + virtual void outPortByte (uChar, uShort) = 0; + virtual int isTTY (int) = 0; + virtual int ioctl (int, uLong, ...) = 0; + virtual int open (const char*, int, ...) = 0; + virtual int close (int) = 0; virtual FILE* fopen (const char*, const char*) = 0; - virtual int fclose (FILE*) = 0; - virtual int putchar (int) = 0; - virtual int tputs (const char*, int, int (*)(int)) = 0; + virtual int fclose (FILE*) = 0; + virtual int putchar (int) = 0; + virtual int tputs (const char*, int, int (*)(int)) = 0; + virtual uid_t getuid() = 0; }; #pragma pack(pop) diff --git a/src/include/final/fsystemimpl.h b/src/include/final/fsystemimpl.h index acc43659..69a337a7 100644 --- a/src/include/final/fsystemimpl.h +++ b/src/include/final/fsystemimpl.h @@ -186,6 +186,10 @@ class FSystemImpl : public FSystem #endif } + virtual uid_t getuid() + { + return ::getuid(); + } }; #pragma pack(pop) diff --git a/test/ftermlinux-test.cpp b/test/ftermlinux-test.cpp index e9a234a3..ac96c7e9 100644 --- a/test/ftermlinux-test.cpp +++ b/test/ftermlinux-test.cpp @@ -114,11 +114,11 @@ class FSystemTest : public finalcut::FSystem virtual int fclose (FILE*); virtual int putchar (int); virtual int tputs (const char*, int, int (*)(int)); + virtual uid_t getuid(); rgb& getRGB (std::size_t); console_font_op& getConsoleFont(); - - // Data Members - std::string characters; + shiftstate& getShiftState(); + std::string& getCharacters(); private: // Methods @@ -126,6 +126,7 @@ class FSystemTest : public finalcut::FSystem static void initFScreenInfo(); // Data Members + std::string characters; static shiftstate shift_state; static rgb terminal_color[16]; static rgb defaultColor[16]; @@ -148,7 +149,6 @@ class FSystemTest : public finalcut::FSystem uChar port_3da = 0; // Input status 1 static uChar vga8x16[]; static struct unipair unicode_cp437_pairs[]; - }; #pragma pack(pop) @@ -1341,6 +1341,12 @@ int FSystemTest::tputs (const char* str, int affcnt, int (*putc)(int)) return ::tputs (str, affcnt, putc); } +//---------------------------------------------------------------------- +uid_t FSystemTest::getuid() +{ + return 0; +} + //---------------------------------------------------------------------- FSystemTest::rgb& FSystemTest::getRGB (std::size_t i) { @@ -1356,6 +1362,17 @@ console_font_op& FSystemTest::getConsoleFont() return terminal_font; } +//---------------------------------------------------------------------- +FSystemTest::shiftstate& FSystemTest::getShiftState() +{ + return shift_state; +} + +//---------------------------------------------------------------------- +std::string& FSystemTest::getCharacters() +{ + return characters; +} // private methods of FSystemTest //---------------------------------------------------------------------- @@ -1450,6 +1467,7 @@ class FTermLinuxTest : public CPPUNIT_NS::TestFixture, test::ConEmu void linuxCursorStyleTest(); void linuxColorPaletteTest(); void linuxFontTest(); + void modifierKeyTest(); private: // Adds code needed to register the test suite @@ -1461,6 +1479,7 @@ class FTermLinuxTest : public CPPUNIT_NS::TestFixture, test::ConEmu CPPUNIT_TEST (linuxCursorStyleTest); CPPUNIT_TEST (linuxColorPaletteTest); CPPUNIT_TEST (linuxFontTest); + CPPUNIT_TEST (modifierKeyTest); // End of test suite definition CPPUNIT_TEST_SUITE_END(); @@ -1556,21 +1575,22 @@ void FTermLinuxTest::linuxConsoleTest() CPPUNIT_ASSERT ( linux.getFramebufferBpp() == 32 ); test::FSystemTest* fsystest = static_cast(fsys); + std::string& characters = fsystest->getCharacters(); linux.setUTF8 (false); - CPPUNIT_ASSERT ( fsystest->characters == ESC "%@" ); - fsystest->characters.clear(); + CPPUNIT_ASSERT ( characters == ESC "%@" ); + characters.clear(); linux.setUTF8 (true); - CPPUNIT_ASSERT ( fsystest->characters == ESC "%G" ); - fsystest->characters.clear(); + CPPUNIT_ASSERT ( characters == ESC "%G" ); + characters.clear(); linux.setBeep (200, 100); - CPPUNIT_ASSERT ( fsystest->characters == CSI "10;200]" CSI "11;100]" ); - fsystest->characters.clear(); + CPPUNIT_ASSERT ( characters == CSI "10;200]" CSI "11;100]" ); + characters.clear(); linux.resetBeep(); - CPPUNIT_ASSERT ( fsystest->characters == CSI "10;750]" CSI "11;125]" ); - fsystest->characters.clear(); + CPPUNIT_ASSERT ( characters == CSI "10;750]" CSI "11;125]" ); + characters.clear(); linux.initCharMap (finalcut::fc::character); auto& character_map = data->getCharSubstitutionMap(); @@ -1579,10 +1599,6 @@ void FTermLinuxTest::linuxConsoleTest() CPPUNIT_ASSERT ( character_map[finalcut::fc::Times] == L'x' ); CPPUNIT_ASSERT ( character_map[L'ˣ'] == L'ⁿ' ); - // linux.loadVGAFont() - // linux.loadNewFont() - // linux.loadOldFont(finalcut::fc::character); - closeConEmuStdStreams(); exit(EXIT_SUCCESS); } @@ -2075,23 +2091,28 @@ void FTermLinuxTest::linuxFontTest() test::FSystemTest* fsystest = static_cast(fsys); console_font_op& font = fsystest->getConsoleFont(); CPPUNIT_ASSERT ( font.op == KD_FONT_OP_GET ); + CPPUNIT_ASSERT ( ! linux.isVGAFontUsed() ); + CPPUNIT_ASSERT ( ! linux.isNewFontUsed() ); linux.loadVGAFont(); CPPUNIT_ASSERT ( data->hasShadowCharacter() ); CPPUNIT_ASSERT ( data->hasHalfBlockCharacter() ); CPPUNIT_ASSERT ( font.op == KD_FONT_OP_SET ); + CPPUNIT_ASSERT ( linux.isVGAFontUsed() ); + CPPUNIT_ASSERT ( ! linux.isNewFontUsed() ); // Full block character test for (std::size_t i = 0; i < 16 ; i++) CPPUNIT_ASSERT ( font.data[219 * 32 + i] == 0xff ); linux.loadNewFont(); + CPPUNIT_ASSERT ( ! linux.isVGAFontUsed() ); + CPPUNIT_ASSERT ( linux.isNewFontUsed() ); // Full block character test for (std::size_t i = 0; i < 16 ; i++) CPPUNIT_ASSERT ( font.data[219 * 32 + i] == 0xff ); - // New font bullet CPPUNIT_ASSERT ( font.data[249 * 32 + 0] == 0x00 ); CPPUNIT_ASSERT ( font.data[249 * 32 + 1] == 0x00 ); @@ -2111,6 +2132,8 @@ void FTermLinuxTest::linuxFontTest() CPPUNIT_ASSERT ( font.data[249 * 32 + 15] == 0x00 ); linux.loadOldFont(finalcut::fc::character); + CPPUNIT_ASSERT ( ! linux.isVGAFontUsed() ); + CPPUNIT_ASSERT ( ! linux.isNewFontUsed() ); // cp437 bullet operator CPPUNIT_ASSERT ( font.data[249 * 32 + 0] == 0x00 ); @@ -2145,6 +2168,435 @@ void FTermLinuxTest::linuxFontTest() linux.finish(); } +//---------------------------------------------------------------------- +void FTermLinuxTest::modifierKeyTest() +{ + FKey keycode; + FKey mod_keycode; + const finalcut::FTermLinux linux; + finalcut::FSystem* fsys; + fsys = new test::FSystemTest(); + test::FSystemTest* fsystest = static_cast(fsys); + test::FSystemTest::shiftstate& mod_key = fsystest->getShiftState(); + + // Up key + keycode = finalcut::fc::Fkey_up; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fkey_up ); + + mod_key.shift = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fkey_sr ); + + mod_key.shift = 0; + mod_key.ctrl = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fckey_up ); + + mod_key.ctrl = 0; + mod_key.alt = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fmkey_up ); + + mod_key.shift = 1; + mod_key.ctrl = 1; + mod_key.alt = 0; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fckey_sup ); + + mod_key.ctrl = 0; + mod_key.alt = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fmkey_sup ); + + mod_key.shift = 0; + mod_key.ctrl = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fcmkey_up ); + + mod_key.shift = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fcmkey_sup ); + + // Down key + mod_key.shift = 0; + mod_key.ctrl = 0; + mod_key.alt = 0; + keycode = finalcut::fc::Fkey_down; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fkey_down ); + + mod_key.shift = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fkey_sf ); + + mod_key.shift = 0; + mod_key.ctrl = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fckey_down ); + + mod_key.ctrl = 0; + mod_key.alt = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fmkey_down ); + + mod_key.shift = 1; + mod_key.ctrl = 1; + mod_key.alt = 0; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fckey_sdown ); + + mod_key.ctrl = 0; + mod_key.alt = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fmkey_sdown ); + + mod_key.shift = 0; + mod_key.ctrl = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fcmkey_down ); + + mod_key.shift = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fcmkey_sdown ); + + // Left key + mod_key.shift = 0; + mod_key.ctrl = 0; + mod_key.alt = 0; + keycode = finalcut::fc::Fkey_left; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fkey_left ); + + mod_key.shift = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fkey_sleft ); + + mod_key.shift = 0; + mod_key.ctrl = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fckey_left ); + + mod_key.ctrl = 0; + mod_key.alt = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fmkey_left ); + + mod_key.shift = 1; + mod_key.ctrl = 1; + mod_key.alt = 0; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fckey_sleft ); + + mod_key.ctrl = 0; + mod_key.alt = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fmkey_sleft ); + + mod_key.shift = 0; + mod_key.ctrl = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fcmkey_left ); + + mod_key.shift = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fcmkey_sleft ); + + // Right key + mod_key.shift = 0; + mod_key.ctrl = 0; + mod_key.alt = 0; + keycode = finalcut::fc::Fkey_right; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fkey_right ); + + mod_key.shift = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fkey_sright ); + + mod_key.shift = 0; + mod_key.ctrl = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fckey_right ); + + mod_key.ctrl = 0; + mod_key.alt = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fmkey_right ); + + mod_key.shift = 1; + mod_key.ctrl = 1; + mod_key.alt = 0; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fckey_sright ); + + mod_key.ctrl = 0; + mod_key.alt = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fmkey_sright ); + + mod_key.shift = 0; + mod_key.ctrl = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fcmkey_right ); + + mod_key.shift = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fcmkey_sright ); + + // Insert key + mod_key.shift = 0; + mod_key.ctrl = 0; + mod_key.alt = 0; + keycode = finalcut::fc::Fkey_ic; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fkey_ic ); + + mod_key.shift = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fkey_sic ); + + mod_key.shift = 0; + mod_key.ctrl = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fckey_ic ); + + mod_key.ctrl = 0; + mod_key.alt = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fmkey_ic ); + + mod_key.shift = 1; + mod_key.ctrl = 1; + mod_key.alt = 0; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fckey_sic ); + + mod_key.ctrl = 0; + mod_key.alt = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fmkey_sic ); + + mod_key.shift = 0; + mod_key.ctrl = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fcmkey_ic ); + + mod_key.shift = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fcmkey_sic ); + + // Delete key + mod_key.shift = 0; + mod_key.ctrl = 0; + mod_key.alt = 0; + keycode = finalcut::fc::Fkey_dc; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fkey_dc ); + + mod_key.shift = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fkey_sdc ); + + mod_key.shift = 0; + mod_key.ctrl = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fckey_dc ); + + mod_key.ctrl = 0; + mod_key.alt = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fmkey_dc ); + + mod_key.shift = 1; + mod_key.ctrl = 1; + mod_key.alt = 0; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fckey_sdc ); + + mod_key.ctrl = 0; + mod_key.alt = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fmkey_sdc ); + + mod_key.shift = 0; + mod_key.ctrl = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fcmkey_dc ); + + mod_key.shift = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fcmkey_sdc ); + + // Home key + mod_key.shift = 0; + mod_key.ctrl = 0; + mod_key.alt = 0; + keycode = finalcut::fc::Fkey_home; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fkey_home ); + + mod_key.shift = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fkey_shome ); + + mod_key.shift = 0; + mod_key.ctrl = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fckey_home ); + + mod_key.ctrl = 0; + mod_key.alt = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fmkey_home ); + + mod_key.shift = 1; + mod_key.ctrl = 1; + mod_key.alt = 0; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fckey_shome ); + + mod_key.ctrl = 0; + mod_key.alt = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fmkey_shome ); + + mod_key.shift = 0; + mod_key.ctrl = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fcmkey_home ); + + mod_key.shift = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fcmkey_shome ); + + // End key + mod_key.shift = 0; + mod_key.ctrl = 0; + mod_key.alt = 0; + keycode = finalcut::fc::Fkey_end; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fkey_end ); + + mod_key.shift = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fkey_send ); + + mod_key.shift = 0; + mod_key.ctrl = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fckey_end ); + + mod_key.ctrl = 0; + mod_key.alt = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fmkey_end ); + + mod_key.shift = 1; + mod_key.ctrl = 1; + mod_key.alt = 0; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fckey_send ); + + mod_key.ctrl = 0; + mod_key.alt = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fmkey_send ); + + mod_key.shift = 0; + mod_key.ctrl = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fcmkey_end ); + + mod_key.shift = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fcmkey_send ); + + // Page Up key + mod_key.shift = 0; + mod_key.ctrl = 0; + mod_key.alt = 0; + keycode = finalcut::fc::Fkey_ppage; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fkey_ppage ); + + mod_key.shift = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fkey_sprevious ); + + mod_key.shift = 0; + mod_key.ctrl = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fckey_ppage ); + + mod_key.ctrl = 0; + mod_key.alt = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fmkey_ppage ); + + mod_key.shift = 1; + mod_key.ctrl = 1; + mod_key.alt = 0; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fckey_sppage ); + + mod_key.ctrl = 0; + mod_key.alt = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fmkey_sppage ); + + mod_key.shift = 0; + mod_key.ctrl = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fcmkey_ppage ); + + mod_key.shift = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fcmkey_sppage ); + + // Page Down key + mod_key.shift = 0; + mod_key.ctrl = 0; + mod_key.alt = 0; + keycode = finalcut::fc::Fkey_npage; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fkey_npage ); + + mod_key.shift = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fkey_snext ); + + mod_key.shift = 0; + mod_key.ctrl = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fckey_npage ); + + mod_key.ctrl = 0; + mod_key.alt = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fmkey_npage ); + + mod_key.shift = 1; + mod_key.ctrl = 1; + mod_key.alt = 0; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fckey_snpage ); + + mod_key.ctrl = 0; + mod_key.alt = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fmkey_snpage ); + + mod_key.shift = 0; + mod_key.ctrl = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fcmkey_npage ); + + mod_key.shift = 1; + mod_keycode = linux.modifierKeyCorrection(keycode); + CPPUNIT_ASSERT ( mod_keycode == finalcut::fc::Fcmkey_snpage ); +} + // Put the test suite in the registry CPPUNIT_TEST_SUITE_REGISTRATION (FTermLinuxTest);