summaryrefslogtreecommitdiff
path: root/basegfx
diff options
context:
space:
mode:
Diffstat (limited to 'basegfx')
-rw-r--r--basegfx/test/B2DPolyPolygonTest.cxx1
-rw-r--r--basegfx/test/boxclipper.cxx9
-rw-r--r--basegfx/test/boxclipper.hxx31
3 files changed, 41 insertions, 0 deletions
diff --git a/basegfx/test/B2DPolyPolygonTest.cxx b/basegfx/test/B2DPolyPolygonTest.cxx
index 5319e6b46967..f51d396b8578 100644
--- a/basegfx/test/B2DPolyPolygonTest.cxx
+++ b/basegfx/test/B2DPolyPolygonTest.cxx
@@ -24,6 +24,7 @@
#include <basegfx/polygon/b2dpolypolygon.hxx>
#include <basegfx/polygon/b2dtrapezoid.hxx>
+#include "boxclipper.hxx"
#include <random>
namespace basegfx
diff --git a/basegfx/test/boxclipper.cxx b/basegfx/test/boxclipper.cxx
index d58806cb739e..b65f25bae425 100644
--- a/basegfx/test/boxclipper.cxx
+++ b/basegfx/test/boxclipper.cxx
@@ -31,10 +31,19 @@
#include <comphelper/random.hxx>
#include <rtl/math.hxx>
+#include "boxclipper.hxx"
+
using namespace ::basegfx;
namespace basegfx2d
{
+/// Gets a random ordinal [0,n)
+double getRandomOrdinal( const std::size_t n )
+{
+ // use this one when displaying polygons in OOo, which still sucks
+ // great rocks when trying to import non-integer svg:d attributes
+ return comphelper::rng::uniform_size_distribution(0, n-1);
+}
static bool compare(const B2DPoint& left, const B2DPoint& right)
{
diff --git a/basegfx/test/boxclipper.hxx b/basegfx/test/boxclipper.hxx
new file mode 100644
index 000000000000..03aad0d2ba74
--- /dev/null
+++ b/basegfx/test/boxclipper.hxx
@@ -0,0 +1,31 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <cstddef>
+
+namespace basegfx2d
+{
+double getRandomOrdinal(const std::size_t n);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */