summaryrefslogtreecommitdiff
path: root/drawinglayer/qa/unit/border.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'drawinglayer/qa/unit/border.cxx')
-rw-r--r--drawinglayer/qa/unit/border.cxx63
1 files changed, 34 insertions, 29 deletions
diff --git a/drawinglayer/qa/unit/border.cxx b/drawinglayer/qa/unit/border.cxx
index 8c4e6e08419b..c69e0e94e7ba 100644
--- a/drawinglayer/qa/unit/border.cxx
+++ b/drawinglayer/qa/unit/border.cxx
@@ -13,9 +13,10 @@
#include <drawinglayer/geometry/viewinformation2d.hxx>
#include <drawinglayer/primitive2d/borderlineprimitive2d.hxx>
-#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/PolygonStrokePrimitive2D.hxx>
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
#include <drawinglayer/processor2d/baseprocessor2d.hxx>
-#include <drawinglayer/processor2d/processorfromoutputdevice.hxx>
+#include <drawinglayer/processor2d/processor2dtools.hxx>
#include <rtl/ref.hxx>
#include <test/bootstrapfixture.hxx>
#include <vcl/metaact.hxx>
@@ -47,22 +48,23 @@ CPPUNIT_TEST_FIXTURE(DrawinglayerBorderTest, testDoubleDecompositionSolid)
double const fExtendRightEnd = 0;
basegfx::BColor aColorRight;
basegfx::BColor aColorLeft;
- const std::vector<double> aDashing(svtools::GetLineDashing(SvxBorderLineStyle::DOUBLE, 10.0));
- const drawinglayer::attribute::StrokeAttribute aStrokeAttribute(aDashing);
- std::vector<drawinglayer::primitive2d::BorderLine> aBorderlines;
+ std::vector<double> aDashing(svtools::GetLineDashing(SvxBorderLineStyle::DOUBLE, 10.0));
+ const drawinglayer::attribute::StrokeAttribute aStrokeAttribute(std::move(aDashing));
+ std::vector<drawinglayer::primitive2d::BorderLine> aBorderlines{
- aBorderlines.push_back(drawinglayer::primitive2d::BorderLine(
- drawinglayer::attribute::LineAttribute(aColorLeft, fLeftWidth), fExtendLeftStart,
- fExtendLeftStart, fExtendLeftEnd, fExtendLeftEnd));
+ drawinglayer::primitive2d::BorderLine(
+ drawinglayer::attribute::LineAttribute(aColorLeft, fLeftWidth), fExtendLeftStart,
+ fExtendLeftStart, fExtendLeftEnd, fExtendLeftEnd),
- aBorderlines.push_back(drawinglayer::primitive2d::BorderLine(fDistance));
+ drawinglayer::primitive2d::BorderLine(fDistance),
- aBorderlines.push_back(drawinglayer::primitive2d::BorderLine(
- drawinglayer::attribute::LineAttribute(aColorRight, fRightWidth), fExtendRightStart,
- fExtendRightStart, fExtendRightEnd, fExtendRightEnd));
+ drawinglayer::primitive2d::BorderLine(
+ drawinglayer::attribute::LineAttribute(aColorRight, fRightWidth), fExtendRightStart,
+ fExtendRightStart, fExtendRightEnd, fExtendRightEnd)
+ };
rtl::Reference<drawinglayer::primitive2d::BorderLinePrimitive2D> aBorder(
- new drawinglayer::primitive2d::BorderLinePrimitive2D(aStart, aEnd, aBorderlines,
+ new drawinglayer::primitive2d::BorderLinePrimitive2D(aStart, aEnd, std::move(aBorderlines),
aStrokeAttribute));
// Decompose it into polygons.
@@ -71,11 +73,14 @@ CPPUNIT_TEST_FIXTURE(DrawinglayerBorderTest, testDoubleDecompositionSolid)
aBorder->get2DDecomposition(aContainer, aView);
// Make sure it results in two borders as it's a double one.
- CPPUNIT_ASSERT_EQUAL(static_cast<std::size_t>(2), aContainer.size());
+ CPPUNIT_ASSERT_EQUAL(static_cast<std::size_t>(1), aContainer.size());
+ auto* pGroupPrimitive
+ = dynamic_cast<const drawinglayer::primitive2d::GroupPrimitive2D*>(aContainer[0].get());
+ CPPUNIT_ASSERT_EQUAL(static_cast<std::size_t>(2), pGroupPrimitive->getChildren().size());
// Get the inside line, now a PolygonStrokePrimitive2D
auto pInside = dynamic_cast<const drawinglayer::primitive2d::PolygonStrokePrimitive2D*>(
- aContainer[0].get());
+ pGroupPrimitive->getChildren()[0].get());
CPPUNIT_ASSERT(pInside);
// Make sure the inside line's height is fLeftWidth.
@@ -92,7 +97,7 @@ CPPUNIT_TEST_FIXTURE(DrawinglayerBorderTest, testDoublePixelProcessing)
ScopedVclPtrInstance<VirtualDevice> pDev;
drawinglayer::geometry::ViewInformation2D aView;
std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor(
- drawinglayer::processor2d::createBaseProcessor2DFromOutputDevice(*pDev, aView));
+ drawinglayer::processor2d::createProcessor2DFromOutputDevice(*pDev, aView));
CPPUNIT_ASSERT(pProcessor);
GDIMetaFile aMetaFile;
// Start recording after the processor is created, so we can test the pixel processor.
@@ -111,26 +116,26 @@ CPPUNIT_TEST_FIXTURE(DrawinglayerBorderTest, testDoublePixelProcessing)
double const fExtendRightEnd = 0;
basegfx::BColor aColorRight;
basegfx::BColor aColorLeft;
- const std::vector<double> aDashing(svtools::GetLineDashing(SvxBorderLineStyle::DOUBLE, 10.0));
- const drawinglayer::attribute::StrokeAttribute aStrokeAttribute(aDashing);
- std::vector<drawinglayer::primitive2d::BorderLine> aBorderlines;
+ std::vector<double> aDashing(svtools::GetLineDashing(SvxBorderLineStyle::DOUBLE, 10.0));
+ const drawinglayer::attribute::StrokeAttribute aStrokeAttribute(std::move(aDashing));
+ std::vector<drawinglayer::primitive2d::BorderLine> aBorderlines{
+ drawinglayer::primitive2d::BorderLine(
+ drawinglayer::attribute::LineAttribute(aColorLeft, fLeftWidth), fExtendLeftStart,
+ fExtendLeftStart, fExtendLeftEnd, fExtendLeftEnd),
- aBorderlines.push_back(drawinglayer::primitive2d::BorderLine(
- drawinglayer::attribute::LineAttribute(aColorLeft, fLeftWidth), fExtendLeftStart,
- fExtendLeftStart, fExtendLeftEnd, fExtendLeftEnd));
+ drawinglayer::primitive2d::BorderLine(fDistance),
- aBorderlines.push_back(drawinglayer::primitive2d::BorderLine(fDistance));
-
- aBorderlines.push_back(drawinglayer::primitive2d::BorderLine(
- drawinglayer::attribute::LineAttribute(aColorRight, fRightWidth), fExtendRightStart,
- fExtendRightStart, fExtendRightEnd, fExtendRightEnd));
+ drawinglayer::primitive2d::BorderLine(
+ drawinglayer::attribute::LineAttribute(aColorRight, fRightWidth), fExtendRightStart,
+ fExtendRightStart, fExtendRightEnd, fExtendRightEnd)
+ };
rtl::Reference<drawinglayer::primitive2d::BorderLinePrimitive2D> aBorder(
- new drawinglayer::primitive2d::BorderLinePrimitive2D(aStart, aEnd, aBorderlines,
+ new drawinglayer::primitive2d::BorderLinePrimitive2D(aStart, aEnd, std::move(aBorderlines),
aStrokeAttribute));
drawinglayer::primitive2d::Primitive2DContainer aPrimitives;
- aPrimitives.push_back(drawinglayer::primitive2d::Primitive2DReference(aBorder.get()));
+ aPrimitives.push_back(drawinglayer::primitive2d::Primitive2DReference(aBorder));
// Process the primitives.
pProcessor->process(aPrimitives);