aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/tests/libsample/polygon.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sources/shiboken6/tests/libsample/polygon.cpp')
-rw-r--r--sources/shiboken6/tests/libsample/polygon.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/sources/shiboken6/tests/libsample/polygon.cpp b/sources/shiboken6/tests/libsample/polygon.cpp
new file mode 100644
index 000000000..6af597192
--- /dev/null
+++ b/sources/shiboken6/tests/libsample/polygon.cpp
@@ -0,0 +1,39 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+#include "polygon.h"
+
+Polygon::Polygon(double x, double y) : m_points({Point(x, y)})
+{
+}
+
+Polygon::Polygon(Point point) : m_points({point})
+{
+}
+
+Polygon::Polygon(PointList points) : m_points(points)
+{
+}
+
+void Polygon::addPoint(Point point)
+{
+ m_points.push_back(point);
+}
+
+Polygon Polygon::doublePolygonScale(Polygon polygon)
+{
+ Polygon result;
+ for (const auto &point : polygon.points())
+ result.addPoint(point * 2.0);
+ return result;
+}
+
+void Polygon::stealOwnershipFromPython(Point *point)
+{
+ delete point;
+}
+
+void Polygon::stealOwnershipFromPython(Polygon *polygon)
+{
+ delete polygon;
+}