sc/qa/unit/tiledrendering/data/select-row-cols.ods |binary sc/qa/unit/tiledrendering/tiledrendering.cxx | 69 +++++++++++++++++++++ sc/source/ui/unoobj/docuno.cxx | 2 3 files changed, 70 insertions(+), 1 deletion(-)
New commits: commit 91904157beb804e78570dedf3b57fc8407d399a8 Author: Pranav Kant <pran...@collabora.com> Date: Wed Mar 16 22:13:08 2016 +0530 sc tiled rendering: Unit test for extended .uno:SelectRow/Column Change-Id: I0ab89598af28e12bebc271f7bce1e6166cb83b1d diff --git a/sc/qa/unit/tiledrendering/data/select-row-cols.ods b/sc/qa/unit/tiledrendering/data/select-row-cols.ods new file mode 100644 index 0000000..83cb8f1 Binary files /dev/null and b/sc/qa/unit/tiledrendering/data/select-row-cols.ods differ diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index ecfd605..539fe18 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -46,11 +46,13 @@ public: virtual void tearDown() SAL_OVERRIDE; #if !defined(WNT) && !defined(MACOSX) + void testRowColumnSelections(); void testSortAscendingDescending(); #endif CPPUNIT_TEST_SUITE(ScTiledRenderingTest); #if !defined(WNT) && !defined(MACOSX) + CPPUNIT_TEST(testRowColumnSelections); CPPUNIT_TEST(testSortAscendingDescending); #endif CPPUNIT_TEST_SUITE_END(); @@ -150,6 +152,73 @@ void ScTiledRenderingTest::callbackImpl(int /*nType*/, const char* /*pPayload*/) } #endif +void ScTiledRenderingTest::testRowColumnSelections() +{ + comphelper::LibreOfficeKit::setActive(); + ScModelObj* pModelObj = createDoc("select-row-cols.ods"); + //ScDocument* pDoc = pModelObj->GetDocument(); + + uno::Sequence<beans::PropertyValue> aArgs(2); + + // Select the 5th row with no modifier + aArgs[0].Name = OUString::fromUtf8("Row"); + aArgs[0].Value <<= static_cast<sal_Int32>(5 - 1); + aArgs[1].Name = OUString::fromUtf8("Modifier"); + aArgs[1].Value <<= static_cast<sal_uInt16>(0); + comphelper::dispatchCommand(".uno:SelectRow", aArgs); + + // Check if it is selected + OString aUsedMimeType; + OString aResult = pModelObj->getTextSelection("text/plain;charset=utf-8", aUsedMimeType); + OString aExpected("1\t2\t3\t4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\n"); + CPPUNIT_ASSERT_EQUAL(aExpected, aResult); + + // Select the 10th row with shift modifier + aArgs[0].Name = OUString::fromUtf8("Row"); + aArgs[0].Value <<= static_cast<sal_Int32>(10 - 1); + aArgs[1].Name = OUString::fromUtf8("Modifier"); + aArgs[1].Value <<= static_cast<sal_uInt16>(KEY_SHIFT); + comphelper::dispatchCommand(".uno:SelectRow", aArgs); + + // Check if all the rows from 5th to 10th get selected + aResult = pModelObj->getTextSelection("text/plain;charset=utf-8", aUsedMimeType); + aExpected = "1\t2\t3\t4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\n2\t3\t4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\t22\n3\t4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\t22\t23\n4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\t22\t23\t24\n5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\t22\t23\t24\t25\n6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\t22\t23\t24\t25\t26\n"; + CPPUNIT_ASSERT_EQUAL(aExpected, aResult); + + // Select the 10th row with ctrl modifier + aArgs[0].Name = OUString::fromUtf8("Row"); + aArgs[0].Value <<= static_cast<sal_Int32>(13 - 1); + aArgs[1].Name = OUString::fromUtf8("Modifier"); + aArgs[1].Value <<= static_cast<sal_uInt16>(KEY_MOD1); + comphelper::dispatchCommand(".uno:SelectRow", aArgs); + + // When we copy this, we don't get anything useful, but we must not crash + // (used to happen) + aResult = pModelObj->getTextSelection("text/plain;charset=utf-8", aUsedMimeType); + CPPUNIT_ASSERT_EQUAL(OString(), aResult); + + // TODO check that we really selected what we wanted here + + // Select Column 5 with ctrl modifier + aArgs[0].Name = OUString::fromUtf8("Col"); + aArgs[0].Value <<= static_cast<sal_Int32>(5 - 1); + aArgs[1].Name = OUString::fromUtf8("Modifier"); + aArgs[1].Value <<= static_cast<sal_uInt16>(KEY_MOD1); + comphelper::dispatchCommand(".uno:SelectColumn", aArgs); + + // When we copy this, we don't get anything useful, but we must not crash + // (used to happen) + aResult = pModelObj->getTextSelection("text/plain;charset=utf-8", aUsedMimeType); + CPPUNIT_ASSERT_EQUAL(OString(), aResult); + + // TODO check that we really selected what we wanted here + + // TODO: Add test for negative selection: .uno:SelectRow/Column on already + // selected row/column should deselect it. + + comphelper::LibreOfficeKit::setActive(false); +} + void ScTiledRenderingTest::testSortAscendingDescending() { comphelper::LibreOfficeKit::setActive(); commit 1592f030f8cab535b7ad0516abca0e309f84d4a3 Author: Jan Holesovsky <ke...@collabora.com> Date: Fri Mar 18 16:23:26 2016 +0100 sc lok bccu#1602: Don't crash when the copy functionality is not allowed. Change-Id: I0fe5871782d5892f9eda201be042648a45b9f9d4 diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 6498fe0..184255c 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -753,7 +753,7 @@ OString ScModelObj::getTextSelection(const char* pMimeType, OString& rUsedMimeTy else aFlavor.DataType = cppu::UnoType< uno::Sequence<sal_Int8> >::get(); - if (!xTransferable->isDataFlavorSupported(aFlavor)) + if (!xTransferable.is() || !xTransferable->isDataFlavorSupported(aFlavor)) return OString(); uno::Any aAny(xTransferable->getTransferData(aFlavor)); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits