diff options
author | Henry Castro <hcastro@collabora.com> | 2017-10-19 22:47:17 -0400 |
---|---|---|
committer | Henry Castro <hcastro@collabora.com> | 2017-10-22 17:18:17 +0200 |
commit | 2fa424f40a185eb43d862a29abce07345695fcf3 (patch) | |
tree | 6d770158526a66d893e171cf56d53a31a6d1fcc6 /sc/qa | |
parent | 2460e7637f635727f4596f3e3d799eed434df082 (diff) |
sc lok: fix spell checking languages in Calc
Change-Id: Iadcc3b55a30ce2a2c785366fb3807ff6e4bda1fe
Reviewed-on: https://gerrit.libreoffice.org/43581
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Henry Castro <hcastro@collabora.com>
Diffstat (limited to 'sc/qa')
-rw-r--r-- | sc/qa/unit/tiledrendering/tiledrendering.cxx | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 1f56bba58179..bc477a044e64 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -85,6 +85,7 @@ public: void testInsertGraphicInvalidations(); void testDocumentSizeWithTwoViews(); void testDisableUndoRepair(); + void testLanguageStatus(); CPPUNIT_TEST_SUITE(ScTiledRenderingTest); CPPUNIT_TEST(testRowColumnSelections); @@ -112,6 +113,7 @@ public: CPPUNIT_TEST(testInsertGraphicInvalidations); CPPUNIT_TEST(testDocumentSizeWithTwoViews); CPPUNIT_TEST(testDisableUndoRepair); + CPPUNIT_TEST(testLanguageStatus); CPPUNIT_TEST_SUITE_END(); private: @@ -1412,6 +1414,55 @@ void ScTiledRenderingTest::testDisableUndoRepair() CPPUNIT_ASSERT_EQUAL(SfxItemState::SET, aSet2.GetItemState(SID_UNDO)); CPPUNIT_ASSERT(dynamic_cast< const SfxStringItem* >(aSet2.GetItem(SID_UNDO))); } + + comphelper::LibreOfficeKit::setActive(false); +} + +void ScTiledRenderingTest::testLanguageStatus() +{ + comphelper::LibreOfficeKit::setActive(); + ScModelObj* pModelObj = createDoc("small.ods"); + CPPUNIT_ASSERT(pModelObj); + ScDocShell* pDocSh = dynamic_cast< ScDocShell* >( pModelObj->GetEmbeddedObject() ); + CPPUNIT_ASSERT(pDocSh); + + // view #1 + SfxViewShell* pView1 = SfxViewShell::Current(); + + // view #2 + SfxLokHelper::createView(); + SfxViewShell* pView2 = SfxViewShell::Current(); + CPPUNIT_ASSERT(pView1 != pView2); + const OUString aLangBolivia("Spanish (Bolivia)"); + { + std::unique_ptr<SfxPoolItem> pItem1; + std::unique_ptr<SfxPoolItem> pItem2; + pView1->GetViewFrame()->GetBindings().QueryState(SID_LANGUAGE_STATUS, pItem1); + pView2->GetViewFrame()->GetBindings().QueryState(SID_LANGUAGE_STATUS, pItem2); + CPPUNIT_ASSERT(dynamic_cast< const SfxStringItem* >(pItem1.get())); + CPPUNIT_ASSERT(dynamic_cast< const SfxStringItem* >(pItem2.get())); + CPPUNIT_ASSERT(!dynamic_cast< const SfxStringItem* >(pItem1.get())->GetValue().isEmpty()); + CPPUNIT_ASSERT(!dynamic_cast< const SfxStringItem* >(pItem1.get())->GetValue().isEmpty()); + } + + { + SfxStringItem aLangString(SID_LANGUAGE_STATUS, "Default_Spanish (Bolivia)"); + pView1->GetViewFrame()->GetDispatcher()->ExecuteList(SID_LANGUAGE_STATUS, + SfxCallMode::SYNCHRON, { &aLangString }); + } + + { + std::unique_ptr<SfxPoolItem> pItem1; + std::unique_ptr<SfxPoolItem> pItem2; + pView1->GetViewFrame()->GetBindings().QueryState(SID_LANGUAGE_STATUS, pItem1); + pView2->GetViewFrame()->GetBindings().QueryState(SID_LANGUAGE_STATUS, pItem2); + CPPUNIT_ASSERT(dynamic_cast< const SfxStringItem* >(pItem1.get())); + CPPUNIT_ASSERT(dynamic_cast< const SfxStringItem* >(pItem2.get())); + CPPUNIT_ASSERT_EQUAL(aLangBolivia, dynamic_cast< const SfxStringItem* >(pItem1.get())->GetValue()); + CPPUNIT_ASSERT_EQUAL(aLangBolivia, dynamic_cast< const SfxStringItem* >(pItem1.get())->GetValue()); + } + + comphelper::LibreOfficeKit::setActive(false); } } |