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-11 12:02:00 +0300
committerAlex Zolotarev <alex@maps.me>2015-09-23 02:34:51 +0300
commit270c4915615e8e74c9605616f469a8e5c3b971a3 (patch)
tree000937bb75888d618e3f0848ac6a82683a1dd7c5
parent9cbaec6c292fae1167d0695d4103abfa60ae2b2b (diff)
[drape] move test widget to common lib
-rw-r--r--drape/drape_tests/drape_tests.pro4
-rw-r--r--drape/drape_tests/glyph_mng_tests.cpp51
-rw-r--r--qt_tstfrm/qt_tstfrm.pro4
-rw-r--r--qt_tstfrm/test_main_loop.cpp43
-rw-r--r--qt_tstfrm/test_main_loop.hpp25
5 files changed, 78 insertions, 49 deletions
diff --git a/drape/drape_tests/drape_tests.pro b/drape/drape_tests/drape_tests.pro
index bc5508eaf0..570267106c 100644
--- a/drape/drape_tests/drape_tests.pro
+++ b/drape/drape_tests/drape_tests.pro
@@ -10,7 +10,7 @@ CONFIG -= app_bundle
TEMPLATE = app
DEFINES += OGL_TEST_ENABLED GTEST_DONT_DEFINE_TEST COMPILER_TESTS
-DEPENDENCIES = platform coding base gmock freetype expat tomcrypt
+DEPENDENCIES = qt_tstfrm platform coding base gmock freetype expat tomcrypt
ROOT_DIR = ../..
SHADER_COMPILE_ARGS = $$PWD/../shaders shader_index.txt shader_def
include($$ROOT_DIR/common.pri)
@@ -36,11 +36,11 @@ SOURCES += \
compile_shaders_test.cpp \
batcher_tests.cpp \
pointers_tests.cpp \
- font_texture_tests.cpp \
bingind_info_tests.cpp \
stipple_pen_tests.cpp \
texture_of_colors_tests.cpp \
glyph_mng_tests.cpp \
+ glyph_packer_test.cpp
HEADERS += \
glmock_functions.hpp \
diff --git a/drape/drape_tests/glyph_mng_tests.cpp b/drape/drape_tests/glyph_mng_tests.cpp
index d11d178d9f..6515ef1d7c 100644
--- a/drape/drape_tests/glyph_mng_tests.cpp
+++ b/drape/drape_tests/glyph_mng_tests.cpp
@@ -1,14 +1,11 @@
#include "../../testing/testing.hpp"
-
-#include <QtWidgets/QApplication>
-#include <QtWidgets/QWidget>
#include <QtGui/QPainter>
-#include <QtCore/QTimer>
+
+#include "../../qt_tstfrm/test_main_loop.hpp"
#include "../glyph_manager.hpp"
#include "../../platform/platform.hpp"
-#include "../../base/scope_guard.hpp"
#include "../../std/cstring.hpp"
#include "../../std/function.hpp"
@@ -16,46 +13,6 @@
namespace
{
- class TestMainLoop : public QObject
- {
- public:
- typedef function<void (QPaintDevice *)> TRednerFn;
- TestMainLoop(TRednerFn const & fn) : m_renderFn(fn) {}
-
- void exec(char const * testName)
- {
- char * buf = (char *)malloc(strlen(testName) + 1);
- MY_SCOPE_GUARD(argvFreeFun, [&buf](){ free(buf); })
- strcpy(buf, testName);
-
- int argc = 1;
- QApplication app(argc, &buf);
- QTimer::singleShot(3000, &app, SLOT(quit()));
-
- QWidget w;
- w.setWindowTitle(testName);
- w.show();
- w.installEventFilter(this);
-
- app.exec();
- }
-
- protected:
- bool eventFilter(QObject * obj, QEvent * event)
- {
- if (event->type() == QEvent::Paint)
- {
- m_renderFn(qobject_cast<QWidget *>(obj));
- return true;
- }
-
- return false;
- }
-
- private:
- TRednerFn m_renderFn;
- };
-
class GlyphRenderer
{
public:
@@ -78,7 +35,9 @@ namespace
void RenderGlyphs(QPaintDevice * device)
{
vector<dp::GlyphManager::Glyph> glyphs;
- m_mng->GetGlyphs({0x58, 0x79, 0x439}, glyphs);
+ glyphs.push_back(m_mng->GetGlyph(0x58));
+ glyphs.push_back(m_mng->GetGlyph(0x79));
+ glyphs.push_back(m_mng->GetGlyph(0x439));
QPainter painter(device);
painter.fillRect(QRectF(0.0, 0.0, device->width(), device->height()), Qt::white);
diff --git a/qt_tstfrm/qt_tstfrm.pro b/qt_tstfrm/qt_tstfrm.pro
index f71ac76c08..3e8fe9bda4 100644
--- a/qt_tstfrm/qt_tstfrm.pro
+++ b/qt_tstfrm/qt_tstfrm.pro
@@ -6,15 +6,17 @@ ROOT_DIR = ..
include($$ROOT_DIR/common.pri)
-QT *= core gui opengl
+QT *= core gui widgets opengl
HEADERS += \
tstwidgets.hpp \
macros.hpp \
gl_test_widget.hpp \
gui_test_widget.hpp \
+ test_main_loop.hpp
SOURCES += \
tstwidgets.cpp \
+ test_main_loop.cpp
diff --git a/qt_tstfrm/test_main_loop.cpp b/qt_tstfrm/test_main_loop.cpp
new file mode 100644
index 0000000000..9108b2ceb0
--- /dev/null
+++ b/qt_tstfrm/test_main_loop.cpp
@@ -0,0 +1,43 @@
+#include "test_main_loop.hpp"
+
+#include <QtCore/QTimer>
+#include <QtWidgets/QApplication>
+#include <QtWidgets/QWidget>
+
+#include "../base/scope_guard.hpp"
+
+#include "../std/cstring.hpp"
+
+TestMainLoop::TestMainLoop(TestMainLoop::TRednerFn const & fn)
+ : m_renderFn(fn)
+{
+}
+
+void TestMainLoop::exec(char const * testName)
+{
+ char * buf = (char *)malloc(strlen(testName) + 1);
+ MY_SCOPE_GUARD(argvFreeFun, [&buf](){ free(buf); });
+ strcpy(buf, testName);
+
+ int argc = 1;
+ QApplication app(argc, &buf);
+ QTimer::singleShot(3000, &app, SLOT(quit()));
+
+ QWidget w;
+ w.setWindowTitle(testName);
+ w.show();
+ w.installEventFilter(this);
+
+ app.exec();
+}
+
+bool TestMainLoop::eventFilter(QObject * obj, QEvent * event)
+{
+ if (event->type() == QEvent::Paint)
+ {
+ m_renderFn(qobject_cast<QWidget *>(obj));
+ return true;
+ }
+
+ return false;
+}
diff --git a/qt_tstfrm/test_main_loop.hpp b/qt_tstfrm/test_main_loop.hpp
new file mode 100644
index 0000000000..6e0b41b1d1
--- /dev/null
+++ b/qt_tstfrm/test_main_loop.hpp
@@ -0,0 +1,25 @@
+#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);
+
+protected:
+ bool eventFilter(QObject * obj, QEvent * event);
+
+private:
+ TRednerFn m_renderFn;
+};