Skip to content

Commit

Permalink
tests: support msvc
Browse files Browse the repository at this point in the history
divide mock library and executable for PDB and exports some core APIs
for msvc testing.

Signed-off-by: JeanTracker <[email protected]>
  • Loading branch information
JeanTracker authored and webispy committed May 30, 2024
1 parent 22166d5 commit 4df9c41
Show file tree
Hide file tree
Showing 13 changed files with 44 additions and 26 deletions.
9 changes: 5 additions & 4 deletions src/clientkit/dialog_ux_state_aggregator.hh
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,16 @@
#include "clientkit/dialog_ux_state_aggregator_interface.hh"
#include "clientkit/interaction_control_manager_interface.hh"
#include "clientkit/session_manager_interface.hh"
#include "nugu.h"

namespace NuguClientKit {

using namespace NuguCapability;

class DialogUXStateAggregator : public IASRListener,
public ITTSListener,
public IChipsListener,
public IInteractionControlManagerListener {
class NUGU_API DialogUXStateAggregator : public IASRListener,
public ITTSListener,
public IChipsListener,
public IInteractionControlManagerListener {
public:
explicit DialogUXStateAggregator(ISessionManager* session_manager);
virtual ~DialogUXStateAggregator();
Expand Down
7 changes: 4 additions & 3 deletions src/clientkit/speech_recognizer_aggregator.hh
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@
#define __SPEECH_RECOGNIZER_AGGREGATOR_H__

#include "clientkit/speech_recognizer_aggregator_interface.hh"
#include "nugu.h"

namespace NuguClientKit {

class SpeechRecognizerAggregator : public ISpeechRecognizerAggregator,
public IWakeupListener,
public IASRListener {
class NUGU_API SpeechRecognizerAggregator : public ISpeechRecognizerAggregator,
public IWakeupListener,
public IASRListener {
public:
SpeechRecognizerAggregator();
virtual ~SpeechRecognizerAggregator();
Expand Down
9 changes: 5 additions & 4 deletions src/core/directive_sequencer.hh
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,22 @@
#define __NUGU_DIRECTIVE_SEQUENCER_H__

#include <map>
#include <vector>
#include <string>
#include <vector>

#include <glib.h>

#include "clientkit/directive_sequencer_interface.hh"
#include "nugu.h"

namespace NuguCore {

using namespace NuguClientKit;

class LookupTable;
class DialogDirectiveList;
class NUGU_API LookupTable;
class NUGU_API DialogDirectiveList;

class DirectiveSequencer : public IDirectiveSequencer {
class NUGU_API DirectiveSequencer : public IDirectiveSequencer {

public:
DirectiveSequencer();
Expand Down
9 changes: 5 additions & 4 deletions src/core/focus_manager.hh
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,20 @@
#include <memory>

#include "clientkit/focus_manager_interface.hh"
#include "nugu.h"

namespace NuguCore {

using namespace NuguClientKit;

class IFocusResourceObserver {
class NUGU_API IFocusResourceObserver {
public:
virtual ~IFocusResourceObserver() = default;

virtual void onFocusChanged(const std::string& type, const std::string& name, FocusState state) = 0;
};

class FocusResource {
class NUGU_API FocusResource {
public:
FocusResource(const std::string& type, const std::string& name, int request_priority, int release_priority, IFocusResourceListener* listener, IFocusResourceObserver* observer);
virtual ~FocusResource() = default;
Expand All @@ -55,8 +56,8 @@ public:
IFocusResourceObserver* observer;
};

class FocusManager : public IFocusManager,
public IFocusResourceObserver {
class NUGU_API FocusManager : public IFocusManager,
public IFocusResourceObserver {
public:
FocusManager();
virtual ~FocusManager() = default;
Expand Down
2 changes: 1 addition & 1 deletion src/core/interaction_control_manager.hh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace NuguCore {

using namespace NuguClientKit;

class InteractionControlManager : public IInteractionControlManager {
class NUGU_API InteractionControlManager : public IInteractionControlManager {
public:
using Requesters = std::set<std::string>;

Expand Down
3 changes: 2 additions & 1 deletion src/core/media_player.hh
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@
#include "base/nugu_media.h"
#include "base/nugu_player.h"
#include "clientkit/media_player_interface.hh"
#include "nugu.h"

namespace NuguCore {

using namespace NuguClientKit;

class MediaPlayerPrivate;
class MediaPlayer : public IMediaPlayer {
class NUGU_API MediaPlayer : public IMediaPlayer {
public:
explicit MediaPlayer(int volume = NUGU_SET_VOLUME_MAX);
virtual ~MediaPlayer();
Expand Down
5 changes: 3 additions & 2 deletions src/core/nugu_timer.hh
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@
#define __NUGU_TIMER_HH__

#include "clientkit/nugu_timer_interface.hh"
#include "nugu.h"

namespace NuguCore {

using namespace NuguClientKit;

class NUGUTimerPrivate;
class NUGUTimer : public INuguTimer {
class NUGU_API NUGUTimerPrivate;
class NUGU_API NUGUTimer : public INuguTimer {
public:
NUGUTimer(bool singleshot = false);
virtual ~NUGUTimer();
Expand Down
7 changes: 4 additions & 3 deletions src/core/playstack_manager.hh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <set>

#include "clientkit/playsync_manager_interface.hh"
#include "nugu.h"
#include "nugu_timer.hh"

namespace NuguCore {
Expand All @@ -33,21 +34,21 @@ enum class PlayStackRemoveMode {
Later
};

class IPlayStackManagerListener {
class NUGU_API IPlayStackManagerListener {
public:
virtual ~IPlayStackManagerListener() = default;

virtual void onStackAdded(const std::string& ps_id) = 0;
virtual void onStackRemoved(const std::string& ps_id) = 0;
};

class IStackTimer : public NUGUTimer {
class NUGU_API IStackTimer : public NUGUTimer {
public:
virtual ~IStackTimer() = default;
virtual bool isStarted() = 0;
};

class PlayStackManager {
class NUGU_API PlayStackManager {
public:
using PlayStack = std::pair<std::map<std::string, PlayStackActivity>, std::vector<std::string>>;
using PlayStackHoldTimes = struct _PlayStackHoldTimes {
Expand Down
5 changes: 3 additions & 2 deletions src/core/playsync_manager.hh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <vector>

#include "base/nugu_directive.h"
#include "nugu.h"

#include "clientkit/playsync_manager_interface.hh"
#include "interaction_control_manager.hh"
Expand All @@ -32,8 +33,8 @@ namespace NuguCore {

using namespace NuguClientKit;

class PlaySyncManager : public IPlaySyncManager,
public IPlayStackManagerListener {
class NUGU_API PlaySyncManager : public IPlaySyncManager,
public IPlayStackManagerListener {
public:
PlaySyncManager();
virtual ~PlaySyncManager();
Expand Down
3 changes: 2 additions & 1 deletion src/core/routine_manager.hh
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@
#include <vector>

#include "clientkit/routine_manager_interface.hh"
#include "nugu.h"
#include "nugu_timer.hh"

namespace NuguCore {

using namespace NuguClientKit;

class RoutineManager : public IRoutineManager {
class NUGU_API RoutineManager : public IRoutineManager {
public:
using RoutineAction = struct _RoutineAction {
std::string type;
Expand Down
3 changes: 2 additions & 1 deletion src/core/session_manager.hh
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@
#include <vector>

#include "clientkit/session_manager_interface.hh"
#include "nugu.h"

namespace NuguCore {

using namespace NuguClientKit;

class SessionManager : public ISessionManager {
class NUGU_API SessionManager : public ISessionManager {
public:
using ActiveDialogs = std::vector<std::pair<std::string, int>>;
using Sessions = std::map<std::string, Session>;
Expand Down
7 changes: 7 additions & 0 deletions tests/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ SET(test_core_media_player_srcs
../../src/core/nugu_timer.cc
../../src/core/media_player.cc)

# doesn't work timer mock in msvc cause of PDB issue.
IF(MSVC)
LIST(REMOVE_ITEM UNIT_TESTS
"test_core_nugu_timer"
"test_core_media_player")
ENDIF()

FOREACH(test ${UNIT_TESTS})
SET(SRC ${test}.cc)
IF (${test}_srcs)
Expand Down
1 change: 1 addition & 0 deletions tests/core/test_core_focus_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>

#include <glib.h>

Expand Down

0 comments on commit 4df9c41

Please sign in to comment.