Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorExMix <rahuba.youri@mapswithme.com>2014-12-16 12:41:22 +0300
committerAlex Zolotarev <alex@maps.me>2015-09-23 02:34:57 +0300
commitc37acaa46c976cbf20c59b8f7cea2c9e9baf5098 (patch)
tree0fd178af0fdddc024431192fb3d59725deadb999
parentfd6415e4f0b9ec5cbbfacc3f8b56b5260aa7c35a (diff)
drape_test linkage fix
-rw-r--r--drape/drape_tests/font_texture_tests.cpp3
-rw-r--r--drape/drape_tests/glyph_mng_tests.cpp3
-rw-r--r--omim.pro2
-rw-r--r--qt_tstfrm/test_main_loop.cpp45
-rw-r--r--qt_tstfrm/test_main_loop.hpp22
5 files changed, 31 insertions, 44 deletions
diff --git a/drape/drape_tests/font_texture_tests.cpp b/drape/drape_tests/font_texture_tests.cpp
index 61012a045d..4454b06447 100644
--- a/drape/drape_tests/font_texture_tests.cpp
+++ b/drape/drape_tests/font_texture_tests.cpp
@@ -102,6 +102,5 @@ UNIT_TEST(UploadingGlyphs)
.WillOnce(Invoke(&r, &UploadedRender::glMemoryToQImage));
index.UploadResources(MakeStackRefPointer<Texture>(&tex));
- TestMainLoop loop(bind(&UploadedRender::Render, &r, _1));
- loop.exec("UploadingGlyphs");
+ RunTestLoop("UploadingGlyphs", bind(&UploadedRender::Render, &r, _1));
}
diff --git a/drape/drape_tests/glyph_mng_tests.cpp b/drape/drape_tests/glyph_mng_tests.cpp
index 9c06159d37..10b8278760 100644
--- a/drape/drape_tests/glyph_mng_tests.cpp
+++ b/drape/drape_tests/glyph_mng_tests.cpp
@@ -71,6 +71,5 @@ namespace
UNIT_TEST(GlyphLoadingTest)
{
GlyphRenderer renderer;
- TestMainLoop loop(bind(&GlyphRenderer::RenderGlyphs, &renderer, _1));
- loop.exec("GlyphLoadingTest");
+ RunTestLoop("GlyphLoadingTest", bind(&GlyphRenderer::RenderGlyphs, &renderer, _1));
}
diff --git a/omim.pro b/omim.pro
index dc6256fff2..ac6b77a6ce 100644
--- a/omim.pro
+++ b/omim.pro
@@ -27,6 +27,7 @@ SUBDIRS = 3party \
geometry/geometry_tests \
platform/platform_tests \
anim \
+ qt_tstfrm \
drape \
drape/drape_tests \
graphics \
@@ -37,7 +38,6 @@ SUBDIRS = 3party \
map map/map_tests map/benchmark_tool map/mwm_tests\
generator generator/generator_tests \
generator/generator_tool \
- qt_tstfrm \
indexer/indexer_tests \
graphics/graphics_tests \
gui/gui_tests \
diff --git a/qt_tstfrm/test_main_loop.cpp b/qt_tstfrm/test_main_loop.cpp
index 1e71a14041..d5db995773 100644
--- a/qt_tstfrm/test_main_loop.cpp
+++ b/qt_tstfrm/test_main_loop.cpp
@@ -8,12 +8,30 @@
#include "../std/cstring.hpp"
-TestMainLoop::TestMainLoop(TestMainLoop::TRednerFn const & fn)
- : m_renderFn(fn)
+namespace
{
-}
-void TestMainLoop::exec(char const * testName, bool autoExit)
+class MyWidget : public QWidget
+{
+public:
+ MyWidget(TRednerFn const & fn)
+ : m_fn(fn)
+ {
+ }
+
+protected:
+ void paintEvent(QPaintEvent * e)
+ {
+ m_fn(this);
+ }
+
+private:
+ TRednerFn m_fn;
+};
+
+} // namespace
+
+void RunTestLoop(char const * testName, TRednerFn const & fn, bool autoExit)
{
char * buf = (char *)malloc(strlen(testName) + 1);
MY_SCOPE_GUARD(argvFreeFun, [&buf](){ free(buf); });
@@ -24,21 +42,10 @@ void TestMainLoop::exec(char const * testName, bool autoExit)
if (autoExit)
QTimer::singleShot(3000, &app, SLOT(quit()));
- QWidget w;
- w.setWindowTitle(testName);
- w.show();
- w.installEventFilter(this);
+ MyWidget * widget = new MyWidget(fn);
+ widget->setWindowTitle(testName);
+ widget->show();
app.exec();
-}
-
-bool TestMainLoop::eventFilter(QObject * obj, QEvent * event)
-{
- if (event->type() == QEvent::Paint)
- {
- m_renderFn(qobject_cast<QWidget *>(obj));
- return true;
- }
-
- return false;
+ delete widget;
}
diff --git a/qt_tstfrm/test_main_loop.hpp b/qt_tstfrm/test_main_loop.hpp
index ea879afee6..4faa8ec708 100644
--- a/qt_tstfrm/test_main_loop.hpp
+++ b/qt_tstfrm/test_main_loop.hpp
@@ -1,25 +1,7 @@
#pragma once
-#include <QtCore/QObject>
-
#include "../std/function.hpp"
class QPaintDevice;
-class TestMainLoop : public QObject
-{
- Q_OBJECT
-
-public:
-
- typedef function<void (QPaintDevice *)> TRednerFn;
- TestMainLoop(TRednerFn const & fn);
- virtual ~TestMainLoop() {}
-
- void exec(char const * testName, bool autoExit = true);
-
-protected:
- bool eventFilter(QObject * obj, QEvent * event);
-
-private:
- TRednerFn m_renderFn;
-};
+typedef function<void (QPaintDevice *)> TRednerFn;
+void RunTestLoop(char const * testName, TRednerFn const & fn, bool autoExit = false);