Skip to content

Commit 35a2003

Browse files
committed
fix tests
1 parent 20bce37 commit 35a2003

6 files changed

+30
-72
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ Makefile.*
1010
*.dmg
1111
*.exe
1212
*.autosave
13+
*.o
1314
/scenes/*

test.pro

+16-18
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include(tracking.pro)
1+
include(track-o-bot.pro)
22

33
CONFIG += console
44
CONFIG -= app_bundle
@@ -18,27 +18,25 @@ INCLUDEPATH += src \
1818
$$GMOCKPATH \
1919
$$GMOCKPATH/include
2020

21-
DEFINES += QT_NO_KEYWORDS \
22-
_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_
23-
24-
# We need to QT_NO_KEYWORDS because of forever def in gmock
25-
# Manually define slots etc.
26-
DEFINES += "slots=Q_SLOTS"
27-
DEFINES += "signals=Q_SIGNALS"
28-
DEFINES += "emit=Q_EMIT"
29-
30-
SOURCES -= src/Main.cpp
21+
# Ignore forever definition of Qt (otherwise clash with gtest)
22+
DEFINES += "forever=forever"
3123

3224
GMOCK_HEADERS = $$GMOCKPATH/include/gmock/*.h \
3325
$$GMOCKPATH/include/gmock/internal/*.h
3426

3527
GTEST_HEADERS = $$GTESTPATH/include/gtest/*.h \
3628
$$GTESTPATH/include/gtest/internal/*.h
3729

38-
HEADERS += $$GTEST_HEADERS \
39-
$$GMOCK_HEADERS
40-
41-
SOURCES += $$GMOCKPATH/src/gmock-all.cc \
42-
$$GTESTPATH/src/gtest-all.cc \
43-
$$GMOCKPATH/src/gmock_main.cc \
44-
test/*_test.cpp
30+
HEADERS = $$GTEST_HEADERS \
31+
$$GMOCK_HEADERS \
32+
src/Local.h \
33+
src/OSXWindowCapture.h \
34+
src/Logger.h
35+
36+
SOURCES = $$GMOCKPATH/src/gmock-all.cc \
37+
$$GTESTPATH/src/gtest-all.cc \
38+
$$GMOCKPATH/src/gmock_main.cc \
39+
test/*Test.cpp \
40+
src/OSXWindowCapture.cpp \
41+
src/Hearthstone.cpp \
42+
src/Logger.cpp

test/hearthstone_test.cpp test/HearthstoneTest.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
#include "hearthstone.h"
1+
#include "Hearthstone.h"
22
#include "gtest/gtest.h"
33
#include "gmock/gmock.h"
44

55
#include <QApplication>
66

7-
#include "mock_window_capture.h"
7+
#include "MockWindowCapture.h"
88

99
using ::testing::Return;
1010

1111
class HearthstoneTest : public ::testing::Test {
12-
private:
12+
public:
1313
QApplication *mApp;
1414
MockWindowCapture *mWindowCapture;
1515

test/MockWindowCapture.h

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#include "WindowCapture.h"
2+
3+
class MockWindowCapture : public WindowCapture
4+
{
5+
public:
6+
MOCK_METHOD0( WindowFound, bool() );
7+
MOCK_METHOD0( Width, int() );
8+
MOCK_METHOD0( Height, int() );
9+
MOCK_METHOD4( Capture, QPixmap( int x, int y, int w, int h ) );
10+
};

test/dhash_test.cpp

-41
This file was deleted.

test/mock_window_capture.h

-10
This file was deleted.

0 commit comments

Comments
 (0)