Publishing 2019 R3 content
[platform/upstream/dldt.git] / inference-engine / thirdparty / fluid / modules / gapi / test / common / gapi_render_tests_inl.hpp
1 // This file is part of OpenCV project.
2 // It is subject to the license terms in the LICENSE file found in the top-level directory
3 // of this distribution and at http://opencv.org/license.html.
4 //
5 // Copyright (C) 2018 Intel Corporation
6
7
8 #ifndef OPENCV_GAPI_RENDER_TESTS_INL_HPP
9 #define OPENCV_GAPI_RENDER_TESTS_INL_HPP
10
11 #include "gapi_render_tests.hpp"
12
13 #include <opencv2/gapi/render.hpp>
14
15 namespace opencv_test
16 {
17
18 TEST_P(RenderTextTest, AccuracyTest)
19 {
20     std::vector<cv::Point> points;
21     std::string text;
22     int         ff;
23     double      fs;
24     bool        blo;
25
26     std::tie(sz, text, points, ff, fs, color, thick, lt, blo, isNV12Format) = GetParam();
27     Init();
28
29     for (const auto& p : points) {
30         cv::putText(out_mat_ocv, text, p, ff, fs, color, thick, lt, blo);
31         prims.emplace_back(cv::gapi::wip::draw::Text{text, p, ff, fs, color, thick, lt, blo});
32     }
33
34     Run();
35
36     EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
37 }
38
39 TEST_P(RenderRectTest, AccuracyTest)
40 {
41     std::vector<cv::Rect> rects;
42     int shift;
43
44     std::tie(sz, rects, color, thick, lt, shift, isNV12Format) = GetParam();
45     Init();
46
47     for (const auto& r : rects) {
48         cv::rectangle(out_mat_ocv, r, color, thick, lt, shift);
49         prims.emplace_back(cv::gapi::wip::draw::Rect{r, color, thick, lt, shift});
50     }
51
52     Run();
53
54     EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
55 }
56
57 TEST_P(RenderCircleTest, AccuracyTest)
58 {
59     std::vector<cv::Point> points;
60     int radius;
61     int shift;
62
63     std::tie(sz, points, radius, color, thick, lt, shift, isNV12Format) = GetParam();
64     Init();
65
66     for (const auto& p : points) {
67         cv::circle(out_mat_ocv, p, radius, color, thick, lt, shift);
68         prims.emplace_back(cv::gapi::wip::draw::Circle{p, radius, color, thick, lt, shift});
69     }
70
71     Run();
72
73     EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
74 }
75
76 TEST_P(RenderLineTest, AccuracyTest)
77 {
78     std::vector<std::pair<cv::Point, cv::Point>> points;
79     int shift;
80
81     std::tie(sz, points, color, thick, lt, shift, isNV12Format) = GetParam();
82     Init();
83
84     for (const auto& p : points) {
85         cv::line(out_mat_ocv, p.first, p.second, color, thick, lt, shift);
86         prims.emplace_back(cv::gapi::wip::draw::Line{p.first, p.second, color, thick, lt, shift});
87     }
88
89     Run();
90
91     EXPECT_EQ(0, cv::countNonZero(out_mat_gapi != out_mat_ocv));
92 }
93
94 } // opencv_test
95
96 #endif //OPENCV_GAPI_RENDER_TESTS_INL_HPP