diff --git a/windows/src/engine/keyman32/keyman-engine.vcxproj b/windows/src/engine/keyman32/keyman-engine.vcxproj index 391b86cbbc..f958f9a797 100644 --- a/windows/src/engine/keyman32/keyman-engine.vcxproj +++ b/windows/src/engine/keyman32/keyman-engine.vcxproj @@ -54,7 +54,7 @@ - $(ProjectDir)..\..\..\..\core\build\x86\$(Configuration)\src;$(ProjectDir)..\..\..\..\core\build\rust\x86\$(Configuration);$(LibraryPath) + $(ProjectDir)..\..\..\..\core\build\x86\$(Configuration)\src;$(ProjectDir)..\..\..\..\core\build\x86\$(Configuration)\subprojects\icu\source\common;$(ProjectDir)..\..\..\..\core\build\x86\$(Configuration)\subprojects\icu\source\i18n;$(ProjectDir)..\..\..\..\core\build\rust\x86\$(Configuration);$(LibraryPath) $(ProjectDir)..\..\..\..\common\include;$(ProjectDir)..\..\..\..\core\build\x86\$(Configuration)\include;$(ProjectDir)..\..\..\..\core\include;$(IncludePath) @@ -98,7 +98,7 @@ /verbose:lib /section:.SHARDATA,rws %(AdditionalOptions) - keymancore.lib;psapi.lib;rpcrt4.lib;version.lib;setupapi.lib;iphlpapi.lib;imm32.lib;crypt32.lib;wintrust.lib;imagehlp.lib;ws2_32.lib;%(AdditionalDependencies) + keymancore.lib;libicuuc.a;libicuin.a;psapi.lib;rpcrt4.lib;version.lib;setupapi.lib;iphlpapi.lib;imm32.lib;crypt32.lib;wintrust.lib;imagehlp.lib;ws2_32.lib;%(AdditionalDependencies) ./Keyman32.dll true keyman32.def @@ -186,6 +186,7 @@ + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) @@ -364,6 +365,7 @@ + @@ -397,4 +399,4 @@ - + \ No newline at end of file diff --git a/windows/src/engine/keyman32/keyman-engine.vcxproj.filters b/windows/src/engine/keyman32/keyman-engine.vcxproj.filters index c0eab08097..f11552a824 100644 --- a/windows/src/engine/keyman32/keyman-engine.vcxproj.filters +++ b/windows/src/engine/keyman32/keyman-engine.vcxproj.filters @@ -135,6 +135,9 @@ Source Files + + Source Files + @@ -243,6 +246,9 @@ Header Files + + Header Files + diff --git a/windows/src/engine/keyman32/tests/keyman-engine-tests/appinttests.cpp b/windows/src/engine/keyman32/tests/keyman-engine-tests/appinttests.cpp index 70119927d6..529b631aae 100644 --- a/windows/src/engine/keyman32/tests/keyman-engine-tests/appinttests.cpp +++ b/windows/src/engine/keyman32/tests/keyman-engine-tests/appinttests.cpp @@ -43,12 +43,10 @@ TEST(AppContext, Get_split_surrogate) { // Test Calling BufMax TEST(AppContext, BufMax_LastChar) { - WCHAR callbuff[MAXCONTEXT]; const uint32_t ExpectedMarker = 0x0002; AppContext testContext; WCHAR testString[] = {0x0042, 0xD800, 0xDC00, UC_SENTINEL, CODE_DEADKEY, ExpectedMarker, 0x0000}; WCHAR expectedString[] = {UC_SENTINEL, CODE_DEADKEY, 0x0002, 0x0000}; - testContext.Set(testString); WCHAR *contextBuf = testContext.BufMax(3); EXPECT_STREQ((expectedString), contextBuf); @@ -60,7 +58,6 @@ TEST(AppContext, BufMax_LastChar) { // Test AppContext::Delete() TEST(AppContext, AppContext_Delete) { - WCHAR callbuff[MAXCONTEXT]; const uint32_t ExpectedMarker = 0x0002; AppContext testContext; WCHAR testString[] = {0x0042, 0xD800, 0xDC00, UC_SENTINEL, CODE_DEADKEY, ExpectedMarker, 0x0000}; diff --git a/windows/src/engine/keyman32/tests/keyman-engine-tests/keyman-engine-tests.vcxproj b/windows/src/engine/keyman32/tests/keyman-engine-tests/keyman-engine-tests.vcxproj index 5b9116ea2d..48afed6fdd 100644 --- a/windows/src/engine/keyman32/tests/keyman-engine-tests/keyman-engine-tests.vcxproj +++ b/windows/src/engine/keyman32/tests/keyman-engine-tests/keyman-engine-tests.vcxproj @@ -34,24 +34,24 @@ - $(ProjectDir)..\..\..\..\..\..\common\include;$(ProjectDir)..\..\..\..\..\..\core\include;$(ProjectDir)..\..\..\..\..\..\core\build\x86\$(Configuration)\include;$(ProjectDir)..\..\..\..\global\inc;$(ProjectDir)..\..;$(IncludePath) + $(ProjectDir)..\..\..\..\..\..\common\include;$(ProjectDir)..\..\..\..\..\..\core\include;$(ProjectDir)..\..\..\..\..\..\core\build\x86\$(Configuration)\include;$(ProjectDir)..\..\..\..\..\..\core\build\x86\$(Configuration)\subprojects\icu\source\common;$(ProjectDir)..\..\..\..\..\..\core\build\x86\$(Configuration)\subprojects\icu\source\i18n;$(ProjectDir)..\..\..\..\global\inc;$(ProjectDir)..\..;$(IncludePath) $(ProjectDir)bin\$(Platform)\$(Configuration)\ $(ProjectDir)obj\$(Platform)\$(Configuration)\ - $(ProjectDir)..\..\..\..\..\..\core\build\x86\$(Configuration)\src;$(ProjectDir)..\..\..\..\..\..\core\build\rust\x86\$(Configuration);$(ProjectDir)..\..\..\kmtip\bin\Win32\$(Configuration);$(LibraryPath) + $(ProjectDir)..\..\..\..\..\..\core\build\x86\$(Configuration)\src;$(ProjectDir)..\..\..\..\kmtip\bin\Win32\$(Configuration);$(ProjectDir)..\..\..\..\..\..\core\build\x86\$(Configuration)\subprojects\icu\source\common;$(ProjectDir)..\..\..\..\..\..\core\build\x86\$(Configuration)\subprojects\icu\source\i18n;$(LibraryPath) true - $(ProjectDir)..\..\..\..\global\inc;$(ProjectDir)..\..;$(IncludePath) + $(ProjectDir)..\..\..\..\..\..\common\include;$(ProjectDir)..\..\..\..\..\..\core\include;$(ProjectDir)..\..\..\..\..\..\core\build\x86\$(Configuration)\include;$(ProjectDir)..\..\..\..\core\build\x86\$(Configuration)\subprojects\icu\source\common;$(ProjectDir)..\..\..\..\core\build\x86\$(Configuration)\subprojects\icu\source\i18n;$(ProjectDir)..\..\..\..\global\inc;$(ProjectDir)..\..;$(IncludePath) $(ProjectDir)bin\$(Platform)\$(Configuration)\ $(ProjectDir)obj\$(Platform)\$(Configuration)\ - $(ProjectDir)..\..\..\..\..\..\common\include;$(ProjectDir)..\..\..\..\..\..\core\build\x86\$(Configuration)\include;$(ProjectDir)..\..\..\..\..\..\core\include;$(ProjectDir)..\..\..\..\global\inc;$(ProjectDir)..\..;$(IncludePath) + $(ProjectDir)..\..\..\..\..\..\common\include;$(ProjectDir)..\..\..\..\..\..\core\build\x64\$(Configuration)\include;$(ProjectDir)..\..\..\..\..\..\core\include;$(ProjectDir)..\..\..\..\..\..\core\build\x64\$(Configuration)\subprojects\icu\source\common;$(ProjectDir)..\..\..\..\..\..\core\build\x64\$(Configuration)\subprojects\icu\source\i18n;$(ProjectDir)..\..\..\..\global\inc;$(ProjectDir)..\..;$(IncludePath) $(ProjectDir)bin\$(Platform)\$(Configuration)\ $(ProjectDir)obj\$(Platform)\$(Configuration)\ - $(ProjectDir)..\..\..\..\global\inc;$(ProjectDir)..\..;$(IncludePath) + $(ProjectDir)..\..\..\..\..\..\common\include;$(ProjectDir)..\..\..\..\..\..\core\build\x64\$(Configuration)\include;$(ProjectDir)..\..\..\..\..\..\core\include;$(ProjectDir)..\..\..\..\..\..\core\build\x64\$(Configuration)\subprojects\icu\source\common;$(ProjectDir)..\..\..\..\..\..\core\build\x64\$(Configuration)\subprojects\icu\source\i18n;$(ProjectDir)..\..\..\..\global\inc;$(ProjectDir)..\..;$(IncludePath) $(ProjectDir)bin\$(Platform)\$(Configuration)\ $(ProjectDir)obj\$(Platform)\$(Configuration)\ @@ -98,7 +98,7 @@ true Console - version.lib;psapi.lib;imm32.lib;libkeymancore.a;%(AdditionalDependencies) + version.lib;psapi.lib;imm32.lib;libkeymancore.a;libicuuc.a;libicuin.a;%(AdditionalDependencies) false diff --git a/windows/src/engine/keyman32/tests/keyman-engine-tests/kmprocessactionstests.cpp b/windows/src/engine/keyman32/tests/keyman-engine-tests/kmprocessactionstests.cpp index 362bc0497f..5e99afe291 100644 --- a/windows/src/engine/keyman32/tests/keyman-engine-tests/kmprocessactionstests.cpp +++ b/windows/src/engine/keyman32/tests/keyman-engine-tests/kmprocessactionstests.cpp @@ -24,163 +24,17 @@ public: }; // KM_CORE_IT_CHAR - processUnicodeChar +// Now that the AITIP no longer contains a context +// this test is just reduced to checking the size of the +// action queue TEST_F(KMPROCESSACTIONS, processUnicodeChartest) { - + // just check something has been added to the que WCHAR callbuf[MAXCONTEXT]; AITIP testApp; - WCHAR *expectedContext = L"A"; - km_core_action_item itemAddChar = { KM_CORE_IT_CHAR, {0,}, {'A'}}; - - processUnicodeChar(&testApp, &itemAddChar); - WCHAR *contextBuf = testApp.ContextBufMax(MAXCONTEXT); - EXPECT_STREQ(contextBuf, expectedContext); - - km_core_usv testSurrogateChar = Uni_SurrogateToUTF32(0xD801, 0xDC37); //𐐷'; - km_core_action_item itemAddChar2 = {KM_CORE_IT_CHAR, {0,}, {testSurrogateChar}}; - WCHAR expectedStringSurrogate[] = {'A', 0xD801, 0xDC37, 0}; - processUnicodeChar(&testApp, &itemAddChar2); - contextBuf = testApp.ContextBufMax(MAXCONTEXT); - EXPECT_STREQ(contextBuf, &expectedStringSurrogate[0]); + int expectedQueueSize = 3; // 1 + surrogate pair + km_core_usv output_string[] = {0x0041, 0x010000, 0}; + processUnicodeChar(&testApp, &output_string[0]); + int queueSize = testApp.GetQueueSize(); + EXPECT_EQ(queueSize, expectedQueueSize); } -// KM_CORE_IT_MARKER - processMarker Deadkey -TEST_F(KMPROCESSACTIONS, processMarkertest) { - - WCHAR callbuf[MAXCONTEXT]; - AITIP testApp; - WCHAR expectedContext[] = {UC_SENTINEL, CODE_DEADKEY, 2, 0}; - uint32_t marker = 2; - km_core_action_item itemAddMarker = {KM_CORE_IT_MARKER, {0,}, {marker}}; - - processMarker(&testApp, &itemAddMarker); - WCHAR *contextBuf = testApp.ContextBufMax(MAXCONTEXT); - EXPECT_STREQ(contextBuf, expectedContext); -} - -// KM_CORE_IT_BACK - processBack -// First test processing a backspace for a deadkey -TEST_F(KMPROCESSACTIONS, processBackDeadkeytest) { - - WCHAR callbuf[MAXCONTEXT]; - AITIP testApp; - WCHAR expectedContext[] = {'A', 0}; - km_core_action_item itemAddChar = {KM_CORE_IT_CHAR, {0,}, {'A'}}; - - processUnicodeChar(&testApp, &itemAddChar); - uint32_t marker = 2; - km_core_action_item itemAddMarker = {KM_CORE_IT_MARKER, {0,}, {marker}}; - processMarker(&testApp, &itemAddMarker); - km_core_action_item itemBackSpace = {KM_CORE_IT_BACK}; - itemBackSpace.backspace.expected_type = KM_CORE_IT_MARKER; - itemBackSpace.backspace.expected_value = marker; - processBack(&testApp, &itemBackSpace); - WCHAR *contextBuf = testApp.ContextBufMax(MAXCONTEXT); - EXPECT_STREQ(contextBuf, expectedContext); -} - -// KM_CORE_IT_BACK - processBack -// Press Backspace for a normal character -// Also test for Unknown Character -TEST_F(KMPROCESSACTIONS, processBackCharactertest) { - - WCHAR callbuf[MAXCONTEXT]; - AITIP testApp; - WCHAR expectedContext[] = {'A', 0}; - WCHAR expectedContextFinal[] = {0}; - km_core_action_item itemAddChar = {KM_CORE_IT_CHAR, {0,}, {'A'}}; - - processUnicodeChar(&testApp, &itemAddChar); - itemAddChar.character = 'B'; - processUnicodeChar(&testApp, &itemAddChar); - km_core_action_item itemBackSpace = {KM_CORE_IT_BACK}; - itemBackSpace.backspace.expected_type = KM_CORE_IT_CHAR; - itemBackSpace.backspace.expected_value = 'B'; - // backspace - processBack(&testApp, &itemBackSpace); - WCHAR *contextBuf = testApp.ContextBufMax(MAXCONTEXT); - EXPECT_STREQ(contextBuf, expectedContext); - // backspace for unknown it should backspace a character - itemBackSpace.type = KM_CORE_BT_UNKNOWN; - processBack(&testApp, &itemBackSpace); - contextBuf = testApp.ContextBufMax(MAXCONTEXT); - EXPECT_STREQ(contextBuf, expectedContextFinal); -} - - -// KM_CORE_IT_BACK - processBack -// Press Backspace for a surrogate character. -// TODO: This test doesn't test for the PostKey handling -// of TSF and two backspaces being sent to the App. -TEST_F(KMPROCESSACTIONS, processBackSurrogateTSFtest) { - WCHAR callbuf[MAXCONTEXT]; - AITIP testApp; - WCHAR expectedContext[] = { 0 }; - WCHAR expectedStringSurrogate[] = {0xD801, 0xDC37, 0}; - - km_core_usv testSurrogateChar = Uni_SurrogateToUTF32(0xD801, 0xDC37); //𐐷'; - km_core_action_item itemAddChar = {KM_CORE_IT_CHAR, {0,}, {testSurrogateChar}}; - processUnicodeChar(&testApp, &itemAddChar); - - km_core_action_item itemBackSpace = {KM_CORE_IT_BACK}; - itemBackSpace.backspace.expected_type = KM_CORE_IT_CHAR; - itemBackSpace.backspace.expected_value = testSurrogateChar; - WCHAR *contextBuf = testApp.ContextBufMax(MAXCONTEXT); - EXPECT_STREQ(contextBuf, expectedStringSurrogate); - // backspace - processBack(&testApp, &itemBackSpace); - contextBuf = testApp.ContextBufMax(MAXCONTEXT); - EXPECT_STREQ(contextBuf, expectedContext); -} - -// KM_CORE_IT_BACK - processBack -// Press Backspace for a character doesn't match expected character -// Note currently we don't check for a character match this should be updated - -TEST_F(KMPROCESSACTIONS, processBackUnexpectedChartest) { - - WCHAR callbuf[MAXCONTEXT]; - AITIP testApp; - WCHAR expectedContext[] = {'A', 0}; - km_core_action_item itemAddChar = {KM_CORE_IT_CHAR, {0,}, {'A'}}; - - processUnicodeChar(&testApp, &itemAddChar); - itemAddChar.character = 'C'; - processUnicodeChar(&testApp, &itemAddChar); - km_core_action_item itemBackSpace = {KM_CORE_IT_BACK}; - itemBackSpace.backspace.expected_type = KM_CORE_IT_CHAR; - itemBackSpace.backspace.expected_value = 'B'; - // backspace - processBack(&testApp, &itemBackSpace); - WCHAR *contextBuf = testApp.ContextBufMax(MAXCONTEXT); - EXPECT_STREQ(contextBuf, expectedContext); -} - -// KM_CORE_IT_INVALIDATE_CONTEXT - processInvalidateContext -TEST_F(KMPROCESSACTIONS, processInvalidateContextTest) { - - WCHAR callbuf[MAXCONTEXT]; - AITIP testApp; - WCHAR expectedContext[] = {0}; - km_core_action_item itemAddChar = {KM_CORE_IT_CHAR, {0,}, {'A'}}; - - processUnicodeChar(&testApp, &itemAddChar); - itemAddChar.character = 'B'; - processUnicodeChar(&testApp, &itemAddChar); - - // A keyboard a state is need to test processInvalidateContext - km_core_option_item test_env_opts[] = {{u"hello", u"world", KM_CORE_OPT_KEYBOARD}, KM_CORE_OPTIONS_END}; - km_core_keyboard *testKB = nullptr; - km_core_state *testState = nullptr; - km_core_path_name dummyPath = L"dummyActions.mock"; - EXPECT_EQ(km_core_keyboard_load(dummyPath, &testKB), KM_CORE_STATUS_OK); - EXPECT_EQ(km_core_state_create(testKB, test_env_opts, &testState), KM_CORE_STATUS_OK); - - processInvalidateContext(&testApp,testState); - WCHAR *contextBuf = testApp.ContextBufMax(MAXCONTEXT); - EXPECT_STREQ(contextBuf, expectedContext); - - // dispose keyboard - km_core_state_dispose(testState); - km_core_keyboard_dispose(testKB); - -}