mirror of
https://github.com/debauchee/barrier.git
synced 2024-11-26 13:16:18 +03:00
test: Update to new APIs
This commit is contained in:
parent
7868043ac4
commit
f23e8a6ad9
@ -25,13 +25,13 @@
|
|||||||
TEST(ArchInternetTests, get)
|
TEST(ArchInternetTests, get)
|
||||||
{
|
{
|
||||||
ARCH_INTERNET internet;
|
ARCH_INTERNET internet;
|
||||||
String result = internet.get(TEST_URL);
|
std::string result = internet.get(TEST_URL);
|
||||||
ASSERT_EQ("Hello world!", result);
|
ASSERT_EQ("Hello world!", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(ArchInternetTests, urlEncode)
|
TEST(ArchInternetTests, urlEncode)
|
||||||
{
|
{
|
||||||
ARCH_INTERNET internet;
|
ARCH_INTERNET internet;
|
||||||
String result = internet.urlEncode("hello=+&world");
|
std::string result = internet.urlEncode("hello=+&world");
|
||||||
ASSERT_EQ("hello%3D%2B%26world", result);
|
ASSERT_EQ("hello%3D%2B%26world", result);
|
||||||
}
|
}
|
||||||
|
@ -76,8 +76,7 @@ TEST_F(XWindowsKeyStateTests, setActiveGroup_pollAndSet_groupIsZero)
|
|||||||
{
|
{
|
||||||
MockKeyMap keyMap;
|
MockKeyMap keyMap;
|
||||||
MockEventQueue eventQueue;
|
MockEventQueue eventQueue;
|
||||||
XWindowsKeyState keyState(
|
XWindowsKeyState keyState(new XWindowsImpl(), m_display, true, &eventQueue, keyMap);
|
||||||
m_display, true, &eventQueue, keyMap);
|
|
||||||
|
|
||||||
keyState.setActiveGroup(XWindowsKeyState::kGroupPollAndSet);
|
keyState.setActiveGroup(XWindowsKeyState::kGroupPollAndSet);
|
||||||
|
|
||||||
@ -88,8 +87,7 @@ TEST_F(XWindowsKeyStateTests, setActiveGroup_poll_groupIsNotSet)
|
|||||||
{
|
{
|
||||||
MockKeyMap keyMap;
|
MockKeyMap keyMap;
|
||||||
MockEventQueue eventQueue;
|
MockEventQueue eventQueue;
|
||||||
XWindowsKeyState keyState(
|
XWindowsKeyState keyState(new XWindowsImpl(), m_display, true, &eventQueue, keyMap);
|
||||||
m_display, true, &eventQueue, keyMap);
|
|
||||||
|
|
||||||
keyState.setActiveGroup(XWindowsKeyState::kGroupPoll);
|
keyState.setActiveGroup(XWindowsKeyState::kGroupPoll);
|
||||||
|
|
||||||
@ -100,8 +98,7 @@ TEST_F(XWindowsKeyStateTests, setActiveGroup_customGroup_groupWasSet)
|
|||||||
{
|
{
|
||||||
MockKeyMap keyMap;
|
MockKeyMap keyMap;
|
||||||
MockEventQueue eventQueue;
|
MockEventQueue eventQueue;
|
||||||
XWindowsKeyState keyState(
|
XWindowsKeyState keyState(new XWindowsImpl(), m_display, true, &eventQueue, keyMap);
|
||||||
m_display, true, &eventQueue, keyMap);
|
|
||||||
|
|
||||||
keyState.setActiveGroup(1);
|
keyState.setActiveGroup(1);
|
||||||
|
|
||||||
@ -112,8 +109,7 @@ TEST_F(XWindowsKeyStateTests, mapModifiersFromX_zeroState_zeroMask)
|
|||||||
{
|
{
|
||||||
MockKeyMap keyMap;
|
MockKeyMap keyMap;
|
||||||
MockEventQueue eventQueue;
|
MockEventQueue eventQueue;
|
||||||
XWindowsKeyState keyState(
|
XWindowsKeyState keyState(new XWindowsImpl(), m_display, true, &eventQueue, keyMap);
|
||||||
m_display, true, &eventQueue, keyMap);
|
|
||||||
|
|
||||||
int mask = keyState.mapModifiersFromX(0);
|
int mask = keyState.mapModifiersFromX(0);
|
||||||
|
|
||||||
@ -124,8 +120,7 @@ TEST_F(XWindowsKeyStateTests, mapModifiersToX_zeroMask_resultIsTrue)
|
|||||||
{
|
{
|
||||||
MockKeyMap keyMap;
|
MockKeyMap keyMap;
|
||||||
MockEventQueue eventQueue;
|
MockEventQueue eventQueue;
|
||||||
XWindowsKeyState keyState(
|
XWindowsKeyState keyState(new XWindowsImpl(), m_display, true, &eventQueue, keyMap);
|
||||||
m_display, true, &eventQueue, keyMap);
|
|
||||||
|
|
||||||
unsigned int modifiers = 0;
|
unsigned int modifiers = 0;
|
||||||
bool result = keyState.mapModifiersToX(0, modifiers);
|
bool result = keyState.mapModifiersToX(0, modifiers);
|
||||||
@ -137,8 +132,7 @@ TEST_F(XWindowsKeyStateTests, fakeCtrlAltDel_default_returnsFalse)
|
|||||||
{
|
{
|
||||||
MockKeyMap keyMap;
|
MockKeyMap keyMap;
|
||||||
MockEventQueue eventQueue;
|
MockEventQueue eventQueue;
|
||||||
XWindowsKeyState keyState(
|
XWindowsKeyState keyState(new XWindowsImpl(), m_display, true, &eventQueue, keyMap);
|
||||||
m_display, true, &eventQueue, keyMap);
|
|
||||||
|
|
||||||
bool result = keyState.fakeCtrlAltDel();
|
bool result = keyState.fakeCtrlAltDel();
|
||||||
|
|
||||||
@ -149,8 +143,7 @@ TEST_F(XWindowsKeyStateTests, pollActiveModifiers_defaultState_returnsZero)
|
|||||||
{
|
{
|
||||||
MockKeyMap keyMap;
|
MockKeyMap keyMap;
|
||||||
MockEventQueue eventQueue;
|
MockEventQueue eventQueue;
|
||||||
XWindowsKeyState keyState(
|
XWindowsKeyState keyState(new XWindowsImpl(), m_display, true, &eventQueue, keyMap);
|
||||||
m_display, true, &eventQueue, keyMap);
|
|
||||||
|
|
||||||
KeyModifierMask actual = keyState.pollActiveModifiers();
|
KeyModifierMask actual = keyState.pollActiveModifiers();
|
||||||
|
|
||||||
@ -162,8 +155,7 @@ TEST_F(XWindowsKeyStateTests, pollActiveModifiers_shiftKeyDownThenUp_masksAreCor
|
|||||||
{
|
{
|
||||||
MockKeyMap keyMap;
|
MockKeyMap keyMap;
|
||||||
MockEventQueue eventQueue;
|
MockEventQueue eventQueue;
|
||||||
XWindowsKeyState keyState(
|
XWindowsKeyState keyState(new XWindowsImpl(), m_display, true, &eventQueue, keyMap);
|
||||||
m_display, true, &eventQueue, keyMap);
|
|
||||||
|
|
||||||
// set mock modifier mapping
|
// set mock modifier mapping
|
||||||
std::fill(keyState.modifierFromX().begin(), keyState.modifierFromX().end(), 0);
|
std::fill(keyState.modifierFromX().begin(), keyState.modifierFromX().end(), 0);
|
||||||
@ -195,8 +187,7 @@ TEST_F(XWindowsKeyStateTests, pollActiveGroup_defaultState_returnsZero)
|
|||||||
{
|
{
|
||||||
MockKeyMap keyMap;
|
MockKeyMap keyMap;
|
||||||
MockEventQueue eventQueue;
|
MockEventQueue eventQueue;
|
||||||
XWindowsKeyState keyState(
|
XWindowsKeyState keyState(new XWindowsImpl(), m_display, true, &eventQueue, keyMap);
|
||||||
m_display, true, &eventQueue, keyMap);
|
|
||||||
|
|
||||||
SInt32 actual = keyState.pollActiveGroup();
|
SInt32 actual = keyState.pollActiveGroup();
|
||||||
|
|
||||||
@ -207,8 +198,7 @@ TEST_F(XWindowsKeyStateTests, pollActiveGroup_positiveGroup_returnsGroup)
|
|||||||
{
|
{
|
||||||
MockKeyMap keyMap;
|
MockKeyMap keyMap;
|
||||||
MockEventQueue eventQueue;
|
MockEventQueue eventQueue;
|
||||||
XWindowsKeyState keyState(
|
XWindowsKeyState keyState(new XWindowsImpl(), m_display, true, &eventQueue, keyMap);
|
||||||
m_display, true, &eventQueue, keyMap);
|
|
||||||
|
|
||||||
keyState.group(3);
|
keyState.group(3);
|
||||||
|
|
||||||
@ -222,8 +212,7 @@ TEST_F(XWindowsKeyStateTests, pollActiveGroup_xkb_areEqual)
|
|||||||
#if HAVE_XKB_EXTENSION
|
#if HAVE_XKB_EXTENSION
|
||||||
MockKeyMap keyMap;
|
MockKeyMap keyMap;
|
||||||
MockEventQueue eventQueue;
|
MockEventQueue eventQueue;
|
||||||
XWindowsKeyState keyState(
|
XWindowsKeyState keyState(new XWindowsImpl(), m_display, true, &eventQueue, keyMap);
|
||||||
m_display, true, &eventQueue, keyMap);
|
|
||||||
|
|
||||||
// reset the group
|
// reset the group
|
||||||
keyState.group(-1);
|
keyState.group(-1);
|
||||||
|
@ -29,12 +29,11 @@ TEST(CXWindowsScreenTests, fakeMouseMove_nonPrimary_getCursorPosValuesCorrect)
|
|||||||
EXPECT_CALL(eventQueue, adoptHandler(_, _, _)).Times(2);
|
EXPECT_CALL(eventQueue, adoptHandler(_, _, _)).Times(2);
|
||||||
EXPECT_CALL(eventQueue, adoptBuffer(_)).Times(2);
|
EXPECT_CALL(eventQueue, adoptBuffer(_)).Times(2);
|
||||||
EXPECT_CALL(eventQueue, removeHandler(_, _)).Times(2);
|
EXPECT_CALL(eventQueue, removeHandler(_, _)).Times(2);
|
||||||
XWindowsScreen screen(
|
XWindowsScreen screen(new XWindowsImpl(), ":0.0", false, false, 0, &eventQueue);
|
||||||
":0.0", false, false, 0, &eventQueue);
|
|
||||||
|
|
||||||
screen.fakeMouseMove(10, 20);
|
screen.fakeMouseMove(10, 20);
|
||||||
|
|
||||||
int x, y;
|
SInt32 x, y;
|
||||||
screen.getCursorPos(x, y);
|
screen.getCursorPos(x, y);
|
||||||
ASSERT_EQ(10, x);
|
ASSERT_EQ(10, x);
|
||||||
ASSERT_EQ(20, y);
|
ASSERT_EQ(20, y);
|
||||||
|
Loading…
Reference in New Issue
Block a user