[test] Fixed tests compilation

This commit is contained in:
Laury
2022-06-25 19:43:58 +02:00
parent 0b2a581177
commit 4893b73917
8 changed files with 36 additions and 4 deletions

View File

@@ -58,6 +58,7 @@ apps_src += $(addprefix apps/,\
math_variable_box_empty_controller.cpp \
shift_alpha_lock_view.cpp \
suspend_timer.cpp \
timer_manager.cpp \
title_bar_view.cpp \
)
@@ -117,6 +118,7 @@ apps_tests_src = $(app_calculation_test_src) $(app_code_test_src) $(app_graph_te
apps_tests_src += $(addprefix apps/,\
alternate_empty_nested_menu_controller.cpp \
global_preferences.cpp \
dummy_timer_manager.cpp \
)
ifeq ($(THEME_REPO),local)

View File

@@ -0,0 +1,6 @@
#include <escher/timer_manager.h>
// This is the dummy implementation used in tests
void TimerManager::AddTimer(Timer * timer) { }
void TimerManager::RemoveTimer(Timer * timer) { }

10
apps/timer_manager.cpp Normal file
View File

@@ -0,0 +1,10 @@
#include <escher/timer_manager.h>
#include <apps/apps_container.h>
void TimerManager::AddTimer(Timer * timer) {
AppsContainer::sharedAppsContainer()->addTimer(timer);
}
void TimerManager::RemoveTimer(Timer * timer) {
AppsContainer::sharedAppsContainer()->removeTimer(timer);
}

View File

@@ -86,6 +86,7 @@
#include <escher/table_view_data_source.h>
#include <escher/tiled_view.h>
#include <escher/timer.h>
#include <escher/timer_manager.h>
#include <escher/toolbox.h>
#include <escher/toolbox_message_tree.h>
#include <escher/transparent_view.h>

View File

@@ -0,0 +1,13 @@
#ifndef ESCHER_TIMER_MANAGER_H
#define ESCHER_TIMER_MANAGER_H
#include <escher/timer.h>
class TimerManager {
public:
// We need this file to not create dependece between apps and escher.
static void AddTimer(Timer * timer);
static void RemoveTimer(Timer * timer);
};
#endif

View File

@@ -1,15 +1,16 @@
#include <apps/apps_container.h>
#include <escher/animation_timer.h>
#include <escher/timer_manager.h>
void AnimationTimer::setAnimated(Animated * animated) {
m_animated = animated;
AppsContainer::sharedAppsContainer()->addTimer(this);
TimerManager::AddTimer(this);
}
void AnimationTimer::removeAnimated(Animated * animated) {
if (m_animated == animated || animated == nullptr) {
m_animated = nullptr;
AppsContainer::sharedAppsContainer()->removeTimer(this);
TimerManager::RemoveTimer(this);
}
}

View File

@@ -1,5 +1,4 @@
#include <escher/slideable_message_text_view.h>
#include <apps/apps_container.h>
SlideableMessageTextView::SlideableMessageTextView(const KDFont * font, I18n::Message message, float horizontalAlignment, float verticalAlignment, KDColor textColor, KDColor backgroundColor) :
MessageTextView(font, message, horizontalAlignment, verticalAlignment, textColor, backgroundColor),

View File

@@ -457,7 +457,7 @@ void assert_additional_results_compute_to(const char * expression, const char *
return;
}
I18n::Message unitMessage;
const int numberOfResults = Unit::SetAdditionalExpressionsAndMessage(units, value, additional, maxNumberOfResults, reductionContext, unitMessage);
const int numberOfResults = Unit::SetAdditionalExpressionsAndMessage(units, value, additional, maxNumberOfResults, reductionContext, &unitMessage);
quiz_assert(numberOfResults == length);
for (int i = 0; i < length; i++) {