From f06e082d5d4478604710ec488166fc3e3dbfdc9d Mon Sep 17 00:00:00 2001 From: rachytski Date: Thu, 24 Jan 2013 19:05:33 +0300 Subject: [PATCH] moved resources for tests into data/testing folder, and added gui_tests project. --- data/testing/images/arrow-big.png | Bin 0 -> 3450 bytes data/testing/images/arrow.png | Bin 0 -> 1724 bytes data/{ => testing/images}/test.png | Bin graphics/graphics_tests/screengl_test.cpp | 2 +- gui/gui_tests/gui_tests.cpp | 128 ++++++++++++++++++++++ gui/gui_tests/gui_tests.pro | 22 ++++ omim.pro | 1 + 7 files changed, 152 insertions(+), 1 deletion(-) create mode 100644 data/testing/images/arrow-big.png create mode 100644 data/testing/images/arrow.png rename data/{ => testing/images}/test.png (100%) create mode 100644 gui/gui_tests/gui_tests.cpp create mode 100644 gui/gui_tests/gui_tests.pro diff --git a/data/testing/images/arrow-big.png b/data/testing/images/arrow-big.png new file mode 100644 index 0000000000000000000000000000000000000000..dfd720ee3969cc1b7934b386b06ed7148a7abfc1 GIT binary patch literal 3450 zcmV-=4TbWFP)VtpGQ^2~j>L z{TPIZho8WF7s8AsF(4%lu=Ilil_c#k1#BD`g+z_-S}ni;lr+9ei2xlpPz``0Lpt{J z$dMzZ_^B@{Dw>Jibd;aJsj2B3y!733&pj6@KtJ~x;DFz76PJNfuq-e=k`c*_WI;+p zny_cjo;%vx+y62;I{LK~Wh2j$KBO<q%jFe7Fb7TM6Ss_@>`@v#vo%+lTPKd z8x>d~%HI`p)l)JZK74rLqD6~#>GgUm-^uHj;NoQ$H1~Mme5(sa-GQ)!B%4IIW2zYn zCmNwN-wX!bSh0LQU*GZL$A7zY>C#&K>L#}+DUK_wqY`2SNt}Y|(xpqQOG-+%p$9ea zoep2J!^y@`=pFIJWj+0(MG;7wZy%ek`TChTlAd?y!8=omI zE`E;haHh!#UwrF;mL5++)=L3u_wMNym{XKA<~MXyub>P&@X{GASRodWIGbx{%$QNd zclh*z4L&+E5><>BtLOOHooP^UN9vgS_4W0e(W>5x7OXCU^U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O z3gF|C2{!}C$!XBV?3MhQjO)!YEzOFI;6_HnW=7MjMvYwMoUJ2kCHo#uqfX}9#RTkL zE<*u`@E&ip@ih;YJz_LaKql^!J-*|Q2-rd#3)IVib#tFu0HXpK3s9{fLdR*?ph2wJ zh65Vl!1Cl{0P@?16pQc>2Vha-xKYPxP#0o-LWp(h=QQlsNTLI=02~icz8?=*>%Dq` zJE8=QGHa;!>3M)LgB%agNO7^iO#uJb5P-3N0SUm5;a?JQ@Jhu0Ud9dZMgUC&{~PvK ckN*oW0PmjUp$BejhyVZp07*qoM6N<$f_@x+#Q*>R literal 0 HcmV?d00001 diff --git a/data/testing/images/arrow.png b/data/testing/images/arrow.png new file mode 100644 index 0000000000000000000000000000000000000000..9acd3c1e401daa7b9f80bce15c3a03410e8068c6 GIT binary patch literal 1724 zcmV;t21EIYP)^{;s+N7(iYn#X8xe`q_?-D|b9wE9r1JO@0#yf{5c12yF-P_{`A zD7=K%a|FrH;gCO?ToZ#-hlcZfX=&+6lvLB&y$I+2a6kZ;31~J>uLNeh09L06I1X{h zOuNy6-2M>U81X`?K?56%TFz)RR+W^LTy1M>n`1^7iX|}}BB89TEaMtBolckg>uonQ zciO`fd?@kQy#VBAB|t%DJhWV2g#5J$kb*=SK2mk{&!t1f76Z85?psMoNtM{;U}_iD z5_8NF6FWLO-ptO~6|A6}L&;xN+kF>iFev7X*b+1n6|N+f!r`YVRLd z3x~EQgK69cR)+w-K;-)@TIQ^4jFP|Z?!EnNY%w6wGw zd}tNBQmb0aqK$l7#fnMoL^Nd!q6-PI=n=t#cWIs%p!(fmF!j44B;QeB0E=@;<U{>(f=ld>kXEk2tT_D<6-ncV;0d`)qU*v5UyvdvZ;tOTqtQ|LJagvEpgMXf#B{4d zYisNH%*@PW@p?V1&xnuA^c15}ZLe%gf$zUsCcQEco0Qt)s1;p2N74@W^z_&nj~Go% z;mn6pU!j4cRgXkw58O0auYvc_Z`Gs?r(=`ScjJpj`TgwKvzKXaRmhZ-%7Uyp4UvN} zx?p5vupD9d)6GyVa z=kxjZ@892qMmvh#7P2>%B1KJ9T}7(b4h#$gu%7Z%R_-jS-I2ymV;UTs_RDudMC9MG zB&7^>=-D**^tCL&^+J7p{izEVF7)Bh48lqdg9wuHG%FN#ahMqwZ8n>|qM~BUp7M-% zO7IgHMCMTXpcq-lk@_n!TYYyl7j~Dd0jt&OsH>~{wxy-z1`bm(ILFeWPgM*?vM8)(lPcX(jtq+;xwDh_U`WPyG>0^ ze+~@|O|$!)WgrzhRnmqYRC7@lS;H(ngCU*u>D9qr<%%ArPCFyBuySJ&_$Oj%_3`OLa412eV!$JB;GHq1F6JsEhdorhWs1j`b@N3(QhUm0m{XRaKT! ztiK9w6~8VThIpohI0nT~Bo(;=K?#j3{mQKN-w9Nig;yO4R7pnqFaJ*e3NQeJD0M~h S%6^pq0000X0 literal 0 HcmV?d00001 diff --git a/data/test.png b/data/testing/images/test.png similarity index 100% rename from data/test.png rename to data/testing/images/test.png diff --git a/graphics/graphics_tests/screengl_test.cpp b/graphics/graphics_tests/screengl_test.cpp index 8c0debaf87..fd6cc2800b 100644 --- a/graphics/graphics_tests/screengl_test.cpp +++ b/graphics/graphics_tests/screengl_test.cpp @@ -1451,7 +1451,7 @@ namespace { void DoDraw(shared_ptr const & p) { - graphics::Image::Info ii("test.png"); + graphics::Image::Info ii("testing/images/test.png"); math::Matrix m = math::Shift( diff --git a/gui/gui_tests/gui_tests.cpp b/gui/gui_tests/gui_tests.cpp new file mode 100644 index 0000000000..6ddcfe3723 --- /dev/null +++ b/gui/gui_tests/gui_tests.cpp @@ -0,0 +1,128 @@ +#include "../../qt_tstfrm/gui_test_widget.hpp" + +#include "../balloon.hpp" +#include "../button.hpp" +#include "../text_view.hpp" +#include "../image_view.hpp" + +struct BalloonTest +{ + shared_ptr m_balloon; + + void Init(gui::Controller * c) + { + gui::Balloon::Params bp; + + bp.m_depth = graphics::maxDepth - 20; + bp.m_pivot = m2::PointD(200, 200); + bp.m_position = graphics::EPosAbove; + + bp.m_textMarginLeft = 10; + bp.m_textMarginRight = 10; + bp.m_textMarginTop = 5; + bp.m_textMarginBottom = 5; + + bp.m_imageMarginLeft = 0; + bp.m_imageMarginRight = 10; + bp.m_imageMarginTop = 5; + bp.m_imageMarginBottom = 5; + + bp.m_text = "Кирова, 24"; + bp.m_image = graphics::Image::Info("testing/images/arrow.png"); + + m_balloon.reset(new gui::Balloon(bp)); + m_balloon->setIsVisible(true); + + c->AddElement(m_balloon); + } + + void DoDraw(shared_ptr const & p) + {} +}; + +struct ButtonTest +{ + shared_ptr m_button; + + void Init(gui::Controller * c) + { + gui::Button::Params bp; + + bp.m_depth = graphics::maxDepth - 10; + bp.m_pivot = m2::PointD(200, 200); + bp.m_position = graphics::EPosAbove; + bp.m_text = "TestButton"; + + m_button.reset(new gui::Button(bp)); + + c->AddElement(m_button); + } + + void DoDraw(shared_ptr const & p) + { + } +}; + +struct TextViewTest +{ + shared_ptr m_textView; + + void Init(gui::Controller * c) + { + gui::TextView::Params tp; + + tp.m_pivot = m2::PointD(100, 100); + tp.m_depth = graphics::maxDepth; + tp.m_position = graphics::EPosRight; + tp.m_text = "Simplicity is the ultimate"; + + m_textView.reset(new gui::TextView(tp)); + m_textView->setIsVisible(true); + + c->AddElement(m_textView); + } + + void DoDraw(shared_ptr const & p) + { + } +}; + +struct ImageViewTest +{ + shared_ptr m_imageView; + m2::PointD m_pivot; + + void Init(gui::Controller * c) + { + gui::ImageView::Params ip; + + m_pivot = m2::PointD(100, 100); + + ip.m_depth = graphics::maxDepth; + ip.m_pivot = m_pivot; + ip.m_position = graphics::EPosUnder; + + ip.m_image = graphics::Image::Info("testing/images/arrow.png"); + + m_imageView.reset(new gui::ImageView(ip)); + + c->AddElement(m_imageView); + + m_imageView->setIsVisible(true); + } + + void DoDraw(shared_ptr const & p) + { + m2::RectD r(m_pivot, m_pivot); + + r.Inflate(2, 2); + + p->drawRectangle(r, graphics::Color(255, 0, 0, 255), graphics::maxDepth); + } +}; + +UNIT_TEST_GUI(BalloonTest); +UNIT_TEST_GUI(ButtonTest); +UNIT_TEST_GUI(TextViewTest); +UNIT_TEST_GUI(ImageViewTest); + diff --git a/gui/gui_tests/gui_tests.pro b/gui/gui_tests/gui_tests.pro new file mode 100644 index 0000000000..99c40c16eb --- /dev/null +++ b/gui/gui_tests/gui_tests.pro @@ -0,0 +1,22 @@ +TARGET = gui_tests +CONFIG += console +CONFIG -= app_bundle +TEMPLATE = app + +ROOT_DIR = ../.. +DEPENDENCIES = qt_tstfrm gui map indexer graphics platform geometry coding base expat freetype fribidi protobuf + +include($$ROOT_DIR/common.pri) + +QT *= opengl gui core + +win32 { + LIBS *= -lopengl32 -lshell32 + win32-g++: LIBS *= -lpthread +} +macx*: LIBS *= "-framework Foundation" + +SOURCES += \ + ../../testing/testingmain.cpp \ + gui_tests.cpp + diff --git a/omim.pro b/omim.pro index dd6d845728..abee2ec558 100644 --- a/omim.pro +++ b/omim.pro @@ -27,6 +27,7 @@ SUBDIRS = 3party \ qt_tstfrm \ indexer/indexer_tests \ graphics/graphics_tests \ + gui/gui_tests \ qt } else { # libraries which are used on mobile devices