From f4bb72ce521d4f367db7f045cf45fb3e72071c6f Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Fri, 28 Feb 2014 15:04:49 +0000 Subject: [PATCH] fixed: - (weird) linker error on windows caused by using different include. - IpcTests using private field which had a public accessor. - some includes using wrong lib. --- src/test/global/access.h | 25 ------------------- .../integtests/arch/ArchInternetUnixTests.cpp | 2 +- .../arch/ArchInternetWindowsTests.cpp | 2 +- src/test/integtests/ipc/IpcTests.cpp | 13 +++++----- src/test/integtests/net/NetworkTests.cpp | 2 +- .../platform/MSWindowsClipboardTests.cpp | 4 +-- .../platform/MSWindowsKeyStateTests.cpp | 9 +++---- .../integtests/platform/OSXScreenTests.cpp | 1 - .../platform/XWindowsClipboardTests.cpp | 2 +- .../platform/XWindowsKeyStateTests.cpp | 4 +-- .../platform/XWindowsScreenSaverTests.cpp | 2 +- .../platform/XWindowsScreenTests.cpp | 2 +- src/test/mock/server/MockPrimaryClient.h | 2 +- src/test/mock/server/MockServer.h | 2 +- 14 files changed, 22 insertions(+), 50 deletions(-) delete mode 100644 src/test/global/access.h diff --git a/src/test/global/access.h b/src/test/global/access.h deleted file mode 100644 index 432df994..00000000 --- a/src/test/global/access.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * synergy -- mouse and keyboard sharing utility - * Copyright (C) 2012 Bolton Software Ltd. - * Copyright (C) 2011 Chris Schoeneman - * - * This package is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * found in the file COPYING that should have accompanied this file. - * - * This package is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#pragma once - -// make everything public for unit tests -#ifdef TEST_ENV -#define protected public -#define private public -#endif diff --git a/src/test/integtests/arch/ArchInternetUnixTests.cpp b/src/test/integtests/arch/ArchInternetUnixTests.cpp index da8d4cc1..b30adb22 100644 --- a/src/test/integtests/arch/ArchInternetUnixTests.cpp +++ b/src/test/integtests/arch/ArchInternetUnixTests.cpp @@ -17,7 +17,7 @@ #include "arch/ArchInternetUnix.h" -#include +#include "test/global/gtest.h" #define TEST_URL "https://synergy-foss.org/tests/?testString" //#define TEST_URL "http://localhost/synergy/tests/?testString" diff --git a/src/test/integtests/arch/ArchInternetWindowsTests.cpp b/src/test/integtests/arch/ArchInternetWindowsTests.cpp index 5dffd594..bf3a5a81 100644 --- a/src/test/integtests/arch/ArchInternetWindowsTests.cpp +++ b/src/test/integtests/arch/ArchInternetWindowsTests.cpp @@ -17,7 +17,7 @@ #include "arch/ArchInternetWindows.h" -#include +#include "test/global/gtest.h" #define TEST_URL "https://synergy-foss.org/tests/?testString" //#define TEST_URL "http://localhost/synergy/tests/?testString" diff --git a/src/test/integtests/ipc/IpcTests.cpp b/src/test/integtests/ipc/IpcTests.cpp index 03231889..5b85d6f7 100644 --- a/src/test/integtests/ipc/IpcTests.cpp +++ b/src/test/integtests/ipc/IpcTests.cpp @@ -21,7 +21,6 @@ #define TEST_ENV -#include "test/global/access.h" #include "test/global/TestEventQueue.h" #include "ipc/IpcServer.h" #include "ipc/IpcClient.h" @@ -38,7 +37,7 @@ #include "base/EventQueue.h" #include "base/TMethodEventJob.h" -#include +#include "test/global/gtest.h" #define TEST_IPC_PORT 24802 @@ -161,7 +160,7 @@ void CIpcTests::connectToServer_handleMessageReceived(const CEvent& e, void*) { CIpcMessage* m = static_cast(e.getDataObject()); - if (m->m_type == kIpcHello) { + if (m->type() == kIpcHello) { m_connectToServer_hasClientNode = m_connectToServer_server->hasClients(kIpcClientNode); m_connectToServer_helloMessageReceived = true; @@ -173,12 +172,12 @@ void CIpcTests::sendMessageToServer_serverHandleMessageReceived(const CEvent& e, void*) { CIpcMessage* m = static_cast(e.getDataObject()); - if (m->m_type == kIpcHello) { + if (m->type() == kIpcHello) { LOG((CLOG_DEBUG "client said hello, sending test to server")); CIpcCommandMessage m("test", true); m_sendMessageToServer_client->send(m); } - else if (m->m_type == kIpcCommand) { + else if (m->type() == kIpcCommand) { CIpcCommandMessage* cm = static_cast(m); LOG((CLOG_DEBUG "got ipc command message, %d", cm->command().c_str())); m_sendMessageToServer_receivedString = cm->command(); @@ -190,7 +189,7 @@ void CIpcTests::sendMessageToClient_serverHandleClientConnected(const CEvent& e, void*) { CIpcMessage* m = static_cast(e.getDataObject()); - if (m->m_type == kIpcHello) { + if (m->type() == kIpcHello) { LOG((CLOG_DEBUG "client said hello, sending test to client")); CIpcLogLineMessage m("test"); m_sendMessageToClient_server->send(m, kIpcClientNode); @@ -201,7 +200,7 @@ void CIpcTests::sendMessageToClient_clientHandleMessageReceived(const CEvent& e, void*) { CIpcMessage* m = static_cast(e.getDataObject()); - if (m->m_type == kIpcLogLine) { + if (m->type() == kIpcLogLine) { CIpcLogLineMessage* llm = static_cast(m); LOG((CLOG_DEBUG "got ipc log message, %d", llm->logLine().c_str())); m_sendMessageToClient_receivedString = llm->logLine(); diff --git a/src/test/integtests/net/NetworkTests.cpp b/src/test/integtests/net/NetworkTests.cpp index 352c763a..2621c74f 100644 --- a/src/test/integtests/net/NetworkTests.cpp +++ b/src/test/integtests/net/NetworkTests.cpp @@ -38,7 +38,7 @@ #include "base/TMethodJob.h" #include "base/Log.h" -#include +#include "test/global/gtest.h" #include #include #include diff --git a/src/test/integtests/platform/MSWindowsClipboardTests.cpp b/src/test/integtests/platform/MSWindowsClipboardTests.cpp index fc39a641..b2759c6d 100644 --- a/src/test/integtests/platform/MSWindowsClipboardTests.cpp +++ b/src/test/integtests/platform/MSWindowsClipboardTests.cpp @@ -19,8 +19,8 @@ #include "platform/MSWindowsClipboard.h" #include "platform/IMSWindowsClipboardFacade.h" -#include -#include +#include "test/global/gmock.h" +#include "test/global/gtest.h" class CMSWindowsClipboardTests : public ::testing::Test { diff --git a/src/test/integtests/platform/MSWindowsKeyStateTests.cpp b/src/test/integtests/platform/MSWindowsKeyStateTests.cpp index 7e36d609..4d593efe 100644 --- a/src/test/integtests/platform/MSWindowsKeyStateTests.cpp +++ b/src/test/integtests/platform/MSWindowsKeyStateTests.cpp @@ -18,17 +18,16 @@ #define TEST_ENV -#include "test/global/access.h" +#include "test/mock/synergy/MockEventQueue.h" +#include "test/mock/synergy/MockKeyMap.h" #include "platform/MSWindowsKeyState.h" #include "platform/MSWindowsDesks.h" #include "platform/MSWindowsScreen.h" #include "platform/MSWindowsScreenSaver.h" -#include "synergy/CMockEventQueue.h" -#include "synergy/CMockKeyMap.h" #include "base/TMethodJob.h" -#include -#include +#include "test/global/gtest.h" +#include "test/global/gmock.h" // wParam = flags, HIBYTE(lParam) = virtual key, LOBYTE(lParam) = scan code #define SYNERGY_MSG_FAKE_KEY SYNERGY_HOOK_LAST_MSG + 4 diff --git a/src/test/integtests/platform/OSXScreenTests.cpp b/src/test/integtests/platform/OSXScreenTests.cpp index 648d355a..f0c82b3c 100644 --- a/src/test/integtests/platform/OSXScreenTests.cpp +++ b/src/test/integtests/platform/OSXScreenTests.cpp @@ -15,7 +15,6 @@ * along with this program. If not, see . */ -#include "test/global/access.h" #include "platform/OSXScreen.h" #include "arch/Arch.h" #include "base/EventQueue.h" diff --git a/src/test/integtests/platform/XWindowsClipboardTests.cpp b/src/test/integtests/platform/XWindowsClipboardTests.cpp index da11315e..7c1ac55a 100644 --- a/src/test/integtests/platform/XWindowsClipboardTests.cpp +++ b/src/test/integtests/platform/XWindowsClipboardTests.cpp @@ -18,7 +18,7 @@ #include "platform/XWindowsClipboard.h" -#include +#include "test/global/gtest.h" #include class CXWindowsClipboardTests : public ::testing::Test diff --git a/src/test/integtests/platform/XWindowsKeyStateTests.cpp b/src/test/integtests/platform/XWindowsKeyStateTests.cpp index 92a033a4..169a8d25 100644 --- a/src/test/integtests/platform/XWindowsKeyStateTests.cpp +++ b/src/test/integtests/platform/XWindowsKeyStateTests.cpp @@ -32,8 +32,8 @@ # include #endif -#include -#include +#include "test/global/gtest.h" +#include "test/global/gmock.h" #include class CXWindowsKeyStateTests : public ::testing::Test diff --git a/src/test/integtests/platform/XWindowsScreenSaverTests.cpp b/src/test/integtests/platform/XWindowsScreenSaverTests.cpp index 09189dcf..caa9beb6 100644 --- a/src/test/integtests/platform/XWindowsScreenSaverTests.cpp +++ b/src/test/integtests/platform/XWindowsScreenSaverTests.cpp @@ -22,7 +22,7 @@ #include "test/mock/synergy/MockEventQueue.h" #include "platform/XWindowsScreenSaver.h" -#include +#include "test/global/gtest.h" #include using ::testing::_; diff --git a/src/test/integtests/platform/XWindowsScreenTests.cpp b/src/test/integtests/platform/XWindowsScreenTests.cpp index a3c18f90..47ae32fd 100644 --- a/src/test/integtests/platform/XWindowsScreenTests.cpp +++ b/src/test/integtests/platform/XWindowsScreenTests.cpp @@ -19,7 +19,7 @@ #include "platform/XWindowsScreen.h" #include "synergy/CMockEventQueue.h" -#include +#include "test/global/gtest.h" using ::testing::_; diff --git a/src/test/mock/server/MockPrimaryClient.h b/src/test/mock/server/MockPrimaryClient.h index f8f04c86..04882d71 100644 --- a/src/test/mock/server/MockPrimaryClient.h +++ b/src/test/mock/server/MockPrimaryClient.h @@ -19,7 +19,7 @@ #define TEST_ENV -#include "synergy/PrimaryClient.h" +#include "server/PrimaryClient.h" #include "base/String.h" #include "test/global/gmock.h" diff --git a/src/test/mock/server/MockServer.h b/src/test/mock/server/MockServer.h index 6f499ab6..20efa088 100644 --- a/src/test/mock/server/MockServer.h +++ b/src/test/mock/server/MockServer.h @@ -21,7 +21,7 @@ #include "server/Server.h" -#include +#include "test/global/gmock.h" class IEventQueue;