re-add tests to build (when CMAKE_BUILD_TESTS is set)

This commit is contained in:
Ian 2020-03-11 10:55:11 -04:00
parent c55ec076f3
commit d31ce38bf7
6 changed files with 21 additions and 63 deletions

View File

@ -23,3 +23,7 @@ add_subdirectory(cmd)
if (BARRIER_BUILD_GUI) if (BARRIER_BUILD_GUI)
add_subdirectory(gui) add_subdirectory(gui)
endif() endif()
if (CMAKE_BUILD_TESTS)
add_subdirectory(test)
endif()

View File

@ -68,4 +68,4 @@ endif()
add_executable(integtests ${sources}) add_executable(integtests ${sources})
target_link_libraries(integtests target_link_libraries(integtests
arch base client common io ipc mt net platform server barrier gtest gmock ${libs} ${OPENSSL_LIBS}) arch base client common io ipc mt net platform server gtest gmock ${libs} ${OPENSSL_LIBS})

View File

@ -77,7 +77,7 @@ TEST_F(XWindowsKeyStateTests, setActiveGroup_pollAndSet_groupIsZero)
MockKeyMap keyMap; MockKeyMap keyMap;
MockEventQueue eventQueue; MockEventQueue eventQueue;
XWindowsKeyState keyState( XWindowsKeyState keyState(
m_display, true, &eventQueue, keyMap); new XWindowsImpl(), m_display, true, &eventQueue, keyMap);
keyState.setActiveGroup(XWindowsKeyState::kGroupPollAndSet); keyState.setActiveGroup(XWindowsKeyState::kGroupPollAndSet);
@ -89,7 +89,7 @@ TEST_F(XWindowsKeyStateTests, setActiveGroup_poll_groupIsNotSet)
MockKeyMap keyMap; MockKeyMap keyMap;
MockEventQueue eventQueue; MockEventQueue eventQueue;
XWindowsKeyState keyState( XWindowsKeyState keyState(
m_display, true, &eventQueue, keyMap); new XWindowsImpl(), m_display, true, &eventQueue, keyMap);
keyState.setActiveGroup(XWindowsKeyState::kGroupPoll); keyState.setActiveGroup(XWindowsKeyState::kGroupPoll);
@ -101,7 +101,7 @@ TEST_F(XWindowsKeyStateTests, setActiveGroup_customGroup_groupWasSet)
MockKeyMap keyMap; MockKeyMap keyMap;
MockEventQueue eventQueue; MockEventQueue eventQueue;
XWindowsKeyState keyState( XWindowsKeyState keyState(
m_display, true, &eventQueue, keyMap); new XWindowsImpl(), m_display, true, &eventQueue, keyMap);
keyState.setActiveGroup(1); keyState.setActiveGroup(1);
@ -113,7 +113,7 @@ TEST_F(XWindowsKeyStateTests, mapModifiersFromX_zeroState_zeroMask)
MockKeyMap keyMap; MockKeyMap keyMap;
MockEventQueue eventQueue; MockEventQueue eventQueue;
XWindowsKeyState keyState( XWindowsKeyState keyState(
m_display, true, &eventQueue, keyMap); new XWindowsImpl(), m_display, true, &eventQueue, keyMap);
int mask = keyState.mapModifiersFromX(0); int mask = keyState.mapModifiersFromX(0);
@ -125,7 +125,7 @@ TEST_F(XWindowsKeyStateTests, mapModifiersToX_zeroMask_resultIsTrue)
MockKeyMap keyMap; MockKeyMap keyMap;
MockEventQueue eventQueue; MockEventQueue eventQueue;
XWindowsKeyState keyState( XWindowsKeyState keyState(
m_display, true, &eventQueue, keyMap); new XWindowsImpl(), 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);
@ -138,7 +138,7 @@ TEST_F(XWindowsKeyStateTests, fakeCtrlAltDel_default_returnsFalse)
MockKeyMap keyMap; MockKeyMap keyMap;
MockEventQueue eventQueue; MockEventQueue eventQueue;
XWindowsKeyState keyState( XWindowsKeyState keyState(
m_display, true, &eventQueue, keyMap); new XWindowsImpl(), m_display, true, &eventQueue, keyMap);
bool result = keyState.fakeCtrlAltDel(); bool result = keyState.fakeCtrlAltDel();
@ -150,7 +150,7 @@ TEST_F(XWindowsKeyStateTests, pollActiveModifiers_defaultState_returnsZero)
MockKeyMap keyMap; MockKeyMap keyMap;
MockEventQueue eventQueue; MockEventQueue eventQueue;
XWindowsKeyState keyState( XWindowsKeyState keyState(
m_display, true, &eventQueue, keyMap); new XWindowsImpl(), m_display, true, &eventQueue, keyMap);
KeyModifierMask actual = keyState.pollActiveModifiers(); KeyModifierMask actual = keyState.pollActiveModifiers();
@ -163,7 +163,7 @@ TEST_F(XWindowsKeyStateTests, pollActiveModifiers_shiftKeyDownThenUp_masksAreCor
MockKeyMap keyMap; MockKeyMap keyMap;
MockEventQueue eventQueue; MockEventQueue eventQueue;
XWindowsKeyState keyState( XWindowsKeyState keyState(
m_display, true, &eventQueue, keyMap); new XWindowsImpl(), 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);
@ -196,7 +196,7 @@ TEST_F(XWindowsKeyStateTests, pollActiveGroup_defaultState_returnsZero)
MockKeyMap keyMap; MockKeyMap keyMap;
MockEventQueue eventQueue; MockEventQueue eventQueue;
XWindowsKeyState keyState( XWindowsKeyState keyState(
m_display, true, &eventQueue, keyMap); new XWindowsImpl(), m_display, true, &eventQueue, keyMap);
SInt32 actual = keyState.pollActiveGroup(); SInt32 actual = keyState.pollActiveGroup();
@ -208,7 +208,7 @@ TEST_F(XWindowsKeyStateTests, pollActiveGroup_positiveGroup_returnsGroup)
MockKeyMap keyMap; MockKeyMap keyMap;
MockEventQueue eventQueue; MockEventQueue eventQueue;
XWindowsKeyState keyState( XWindowsKeyState keyState(
m_display, true, &eventQueue, keyMap); new XWindowsImpl(), m_display, true, &eventQueue, keyMap);
keyState.group(3); keyState.group(3);
@ -223,7 +223,7 @@ TEST_F(XWindowsKeyStateTests, pollActiveGroup_xkb_areEqual)
MockKeyMap keyMap; MockKeyMap keyMap;
MockEventQueue eventQueue; MockEventQueue eventQueue;
XWindowsKeyState keyState( XWindowsKeyState keyState(
m_display, true, &eventQueue, keyMap); new XWindowsImpl(), m_display, true, &eventQueue, keyMap);
// reset the group // reset the group
keyState.group(-1); keyState.group(-1);

View File

@ -30,7 +30,7 @@ TEST(CXWindowsScreenTests, fakeMouseMove_nonPrimary_getCursorPosValuesCorrect)
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(
":0.0", false, false, 0, &eventQueue); new XWindowsImpl(), ":0.0", false, false, 0, &eventQueue);
screen.fakeMouseMove(10, 20); screen.fakeMouseMove(10, 20);

View File

@ -68,4 +68,4 @@ endif()
add_executable(unittests ${sources}) add_executable(unittests ${sources})
target_link_libraries(unittests target_link_libraries(unittests
arch base client server common io net platform server barrier mt ipc gtest gmock ${libs} ${OPENSSL_LIBS}) arch base client server common io net platform server mt ipc gtest gmock ${libs} ${OPENSSL_LIBS})

View File

@ -22,19 +22,6 @@
TEST(ClipboardChunkTests, start_formatStartChunk) TEST(ClipboardChunkTests, start_formatStartChunk)
{ {
<<<<<<< HEAD
ClipboardID id = 0;
UInt32 sequence = 0;
String mockDataSize("10");
ClipboardChunk* chunk = ClipboardChunk::start(id, sequence, mockDataSize);
EXPECT_EQ(id, chunk->m_chunk[0]);
EXPECT_EQ(sequence, (UInt32)chunk->m_chunk[1]);
EXPECT_EQ(kDataStart, chunk->m_chunk[5]);
EXPECT_EQ('1', chunk->m_chunk[6]);
EXPECT_EQ('0', chunk->m_chunk[7]);
EXPECT_EQ('\0', chunk->m_chunk[8]);
=======
ClipboardID id = 0; ClipboardID id = 0;
UInt32 sequence = 0; UInt32 sequence = 0;
String mockDataSize("10"); String mockDataSize("10");
@ -48,33 +35,12 @@ TEST(ClipboardChunkTests, start_formatStartChunk)
EXPECT_EQ('1', chunk->m_chunk[6]); EXPECT_EQ('1', chunk->m_chunk[6]);
EXPECT_EQ('0', chunk->m_chunk[7]); EXPECT_EQ('0', chunk->m_chunk[7]);
EXPECT_EQ('\0', chunk->m_chunk[8]); EXPECT_EQ('\0', chunk->m_chunk[8]);
>>>>>>> master
delete chunk; delete chunk;
} }
TEST(ClipboardChunkTests, data_formatDataChunk) TEST(ClipboardChunkTests, data_formatDataChunk)
{ {
<<<<<<< HEAD
ClipboardID id = 0;
UInt32 sequence = 1;
String mockData("mock data");
ClipboardChunk* chunk = ClipboardChunk::data(id, sequence, mockData);
EXPECT_EQ(id, chunk->m_chunk[0]);
EXPECT_EQ(sequence, (UInt32)chunk->m_chunk[1]);
EXPECT_EQ(kDataChunk, chunk->m_chunk[5]);
EXPECT_EQ('m', chunk->m_chunk[6]);
EXPECT_EQ('o', chunk->m_chunk[7]);
EXPECT_EQ('c', chunk->m_chunk[8]);
EXPECT_EQ('k', chunk->m_chunk[9]);
EXPECT_EQ(' ', chunk->m_chunk[10]);
EXPECT_EQ('d', chunk->m_chunk[11]);
EXPECT_EQ('a', chunk->m_chunk[12]);
EXPECT_EQ('t', chunk->m_chunk[13]);
EXPECT_EQ('a', chunk->m_chunk[14]);
EXPECT_EQ('\0', chunk->m_chunk[15]);
=======
ClipboardID id = 0; ClipboardID id = 0;
UInt32 sequence = 1; UInt32 sequence = 1;
String mockData("mock data"); String mockData("mock data");
@ -95,23 +61,12 @@ TEST(ClipboardChunkTests, data_formatDataChunk)
EXPECT_EQ('t', chunk->m_chunk[13]); EXPECT_EQ('t', chunk->m_chunk[13]);
EXPECT_EQ('a', chunk->m_chunk[14]); EXPECT_EQ('a', chunk->m_chunk[14]);
EXPECT_EQ('\0', chunk->m_chunk[15]); EXPECT_EQ('\0', chunk->m_chunk[15]);
>>>>>>> master
delete chunk; delete chunk;
} }
TEST(ClipboardChunkTests, end_formatDataChunk) TEST(ClipboardChunkTests, end_formatDataChunk)
{ {
<<<<<<< HEAD
ClipboardID id = 1;
UInt32 sequence = 1;
ClipboardChunk* chunk = ClipboardChunk::end(id, sequence);
EXPECT_EQ(id, chunk->m_chunk[0]);
EXPECT_EQ(sequence, (UInt32)chunk->m_chunk[1]);
EXPECT_EQ(kDataEnd, chunk->m_chunk[5]);
EXPECT_EQ('\0', chunk->m_chunk[6]);
=======
ClipboardID id = 1; ClipboardID id = 1;
UInt32 sequence = 1; UInt32 sequence = 1;
ClipboardChunk* chunk = ClipboardChunk::end(id, sequence); ClipboardChunk* chunk = ClipboardChunk::end(id, sequence);
@ -122,7 +77,6 @@ TEST(ClipboardChunkTests, end_formatDataChunk)
EXPECT_EQ(sequence, temp_m_chunk); EXPECT_EQ(sequence, temp_m_chunk);
EXPECT_EQ(kDataEnd, chunk->m_chunk[5]); EXPECT_EQ(kDataEnd, chunk->m_chunk[5]);
EXPECT_EQ('\0', chunk->m_chunk[6]); EXPECT_EQ('\0', chunk->m_chunk[6]);
>>>>>>> master
delete chunk; delete chunk;
} }