Extend loplugin:elidestringvar to OString

(In VisitVarDecl, filtering out AbstractConditionalOperator avoids an unhelpful

> ~/lo/core/vcl/source/pdf/XmpMetadata.cxx:63:32: error: replace single use of literal 'rtl::OString' variable with a literal [loplugin:elidestringvar]
>             aXmlWriter.content(sPdfConformance);
>                                ^~~~~~~~~~~~~~~
> ~/lo/core/vcl/source/pdf/XmpMetadata.cxx:52:21: note: literal 'rtl::OString' variable defined here [loplugin:elidestringvar]
>             OString sPdfConformance = (mnPDF_A == 1) ? "A" : "B";
>             ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

)

Change-Id: I7d0410f04827d79b4b526752917c37d33cad2671
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104911
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Stephan Bergmann 2020-10-27 23:18:23 +01:00
parent c496792847
commit 40fa3a61ac
23 changed files with 145 additions and 218 deletions

View File

@ -296,9 +296,9 @@ void Chart2GeometryTest::testTdf128345ChartArea_CG_TS_import()
// Find transparency gradient name // Find transparency gradient name
xmlDocUniquePtr pXmlDoc = parseExport("Object 1/content.xml", "impress8"); xmlDocUniquePtr pXmlDoc = parseExport("Object 1/content.xml", "impress8");
CPPUNIT_ASSERT(pXmlDoc); CPPUNIT_ASSERT(pXmlDoc);
const OString sChartPath( const OUString sOUChartStyleName = getXPathContent(
pXmlDoc,
"//office:document-content/office:body/office:chart/chart:chart/@chart:style-name"); "//office:document-content/office:body/office:chart/chart:chart/@chart:style-name");
const OUString sOUChartStyleName = getXPathContent(pXmlDoc, sChartPath);
const OString sStylePath( const OString sStylePath(
"//office:document-content/office:automatic-styles/style:style[@style:name='" "//office:document-content/office:automatic-styles/style:style[@style:name='"
+ OU2O(sOUChartStyleName) + "']"); + OU2O(sOUChartStyleName) + "']");
@ -310,9 +310,8 @@ void Chart2GeometryTest::testTdf128345ChartArea_CG_TS_import()
// Verify the content of the opacity definition // Verify the content of the opacity definition
xmlDocUniquePtr pXmlDoc2 = parseExport("Object 1/styles.xml", "impress8"); xmlDocUniquePtr pXmlDoc2 = parseExport("Object 1/styles.xml", "impress8");
CPPUNIT_ASSERT(pXmlDoc2); CPPUNIT_ASSERT(pXmlDoc2);
const OString sOpacityPath("//office:document-styles/office:styles/draw:opacity");
const OString sAttribute("@draw:name='" + OU2O(sOUOpacityName) + "'"); const OString sAttribute("@draw:name='" + OU2O(sOUOpacityName) + "'");
const OString sStart(sOpacityPath + "[" + sAttribute); const OString sStart("//office:document-styles/office:styles/draw:opacity[" + sAttribute);
assertXPath(pXmlDoc2, sStart + "]", 1); assertXPath(pXmlDoc2, sStart + "]", 1);
assertXPath(pXmlDoc2, sStart + " and @draw:style='linear']"); assertXPath(pXmlDoc2, sStart + " and @draw:style='linear']");
assertXPath(pXmlDoc2, sStart + " and @draw:start='30%']"); assertXPath(pXmlDoc2, sStart + " and @draw:start='30%']");
@ -348,9 +347,9 @@ void Chart2GeometryTest::testTdf128345ChartWall_CS_TG_import()
// Find transparency gradient name // Find transparency gradient name
xmlDocUniquePtr pXmlDoc = parseExport("Object 1/content.xml", "impress8"); xmlDocUniquePtr pXmlDoc = parseExport("Object 1/content.xml", "impress8");
CPPUNIT_ASSERT(pXmlDoc); CPPUNIT_ASSERT(pXmlDoc);
const OString sChartPath("//office:document-content/office:body/office:chart/chart:chart/" const OUString sOUChartStyleName
= getXPathContent(pXmlDoc, "//office:document-content/office:body/office:chart/chart:chart/"
"chart:plot-area/chart:wall/@chart:style-name"); "chart:plot-area/chart:wall/@chart:style-name");
const OUString sOUChartStyleName = getXPathContent(pXmlDoc, sChartPath);
const OString sStylePath( const OString sStylePath(
"//office:document-content/office:automatic-styles/style:style[@style:name='" "//office:document-content/office:automatic-styles/style:style[@style:name='"
+ OU2O(sOUChartStyleName) + "']"); + OU2O(sOUChartStyleName) + "']");
@ -362,9 +361,8 @@ void Chart2GeometryTest::testTdf128345ChartWall_CS_TG_import()
// Verify content of the opacity definition // Verify content of the opacity definition
xmlDocUniquePtr pXmlDoc2 = parseExport("Object 1/styles.xml", "impress8"); xmlDocUniquePtr pXmlDoc2 = parseExport("Object 1/styles.xml", "impress8");
CPPUNIT_ASSERT(pXmlDoc2); CPPUNIT_ASSERT(pXmlDoc2);
const OString sOpacityPath("//office:document-styles/office:styles/draw:opacity");
const OString sAttribute("@draw:name='" + OU2O(sOUOpacityName) + "'"); const OString sAttribute("@draw:name='" + OU2O(sOUOpacityName) + "'");
const OString sStart(sOpacityPath + "[" + sAttribute); const OString sStart("//office:document-styles/office:styles/draw:opacity[" + sAttribute);
assertXPath(pXmlDoc2, sStart + "]", 1); assertXPath(pXmlDoc2, sStart + "]", 1);
assertXPath(pXmlDoc2, sStart + " and @draw:style='linear']"); assertXPath(pXmlDoc2, sStart + " and @draw:style='linear']");
assertXPath(pXmlDoc2, sStart + " and @draw:start='0%']"); assertXPath(pXmlDoc2, sStart + " and @draw:start='0%']");
@ -400,9 +398,9 @@ void Chart2GeometryTest::testTdf128345Legend_CS_TG_axial_import()
// Find transparency gradient name // Find transparency gradient name
xmlDocUniquePtr pXmlDoc = parseExport("Object 1/content.xml", "impress8"); xmlDocUniquePtr pXmlDoc = parseExport("Object 1/content.xml", "impress8");
CPPUNIT_ASSERT(pXmlDoc); CPPUNIT_ASSERT(pXmlDoc);
const OString sChartPath("//office:document-content/office:body/office:chart/chart:chart/" const OUString sOUChartStyleName
= getXPathContent(pXmlDoc, "//office:document-content/office:body/office:chart/chart:chart/"
"chart:legend/@chart:style-name"); "chart:legend/@chart:style-name");
const OUString sOUChartStyleName = getXPathContent(pXmlDoc, sChartPath);
const OString sStylePath( const OString sStylePath(
"//office:document-content/office:automatic-styles/style:style[@style:name='" "//office:document-content/office:automatic-styles/style:style[@style:name='"
+ OU2O(sOUChartStyleName) + "']"); + OU2O(sOUChartStyleName) + "']");
@ -414,9 +412,8 @@ void Chart2GeometryTest::testTdf128345Legend_CS_TG_axial_import()
// Verify content of the opacity definition // Verify content of the opacity definition
xmlDocUniquePtr pXmlDoc2 = parseExport("Object 1/styles.xml", "impress8"); xmlDocUniquePtr pXmlDoc2 = parseExport("Object 1/styles.xml", "impress8");
CPPUNIT_ASSERT(pXmlDoc2); CPPUNIT_ASSERT(pXmlDoc2);
const OString sOpacityPath("//office:document-styles/office:styles/draw:opacity");
const OString sAttribute("@draw:name='" + OU2O(sOUOpacityName) + "'"); const OString sAttribute("@draw:name='" + OU2O(sOUOpacityName) + "'");
const OString sStart(sOpacityPath + "[" + sAttribute); const OString sStart("//office:document-styles/office:styles/draw:opacity[" + sAttribute);
assertXPath(pXmlDoc2, sStart + "]", 1); assertXPath(pXmlDoc2, sStart + "]", 1);
assertXPath(pXmlDoc2, sStart + " and @draw:style='axial']"); assertXPath(pXmlDoc2, sStart + " and @draw:style='axial']");
assertXPath(pXmlDoc2, sStart + " and @draw:start='0%']"); assertXPath(pXmlDoc2, sStart + " and @draw:start='0%']");
@ -517,10 +514,9 @@ void Chart2GeometryTest::testTdf135366LabelExport()
CPPUNIT_ASSERT(pXmlDoc); CPPUNIT_ASSERT(pXmlDoc);
// Find label style // Find label style
const OString sLabelPath( const OUString sOULabelStyleName = getXPathContent(
"//office:document-content/office:body/office:chart/chart:chart/chart:plot-area" pXmlDoc, "//office:document-content/office:body/office:chart/chart:chart/chart:plot-area"
"/chart:series/chart:data-point[1]/chart:data-label/@chart:style-name"); "/chart:series/chart:data-point[1]/chart:data-label/@chart:style-name");
const OUString sOULabelStyleName = getXPathContent(pXmlDoc, sLabelPath);
// Verify content of graphic properties of label style // Verify content of graphic properties of label style
const OString sStylePath( const OString sStylePath(

View File

@ -75,14 +75,11 @@ void TestString::testDecimalStringToNumber()
void TestString::testIsdigitAsciiString() void TestString::testIsdigitAsciiString()
{ {
OString s1("1234"); CPPUNIT_ASSERT_EQUAL(true, comphelper::string::isdigitAsciiString(OString("1234")));
CPPUNIT_ASSERT_EQUAL(true, comphelper::string::isdigitAsciiString(s1));
OString s2("1A34"); CPPUNIT_ASSERT_EQUAL(false, comphelper::string::isdigitAsciiString(OString("1A34")));
CPPUNIT_ASSERT_EQUAL(false, comphelper::string::isdigitAsciiString(s2));
OString s3; CPPUNIT_ASSERT_EQUAL(true, comphelper::string::isdigitAsciiString(OString()));
CPPUNIT_ASSERT_EQUAL(true, comphelper::string::isdigitAsciiString(s3));
} }
using namespace ::com::sun::star; using namespace ::com::sun::star;
@ -369,8 +366,7 @@ void TestString::testTokenCount()
void TestString::testReverseString() void TestString::testReverseString()
{ {
OString aIn("ABC"); OString aOut = ::comphelper::string::reverseString(OString("ABC"));
OString aOut = ::comphelper::string::reverseString(aIn);
CPPUNIT_ASSERT_EQUAL(OString("CBA"), aOut); CPPUNIT_ASSERT_EQUAL(OString("CBA"), aOut);
} }

View File

@ -17,7 +17,7 @@
#include "compat.hxx" #include "compat.hxx"
#include "plugin.hxx" #include "plugin.hxx"
// Find cases where a variable of a string type (at least for now, only OUString) is initialized // Find cases where a variable of a OString/OUString type is initialized
// with a literal value (incl. as an empty string) and used only once. Conservatively this only // with a literal value (incl. as an empty string) and used only once. Conservatively this only
// covers local non-static variables that are not defined outside of the loop (if any) in which they // covers local non-static variables that are not defined outside of the loop (if any) in which they
// are used, as other cases may deliberately use the variable for performance (or even correctness, // are used, as other cases may deliberately use the variable for performance (or even correctness,
@ -37,6 +37,13 @@
namespace namespace
{ {
bool isStringType(QualType type)
{
loplugin::TypeCheck const c(type);
return c.Class("OString").Namespace("rtl").GlobalNamespace()
|| c.Class("OUString").Namespace("rtl").GlobalNamespace();
}
class ElideStringVar : public loplugin::FilteringPlugin<ElideStringVar> class ElideStringVar : public loplugin::FilteringPlugin<ElideStringVar>
{ {
public: public:
@ -67,12 +74,12 @@ public:
continue; continue;
} }
report(DiagnosticsEngine::Warning, report(DiagnosticsEngine::Warning,
"replace single use of literal OUString variable with a literal", "replace single use of literal %0 variable with a literal",
(*var.second.singleUse)->getExprLoc()) (*var.second.singleUse)->getExprLoc())
<< (*var.second.singleUse)->getSourceRange(); << var.first->getType() << (*var.second.singleUse)->getSourceRange();
report(DiagnosticsEngine::Note, "literal OUString variable defined here", report(DiagnosticsEngine::Note, "literal %0 variable defined here",
var.first->getLocation()) var.first->getLocation())
<< var.first->getSourceRange(); << var.first->getType() << var.first->getSourceRange();
} }
} }
@ -94,10 +101,7 @@ public:
{ {
return true; return true;
} }
if (!loplugin::TypeCheck(decl->getType()) if (!isStringType(decl->getType()))
.Class("OUString")
.Namespace("rtl")
.GlobalNamespace())
{ {
return true; return true;
} }
@ -110,10 +114,7 @@ public:
{ {
return true; return true;
} }
if (!loplugin::TypeCheck(e1->getType()) if (!isStringType(e1->getType()))
.Class("OUString")
.Namespace("rtl")
.GlobalNamespace())
{ {
return true; return true;
} }
@ -124,10 +125,9 @@ public:
case 1: case 1:
{ {
auto const e2 = e1->getArg(0); auto const e2 = e1->getArg(0);
if (loplugin::TypeCheck(e2->getType()) loplugin::TypeCheck const c(e2->getType());
.Class("OUStringLiteral") if (c.Class("OStringLiteral").Namespace("rtl").GlobalNamespace()
.Namespace("rtl") || c.Class("OUStringLiteral").Namespace("rtl").GlobalNamespace())
.GlobalNamespace())
{ {
break; break;
} }
@ -139,14 +139,19 @@ public:
} }
case 2: case 2:
{ {
auto const t = e1->getArg(0)->getType(); auto const e2 = e1->getArg(0);
auto const t = e2->getType();
if (!(t.isConstQualified() && t->isConstantArrayType())) if (!(t.isConstQualified() && t->isConstantArrayType()))
{ {
return true; return true;
} }
auto const e2 = e1->getArg(1); if (isa<AbstractConditionalOperator>(e2->IgnoreParenImpCasts()))
if (!(isa<CXXDefaultArgExpr>(e2) {
&& loplugin::TypeCheck(e2->getType()) return true;
}
auto const e3 = e1->getArg(1);
if (!(isa<CXXDefaultArgExpr>(e3)
&& loplugin::TypeCheck(e3->getType())
.Struct("Dummy") .Struct("Dummy")
.Namespace("libreoffice_internal") .Namespace("libreoffice_internal")
.Namespace("rtl") .Namespace("rtl")

View File

@ -14,25 +14,25 @@
OUString f(sal_Unicode c, int n) OUString f(sal_Unicode c, int n)
{ {
OUString s1(c); OUString s1(c);
// expected-note@+1 {{literal OUString variable defined here [loplugin:elidestringvar]}} // expected-note@+1 {{literal 'rtl::OUString' variable defined here [loplugin:elidestringvar]}}
OUString s2('a'); OUString s2('a');
// expected-note@+1 {{literal OUString variable defined here [loplugin:elidestringvar]}} // expected-note@+1 {{literal 'rtl::OUString' variable defined here [loplugin:elidestringvar]}}
OUString s3(u'a'); OUString s3(u'a');
static constexpr OUStringLiteral s4lit(u"a"); static constexpr OUStringLiteral s4lit(u"a");
// expected-note@+1 {{literal OUString variable defined here [loplugin:elidestringvar]}} // expected-note@+1 {{literal 'rtl::OUString' variable defined here [loplugin:elidestringvar]}}
OUString s4 = s4lit; OUString s4 = s4lit;
switch (n) switch (n)
{ {
case 1: case 1:
return s1; return s1;
case 2: case 2:
// expected-error@+1 {{replace single use of literal OUString variable with a literal [loplugin:elidestringvar]}} // expected-error@+1 {{replace single use of literal 'rtl::OUString' variable with a literal [loplugin:elidestringvar]}}
return s2; return s2;
case 3: case 3:
// expected-error@+1 {{replace single use of literal OUString variable with a literal [loplugin:elidestringvar]}} // expected-error@+1 {{replace single use of literal 'rtl::OUString' variable with a literal [loplugin:elidestringvar]}}
return s3; return s3;
default: default:
// expected-error@+1 {{replace single use of literal OUString variable with a literal [loplugin:elidestringvar]}} // expected-error@+1 {{replace single use of literal 'rtl::OUString' variable with a literal [loplugin:elidestringvar]}}
return s4; return s4;
} }
} }

View File

@ -511,9 +511,7 @@ AdditionsDialog::AdditionsDialog(weld::Window* pParent, const OUString& sAdditio
m_sTag = "allextensions"; // Means empty parameter m_sTag = "allextensions"; // Means empty parameter
} }
//FIXME: Temporary URL //FIXME: Temporary URL
OString sPrefixURL = "https://yusufketen.com/api/"; OString rURL = "https://yusufketen.com/api/" + m_sTag + ".json";
OString sSuffixURL = ".json";
OString rURL = sPrefixURL + m_sTag + sSuffixURL;
m_sURL = rURL; m_sURL = rURL;
m_xExtensionManager m_xExtensionManager

View File

@ -1783,8 +1783,7 @@ void DesktopLOKTest::testInput()
Scheduler::ProcessEventsToIdle(); Scheduler::ProcessEventsToIdle();
char* pText = pDocument->pClass->getTextSelection(pDocument, "text/plain;charset=utf-8", nullptr); char* pText = pDocument->pClass->getTextSelection(pDocument, "text/plain;charset=utf-8", nullptr);
CPPUNIT_ASSERT(pText != nullptr); CPPUNIT_ASSERT(pText != nullptr);
OString aLovely("far beyond lovely "); CPPUNIT_ASSERT_EQUAL(OString("far beyond lovely "), OString(pText));
CPPUNIT_ASSERT_EQUAL(aLovely, OString(pText));
free(pText); free(pText);
} }

View File

@ -1207,8 +1207,6 @@ void VclMetafileProcessor2D::processTextHierarchyFieldPrimitive2D(
// support for FIELD_SEQ_BEGIN, FIELD_SEQ_END and URL. It wraps text primitives (but is not limited to) // support for FIELD_SEQ_BEGIN, FIELD_SEQ_END and URL. It wraps text primitives (but is not limited to)
// thus do the MetafileAction embedding stuff but just handle recursively. // thus do the MetafileAction embedding stuff but just handle recursively.
const OString aCommentStringCommon("FIELD_SEQ_BEGIN"); const OString aCommentStringCommon("FIELD_SEQ_BEGIN");
const OString aCommentStringPage("FIELD_SEQ_BEGIN;PageField");
const OString aCommentStringEnd("FIELD_SEQ_END");
OUString aURL; OUString aURL;
switch (rFieldPrimitive.getType()) switch (rFieldPrimitive.getType())
@ -1220,7 +1218,7 @@ void VclMetafileProcessor2D::processTextHierarchyFieldPrimitive2D(
} }
case drawinglayer::primitive2d::FIELD_TYPE_PAGE: case drawinglayer::primitive2d::FIELD_TYPE_PAGE:
{ {
mpMetaFile->AddAction(new MetaCommentAction(aCommentStringPage)); mpMetaFile->AddAction(new MetaCommentAction("FIELD_SEQ_BEGIN;PageField"));
break; break;
} }
case drawinglayer::primitive2d::FIELD_TYPE_URL: case drawinglayer::primitive2d::FIELD_TYPE_URL:
@ -1244,7 +1242,7 @@ void VclMetafileProcessor2D::processTextHierarchyFieldPrimitive2D(
process(rContent); process(rContent);
// for the end comment the type is not relevant yet, they are all the same. Just add. // for the end comment the type is not relevant yet, they are all the same. Just add.
mpMetaFile->AddAction(new MetaCommentAction(aCommentStringEnd)); mpMetaFile->AddAction(new MetaCommentAction("FIELD_SEQ_END"));
if (!(mpPDFExtOutDevData if (!(mpPDFExtOutDevData
&& drawinglayer::primitive2d::FIELD_TYPE_URL == rFieldPrimitive.getType())) && drawinglayer::primitive2d::FIELD_TYPE_URL == rFieldPrimitive.getType()))
@ -1266,20 +1264,14 @@ void VclMetafileProcessor2D::processTextHierarchyFieldPrimitive2D(
void VclMetafileProcessor2D::processTextHierarchyLinePrimitive2D( void VclMetafileProcessor2D::processTextHierarchyLinePrimitive2D(
const primitive2d::TextHierarchyLinePrimitive2D& rLinePrimitive) const primitive2d::TextHierarchyLinePrimitive2D& rLinePrimitive)
{ {
const OString aCommentString("XTEXT_EOL");
// process recursively and add MetaFile comment // process recursively and add MetaFile comment
process(rLinePrimitive); process(rLinePrimitive);
mpMetaFile->AddAction(new MetaCommentAction(aCommentString)); mpMetaFile->AddAction(new MetaCommentAction("XTEXT_EOL"));
} }
void VclMetafileProcessor2D::processTextHierarchyBulletPrimitive2D( void VclMetafileProcessor2D::processTextHierarchyBulletPrimitive2D(
const primitive2d::TextHierarchyBulletPrimitive2D& rBulletPrimitive) const primitive2d::TextHierarchyBulletPrimitive2D& rBulletPrimitive)
{ {
// in Outliner::PaintBullet(), a MetafileComment for bullets is added, too. The
// "XTEXT_EOC" is used, use here, too.
const OString aCommentString("XTEXT_EOC");
// this is a part of list item, start LILabel ( = bullet) // this is a part of list item, start LILabel ( = bullet)
if (mbInListItem) if (mbInListItem)
{ {
@ -1289,7 +1281,9 @@ void VclMetafileProcessor2D::processTextHierarchyBulletPrimitive2D(
// process recursively and add MetaFile comment // process recursively and add MetaFile comment
process(rBulletPrimitive); process(rBulletPrimitive);
mpMetaFile->AddAction(new MetaCommentAction(aCommentString)); // in Outliner::PaintBullet(), a MetafileComment for bullets is added, too. The
// "XTEXT_EOC" is used, use here, too.
mpMetaFile->AddAction(new MetaCommentAction("XTEXT_EOC"));
if (mbInListItem) if (mbInListItem)
{ {
@ -1400,11 +1394,8 @@ void VclMetafileProcessor2D::processTextHierarchyParagraphPrimitive2D(
void VclMetafileProcessor2D::processTextHierarchyBlockPrimitive2D( void VclMetafileProcessor2D::processTextHierarchyBlockPrimitive2D(
const primitive2d::TextHierarchyBlockPrimitive2D& rBlockPrimitive) const primitive2d::TextHierarchyBlockPrimitive2D& rBlockPrimitive)
{ {
const OString aCommentStringA("XTEXT_PAINTSHAPE_BEGIN");
const OString aCommentStringB("XTEXT_PAINTSHAPE_END");
// add MetaFile comment, process recursively and add MetaFile comment // add MetaFile comment, process recursively and add MetaFile comment
mpMetaFile->AddAction(new MetaCommentAction(aCommentStringA)); mpMetaFile->AddAction(new MetaCommentAction("XTEXT_PAINTSHAPE_BEGIN"));
process(rBlockPrimitive); process(rBlockPrimitive);
if (mnCurrentOutlineLevel >= 0) if (mnCurrentOutlineLevel >= 0)
@ -1416,7 +1407,7 @@ void VclMetafileProcessor2D::processTextHierarchyBlockPrimitive2D(
} }
} }
mpMetaFile->AddAction(new MetaCommentAction(aCommentStringB)); mpMetaFile->AddAction(new MetaCommentAction("XTEXT_PAINTSHAPE_END"));
} }
void VclMetafileProcessor2D::processTextSimplePortionPrimitive2D( void VclMetafileProcessor2D::processTextSimplePortionPrimitive2D(

View File

@ -211,9 +211,8 @@ namespace rtl_OStringBuffer
void makeStringAndClear_001() void makeStringAndClear_001()
{ {
OStringBuffer aStrBuf1; OStringBuffer aStrBuf1;
OString aStr1;
bool lastRes = (aStrBuf1.makeStringAndClear() == aStr1 ); bool lastRes = aStrBuf1.makeStringAndClear().isEmpty();
CPPUNIT_ASSERT_MESSAGE CPPUNIT_ASSERT_MESSAGE
( (
@ -236,9 +235,8 @@ namespace rtl_OStringBuffer
void makeStringAndClear_002() void makeStringAndClear_002()
{ {
OStringBuffer aStrBuf2(26); OStringBuffer aStrBuf2(26);
OString aStr2;
bool lastRes = (aStrBuf2.makeStringAndClear() == aStr2 ); bool lastRes = aStrBuf2.makeStringAndClear().isEmpty();
CPPUNIT_ASSERT_MESSAGE CPPUNIT_ASSERT_MESSAGE
( (
@ -975,7 +973,6 @@ namespace rtl_OStringBuffer
{ {
OStringBuffer aStrBuf( arrOUS[0] ); OStringBuffer aStrBuf( arrOUS[0] );
sal_Int32 expVal1 = 0; sal_Int32 expVal1 = 0;
OString expVal2;
sal_Int32 expVal3 = 32; sal_Int32 expVal3 = 32;
sal_Int32 input = 0; sal_Int32 input = 0;
@ -984,7 +981,7 @@ namespace rtl_OStringBuffer
CPPUNIT_ASSERT_MESSAGE CPPUNIT_ASSERT_MESSAGE
( (
"newLength equal to 0", "newLength equal to 0",
aStrBuf.getStr() == expVal2 && aStrBuf.getStr()[0] == '\0' &&
aStrBuf.getLength() == expVal1 && aStrBuf.getLength() == expVal1 &&
aStrBuf.getCapacity() == expVal3 aStrBuf.getCapacity() == expVal3
); );
@ -1035,7 +1032,6 @@ namespace rtl_OStringBuffer
{ {
OStringBuffer aStrBuf( arrOUS[1] ); OStringBuffer aStrBuf( arrOUS[1] );
sal_Int32 expVal1 = 0; sal_Int32 expVal1 = 0;
OString expVal2;
sal_Int32 expVal3 = 17; sal_Int32 expVal3 = 17;
sal_Int32 input = 0; sal_Int32 input = 0;
@ -1044,7 +1040,7 @@ namespace rtl_OStringBuffer
CPPUNIT_ASSERT_MESSAGE CPPUNIT_ASSERT_MESSAGE
( (
"newLength less than the length of OUStringBuffer(1)", "newLength less than the length of OUStringBuffer(1)",
aStrBuf.getStr() == expVal2 && aStrBuf.getStr()[0] == '\0' &&
aStrBuf.getLength() == expVal1 && aStrBuf.getLength() == expVal1 &&
aStrBuf.getCapacity() == expVal3 aStrBuf.getCapacity() == expVal3
); );
@ -1055,7 +1051,6 @@ namespace rtl_OStringBuffer
{ {
OStringBuffer aStrBuf( arrOUS[2] ); OStringBuffer aStrBuf( arrOUS[2] );
sal_Int32 expVal1 = 20; sal_Int32 expVal1 = 20;
OString expVal2;
sal_Int32 expVal3 = 20; sal_Int32 expVal3 = 20;
sal_Int32 input = 20; sal_Int32 input = 20;
@ -1064,7 +1059,7 @@ namespace rtl_OStringBuffer
CPPUNIT_ASSERT_MESSAGE CPPUNIT_ASSERT_MESSAGE
( (
"newLength more than the capacity of OStringBuffer()", "newLength more than the capacity of OStringBuffer()",
aStrBuf.getStr() == expVal2 && aStrBuf.getStr()[0] == '\0' &&
aStrBuf.getLength() == expVal1 && aStrBuf.getLength() == expVal1 &&
aStrBuf.getCapacity() == expVal3 aStrBuf.getCapacity() == expVal3
); );
@ -1075,7 +1070,6 @@ namespace rtl_OStringBuffer
{ {
OStringBuffer aStrBuf( arrOUS[2] ); OStringBuffer aStrBuf( arrOUS[2] );
sal_Int32 expVal1 = 3; sal_Int32 expVal1 = 3;
OString expVal2;
sal_Int32 expVal3 = 16; sal_Int32 expVal3 = 16;
sal_Int32 input = 3; sal_Int32 input = 3;
@ -1084,7 +1078,7 @@ namespace rtl_OStringBuffer
CPPUNIT_ASSERT_MESSAGE CPPUNIT_ASSERT_MESSAGE
( (
"newLength more than the length of OStringBuffer()", "newLength more than the length of OStringBuffer()",
aStrBuf.getStr() == expVal2 && aStrBuf.getStr()[0] == '\0' &&
aStrBuf.getLength() == expVal1 && aStrBuf.getLength() == expVal1 &&
aStrBuf.getCapacity() == expVal3 aStrBuf.getCapacity() == expVal3
); );
@ -1095,7 +1089,6 @@ namespace rtl_OStringBuffer
{ {
OStringBuffer aStrBuf( arrOUS[2] ); OStringBuffer aStrBuf( arrOUS[2] );
sal_Int32 expVal1 = 0; sal_Int32 expVal1 = 0;
OString expVal2;
sal_Int32 expVal3 = 16; sal_Int32 expVal3 = 16;
sal_Int32 input = 0; sal_Int32 input = 0;
@ -1104,7 +1097,7 @@ namespace rtl_OStringBuffer
CPPUNIT_ASSERT_MESSAGE CPPUNIT_ASSERT_MESSAGE
( (
"newLength more than the length of OStringBuffer()", "newLength more than the length of OStringBuffer()",
aStrBuf.getStr() == expVal2 && aStrBuf.getStr()[0] == '\0' &&
aStrBuf.getLength() == expVal1 && aStrBuf.getLength() == expVal1 &&
aStrBuf.getCapacity() == expVal3 aStrBuf.getCapacity() == expVal3
); );
@ -1115,7 +1108,6 @@ namespace rtl_OStringBuffer
{ {
OStringBuffer aStrBuf( arrOUS[3] ); OStringBuffer aStrBuf( arrOUS[3] );
sal_Int32 expVal1 = 20; sal_Int32 expVal1 = 20;
OString expVal2;
sal_Int32 expVal3 = 20; sal_Int32 expVal3 = 20;
sal_Int32 input = 20; sal_Int32 input = 20;
@ -1124,7 +1116,7 @@ namespace rtl_OStringBuffer
CPPUNIT_ASSERT_MESSAGE CPPUNIT_ASSERT_MESSAGE
( (
"newLength more than the capacity of OStringBuffer("")", "newLength more than the capacity of OStringBuffer("")",
aStrBuf.getStr() == expVal2 && aStrBuf.getStr()[0] == '\0' &&
aStrBuf.getLength() == expVal1 && aStrBuf.getLength() == expVal1 &&
aStrBuf.getCapacity() == expVal3 aStrBuf.getCapacity() == expVal3
); );
@ -1135,7 +1127,6 @@ namespace rtl_OStringBuffer
{ {
OStringBuffer aStrBuf( arrOUS[3] ); OStringBuffer aStrBuf( arrOUS[3] );
sal_Int32 expVal1 = 5; sal_Int32 expVal1 = 5;
OString expVal2;
sal_Int32 expVal3 = 16; sal_Int32 expVal3 = 16;
sal_Int32 input = 5; sal_Int32 input = 5;
@ -1144,7 +1135,7 @@ namespace rtl_OStringBuffer
CPPUNIT_ASSERT_MESSAGE CPPUNIT_ASSERT_MESSAGE
( (
"newLength more than the length of OStringBuffer("")", "newLength more than the length of OStringBuffer("")",
aStrBuf.getStr() == expVal2 && aStrBuf.getStr()[0] == '\0' &&
aStrBuf.getLength() == expVal1 && aStrBuf.getLength() == expVal1 &&
aStrBuf.getCapacity() == expVal3 aStrBuf.getCapacity() == expVal3
); );
@ -1155,7 +1146,6 @@ namespace rtl_OStringBuffer
{ {
OStringBuffer aStrBuf( arrOUS[3] ); OStringBuffer aStrBuf( arrOUS[3] );
sal_Int32 expVal1 = 0; sal_Int32 expVal1 = 0;
OString expVal2;
sal_Int32 expVal3 = 16; sal_Int32 expVal3 = 16;
sal_Int32 input = 0; sal_Int32 input = 0;
@ -1164,7 +1154,7 @@ namespace rtl_OStringBuffer
CPPUNIT_ASSERT_MESSAGE CPPUNIT_ASSERT_MESSAGE
( (
"newLength less than the length of OStringBuffer("")", "newLength less than the length of OStringBuffer("")",
aStrBuf.getStr() == expVal2 && aStrBuf.getStr()[0] == '\0' &&
aStrBuf.getLength() == expVal1 && aStrBuf.getLength() == expVal1 &&
aStrBuf.getCapacity() == expVal3 aStrBuf.getCapacity() == expVal3
); );
@ -1175,7 +1165,6 @@ namespace rtl_OStringBuffer
{ {
OStringBuffer aStrBuf( arrOUS[4] ); OStringBuffer aStrBuf( arrOUS[4] );
sal_Int32 expVal1 = 20; sal_Int32 expVal1 = 20;
OString expVal2;
sal_Int32 expVal3 = 20; sal_Int32 expVal3 = 20;
sal_Int32 input = 20; sal_Int32 input = 20;
@ -1184,7 +1173,7 @@ namespace rtl_OStringBuffer
CPPUNIT_ASSERT_MESSAGE CPPUNIT_ASSERT_MESSAGE
( (
"newLength more than the length of OStringBuffer(\0)", "newLength more than the length of OStringBuffer(\0)",
aStrBuf.getStr() == expVal2 && aStrBuf.getStr()[0] == '\0' &&
aStrBuf.getLength() == expVal1 && aStrBuf.getLength() == expVal1 &&
aStrBuf.getCapacity() == expVal3 aStrBuf.getCapacity() == expVal3
); );
@ -1195,7 +1184,6 @@ namespace rtl_OStringBuffer
{ {
OStringBuffer aStrBuf( arrOUS[4] ); OStringBuffer aStrBuf( arrOUS[4] );
sal_Int32 expVal1 = 5; sal_Int32 expVal1 = 5;
OString expVal2;
sal_Int32 expVal3 = 17; sal_Int32 expVal3 = 17;
sal_Int32 input = 5; sal_Int32 input = 5;
@ -1204,7 +1192,7 @@ namespace rtl_OStringBuffer
CPPUNIT_ASSERT_MESSAGE CPPUNIT_ASSERT_MESSAGE
( (
"newLength more than the length of OStringBuffer(\0)", "newLength more than the length of OStringBuffer(\0)",
aStrBuf.getStr() == expVal2 && aStrBuf.getStr()[0] == '\0' &&
aStrBuf.getLength() == expVal1 && aStrBuf.getLength() == expVal1 &&
aStrBuf.getCapacity() == expVal3 aStrBuf.getCapacity() == expVal3
); );
@ -1215,7 +1203,6 @@ namespace rtl_OStringBuffer
{ {
OStringBuffer aStrBuf( arrOUS[4] ); OStringBuffer aStrBuf( arrOUS[4] );
sal_Int32 expVal1 = 0; sal_Int32 expVal1 = 0;
OString expVal2;
sal_Int32 expVal3 = 17; sal_Int32 expVal3 = 17;
sal_Int32 input = 0; sal_Int32 input = 0;
@ -1224,7 +1211,7 @@ namespace rtl_OStringBuffer
CPPUNIT_ASSERT_MESSAGE CPPUNIT_ASSERT_MESSAGE
( (
"newLength less than the length of OStringBuffer(\0)", "newLength less than the length of OStringBuffer(\0)",
aStrBuf.getStr() == expVal2 && aStrBuf.getStr()[0] == '\0' &&
aStrBuf.getLength() == expVal1 && aStrBuf.getLength() == expVal1 &&
aStrBuf.getCapacity() == expVal3 aStrBuf.getCapacity() == expVal3
); );
@ -1315,7 +1302,6 @@ namespace rtl_OStringBuffer
{ {
OStringBuffer aStrBuf( arrOUS[5] ); OStringBuffer aStrBuf( arrOUS[5] );
sal_Int32 expVal1 = 0; sal_Int32 expVal1 = 0;
OString expVal2;
sal_Int32 expVal3 = 48; sal_Int32 expVal3 = 48;
sal_Int32 input = 0; sal_Int32 input = 0;
@ -1324,7 +1310,7 @@ namespace rtl_OStringBuffer
CPPUNIT_ASSERT_MESSAGE CPPUNIT_ASSERT_MESSAGE
( (
"newLength equal to 0", "newLength equal to 0",
aStrBuf.getStr() == expVal2 && aStrBuf.getStr()[0] == '\0' &&
aStrBuf.getLength() == expVal1 && aStrBuf.getLength() == expVal1 &&
aStrBuf.getCapacity() == expVal3 aStrBuf.getCapacity() == expVal3
); );
@ -1443,6 +1429,8 @@ namespace rtl_OStringBuffer
{ {
OString arrOUS[5]; OString arrOUS[5];
OString empty; // silence loplugin
public: public:
void setUp() override void setUp() override
{ {
@ -1508,9 +1496,8 @@ namespace rtl_OStringBuffer
{ {
OString expVal( kTestStr7 ); OString expVal( kTestStr7 );
OStringBuffer aStrBuf( arrOUS[0] ); OStringBuffer aStrBuf( arrOUS[0] );
OString input2;
aStrBuf.append( input2 ); aStrBuf.append( empty );
CPPUNIT_ASSERT_MESSAGE CPPUNIT_ASSERT_MESSAGE
( (
@ -1576,9 +1563,8 @@ namespace rtl_OStringBuffer
{ {
OString expVal; OString expVal;
OStringBuffer aStrBuf( arrOUS[1] ); OStringBuffer aStrBuf( arrOUS[1] );
OString input2;
aStrBuf.append( input2 ); aStrBuf.append( empty );
CPPUNIT_ASSERT_MESSAGE CPPUNIT_ASSERT_MESSAGE
( (
@ -1644,9 +1630,8 @@ namespace rtl_OStringBuffer
{ {
OString expVal; OString expVal;
OStringBuffer aStrBuf( arrOUS[2] ); OStringBuffer aStrBuf( arrOUS[2] );
OString input2;
aStrBuf.append( input2 ); aStrBuf.append( empty );
CPPUNIT_ASSERT_MESSAGE CPPUNIT_ASSERT_MESSAGE
( (
@ -1712,9 +1697,8 @@ namespace rtl_OStringBuffer
{ {
OString expVal; OString expVal;
OStringBuffer aStrBuf( arrOUS[3] ); OStringBuffer aStrBuf( arrOUS[3] );
OString input2;
aStrBuf.append( input2 ); aStrBuf.append( empty );
CPPUNIT_ASSERT_MESSAGE CPPUNIT_ASSERT_MESSAGE
( (
@ -1780,9 +1764,8 @@ namespace rtl_OStringBuffer
{ {
OString expVal( kTestStr28 ); OString expVal( kTestStr28 );
OStringBuffer aStrBuf( arrOUS[4] ); OStringBuffer aStrBuf( arrOUS[4] );
OString input2;
aStrBuf.append( input2 ); aStrBuf.append( empty );
CPPUNIT_ASSERT_MESSAGE CPPUNIT_ASSERT_MESSAGE
( (

View File

@ -194,22 +194,16 @@ public:
void testEqual() void testEqual()
{ {
{ {
OString aMsg1 = sSampleString; OString aSum1 = getDigest(sSampleString, rtl_Digest_AlgorithmMD5);
OString aMsg2 = sSampleString; OString aSum2 = getDigest(sSampleString, rtl_Digest_AlgorithmMD5);
OString aSum1 = getDigest(aMsg1, rtl_Digest_AlgorithmMD5);
OString aSum2 = getDigest(aMsg2, rtl_Digest_AlgorithmMD5);
CPPUNIT_ASSERT_MESSAGE("md5sum must have a length", aSum1.getLength() == 32 && aSum2.getLength() == 32 ); CPPUNIT_ASSERT_MESSAGE("md5sum must have a length", aSum1.getLength() == 32 && aSum2.getLength() == 32 );
CPPUNIT_ASSERT_EQUAL_MESSAGE("source is the same, dest must be also the same", aSum1, aSum2); CPPUNIT_ASSERT_EQUAL_MESSAGE("source is the same, dest must be also the same", aSum1, aSum2);
} }
{ {
OString aMsg1 = sSampleString; OString aSum1 = getDigest(sSampleString, rtl_Digest_AlgorithmMD5);
OString aMsg2 = sSampleString_only_one_diff; OString aSum2 = getDigest(sSampleString_only_one_diff, rtl_Digest_AlgorithmMD5);
OString aSum1 = getDigest(aMsg1, rtl_Digest_AlgorithmMD5);
OString aSum2 = getDigest(aMsg2, rtl_Digest_AlgorithmMD5);
CPPUNIT_ASSERT_MESSAGE("md5sum must have a length", aSum1.getLength() == 32 && aSum2.getLength() == 32 ); CPPUNIT_ASSERT_MESSAGE("md5sum must have a length", aSum1.getLength() == 32 && aSum2.getLength() == 32 );
CPPUNIT_ASSERT_MESSAGE("differ only in one char", aSum1 != aSum2); CPPUNIT_ASSERT_MESSAGE("differ only in one char", aSum1 != aSum2);
@ -380,13 +374,11 @@ public:
std::unique_ptr<sal_uInt8[]> pResult(new sal_uInt8[RTL_DIGEST_LENGTH_SHA1]); std::unique_ptr<sal_uInt8[]> pResult(new sal_uInt8[RTL_DIGEST_LENGTH_SHA1]);
OString sExpected = "06f460d693aecdd3b5cbe8365408eccfc570f32a";
rtl_digest_SHA1(aData, sizeof(aData), pResult.get(), RTL_DIGEST_LENGTH_SHA1); rtl_digest_SHA1(aData, sizeof(aData), pResult.get(), RTL_DIGEST_LENGTH_SHA1);
OString sKey = createHex(pResult.get(), RTL_DIGEST_LENGTH_SHA1); OString sKey = createHex(pResult.get(), RTL_DIGEST_LENGTH_SHA1);
CPPUNIT_ASSERT_EQUAL(sExpected, sKey); CPPUNIT_ASSERT_EQUAL(OString("06f460d693aecdd3b5cbe8365408eccfc570f32a"), sKey);
} }
// tdf#114939, verify that rtl_digest_SHA1 computes broken results for certain input (which // tdf#114939, verify that rtl_digest_SHA1 computes broken results for certain input (which

View File

@ -296,65 +296,53 @@ public:
void toDouble_test_3() void toDouble_test_3()
{ {
OString sValue("3"); toDouble_test("3");
toDouble_test(sValue);
} }
void toDouble_test_3_5() void toDouble_test_3_5()
{ {
OString sValue("3.5"); toDouble_test("3.5");
toDouble_test(sValue);
} }
void toDouble_test_3_0625() void toDouble_test_3_0625()
{ {
OString sValue("3.0625"); toDouble_test("3.0625");
toDouble_test(sValue);
} }
void toDouble_test_pi() void toDouble_test_pi()
{ {
// value from http://www.angio.net/pi/digits/50.txt // value from http://www.angio.net/pi/digits/50.txt
OString sValue("3.141592653589793238462643383279502884197169399375"); toDouble_test("3.141592653589793238462643383279502884197169399375");
toDouble_test(sValue);
} }
void toDouble_test_1() void toDouble_test_1()
{ {
OString sValue("1"); toDouble_test("1");
toDouble_test(sValue);
} }
void toDouble_test_10() void toDouble_test_10()
{ {
OString sValue("10"); toDouble_test("10");
toDouble_test(sValue);
} }
void toDouble_test_100() void toDouble_test_100()
{ {
OString sValue("100"); toDouble_test("100");
toDouble_test(sValue);
} }
void toDouble_test_1000() void toDouble_test_1000()
{ {
OString sValue("1000"); toDouble_test("1000");
toDouble_test(sValue);
} }
void toDouble_test_10000() void toDouble_test_10000()
{ {
OString sValue("10000"); toDouble_test("10000");
toDouble_test(sValue);
} }
void toDouble_test_1e99() void toDouble_test_1e99()
{ {
OString sValue("1e99"); toDouble_test("1e99");
toDouble_test(sValue);
} }
void toDouble_test_1e_n99() void toDouble_test_1e_n99()
{ {
OString sValue("1e-99"); toDouble_test("1e-99");
toDouble_test(sValue);
} }
void toDouble_test_1e308() void toDouble_test_1e308()
{ {
OString sValue("1e308"); toDouble_test("1e308");
toDouble_test(sValue);
} }
// Change the following lines only, if you add, remove or rename // Change the following lines only, if you add, remove or rename
@ -424,75 +412,61 @@ public:
void toFloat_test_3() void toFloat_test_3()
{ {
OString sValue("3"); toFloat_test("3");
toFloat_test(sValue);
} }
void toFloat_test_3_5() void toFloat_test_3_5()
{ {
OString sValue("3.5"); toFloat_test("3.5");
toFloat_test(sValue);
} }
void toFloat_test_3_0625() void toFloat_test_3_0625()
{ {
OString sValue("3.0625"); toFloat_test("3.0625");
toFloat_test(sValue);
} }
void toFloat_test_3_0625_e() void toFloat_test_3_0625_e()
{ {
OString sValue("3.0625e-4"); toFloat_test("3.0625e-4");
toFloat_test(sValue);
} }
void toFloat_test_pi() void toFloat_test_pi()
{ {
// value from http://www.angio.net/pi/digits/50.txt // value from http://www.angio.net/pi/digits/50.txt
OString sValue("3.141592653589793238462643383279502884197169399375"); toFloat_test("3.141592653589793238462643383279502884197169399375");
toFloat_test(sValue);
} }
void toFloat_test_1() void toFloat_test_1()
{ {
OString sValue("1"); toFloat_test("1");
toFloat_test(sValue);
} }
void toFloat_test_10() void toFloat_test_10()
{ {
OString sValue("10"); toFloat_test("10");
toFloat_test(sValue);
} }
void toFloat_test_100() void toFloat_test_100()
{ {
OString sValue("100"); toFloat_test("100");
toFloat_test(sValue);
} }
void toFloat_test_1000() void toFloat_test_1000()
{ {
OString sValue("1000"); toFloat_test("1000");
toFloat_test(sValue);
} }
void toFloat_test_10000() void toFloat_test_10000()
{ {
OString sValue("10000"); toFloat_test("10000");
toFloat_test(sValue);
} }
void toFloat_test_mix() void toFloat_test_mix()
{ {
OString sValue("456789321455.123456789012"); toFloat_test("456789321455.123456789012");
toFloat_test(sValue);
} }
void toFloat_test_1e99() void toFloat_test_1e99()
{ {
OString sValue("1e99"); toFloat_test("1e99");
toFloat_test(sValue);
} }
void toFloat_test_1e_n99() void toFloat_test_1e_n99()
{ {
OString sValue("1e-9"); toFloat_test("1e-9");
toFloat_test(sValue);
} }
void toFloat_test_1e308() void toFloat_test_1e308()
{ {
OString sValue("1e308"); toFloat_test("1e308");
toFloat_test(sValue);
} }
// Change the following lines only, if you add, remove or rename // Change the following lines only, if you add, remove or rename

View File

@ -47,8 +47,7 @@ namespace Stringtest
void test_FromUTF8_001() void test_FromUTF8_001()
{ {
// string --> ustring // string --> ustring
OString sStrUTF8("h%C3%A4llo"); OUString suStrUTF8 = OStringToOUString("h%C3%A4llo", RTL_TEXTENCODING_ASCII_US);
OUString suStrUTF8 = OStringToOUString(sStrUTF8, RTL_TEXTENCODING_ASCII_US);
// UTF8 --> real ustring // UTF8 --> real ustring
OUString suStr_UriDecodeToIuri = rtl::Uri::decode(suStrUTF8, rtl_UriDecodeToIuri, RTL_TEXTENCODING_UTF8); OUString suStr_UriDecodeToIuri = rtl::Uri::decode(suStrUTF8, rtl_UriDecodeToIuri, RTL_TEXTENCODING_UTF8);

View File

@ -407,9 +407,8 @@ void ScCopyPasteTest::testTdf107394()
ScImportExport aObj(rDoc, ScAddress(0,0,0)); ScImportExport aObj(rDoc, ScAddress(0,0,0));
aObj.SetImportBroadcast(true); aObj.SetImportBroadcast(true);
OString aHTML("<pre>First\nVery long sentence.</pre>");
SvMemoryStream aStream; SvMemoryStream aStream;
aStream.WriteOString(aHTML); aStream.WriteOString("<pre>First\nVery long sentence.</pre>");
aStream.Seek(0); aStream.Seek(0);
CPPUNIT_ASSERT(aObj.ImportStream(aStream, OUString(), SotClipboardFormatId::HTML)); CPPUNIT_ASSERT(aObj.ImportStream(aStream, OUString(), SotClipboardFormatId::HTML));

View File

@ -193,10 +193,9 @@ VclPtr<VclAbstractDialog> ScScreenshotTest::createDialogByID(sal_uInt32 nID)
case 8: // "modules/scalc/ui/inputstringdialog.ui" case 8: // "modules/scalc/ui/inputstringdialog.ui"
{ {
const OString aEmpty("");
pReturnDialog = mpFact->CreateScStringInputDlg(mpViewShell->GetFrameWeld(), pReturnDialog = mpFact->CreateScStringInputDlg(mpViewShell->GetFrameWeld(),
ScResId(SCSTR_APDTABLE), ScResId(SCSTR_NAME), ScResId(SCSTR_APDTABLE), ScResId(SCSTR_NAME),
aDefaultSheetName, "modules/scalc/ui/inputstringdialog/InputStringDialog", aEmpty ); aDefaultSheetName, "modules/scalc/ui/inputstringdialog/InputStringDialog", "" );
break; break;
} }

View File

@ -5124,9 +5124,11 @@ void ScExportTest::testRotatedImageODS()
xmlDocUniquePtr pXmlDoc = XPathHelper::parseExport(pTemp, m_xSFactory, "content.xml"); xmlDocUniquePtr pXmlDoc = XPathHelper::parseExport(pTemp, m_xSFactory, "content.xml");
CPPUNIT_ASSERT(pXmlDoc); CPPUNIT_ASSERT(pXmlDoc);
const OString sPathStart = "/office:document-content/office:body/office:spreadsheet/" const OUString sTransform = getXPath(
"table:table/table:shapes/draw:frame"; pXmlDoc,
const OUString sTransform = getXPath(pXmlDoc, sPathStart, "transform"); "/office:document-content/office:body/office:spreadsheet/"
"table:table/table:shapes/draw:frame",
"transform");
// Attribute transform has the structure skew (...) rotate (...) translate (x y) // Attribute transform has the structure skew (...) rotate (...) translate (x y)
// parts are separated by blank // parts are separated by blank
OUString sTranslate(sTransform.copy(sTransform.lastIndexOf('('))); OUString sTranslate(sTransform.copy(sTransform.lastIndexOf('(')));

View File

@ -634,9 +634,7 @@ void SdDialogsTest::openAnyDialog()
// //
// Take any example here, it's only for demonstration - using // Take any example here, it's only for demonstration - using
// even a known one to demonstrate the fallback possibility // even a known one to demonstrate the fallback possibility
const OString aUIXMLDescription("modules/sdraw/ui/breakdialog.ui"); dumpDialogToPath("modules/sdraw/ui/breakdialog.ui");
dumpDialogToPath(aUIXMLDescription);
} }
} }

View File

@ -1100,8 +1100,7 @@ void SdOOXMLExportTest1::testDashOnHairline()
xDocShRef->DoClose(); xDocShRef->DoClose();
xmlDocUniquePtr pXmlDoc = parseExport(tempFile, "ppt/slides/slide1.xml"); xmlDocUniquePtr pXmlDoc = parseExport(tempFile, "ppt/slides/slide1.xml");
const OString sXmlPath = "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:ln/a:custDash/a:ds"; assertXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:ln/a:custDash/a:ds", 11);
assertXPath(pXmlDoc, sXmlPath, 11);
} }
void SdOOXMLExportTest1::testCustomshapeBitmapfillSrcrect() void SdOOXMLExportTest1::testCustomshapeBitmapfillSrcrect()
@ -1170,8 +1169,7 @@ void SdOOXMLExportTest1::testTdf128345FullTransparentGradient()
// Make sure the shape has no fill. Without the patch, fill was solid red. // Make sure the shape has no fill. Without the patch, fill was solid red.
xmlDocUniquePtr pXmlDoc = parseExport(tempFile, "ppt/slides/slide1.xml"); xmlDocUniquePtr pXmlDoc = parseExport(tempFile, "ppt/slides/slide1.xml");
const OString sPathStart("//p:sld/p:cSld/p:spTree/p:sp/p:spPr"); assertXPath(pXmlDoc, "//p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:noFill");
assertXPath(pXmlDoc, sPathStart + "/a:noFill");
} }
void SdOOXMLExportTest1::testTdf128345GradientLinear() void SdOOXMLExportTest1::testTdf128345GradientLinear()

View File

@ -2685,8 +2685,8 @@ void SdOOXMLExportTest2::testTdf1225573_FontWorkScaleX()
// Error was, that attribute 'fromWordArt' was ignored // Error was, that attribute 'fromWordArt' was ignored
// ensure, resulting pptx has fromWordArt="1" on textArchDown shape // ensure, resulting pptx has fromWordArt="1" on textArchDown shape
xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
const OString sPathStart("/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:bodyPr"); assertXPath(
assertXPath(pXmlDocContent, sPathStart + "[@fromWordArt='1']"); pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:bodyPr[@fromWordArt='1']");
// Error was, that text in legacy shapes of category "Follow Path" was not scaled to the path. // Error was, that text in legacy shapes of category "Follow Path" was not scaled to the path.
uno::Reference<beans::XPropertySet> xShapeArchProps(getShapeFromPage(0, 0, xDocShRef)); uno::Reference<beans::XPropertySet> xShapeArchProps(getShapeFromPage(0, 0, xDocShRef));

View File

@ -1611,10 +1611,14 @@ void SdTiledRenderingTest::testTdf104405()
// check that the first cell has acquired the resulting vertical style // check that the first cell has acquired the resulting vertical style
xmlDocUniquePtr pXmlDoc = parseXmlDump(); xmlDocUniquePtr pXmlDoc = parseXmlDump();
OString aPrefix = "/SdDrawDocument/SdrModel/SdPage/SdrObjList/SdrTableObj/SdrTableObjImpl"
"/TableModel/Cell[1]/DefaultProperties/SfxItemSet/SdrTextVertAdjustItem";
// the following name has a compiler-dependent part // the following name has a compiler-dependent part
CPPUNIT_ASSERT_EQUAL(OUString("2"), getXPath(pXmlDoc, aPrefix, "value")); CPPUNIT_ASSERT_EQUAL(
OUString("2"),
getXPath(
pXmlDoc,
"/SdDrawDocument/SdrModel/SdPage/SdrObjList/SdrTableObj/SdrTableObjImpl"
"/TableModel/Cell[1]/DefaultProperties/SfxItemSet/SdrTextVertAdjustItem",
"value"));
} }
void SdTiledRenderingTest::testTdf81754() void SdTiledRenderingTest::testTdf81754()

View File

@ -58,9 +58,8 @@ void Communicator::execute()
pTransmitter->addMessage( "LO_SERVER_SERVER_PAIRED\n\n", pTransmitter->addMessage( "LO_SERVER_SERVER_PAIRED\n\n",
Transmitter::PRIORITY_HIGH ); Transmitter::PRIORITY_HIGH );
OString aServerInformation = "LO_SERVER_INFO\n" LIBO_VERSION_DOTTED "\n\n"; pTransmitter->addMessage( "LO_SERVER_INFO\n" LIBO_VERSION_DOTTED "\n\n",
Transmitter::PRIORITY_HIGH );
pTransmitter->addMessage( aServerInformation, Transmitter::PRIORITY_HIGH );
Receiver aReceiver( pTransmitter.get() ); Receiver aReceiver( pTransmitter.get() );
try { try {

View File

@ -112,9 +112,8 @@ void SfxFrameHTMLWriter::Out_DocInfo( SvStream& rStrm, const OUString& rBaseURL,
if( pIndent ) if( pIndent )
rStrm.WriteCharPtr( pIndent ); rStrm.WriteCharPtr( pIndent );
OString sOut = "<" OOO_STRING_SVTOOLS_HTML_base " " rStrm.WriteOString( "<" OOO_STRING_SVTOOLS_HTML_base " "
OOO_STRING_SVTOOLS_HTML_O_target "=\""; OOO_STRING_SVTOOLS_HTML_O_target "=\"" );
rStrm.WriteOString( sOut );
HTMLOutFuncs::Out_String( rStrm, rTarget, eDestEnc, pNonConvertableChars ) HTMLOutFuncs::Out_String( rStrm, rTarget, eDestEnc, pNonConvertableChars )
.WriteCharPtr( "\">" ); .WriteCharPtr( "\">" );
} }

View File

@ -810,9 +810,11 @@ CPPUNIT_TEST_FIXTURE(SwModelTestBase, testSemiTransparentText)
mbExported = true; mbExported = true;
xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
CPPUNIT_ASSERT(pXmlDoc); CPPUNIT_ASSERT(pXmlDoc);
OString aXPath double fValue = getXPath(
= "/w:document/w:body/w:p/w:r/w:rPr/w14:textFill/w14:solidFill/w14:srgbClr/w14:alpha"; pXmlDoc,
double fValue = getXPath(pXmlDoc, aXPath, "val").toDouble(); "/w:document/w:body/w:p/w:r/w:rPr/w14:textFill/w14:solidFill/w14:srgbClr/w14:alpha",
"val")
.toDouble();
sal_Int16 nActual = basegfx::fround(fValue / oox::drawingml::PER_PERCENT); sal_Int16 nActual = basegfx::fround(fValue / oox::drawingml::PER_PERCENT);
// Without the accompanying fix in place, this test would have failed, as the w14:textFill // Without the accompanying fix in place, this test would have failed, as the w14:textFill

View File

@ -7463,13 +7463,9 @@ void SwUiWriterTest::testInconsistentBookmark()
{ {
const OString aPath("/office:document-content/office:body/office:text/text:p"); const OString aPath("/office:document-content/office:body/office:text/text:p");
const OString aTagBookmarkStart("bookmark-start"); const int pos1 = getXPathPosition(pXmlDoc, aPath, "bookmark-start");
const OString aTagControl("control"); const int pos2 = getXPathPosition(pXmlDoc, aPath, "control");
const OString aTagBookmarkEnd("bookmark-end"); const int pos3 = getXPathPosition(pXmlDoc, aPath, "bookmark-end");
const int pos1 = getXPathPosition(pXmlDoc, aPath, aTagBookmarkStart);
const int pos2 = getXPathPosition(pXmlDoc, aPath, aTagControl);
const int pos3 = getXPathPosition(pXmlDoc, aPath, aTagBookmarkEnd);
CPPUNIT_ASSERT_GREATER(pos1, pos2); CPPUNIT_ASSERT_GREATER(pos1, pos2);
CPPUNIT_ASSERT_GREATER(pos2, pos3); CPPUNIT_ASSERT_GREATER(pos2, pos3);

View File

@ -1273,9 +1273,7 @@ void SwHTMLWriter::OutBackground( const SvxBrushItem *pBrushItem, bool bGraphic
/// only checking, if transparency is not set. /// only checking, if transparency is not set.
if( rBackColor != COL_TRANSPARENT ) if( rBackColor != COL_TRANSPARENT )
{ {
OString sOut = Strm().WriteOString( " " OOO_STRING_SVTOOLS_HTML_O_bgcolor "=" );
" " OOO_STRING_SVTOOLS_HTML_O_bgcolor "=";
Strm().WriteOString( sOut );
HTMLOutFuncs::Out_Color( Strm(), rBackColor); HTMLOutFuncs::Out_Color( Strm(), rBackColor);
} }