From f23e8a6ad92d2a56f2bf7bdcadaa779b56a376c4 Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Sat, 30 May 2020 22:41:24 +0300 Subject: [PATCH] test: Update to new APIs --- .../integtests/arch/ArchInternetTests.cpp | 4 +-- .../platform/XWindowsKeyStateTests.cpp | 33 +++++++------------ .../platform/XWindowsScreenTests.cpp | 5 ++- 3 files changed, 15 insertions(+), 27 deletions(-) diff --git a/src/test/integtests/arch/ArchInternetTests.cpp b/src/test/integtests/arch/ArchInternetTests.cpp index 722df2f3..7a79a261 100644 --- a/src/test/integtests/arch/ArchInternetTests.cpp +++ b/src/test/integtests/arch/ArchInternetTests.cpp @@ -25,13 +25,13 @@ TEST(ArchInternetTests, get) { ARCH_INTERNET internet; - String result = internet.get(TEST_URL); + std::string result = internet.get(TEST_URL); ASSERT_EQ("Hello world!", result); } TEST(ArchInternetTests, urlEncode) { ARCH_INTERNET internet; - String result = internet.urlEncode("hello=+&world"); + std::string result = internet.urlEncode("hello=+&world"); ASSERT_EQ("hello%3D%2B%26world", result); } diff --git a/src/test/integtests/platform/XWindowsKeyStateTests.cpp b/src/test/integtests/platform/XWindowsKeyStateTests.cpp index ea8ce441..00c01273 100644 --- a/src/test/integtests/platform/XWindowsKeyStateTests.cpp +++ b/src/test/integtests/platform/XWindowsKeyStateTests.cpp @@ -76,8 +76,7 @@ TEST_F(XWindowsKeyStateTests, setActiveGroup_pollAndSet_groupIsZero) { MockKeyMap keyMap; MockEventQueue eventQueue; - XWindowsKeyState keyState( - m_display, true, &eventQueue, keyMap); + XWindowsKeyState keyState(new XWindowsImpl(), m_display, true, &eventQueue, keyMap); keyState.setActiveGroup(XWindowsKeyState::kGroupPollAndSet); @@ -88,8 +87,7 @@ TEST_F(XWindowsKeyStateTests, setActiveGroup_poll_groupIsNotSet) { MockKeyMap keyMap; MockEventQueue eventQueue; - XWindowsKeyState keyState( - m_display, true, &eventQueue, keyMap); + XWindowsKeyState keyState(new XWindowsImpl(), m_display, true, &eventQueue, keyMap); keyState.setActiveGroup(XWindowsKeyState::kGroupPoll); @@ -100,8 +98,7 @@ TEST_F(XWindowsKeyStateTests, setActiveGroup_customGroup_groupWasSet) { MockKeyMap keyMap; MockEventQueue eventQueue; - XWindowsKeyState keyState( - m_display, true, &eventQueue, keyMap); + XWindowsKeyState keyState(new XWindowsImpl(), m_display, true, &eventQueue, keyMap); keyState.setActiveGroup(1); @@ -112,8 +109,7 @@ TEST_F(XWindowsKeyStateTests, mapModifiersFromX_zeroState_zeroMask) { MockKeyMap keyMap; MockEventQueue eventQueue; - XWindowsKeyState keyState( - m_display, true, &eventQueue, keyMap); + XWindowsKeyState keyState(new XWindowsImpl(), m_display, true, &eventQueue, keyMap); int mask = keyState.mapModifiersFromX(0); @@ -124,8 +120,7 @@ TEST_F(XWindowsKeyStateTests, mapModifiersToX_zeroMask_resultIsTrue) { MockKeyMap keyMap; MockEventQueue eventQueue; - XWindowsKeyState keyState( - m_display, true, &eventQueue, keyMap); + XWindowsKeyState keyState(new XWindowsImpl(), m_display, true, &eventQueue, keyMap); unsigned int modifiers = 0; bool result = keyState.mapModifiersToX(0, modifiers); @@ -137,8 +132,7 @@ TEST_F(XWindowsKeyStateTests, fakeCtrlAltDel_default_returnsFalse) { MockKeyMap keyMap; MockEventQueue eventQueue; - XWindowsKeyState keyState( - m_display, true, &eventQueue, keyMap); + XWindowsKeyState keyState(new XWindowsImpl(), m_display, true, &eventQueue, keyMap); bool result = keyState.fakeCtrlAltDel(); @@ -149,8 +143,7 @@ TEST_F(XWindowsKeyStateTests, pollActiveModifiers_defaultState_returnsZero) { MockKeyMap keyMap; MockEventQueue eventQueue; - XWindowsKeyState keyState( - m_display, true, &eventQueue, keyMap); + XWindowsKeyState keyState(new XWindowsImpl(), m_display, true, &eventQueue, keyMap); KeyModifierMask actual = keyState.pollActiveModifiers(); @@ -162,8 +155,7 @@ TEST_F(XWindowsKeyStateTests, pollActiveModifiers_shiftKeyDownThenUp_masksAreCor { MockKeyMap keyMap; MockEventQueue eventQueue; - XWindowsKeyState keyState( - m_display, true, &eventQueue, keyMap); + XWindowsKeyState keyState(new XWindowsImpl(), m_display, true, &eventQueue, keyMap); // set mock modifier mapping std::fill(keyState.modifierFromX().begin(), keyState.modifierFromX().end(), 0); @@ -195,8 +187,7 @@ TEST_F(XWindowsKeyStateTests, pollActiveGroup_defaultState_returnsZero) { MockKeyMap keyMap; MockEventQueue eventQueue; - XWindowsKeyState keyState( - m_display, true, &eventQueue, keyMap); + XWindowsKeyState keyState(new XWindowsImpl(), m_display, true, &eventQueue, keyMap); SInt32 actual = keyState.pollActiveGroup(); @@ -207,8 +198,7 @@ TEST_F(XWindowsKeyStateTests, pollActiveGroup_positiveGroup_returnsGroup) { MockKeyMap keyMap; MockEventQueue eventQueue; - XWindowsKeyState keyState( - m_display, true, &eventQueue, keyMap); + XWindowsKeyState keyState(new XWindowsImpl(), m_display, true, &eventQueue, keyMap); keyState.group(3); @@ -222,8 +212,7 @@ TEST_F(XWindowsKeyStateTests, pollActiveGroup_xkb_areEqual) #if HAVE_XKB_EXTENSION MockKeyMap keyMap; MockEventQueue eventQueue; - XWindowsKeyState keyState( - m_display, true, &eventQueue, keyMap); + XWindowsKeyState keyState(new XWindowsImpl(), m_display, true, &eventQueue, keyMap); // reset the group keyState.group(-1); diff --git a/src/test/integtests/platform/XWindowsScreenTests.cpp b/src/test/integtests/platform/XWindowsScreenTests.cpp index b74599c9..d8f75e15 100644 --- a/src/test/integtests/platform/XWindowsScreenTests.cpp +++ b/src/test/integtests/platform/XWindowsScreenTests.cpp @@ -29,12 +29,11 @@ TEST(CXWindowsScreenTests, fakeMouseMove_nonPrimary_getCursorPosValuesCorrect) EXPECT_CALL(eventQueue, adoptHandler(_, _, _)).Times(2); EXPECT_CALL(eventQueue, adoptBuffer(_)).Times(2); EXPECT_CALL(eventQueue, removeHandler(_, _)).Times(2); - XWindowsScreen screen( - ":0.0", false, false, 0, &eventQueue); + XWindowsScreen screen(new XWindowsImpl(), ":0.0", false, false, 0, &eventQueue); screen.fakeMouseMove(10, 20); - int x, y; + SInt32 x, y; screen.getCursorPos(x, y); ASSERT_EQ(10, x); ASSERT_EQ(20, y);