diff options
Diffstat (limited to 'sc/qa/unit/tiledrendering/tiledrendering.cxx')
-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 8eaf06f7483d..32ccf698e872 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -77,6 +77,7 @@ public: void testInsertGraphicInvalidations(); void testDocumentSizeWithTwoViews(); void testDisableUndoRepair(); + void testLanguageStatus(); CPPUNIT_TEST_SUITE(ScTiledRenderingTest); CPPUNIT_TEST(testRowColumnSelections); @@ -104,6 +105,7 @@ public: CPPUNIT_TEST(testInsertGraphicInvalidations); CPPUNIT_TEST(testDocumentSizeWithTwoViews); CPPUNIT_TEST(testDisableUndoRepair); + CPPUNIT_TEST(testLanguageStatus); CPPUNIT_TEST_SUITE_END(); private: @@ -1414,6 +1416,55 @@ void ScTiledRenderingTest::testDisableUndoRepair() CPPUNIT_ASSERT(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); } } |