add ASSERT_MSG, increase window resize try count
authorU. Artie Eoff <ullysses.a.eoff@intel.com>
Thu, 7 Feb 2013 22:41:23 +0000 (14:41 -0800)
committerU. Artie Eoff <ullysses.a.eoff@intel.com>
Thu, 7 Feb 2013 22:41:23 +0000 (14:41 -0800)
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
src/common/test.cpp
src/common/test.h
src/efl/test_window.cpp
src/efl/wayland-fits.cpp

index 46feec6..0670cbc 100644 (file)
@@ -46,4 +46,18 @@ std::vector<std::string> GlobalTestSuite::testNames(const std::string& testPatte
                }
        }
        return result;
+}
+
+TEST(MacroTest, "Common/Sanity")
+{
+       FAIL_UNLESS(1);
+       FAIL_UNLESS(1 == 1);
+       FAIL_UNLESS_EQUAL(0, 0);
+       FAIL_IF(0);
+       FAIL_IF(0 == 1);
+       FAIL_IF_EQUAL(0, 1);
+       FAIL_UNLESS_GE(1, 1);
+       FAIL_UNLESS_GE(1, 0);
+       ASSERT(1);
+       ASSERT_MSG(1, "sanity failed");
 }
\ No newline at end of file
index d31fadf..f62428e 100644 (file)
@@ -3,6 +3,7 @@
 
 #include <iostream>
 #include <boost/foreach.hpp>
+#include <boost/test/utils/wrap_stringstream.hpp>
 #include <map>
 #include <vector>
 #include <check.h> // Check unit testing framework... see http://check.sourceforge.net
@@ -47,6 +48,13 @@ typedef Singleton<GlobalTestSuite> TheGlobalTestSuite;
        #define ASSERT(expr) fail_unless(expr)
 #endif
 
+#define ASSERT_MSG(expr, msg) \
+{ \
+       boost::wrap_stringstream s; \
+       s.ref() << msg; \
+       ck_assert_msg(expr, s.str().c_str()); \
+}
+
 #define TEST(name, suite) \
        class class_ ## name { \
        public: \
index 74fe8d5..dc4f7fb 100644 (file)
@@ -59,11 +59,15 @@ public:
        void checkResize(int w, int h, unsigned tries)
        {
                if (not resizeDone_) {
-                       ASSERT(tries != 0);
+                       ASSERT_MSG(tries != 0,
+                               "failed to get EVAS_CALLBACK_RESIZE event ("
+                               << w << ","
+                               << h << ")"
+                       );
                        queueStep(boost::bind(&WindowResizeTest::checkResize, boost::ref(*this), w, h, --tries));
                } else {
                        window_.checkSize(std::max(1, w), std::max(1, h));
-                       checkServerSize(Geometry(), 20);
+                       checkServerSize(Geometry(), 100);
                }
        }
 
@@ -73,7 +77,14 @@ public:
                        and window_.getHeight() == geometry.height);
 
                if (not sizeMatch) {
-                       ASSERT(tries != 0);
+                       ASSERT_MSG(tries != 0, ""
+                               << "client size ("
+                               << window_.getWidth() << ","
+                               << window_.getHeight() << ") != "
+                               << "server size ("
+                               << geometry.width << ","
+                               << geometry.height << ")"
+                       );
                        GeometryCallback cb = boost::bind(&WindowResizeTest::checkServerSize, boost::ref(*this), _1, --tries);
                        getSurfaceGeometry(elm_win_wl_window_get(window_)->surface, cb);
                } else {
index d823c29..21e0935 100644 (file)
@@ -75,8 +75,8 @@ query_result_surface_geometry(void *data, wfits_query_result *result,
 
 WaylandFits::QueryRequest* WaylandFits::makeGeometryRequest(wl_surface* surface) const
 {
-       QueryRequest* request(new QueryRequest);
-       request->data = new Geometry;
+       QueryRequest* request(new QueryRequest); // caller responsible for deleting
+       request->data = new Geometry; // caller responsible for deleting
 
        static const wfits_query_result_listener listener = {
                query_result_surface_geometry,