summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/source/mtfxmldump.cxx463
-rw-r--r--vcl/qa/cppunit/svm/svmtest.cxx294
2 files changed, 502 insertions, 255 deletions
diff --git a/test/source/mtfxmldump.cxx b/test/source/mtfxmldump.cxx
index ee2bd7a9d3ba..a59375a8c079 100644
--- a/test/source/mtfxmldump.cxx
+++ b/test/source/mtfxmldump.cxx
@@ -16,44 +16,11 @@
#include <rtl/strbuf.hxx>
#include <memory>
+#include <numeric>
namespace
{
-OUString flagToString(PushFlags nFlag)
-{
- if (nFlag & PushFlags::LINECOLOR)
- return OUString("PushLineColor");
- else if (nFlag & PushFlags::FILLCOLOR)
- return OUString("PushFillColor");
- else if (nFlag & PushFlags::FONT)
- return OUString("PushFont");
- else if (nFlag & PushFlags::TEXTCOLOR)
- return OUString("PushTextColor");
- else if (nFlag & PushFlags::MAPMODE)
- return OUString("PushMapMode");
- else if (nFlag & PushFlags::CLIPREGION)
- return OUString("PushClipRegion");
- else if (nFlag & PushFlags::RASTEROP)
- return OUString("PushRasterOp");
- else if (nFlag & PushFlags::TEXTFILLCOLOR)
- return OUString("PushTextFillColor");
- else if (nFlag & PushFlags::TEXTALIGN)
- return OUString("PushTextAlign");
- else if (nFlag & PushFlags::REFPOINT)
- return OUString("PushRefPoint");
- else if (nFlag & PushFlags::TEXTLINECOLOR)
- return OUString("PushTextLineColor");
- else if (nFlag & PushFlags::TEXTLAYOUTMODE)
- return OUString("PushTextLayoutMode");
- else if (nFlag & PushFlags::TEXTLANGUAGE)
- return OUString("PushTextLanguage");
- else if (nFlag & PushFlags::OVERLINECOLOR)
- return OUString("PushOverlineColor");
-
- return OUString();
-}
-
OUString collectPushFlags(PushFlags nFlags)
{
if ((nFlags & PushFlags::ALL) == PushFlags::ALL)
@@ -63,27 +30,103 @@ OUString collectPushFlags(PushFlags nFlags)
else if ((nFlags & PUSH_ALLTEXT) == PUSH_ALLTEXT)
return OUString("PushAllText");
- OUString sFlags;
-
- for (sal_uInt16 nFlag = 1; nFlag > 0; nFlag <<= 1)
+ std::vector<OUString> aStrings;
+
+ if (nFlags & PushFlags::LINECOLOR)
+ aStrings.push_back("PushLineColor");
+ if (nFlags & PushFlags::FILLCOLOR)
+ aStrings.push_back("PushFillColor");
+ if (nFlags & PushFlags::FONT)
+ aStrings.push_back("PushFont");
+ if (nFlags & PushFlags::TEXTCOLOR)
+ aStrings.push_back("PushTextColor");
+ if (nFlags & PushFlags::MAPMODE)
+ aStrings.push_back("PushMapMode");
+ if (nFlags & PushFlags::CLIPREGION)
+ aStrings.push_back("PushClipRegion");
+ if (nFlags & PushFlags::RASTEROP)
+ aStrings.push_back("PushRasterOp");
+ if (nFlags & PushFlags::TEXTFILLCOLOR)
+ aStrings.push_back("PushTextFillColor");
+ if (nFlags & PushFlags::TEXTALIGN)
+ aStrings.push_back("PushTextAlign");
+ if (nFlags & PushFlags::REFPOINT)
+ aStrings.push_back("PushRefPoint");
+ if (nFlags & PushFlags::TEXTLINECOLOR)
+ aStrings.push_back("PushTextLineColor");
+ if (nFlags & PushFlags::TEXTLAYOUTMODE)
+ aStrings.push_back("PushTextLayoutMode");
+ if (nFlags & PushFlags::TEXTLANGUAGE)
+ aStrings.push_back("PushTextLanguage");
+ if (nFlags & PushFlags::OVERLINECOLOR)
+ aStrings.push_back("PushOverlineColor");
+
+ OUString aString;
+
+ if (aStrings.empty())
+ return aString;
+
+ aString = aStrings[0];
+ for (size_t i = 1; i < aStrings.size(); ++i)
{
- if ((nFlag & sal_uInt16(nFlags)) == nFlag)
- {
- OUString sFlag = flagToString(static_cast<PushFlags>(nFlag));
- if (!sFlag.isEmpty())
- {
- if (!sFlags.isEmpty())
- {
- sFlags += ", ";
- }
- sFlags += flagToString(static_cast<PushFlags>(nFlag));
- }
- }
+ aString = aString + ", " + aStrings[i];
}
-
- return sFlags;
+ return aString;
}
+OUString convertDrawTextFlagsToString(DrawTextFlags eDrawTextFlags)
+{
+ std::vector<OUString> aStrings;
+ if (eDrawTextFlags & DrawTextFlags::Disable)
+ aStrings.push_back("Disable");
+ if (eDrawTextFlags & DrawTextFlags::Mnemonic)
+ aStrings.push_back("Mnemonic");
+ if (eDrawTextFlags & DrawTextFlags::Mono)
+ aStrings.push_back("Mono");
+ if (eDrawTextFlags & DrawTextFlags::Clip)
+ aStrings.push_back("Clip");
+ if (eDrawTextFlags & DrawTextFlags::Left)
+ aStrings.push_back("Left");
+ if (eDrawTextFlags & DrawTextFlags::Center)
+ aStrings.push_back("Center");
+ if (eDrawTextFlags & DrawTextFlags::Right)
+ aStrings.push_back("Right");
+ if (eDrawTextFlags & DrawTextFlags::Top)
+ aStrings.push_back("Top");
+ if (eDrawTextFlags & DrawTextFlags::VCenter)
+ aStrings.push_back("VCenter");
+ if (eDrawTextFlags & DrawTextFlags::Bottom)
+ aStrings.push_back("Bottom");
+ if (eDrawTextFlags & DrawTextFlags::EndEllipsis)
+ aStrings.push_back("EndEllipsis");
+ if (eDrawTextFlags & DrawTextFlags::PathEllipsis)
+ aStrings.push_back("PathEllipsis");
+ if (eDrawTextFlags & DrawTextFlags::MultiLine)
+ aStrings.push_back("MultiLine");
+ if (eDrawTextFlags & DrawTextFlags::WordBreak)
+ aStrings.push_back("WordBreak");
+ if (eDrawTextFlags & DrawTextFlags::NewsEllipsis)
+ aStrings.push_back("NewsEllipsis");
+ if (eDrawTextFlags & DrawTextFlags::WordBreakHyphenation)
+ aStrings.push_back("WordBreakHyphenation");
+ if (eDrawTextFlags & DrawTextFlags::CenterEllipsis)
+ aStrings.push_back("CenterEllipsis");
+ if (eDrawTextFlags & DrawTextFlags::HideMnemonic)
+ aStrings.push_back("HideMnemonic");
+
+ OUString aString;
+
+ if (aStrings.empty())
+ return OUString("None");
+
+ aString = aStrings[0];
+ for (size_t i = 1; i < aStrings.size(); ++i)
+ {
+ aString = aString + " " + aStrings[i];
+ }
+ return aString;
+};
+
OUString convertRopToString(RasterOp eRop)
{
switch (eRop)
@@ -155,19 +198,15 @@ OUString convertPolygonFlags(PolyFlags eFlags)
switch (eFlags)
{
default:
- case PolyFlags::Normal: return OUString("normal");
- case PolyFlags::Control: return OUString("control");
- case PolyFlags::Smooth: return OUString("smooth");
- case PolyFlags::Symmetric: return OUString("symmetric");
+ case PolyFlags::Normal: return OUString("normal");
+ case PolyFlags::Control: return OUString("control");
+ case PolyFlags::Smooth: return OUString("smooth");
+ case PolyFlags::Symmetric: return OUString("symmetric");
}
}
OUString convertFontWeigthToString(FontWeight eFontWeight)
{
- enum FontWeight { WEIGHT_DONTKNOW, WEIGHT_THIN, WEIGHT_ULTRALIGHT,
- WEIGHT_LIGHT, WEIGHT_SEMILIGHT, WEIGHT_NORMAL,
- WEIGHT_MEDIUM, WEIGHT_SEMIBOLD, WEIGHT_BOLD,
- WEIGHT_ULTRABOLD, WEIGHT_BLACK, FontWeight_FORCE_EQUAL_SIZE=SAL_MAX_ENUM };
switch (eFontWeight)
{
case WEIGHT_DONTKNOW: return OUString("unknown");
@@ -181,7 +220,51 @@ OUString convertFontWeigthToString(FontWeight eFontWeight)
case WEIGHT_BOLD: return OUString("bold");
case WEIGHT_ULTRABOLD: return OUString("ultrabold");
case WEIGHT_BLACK: return OUString("black");
- case FontWeight_FORCE_EQUAL_SIZE: return OUString("equalsize");
+ case FontWeight_FORCE_EQUAL_SIZE: return OUString("equalsize");
+ }
+ return OUString();
+}
+
+OUString convertFontStrikeoutToString(FontStrikeout eFontStrikeout)
+{
+ switch (eFontStrikeout)
+ {
+ case STRIKEOUT_NONE: return OUString("none");
+ case STRIKEOUT_SINGLE: return OUString("single");
+ case STRIKEOUT_DOUBLE: return OUString("double");
+ case STRIKEOUT_DONTKNOW: return OUString("dontknow");
+ case STRIKEOUT_BOLD: return OUString("bold");
+ case STRIKEOUT_SLASH: return OUString("slash");
+ case STRIKEOUT_X: return OUString("x");
+ case FontStrikeout_FORCE_EQUAL_SIZE: return OUString("equalsize");
+ }
+ return OUString();
+}
+
+OUString convertFontLineStyleToString(FontLineStyle eFontLineStyle)
+{
+ switch (eFontLineStyle)
+ {
+ case LINESTYLE_NONE: return OUString("none");
+ case LINESTYLE_SINGLE: return OUString("single");
+ case LINESTYLE_DOUBLE: return OUString("double");
+ case LINESTYLE_DOTTED: return OUString("dotted");
+ case LINESTYLE_DONTKNOW: return OUString("dontknow");
+ case LINESTYLE_DASH: return OUString("dash");
+ case LINESTYLE_LONGDASH: return OUString("longdash");
+ case LINESTYLE_DASHDOT: return OUString("dashdot");
+ case LINESTYLE_DASHDOTDOT: return OUString("dashdotdot");
+ case LINESTYLE_SMALLWAVE: return OUString("smallwave");
+ case LINESTYLE_WAVE: return OUString("wave");
+ case LINESTYLE_DOUBLEWAVE: return OUString("doublewave");
+ case LINESTYLE_BOLD: return OUString("bold");
+ case LINESTYLE_BOLDDOTTED: return OUString("bolddotted");
+ case LINESTYLE_BOLDDASH: return OUString("bolddash");
+ case LINESTYLE_BOLDLONGDASH: return OUString("boldlongdash");
+ case LINESTYLE_BOLDDASHDOT: return OUString("bolddashdot");
+ case LINESTYLE_BOLDDASHDOTDOT: return OUString("bolddashdotdot");
+ case LINESTYLE_BOLDWAVE: return OUString("boldwave");
+ case FontLineStyle_FORCE_EQUAL_SIZE: return OUString("equalsize");
}
return OUString();
}
@@ -267,6 +350,51 @@ OUString hex32(sal_uInt32 nNumber)
return OUString::createFromAscii(ss.str().c_str());
}
+void writePoint(XmlWriter& rWriter, Point const& rPoint)
+{
+ rWriter.attribute("x", rPoint.X());
+ rWriter.attribute("y", rPoint.Y());
+}
+
+void writeStartPoint(XmlWriter& rWriter, Point const& rPoint)
+{
+ rWriter.attribute("startx", rPoint.X());
+ rWriter.attribute("starty", rPoint.Y());
+}
+
+void writeEndPoint(XmlWriter& rWriter, Point const& rPoint)
+{
+ rWriter.attribute("endx", rPoint.X());
+ rWriter.attribute("endy", rPoint.Y());
+}
+
+void writeSize(XmlWriter& rWriter, Size const& rSize)
+{
+ rWriter.attribute("width", rSize.Width());
+ rWriter.attribute("height", rSize.Height());
+}
+
+void writeRectangle(XmlWriter& rWriter, Rectangle const& rRectangle)
+{
+ rWriter.attribute("left", rRectangle.Left());
+ rWriter.attribute("top", rRectangle.Top());
+ rWriter.attribute("right", rRectangle.Right());
+ rWriter.attribute("bottom", rRectangle.Bottom());
+}
+
+void writeLineInfo(XmlWriter& rWriter, LineInfo const& rLineInfo)
+{
+ rWriter.attribute("style", convertLineStyleToString(rLineInfo.GetStyle()));
+ rWriter.attribute("width", rLineInfo.GetWidth());
+ rWriter.attribute("dashlen", rLineInfo.GetDashLen());
+ rWriter.attribute("dashcount", rLineInfo.GetDashCount());
+ rWriter.attribute("dotlen", rLineInfo.GetDotLen());
+ rWriter.attribute("dotcount", rLineInfo.GetDotCount());
+ rWriter.attribute("distance", rLineInfo.GetDistance());
+ rWriter.attribute("join", convertLineJoinToString(rLineInfo.GetLineJoin()));
+ rWriter.attribute("cap", convertLineCapToString(rLineInfo.GetLineCap()));
+}
+
} // anonymous namespace
MetafileXmlDump::MetafileXmlDump()
@@ -329,8 +457,7 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, XmlWriter& rWriter)
{
auto* pMetaAction = static_cast<MetaPixelAction*>(pAction);
rWriter.startElement(sCurrentElementTag);
- rWriter.attribute("x", pMetaAction->GetPoint().X());
- rWriter.attribute("y", pMetaAction->GetPoint().Y());
+ writePoint(rWriter, pMetaAction->GetPoint());
rWriter.attribute("color", convertColorToString(pMetaAction->GetColor()));
rWriter.endElement();
}
@@ -340,8 +467,7 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, XmlWriter& rWriter)
{
auto* pMetaAction = static_cast<MetaPointAction*>(pAction);
rWriter.startElement(sCurrentElementTag);
- rWriter.attribute("x", pMetaAction->GetPoint().X());
- rWriter.attribute("y", pMetaAction->GetPoint().Y());
+ writePoint(rWriter, pMetaAction->GetPoint());
rWriter.endElement();
}
break;
@@ -350,10 +476,7 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, XmlWriter& rWriter)
{
MetaRectAction* pMetaAction = static_cast<MetaRectAction*>(pAction);
rWriter.startElement(sCurrentElementTag);
- rWriter.attribute("left", pMetaAction->GetRect().Left());
- rWriter.attribute("top", pMetaAction->GetRect().Top());
- rWriter.attribute("right", pMetaAction->GetRect().Right());
- rWriter.attribute("bottom", pMetaAction->GetRect().Bottom());
+ writeRectangle(rWriter, pMetaAction->GetRect());
rWriter.endElement();
}
break;
@@ -362,10 +485,7 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, XmlWriter& rWriter)
{
auto pMetaAction = static_cast<MetaRoundRectAction*>(pAction);
rWriter.startElement(sCurrentElementTag);
- rWriter.attribute("left", pMetaAction->GetRect().Left());
- rWriter.attribute("top", pMetaAction->GetRect().Top());
- rWriter.attribute("right", pMetaAction->GetRect().Right());
- rWriter.attribute("bottom", pMetaAction->GetRect().Bottom());
+ writeRectangle(rWriter, pMetaAction->GetRect());
rWriter.attribute("horizontalround", pMetaAction->GetHorzRound());
rWriter.attribute("verticalround", pMetaAction->GetVertRound());
rWriter.endElement();
@@ -376,10 +496,7 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, XmlWriter& rWriter)
{
auto pMetaAction = static_cast<MetaEllipseAction*>(pAction);
rWriter.startElement(sCurrentElementTag);
- rWriter.attribute("left", pMetaAction->GetRect().Left());
- rWriter.attribute("top", pMetaAction->GetRect().Top());
- rWriter.attribute("right", pMetaAction->GetRect().Right());
- rWriter.attribute("bottom", pMetaAction->GetRect().Bottom());
+ writeRectangle(rWriter, pMetaAction->GetRect());
rWriter.endElement();
}
break;
@@ -388,16 +505,9 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, XmlWriter& rWriter)
{
auto pMetaAction = static_cast<MetaArcAction*>(pAction);
rWriter.startElement(sCurrentElementTag);
- rWriter.attribute("left", pMetaAction->GetRect().Left());
- rWriter.attribute("top", pMetaAction->GetRect().Top());
- rWriter.attribute("right", pMetaAction->GetRect().Right());
- rWriter.attribute("bottom", pMetaAction->GetRect().Bottom());
-
- rWriter.attribute("startx", pMetaAction->GetStartPoint().X());
- rWriter.attribute("starty", pMetaAction->GetStartPoint().Y());
- rWriter.attribute("endx", pMetaAction->GetEndPoint().X());
- rWriter.attribute("endy", pMetaAction->GetEndPoint().Y());
-
+ writeRectangle(rWriter, pMetaAction->GetRect());
+ writeStartPoint(rWriter, pMetaAction->GetStartPoint());
+ writeEndPoint(rWriter, pMetaAction->GetEndPoint());
rWriter.endElement();
}
break;
@@ -406,16 +516,9 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, XmlWriter& rWriter)
{
auto pMetaAction = static_cast<MetaPieAction*>(pAction);
rWriter.startElement(sCurrentElementTag);
- rWriter.attribute("left", pMetaAction->GetRect().Left());
- rWriter.attribute("top", pMetaAction->GetRect().Top());
- rWriter.attribute("right", pMetaAction->GetRect().Right());
- rWriter.attribute("bottom", pMetaAction->GetRect().Bottom());
-
- rWriter.attribute("startx", pMetaAction->GetStartPoint().X());
- rWriter.attribute("starty", pMetaAction->GetStartPoint().Y());
- rWriter.attribute("endx", pMetaAction->GetEndPoint().X());
- rWriter.attribute("endy", pMetaAction->GetEndPoint().Y());
-
+ writeRectangle(rWriter, pMetaAction->GetRect());
+ writeStartPoint(rWriter, pMetaAction->GetStartPoint());
+ writeEndPoint(rWriter, pMetaAction->GetEndPoint());
rWriter.endElement();
}
break;
@@ -424,16 +527,9 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, XmlWriter& rWriter)
{
auto pMetaAction = static_cast<MetaChordAction*>(pAction);
rWriter.startElement(sCurrentElementTag);
- rWriter.attribute("left", pMetaAction->GetRect().Left());
- rWriter.attribute("top", pMetaAction->GetRect().Top());
- rWriter.attribute("right", pMetaAction->GetRect().Right());
- rWriter.attribute("bottom", pMetaAction->GetRect().Bottom());
-
- rWriter.attribute("startx", pMetaAction->GetStartPoint().X());
- rWriter.attribute("starty", pMetaAction->GetStartPoint().Y());
- rWriter.attribute("endx", pMetaAction->GetEndPoint().X());
- rWriter.attribute("endy", pMetaAction->GetEndPoint().Y());
-
+ writeRectangle(rWriter, pMetaAction->GetRect());
+ writeStartPoint(rWriter, pMetaAction->GetStartPoint());
+ writeEndPoint(rWriter, pMetaAction->GetEndPoint());
rWriter.endElement();
}
break;
@@ -442,22 +538,11 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, XmlWriter& rWriter)
{
MetaLineAction* pMetaLineAction = static_cast<MetaLineAction*>(pAction);
rWriter.startElement(sCurrentElementTag);
-
- rWriter.attribute("startx", pMetaLineAction->GetStartPoint().X());
- rWriter.attribute("starty", pMetaLineAction->GetStartPoint().Y());
- rWriter.attribute("endx", pMetaLineAction->GetEndPoint().X());
- rWriter.attribute("endy", pMetaLineAction->GetEndPoint().Y());
+ writeStartPoint(rWriter, pMetaLineAction->GetStartPoint());
+ writeEndPoint(rWriter, pMetaLineAction->GetEndPoint());
LineInfo aLineInfo = pMetaLineAction->GetLineInfo();
- rWriter.attribute("style", convertLineStyleToString(aLineInfo.GetStyle()));
- rWriter.attribute("width", aLineInfo.GetWidth());
- rWriter.attribute("dashlen", aLineInfo.GetDashLen());
- rWriter.attribute("dashcount", aLineInfo.GetDashCount());
- rWriter.attribute("dotlen", aLineInfo.GetDotLen());
- rWriter.attribute("dotcount", aLineInfo.GetDotCount());
- rWriter.attribute("distance", aLineInfo.GetDistance());
- rWriter.attribute("join", convertLineJoinToString(aLineInfo.GetLineJoin()));
- rWriter.attribute("cap", convertLineCapToString(aLineInfo.GetLineCap()));
+ writeLineInfo(rWriter, pMetaLineAction->GetLineInfo());
rWriter.endElement();
}
break;
@@ -559,12 +644,9 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, XmlWriter& rWriter)
{
auto* pMeta = static_cast<MetaTextAction*>(pAction);
rWriter.startElement(sCurrentElementTag);
-
- rWriter.attribute("x", pMeta->GetPoint().X());
- rWriter.attribute("y", pMeta->GetPoint().Y());
+ writePoint(rWriter, pMeta->GetPoint());
rWriter.attribute("index", pMeta->GetIndex());
rWriter.attribute("length", pMeta->GetLen());
-
rWriter.startElement("textcontent");
rWriter.content(pMeta->GetText());
rWriter.endElement();
@@ -581,8 +663,7 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, XmlWriter& rWriter)
sal_Int32 aIndex = pMetaTextArrayAction->GetIndex();
sal_Int32 aLength = pMetaTextArrayAction->GetLen();
- rWriter.attribute("x", pMetaTextArrayAction->GetPoint().X());
- rWriter.attribute("y", pMetaTextArrayAction->GetPoint().Y());
+ writePoint(rWriter, pMetaTextArrayAction->GetPoint());
rWriter.attribute("index", aIndex);
rWriter.attribute("length", aLength);
@@ -612,8 +693,7 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, XmlWriter& rWriter)
auto* pMeta = static_cast<MetaStretchTextAction*>(pAction);
rWriter.startElement(sCurrentElementTag);
- rWriter.attribute("x", pMeta->GetPoint().X());
- rWriter.attribute("y", pMeta->GetPoint().Y());
+ writePoint(rWriter, pMeta->GetPoint());
rWriter.attribute("index", pMeta->GetIndex());
rWriter.attribute("length", pMeta->GetLen());
rWriter.attribute("width", pMeta->GetWidth());
@@ -626,6 +706,36 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, XmlWriter& rWriter)
}
break;
+ case MetaActionType::TEXTRECT:
+ {
+ auto* pMeta = static_cast<MetaTextRectAction*>(pAction);
+ rWriter.startElement(sCurrentElementTag);
+ writeRectangle(rWriter, pMeta->GetRect());
+ rWriter.startElement("textcontent");
+ rWriter.content(pMeta->GetText());
+ rWriter.endElement();
+
+ rWriter.startElement("style");
+ rWriter.content(convertDrawTextFlagsToString(pMeta->GetStyle()));
+ rWriter.endElement();
+
+ rWriter.endElement();
+ }
+ break;
+
+ case MetaActionType::TEXTLINE:
+ {
+ auto* pMeta = static_cast<MetaTextLineAction*>(pAction);
+ rWriter.startElement(sCurrentElementTag);
+ writePoint(rWriter, pMeta->GetStartPoint());
+ rWriter.attribute("width", pMeta->GetWidth());
+ rWriter.attribute("strikeout", convertFontStrikeoutToString(pMeta->GetStrikeout()));
+ rWriter.attribute("underline", convertFontLineStyleToString(pMeta->GetUnderline()));
+ rWriter.attribute("overline", convertFontLineStyleToString(pMeta->GetOverline()));
+ rWriter.endElement();
+ }
+ break;
+
case MetaActionType::LINECOLOR:
{
MetaLineColorAction* pMetaLineColorAction = static_cast<MetaLineColorAction*>(pAction);
@@ -655,11 +765,7 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, XmlWriter& rWriter)
// enough for the tests we have, but may need extending to
// dumping the real polypolygon in the future
Rectangle aRectangle = pA->GetRegion().GetBoundRect();
- rWriter.attribute("top", aRectangle.Top());
- rWriter.attribute("left", aRectangle.Left());
- rWriter.attribute("bottom", aRectangle.Bottom());
- rWriter.attribute("right", aRectangle.Right());
-
+ writeRectangle(rWriter, aRectangle);
rWriter.endElement();
}
break;
@@ -670,11 +776,7 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, XmlWriter& rWriter)
rWriter.startElement(sCurrentElementTag);
Rectangle aRectangle = pMetaISectRectClipRegionAction->GetRect();
- rWriter.attribute("top", aRectangle.Top());
- rWriter.attribute("left", aRectangle.Left());
- rWriter.attribute("bottom", aRectangle.Bottom());
- rWriter.attribute("right", aRectangle.Right());
-
+ writeRectangle(rWriter, aRectangle);
rWriter.endElement();
}
break;
@@ -688,11 +790,7 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, XmlWriter& rWriter)
// enough for the tests we have, but may need extending to
// dumping the real polypolygon in the future
Rectangle aRectangle = pMetaISectRegionClipRegionAction->GetRegion().GetBoundRect();
- rWriter.attribute("top", aRectangle.Top());
- rWriter.attribute("left", aRectangle.Left());
- rWriter.attribute("bottom", aRectangle.Bottom());
- rWriter.attribute("right", aRectangle.Right());
-
+ writeRectangle(rWriter, aRectangle);
rWriter.endElement();
}
break;
@@ -702,24 +800,14 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, XmlWriter& rWriter)
MetaPolyLineAction* pMetaPolyLineAction = static_cast<MetaPolyLineAction*>(pAction);
rWriter.startElement(sCurrentElementTag);
- LineInfo aLineInfo = pMetaPolyLineAction->GetLineInfo();
- rWriter.attribute("style", convertLineStyleToString(aLineInfo.GetStyle()));
- rWriter.attribute("width", aLineInfo.GetWidth());
- rWriter.attribute("dashlen", aLineInfo.GetDashLen());
- rWriter.attribute("dashcount", aLineInfo.GetDashCount());
- rWriter.attribute("dotlen", aLineInfo.GetDotLen());
- rWriter.attribute("dotcount", aLineInfo.GetDotCount());
- rWriter.attribute("distance", aLineInfo.GetDistance());
- rWriter.attribute("join", convertLineJoinToString(aLineInfo.GetLineJoin()));
- rWriter.attribute("cap", convertLineCapToString(aLineInfo.GetLineCap()));
+ writeLineInfo(rWriter, pMetaPolyLineAction->GetLineInfo());
tools::Polygon aPolygon = pMetaPolyLineAction->GetPolygon();
bool bFlags = aPolygon.HasFlags();
for (sal_uInt16 i = 0; i < aPolygon.GetSize(); i++)
{
rWriter.startElement("point");
- rWriter.attribute("x", aPolygon[i].X());
- rWriter.attribute("y", aPolygon[i].Y());
+ writePoint(rWriter, aPolygon[i]);
if (bFlags)
rWriter.attribute("flags", convertPolygonFlags(aPolygon.GetFlags(i)));
rWriter.endElement();
@@ -739,8 +827,7 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, XmlWriter& rWriter)
for (sal_uInt16 i = 0; i < aPolygon.GetSize(); i++)
{
rWriter.startElement("point");
- rWriter.attribute("x", aPolygon[i].X());
- rWriter.attribute("y", aPolygon[i].Y());
+ writePoint(rWriter, aPolygon[i]);
if (bFlags)
rWriter.attribute("flags", convertPolygonFlags(aPolygon.GetFlags(i)));
rWriter.endElement();
@@ -765,8 +852,7 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, XmlWriter& rWriter)
for (sal_uInt16 i = 0; i < rPolygon.GetSize(); ++i)
{
rWriter.startElement("point");
- rWriter.attribute("x", rPolygon[i].X());
- rWriter.attribute("y", rPolygon[i].Y());
+ writePoint(rWriter, rPolygon[i]);
if (bFlags)
rWriter.attribute("flags", convertPolygonFlags(rPolygon.GetFlags(i)));
rWriter.endElement();
@@ -802,8 +888,7 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, XmlWriter& rWriter)
{
auto pMeta = static_cast<MetaBmpAction*>(pAction);
rWriter.startElement(sCurrentElementTag);
- rWriter.attribute("x", pMeta->GetPoint().X());
- rWriter.attribute("y", pMeta->GetPoint().Y());
+ writePoint(rWriter, pMeta->GetPoint());
rWriter.attribute("crc", hex32(pMeta->GetBitmap().GetChecksum()));
rWriter.endElement();
}
@@ -813,10 +898,8 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, XmlWriter& rWriter)
{
auto pMeta = static_cast<MetaBmpScaleAction*>(pAction);
rWriter.startElement(sCurrentElementTag);
- rWriter.attribute("x", pMeta->GetPoint().X());
- rWriter.attribute("y", pMeta->GetPoint().Y());
- rWriter.attribute("width", pMeta->GetSize().Width());
- rWriter.attribute("height", pMeta->GetSize().Height());
+ writePoint(rWriter, pMeta->GetPoint());
+ writeSize(rWriter, pMeta->GetSize());
rWriter.attribute("crc", hex32(pMeta->GetBitmap().GetChecksum()));
rWriter.endElement();
}
@@ -843,8 +926,7 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, XmlWriter& rWriter)
{
auto pMeta = static_cast<MetaBmpExAction*>(pAction);
rWriter.startElement(sCurrentElementTag);
- rWriter.attribute("x", pMeta->GetPoint().X());
- rWriter.attribute("y", pMeta->GetPoint().Y());
+ writePoint(rWriter, pMeta->GetPoint());
rWriter.attribute("crc", hex32(pMeta->GetBitmapEx().GetBitmap().GetChecksum()));
rWriter.attribute("transparenttype", convertBitmapExTransparentType(pMeta->GetBitmapEx().GetTransparentType()));
rWriter.endElement();
@@ -855,10 +937,8 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, XmlWriter& rWriter)
{
auto pMeta = static_cast<MetaBmpExScaleAction*>(pAction);
rWriter.startElement(sCurrentElementTag);
- rWriter.attribute("x", pMeta->GetPoint().X());
- rWriter.attribute("y", pMeta->GetPoint().Y());
- rWriter.attribute("width", pMeta->GetSize().Width());
- rWriter.attribute("height", pMeta->GetSize().Height());
+ writePoint(rWriter, pMeta->GetPoint());
+ writeSize(rWriter, pMeta->GetSize());
rWriter.attribute("crc", hex32(pMeta->GetBitmapEx().GetBitmap().GetChecksum()));
rWriter.attribute("transparenttype", convertBitmapExTransparentType(pMeta->GetBitmapEx().GetTransparentType()));
rWriter.endElement();
@@ -883,6 +963,47 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, XmlWriter& rWriter)
}
break;
+ case MetaActionType::MASK:
+ {
+ auto pMeta = static_cast<MetaMaskAction*>(pAction);
+ rWriter.startElement(sCurrentElementTag);
+ writePoint(rWriter, pMeta->GetPoint());
+ rWriter.attribute("crc", hex32(pMeta->GetBitmap().GetChecksum()));
+ rWriter.attribute("color", convertColorToString(pMeta->GetColor()));
+ rWriter.endElement();
+ }
+ break;
+
+ case MetaActionType::MASKSCALE:
+ {
+ auto pMeta = static_cast<MetaMaskScaleAction*>(pAction);
+ rWriter.startElement(sCurrentElementTag);
+ writePoint(rWriter, pMeta->GetPoint());
+ writeSize(rWriter, pMeta->GetSize());
+ rWriter.attribute("crc", hex32(pMeta->GetBitmap().GetChecksum()));
+ rWriter.attribute("color", convertColorToString(pMeta->GetColor()));
+ rWriter.endElement();
+ }
+ break;
+
+ case MetaActionType::MASKSCALEPART:
+ {
+ auto pMeta = static_cast<MetaMaskScalePartAction*>(pAction);
+ rWriter.startElement(sCurrentElementTag);
+ rWriter.attribute("destx", pMeta->GetDestPoint().X());
+ rWriter.attribute("desty", pMeta->GetDestPoint().Y());
+ rWriter.attribute("destwidth", pMeta->GetDestSize().Width());
+ rWriter.attribute("destheight", pMeta->GetDestSize().Height());
+ rWriter.attribute("srcx", pMeta->GetSrcPoint().X());
+ rWriter.attribute("srcy", pMeta->GetSrcPoint().Y());
+ rWriter.attribute("srcwidth", pMeta->GetSrcSize().Width());
+ rWriter.attribute("srcheight", pMeta->GetSrcSize().Height());
+ rWriter.attribute("crc", hex32(pMeta->GetBitmap().GetChecksum()));
+ rWriter.attribute("color", convertColorToString(pMeta->GetColor()));
+ rWriter.endElement();
+ }
+ break;
+
default:
{
rWriter.element(sCurrentElementTag);
diff --git a/vcl/qa/cppunit/svm/svmtest.cxx b/vcl/qa/cppunit/svm/svmtest.cxx
index 7bdcd68564f0..f90b1992d536 100644
--- a/vcl/qa/cppunit/svm/svmtest.cxx
+++ b/vcl/qa/cppunit/svm/svmtest.cxx
@@ -19,7 +19,9 @@ using namespace css;
class SvmTest : public test::BootstrapFixture, public XmlTestTools
{
- /*OUString getFullUrl(const OUString& sFileName)
+ /*OUString maDataUrl;
+
+ OUString getFullUrl(const OUString& sFileName)
{
return m_directories.getURLFromSrc(maDataUrl) + sFileName;
}*/
@@ -32,6 +34,9 @@ class SvmTest : public test::BootstrapFixture, public XmlTestTools
void checkPixel(const GDIMetaFile& rMetaFile);
void testPixel();
+ void checkPoint(const GDIMetaFile& rMetaFile);
+ void testPoint();
+
void checkLine(const GDIMetaFile& rMetaFile);
void testLine();
@@ -62,15 +67,6 @@ class SvmTest : public test::BootstrapFixture, public XmlTestTools
void checkPolyPolygon(const GDIMetaFile& rMetaFile);
void testPolyPolygon();
- void checkBitmaps(const GDIMetaFile& rMetaFile);
- void testBitmaps();
-
- void checkBitmapExs(const GDIMetaFile& rMetaFile);
- void testBitmapExs();
-
- void checkPushPop(const GDIMetaFile& rMetaFile);
- void testPushPop();
-
void checkText(const GDIMetaFile& rMetaFile);
void testText();
@@ -80,6 +76,24 @@ class SvmTest : public test::BootstrapFixture, public XmlTestTools
void checkStrechText(const GDIMetaFile& rMetaFile);
void testStrechText();
+ void checkTextRect(const GDIMetaFile& rMetaFile);
+ void testTextRect();
+
+ void checkTextLine(const GDIMetaFile& rMetaFile);
+ void testTextLine();
+
+ void checkBitmaps(const GDIMetaFile& rMetaFile);
+ void testBitmaps();
+
+ void checkBitmapExs(const GDIMetaFile& rMetaFile);
+ void testBitmapExs();
+
+ void checkMasks(const GDIMetaFile& rMetaFile);
+ void testMasks();
+
+ void checkPushPop(const GDIMetaFile& rMetaFile);
+ void testPushPop();
+
void checkTextColor(const GDIMetaFile& rMetaFile);
void testTextColor();
@@ -90,11 +104,13 @@ class SvmTest : public test::BootstrapFixture, public XmlTestTools
void testTextLineColor();
public:
- SvmTest() :
- BootstrapFixture(true, false)
+ SvmTest()
+ : BootstrapFixture(true, false)
+// , maDataUrl("/vcl/qa/cppunit/svm/data/")
{}
CPPUNIT_TEST_SUITE(SvmTest);
+ CPPUNIT_TEST(testPoint);
CPPUNIT_TEST(testPixel);
CPPUNIT_TEST(testLine);
CPPUNIT_TEST(testRect);
@@ -106,12 +122,15 @@ public:
CPPUNIT_TEST(testPolyLine);
CPPUNIT_TEST(testPolygon);
CPPUNIT_TEST(testPolyPolygon);
- CPPUNIT_TEST(testBitmaps);
- CPPUNIT_TEST(testBitmapExs);
- CPPUNIT_TEST(testPushPop);
CPPUNIT_TEST(testText);
CPPUNIT_TEST(testTextArray);
CPPUNIT_TEST(testStrechText);
+ CPPUNIT_TEST(testTextRect);
+ CPPUNIT_TEST(testTextLine);
+ CPPUNIT_TEST(testBitmaps); // BMP, BMPSCALE, BMPSCALEPART
+ CPPUNIT_TEST(testBitmapExs);
+ CPPUNIT_TEST(testMasks);
+ CPPUNIT_TEST(testPushPop);
CPPUNIT_TEST(testTextColor);
CPPUNIT_TEST(testTextFillColor);
CPPUNIT_TEST(testTextLineColor);
@@ -216,23 +235,38 @@ void SvmTest::checkPixel(const GDIMetaFile& rMetaFile)
assertXPathAttrs(pDoc, "/metafile/pixel[2]", {
{"x", "1"}, {"y", "8"}, {"color", "#000080"},
});
+}
+
+void SvmTest::testPixel()
+{
+ GDIMetaFile aGDIMetaFile;
+ ScopedVclPtrInstance<VirtualDevice> pVirtualDev;
+ setupBaseVirtualDevice(*pVirtualDev.get(), aGDIMetaFile);
+
+ pVirtualDev->DrawPixel(Point(8, 1), COL_GREEN);
+ pVirtualDev->DrawPixel(Point(1, 8), COL_BLUE);
+
+ checkPixel(writeAndRead(aGDIMetaFile, "pixel.svm"));
+}
+
+void SvmTest::checkPoint(const GDIMetaFile& rMetaFile)
+{
+ xmlDocPtr pDoc = dumpMeta(rMetaFile);
assertXPathAttrs(pDoc, "/metafile/point[1]", {
{"x", "4"}, {"y", "4"}
});
}
-void SvmTest::testPixel()
+void SvmTest::testPoint()
{
GDIMetaFile aGDIMetaFile;
ScopedVclPtrInstance<VirtualDevice> pVirtualDev;
setupBaseVirtualDevice(*pVirtualDev.get(), aGDIMetaFile);
- pVirtualDev->DrawPixel(Point(8, 1), COL_GREEN);
- pVirtualDev->DrawPixel(Point(1, 8), COL_BLUE);
pVirtualDev->DrawPixel(Point(4, 4));
- checkPixel(writeAndRead(aGDIMetaFile, "pixel.svm"));
+ checkPoint(writeAndRead(aGDIMetaFile, "point.svm"));
}
void SvmTest::checkLine(const GDIMetaFile& rMetaFile)
@@ -614,6 +648,112 @@ void SvmTest::testPolyPolygon()
checkPolyPolygon(writeAndRead(aGDIMetaFile, "polypolygon.svm"));
}
+void SvmTest::checkText(const GDIMetaFile& rMetaFile)
+{
+ xmlDocPtr pDoc = dumpMeta(rMetaFile);
+
+ assertXPathAttrs(pDoc, "/metafile/text[1]", {
+ {"x", "4"}, {"y", "6"}, {"index", "1"}, {"length", "2"},
+ });
+
+ assertXPathContent(pDoc, "/metafile/text[1]/textcontent", "xABC");
+}
+
+void SvmTest::testText()
+{
+ GDIMetaFile aGDIMetaFile;
+ ScopedVclPtrInstance<VirtualDevice> pVirtualDev;
+ setupBaseVirtualDevice(*pVirtualDev.get(), aGDIMetaFile);
+
+ pVirtualDev->DrawText(Point(4,6), "xABC", 1, 2);
+
+ checkText(writeAndRead(aGDIMetaFile, "text.svm"));
+}
+
+void SvmTest::checkTextArray(const GDIMetaFile& rMetaFile)
+{
+ xmlDocPtr pDoc = dumpMeta(rMetaFile);
+
+ assertXPathAttrs(pDoc, "/metafile/textarray[1]", {
+ {"x", "4"}, {"y", "6"}, {"index", "1"}, {"length", "4"},
+ });
+ assertXPathContent(pDoc, "/metafile/textarray[1]/dxarray", "15 20 25 ");
+ assertXPathContent(pDoc, "/metafile/textarray[1]/text", "123456");
+}
+
+void SvmTest::testTextArray()
+{
+ GDIMetaFile aGDIMetaFile;
+ ScopedVclPtrInstance<VirtualDevice> pVirtualDev;
+ setupBaseVirtualDevice(*pVirtualDev.get(), aGDIMetaFile);
+ long aDX[] = { 10, 15, 20, 25, 30, 35 };
+ pVirtualDev->DrawTextArray(Point(4,6), "123456", aDX, 1, 4);
+
+ checkTextArray(writeAndRead(aGDIMetaFile, "textarray.svm"));
+}
+
+void SvmTest::checkStrechText(const GDIMetaFile& rMetaFile)
+{
+ xmlDocPtr pDoc = dumpMeta(rMetaFile);
+
+ assertXPathAttrs(pDoc, "/metafile/stretchtext[1]", {
+ {"x", "4"}, {"y", "6"}, {"index", "1"}, {"length", "4"}, {"width", "10"}
+ });
+
+ assertXPathContent(pDoc, "/metafile/stretchtext[1]/textcontent", "123456");
+}
+
+void SvmTest::testStrechText()
+{
+ GDIMetaFile aGDIMetaFile;
+ ScopedVclPtrInstance<VirtualDevice> pVirtualDev;
+ setupBaseVirtualDevice(*pVirtualDev.get(), aGDIMetaFile);
+ pVirtualDev->DrawStretchText(Point(4,6), 10, "123456", 1, 4);
+
+ checkStrechText(writeAndRead(aGDIMetaFile, "strecthtext.svm"));
+}
+
+void SvmTest::checkTextRect(const GDIMetaFile& rMetaFile)
+{
+ xmlDocPtr pDoc = dumpMeta(rMetaFile);
+
+ assertXPathAttrs(pDoc, "/metafile/textrect[1]", {
+ {"left", "0"}, {"top", "0"}, {"right", "4"}, {"bottom", "4"}
+ });
+ assertXPathContent(pDoc, "/metafile/textrect[1]/textcontent", "123456");
+ assertXPathContent(pDoc, "/metafile/textrect[1]/style", "Center");
+}
+
+void SvmTest::testTextRect()
+{
+ GDIMetaFile aGDIMetaFile;
+ ScopedVclPtrInstance<VirtualDevice> pVirtualDev;
+ setupBaseVirtualDevice(*pVirtualDev.get(), aGDIMetaFile);
+ pVirtualDev->DrawText(Rectangle(Point(0,0), Size(5,5)), "123456", DrawTextFlags::Center);
+
+ checkTextRect(writeAndRead(aGDIMetaFile, "textrectangle.svm"));
+}
+
+void SvmTest::checkTextLine(const GDIMetaFile& rMetaFile)
+{
+ xmlDocPtr pDoc = dumpMeta(rMetaFile);
+
+ assertXPathAttrs(pDoc, "/metafile/textline[1]", {
+ {"x", "4"}, {"y", "6"}, {"width", "10"},
+ {"strikeout", "single"}, {"underline", "single"}, {"overline", "single"}
+ });
+}
+
+void SvmTest::testTextLine()
+{
+ GDIMetaFile aGDIMetaFile;
+ ScopedVclPtrInstance<VirtualDevice> pVirtualDev;
+ setupBaseVirtualDevice(*pVirtualDev.get(), aGDIMetaFile);
+ pVirtualDev->DrawTextLine(Point(4,6), 10, STRIKEOUT_SINGLE, LINESTYLE_SINGLE, LINESTYLE_SINGLE);
+
+ checkTextLine(writeAndRead(aGDIMetaFile, "textline.svm"));
+}
+
void SvmTest::checkBitmaps(const GDIMetaFile& rMetaFile)
{
xmlDocPtr pDoc = dumpMeta(rMetaFile);
@@ -736,6 +876,57 @@ void SvmTest::testBitmapExs()
checkBitmapExs(writeAndRead(aGDIMetaFile, "bitmapexs.svm"));
}
+void SvmTest::checkMasks(const GDIMetaFile& rMetaFile)
+{
+ xmlDocPtr pDoc = dumpMeta(rMetaFile);
+
+ assertXPathAttrs(pDoc, "/metafile/mask[1]", {
+ {"x", "1"}, {"y", "2"},
+ {"color", "#000000"}
+ });
+ assertXPathAttrs(pDoc, "/metafile/maskscale[1]", {
+ {"x", "1"}, {"y", "2"}, {"width", "3"}, {"height", "4"},
+ {"color", "#000000"}
+ });
+ assertXPathAttrs(pDoc, "/metafile/maskscalepart[1]", {
+ {"destx", "1"}, {"desty", "2"}, {"destwidth", "3"}, {"destheight", "4"},
+ {"srcx", "2"}, {"srcy", "1"}, {"srcwidth", "4"}, {"srcheight", "3"},
+ {"color", "#ff0000"}
+ });
+}
+
+// TODO: Masks are kind-of special - we don't persist the color attribute (it is
+// always #000000) of the meta-action (which is wrong), but rely on alpha to do
+// the right thing.
+void SvmTest::testMasks()
+{
+ GDIMetaFile aGDIMetaFile;
+ ScopedVclPtrInstance<VirtualDevice> pVirtualDev;
+ setupBaseVirtualDevice(*pVirtualDev.get(), aGDIMetaFile);
+
+ Bitmap aBitmap1(Size(4,4), 24);
+ {
+ Bitmap::ScopedWriteAccess pAccess(aBitmap1);
+ pAccess->Erase(COL_RED);
+ }
+ Bitmap aBitmap2(Size(4,4), 24);
+ {
+ Bitmap::ScopedWriteAccess pAccess(aBitmap2);
+ pAccess->Erase(COL_GREEN);
+ }
+ Bitmap aBitmap3(Size(4,4), 24);
+ {
+ Bitmap::ScopedWriteAccess pAccess(aBitmap3);
+ pAccess->Erase(COL_BLUE);
+ }
+
+ pVirtualDev->DrawMask(Point(1, 2), aBitmap1, Color(COL_LIGHTRED));
+ pVirtualDev->DrawMask(Point(1, 2), Size(3, 4), aBitmap2, Color(COL_LIGHTRED));
+ pVirtualDev->DrawMask(Point(1, 2), Size(3, 4), Point(2, 1), Size(4, 3), aBitmap3, Color(COL_LIGHTRED), MetaActionType::MASKSCALEPART);
+
+ checkMasks(writeAndRead(aGDIMetaFile, "masks.svm"));
+}
+
void SvmTest::checkPushPop(const GDIMetaFile& rMetaFile)
{
xmlDocPtr pDoc = dumpMeta(rMetaFile);
@@ -773,71 +964,6 @@ void SvmTest::testPushPop()
checkPushPop(writeAndRead(aGDIMetaFile, "pushpop.svm"));
}
-void SvmTest::checkText(const GDIMetaFile& rMetaFile)
-{
- xmlDocPtr pDoc = dumpMeta(rMetaFile);
-
- assertXPathAttrs(pDoc, "/metafile/text[1]", {
- {"x", "4"}, {"y", "6"}, {"index", "1"}, {"length", "2"},
- });
-
- assertXPathContent(pDoc, "/metafile/text[1]/textcontent", "xABC");
-}
-
-void SvmTest::testText()
-{
- GDIMetaFile aGDIMetaFile;
- ScopedVclPtrInstance<VirtualDevice> pVirtualDev;
- setupBaseVirtualDevice(*pVirtualDev.get(), aGDIMetaFile);
-
- pVirtualDev->DrawText(Point(4,6), "xABC", 1, 2);
-
- checkText(writeAndRead(aGDIMetaFile, "text.svm"));
-}
-
-void SvmTest::checkTextArray(const GDIMetaFile& rMetaFile)
-{
- xmlDocPtr pDoc = dumpMeta(rMetaFile);
-
- assertXPathAttrs(pDoc, "/metafile/textarray[1]", {
- {"x", "4"}, {"y", "6"}, {"index", "1"}, {"length", "4"},
- });
- assertXPathContent(pDoc, "/metafile/textarray[1]/dxarray", "15 20 25 ");
- assertXPathContent(pDoc, "/metafile/textarray[1]/text", "123456");
-}
-
-void SvmTest::testTextArray()
-{
- GDIMetaFile aGDIMetaFile;
- ScopedVclPtrInstance<VirtualDevice> pVirtualDev;
- setupBaseVirtualDevice(*pVirtualDev.get(), aGDIMetaFile);
- long aDX[] = { 10, 15, 20, 25, 30, 35 };
- pVirtualDev->DrawTextArray(Point(4,6), "123456", aDX, 1, 4);
-
- checkTextArray(writeAndRead(aGDIMetaFile, "textarray.svm"));
-}
-
-void SvmTest::checkStrechText(const GDIMetaFile& rMetaFile)
-{
- xmlDocPtr pDoc = dumpMeta(rMetaFile);
-
- assertXPathAttrs(pDoc, "/metafile/stretchtext[1]", {
- {"x", "4"}, {"y", "6"}, {"index", "1"}, {"length", "4"}, {"width", "10"}
- });
-
- assertXPathContent(pDoc, "/metafile/stretchtext[1]/textcontent", "123456");
-}
-
-void SvmTest::testStrechText()
-{
- GDIMetaFile aGDIMetaFile;
- ScopedVclPtrInstance<VirtualDevice> pVirtualDev;
- setupBaseVirtualDevice(*pVirtualDev.get(), aGDIMetaFile);
- pVirtualDev->DrawStretchText(Point(4,6), 10, "123456", 1, 4);
-
- checkStrechText(writeAndRead(aGDIMetaFile, "strecthtext.svm"));
-}
-
void SvmTest::checkTextColor(const GDIMetaFile& rMetaFile)
{
xmlDocPtr pDoc = dumpMeta(rMetaFile);