Define operator<< for cv::gapi::wip::draw::Prim
authorTalamanov, Anatoliy <anatoliy.talamanov@intel.com>
Wed, 9 Oct 2019 10:41:36 +0000 (13:41 +0300)
committerTalamanov, Anatoliy <anatoliy.talamanov@intel.com>
Wed, 9 Oct 2019 10:41:36 +0000 (13:41 +0300)
modules/gapi/test/common/gapi_tests_common.hpp

index 3d3141f..7dc61ef 100644 (file)
@@ -16,6 +16,7 @@
 #include <opencv2/gapi/util/util.hpp>
 
 #include "gapi_tests_helpers.hpp"
+#include <opencv2/gapi/render.hpp>
 
 namespace
 {
@@ -23,6 +24,38 @@ namespace
     {
         return o << (arg.tag.empty() ? "empty" : arg.tag);
     }
+
+    inline std::ostream& operator<<(std::ostream& o, const cv::gapi::wip::draw::Prim& p)
+    {
+        using namespace cv::gapi::wip::draw;
+        switch (p.index())
+        {
+            case Prim::index_of<Rect>():
+                o << "cv::gapi::draw::Rect";
+                break;
+            case Prim::index_of<Text>():
+                o << "cv::gapi::draw::Text";
+                break;
+            case Prim::index_of<Circle>():
+                o << "cv::gapi::draw::Circle";
+                break;
+            case Prim::index_of<Line>():
+                o << "cv::gapi::draw::Line";
+                break;
+            case Prim::index_of<Mosaic>():
+                o << "cv::gapi::draw::Mosaic";
+                break;
+            case Prim::index_of<Image>():
+                o << "cv::gapi::draw::Image";
+                break;
+            case Prim::index_of<Poly>():
+                o << "cv::gapi::draw::Poly";
+                break;
+            default: o << "Unrecognized primitive";
+        }
+
+        return o;
+    }
 }
 
 namespace opencv_test