summaryrefslogtreecommitdiff
path: root/sc/qa/unit/subsequent_filters-test.cxx
diff options
context:
space:
mode:
authorSzabolcs Toth <toth.szabolcs@nisz.hu>2020-09-16 14:41:24 +0200
committerLászló Németh <nemeth@numbertext.org>2020-09-24 12:54:14 +0200
commit8c23be49fb5a9044989532e6e20feb1e3ff64f2b (patch)
tree9479b0ea74d33dc582d8b9c7266cc3e9281dea74 /sc/qa/unit/subsequent_filters-test.cxx
parent4a899a5f8a72ea29a6919316afe3627de9f33e95 (diff)
tdf#106197 XLSX shape import: keep text upright
Handle and grab-bag attribute upright to keep text upright regardless of shape rotation, fixing the text direction after import and after a round-trip. Co-authored-by: Balázs Regényi Change-Id: If4c73aeaebad55af967cea894a94756068ca3766 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102870 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sc/qa/unit/subsequent_filters-test.cxx')
-rw-r--r--sc/qa/unit/subsequent_filters-test.cxx45
1 files changed, 45 insertions, 0 deletions
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 203460654d17..4b8d999dc787 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -279,6 +279,7 @@ public:
void testPreviewMissingObjLink();
void testShapeRotationImport();
void testShapeDisplacementOnRotationImport();
+ void testTextBoxBodyUpright();
CPPUNIT_TEST_SUITE(ScFiltersTest);
CPPUNIT_TEST(testBooleanFormatXLSX);
@@ -448,6 +449,7 @@ public:
CPPUNIT_TEST(testPreviewMissingObjLink);
CPPUNIT_TEST(testShapeRotationImport);
CPPUNIT_TEST(testShapeDisplacementOnRotationImport);
+ CPPUNIT_TEST(testTextBoxBodyUpright);
CPPUNIT_TEST_SUITE_END();
@@ -4910,6 +4912,49 @@ void ScFiltersTest::testShapeDisplacementOnRotationImport()
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aRectangle.Y);
}
+void ScFiltersTest::testTextBoxBodyUpright()
+{
+ // tdf#106197 We should import the "upright" attribute of txBody.
+ ScDocShellRef xDocSh = loadDoc("tdf106197_import_upright.", FORMAT_XLSX);
+ CPPUNIT_ASSERT_MESSAGE("Failed to load testTextBoxBodyUpright.xlsx", xDocSh.is());
+
+ uno::Reference<drawing::XDrawPagesSupplier> xDoc(xDocSh->GetModel(), uno::UNO_QUERY_THROW);
+ uno::Reference<drawing::XDrawPage> xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW);
+ uno::Reference<drawing::XShape> xShape(xPage->getByIndex(0), uno::UNO_QUERY_THROW);
+ uno::Reference<beans::XPropertySet> xShapeProperties(xShape, uno::UNO_QUERY_THROW);
+
+ // Check that we imported "Upright".
+ bool isUpright = false;
+ if (xShapeProperties->getPropertySetInfo()->hasPropertyByName("InteropGrabBag"))
+ {
+ uno::Sequence<beans::PropertyValue> aGrabBag;
+ xShapeProperties->getPropertyValue("InteropGrabBag") >>= aGrabBag;
+ for (auto& aProp : aGrabBag)
+ {
+ if (aProp.Name == "Upright")
+ {
+ aProp.Value >>= isUpright;
+ break;
+ }
+ }
+ }
+ CPPUNIT_ASSERT_EQUAL(true, isUpright);
+
+ // Check the new textRotateAngle.
+ sal_Int32 nAngle;
+ uno::Any aGeom = xShapeProperties->getPropertyValue("CustomShapeGeometry");
+ auto aGeomSeq = aGeom.get<Sequence<beans::PropertyValue>>();
+ for (const auto& aProp : std::as_const(aGeomSeq))
+ {
+ if (aProp.Name == "TextPreRotateAngle")
+ {
+ aProp.Value >>= nAngle;
+ break;
+ }
+ }
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(90), nAngle);
+}
+
ScFiltersTest::ScFiltersTest()
: ScBootstrapFixture( "sc/qa/unit/data" )
{