Skip to content

Commit

Permalink
test: Update to new APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
p12tic committed May 30, 2020
1 parent 7868043 commit f23e8a6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 27 deletions.
4 changes: 2 additions & 2 deletions src/test/integtests/arch/ArchInternetTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
33 changes: 11 additions & 22 deletions src/test/integtests/platform/XWindowsKeyStateTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);

Expand All @@ -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);

Expand All @@ -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);

Expand All @@ -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);
Expand All @@ -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();

Expand All @@ -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();

Expand All @@ -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);
Expand Down Expand Up @@ -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();

Expand All @@ -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);

Expand All @@ -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);
Expand Down
5 changes: 2 additions & 3 deletions src/test/integtests/platform/XWindowsScreenTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit f23e8a6

Please sign in to comment.