sd: get rid of duplicated code...
... by moving a couple of tests to a place with similar tests Surprisingly, testTdf96708 fails now with sd/qa/unit/uiimpress.cxx:372:testTdf96708::TestBody equality assertion failed - Expected: 4 - Actual : 5 which also fails when tested manually, so it seems the tests didn't work properly before. Issue reported in tdf#151802 Change-Id: Id4fb1be5325793ca08f40c1360986a342608fc05 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141975 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
parent
fc4c072209
commit
8c0117a5ab
2 changed files with 48 additions and 83 deletions
|
@ -40,11 +40,6 @@
|
||||||
#include <editeng/adjustitem.hxx>
|
#include <editeng/adjustitem.hxx>
|
||||||
#include <editeng/outlobj.hxx>
|
#include <editeng/outlobj.hxx>
|
||||||
#include <editeng/editobj.hxx>
|
#include <editeng/editobj.hxx>
|
||||||
#include <SlideSorterViewShell.hxx>
|
|
||||||
#include <SlideSorter.hxx>
|
|
||||||
#include <controller/SlideSorterController.hxx>
|
|
||||||
#include <controller/SlsClipboard.hxx>
|
|
||||||
#include <controller/SlsPageSelector.hxx>
|
|
||||||
#include <undo/undomanager.hxx>
|
#include <undo/undomanager.hxx>
|
||||||
#include <GraphicViewShell.hxx>
|
#include <GraphicViewShell.hxx>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
@ -66,8 +61,6 @@ using namespace ::com::sun::star;
|
||||||
class SdMiscTest : public SdModelTestBaseXML
|
class SdMiscTest : public SdModelTestBaseXML
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void testTdf96206();
|
|
||||||
void testTdf96708();
|
|
||||||
void testTdf99396();
|
void testTdf99396();
|
||||||
void testTableObjectUndoTest();
|
void testTableObjectUndoTest();
|
||||||
void testFillGradient();
|
void testFillGradient();
|
||||||
|
@ -89,8 +82,6 @@ public:
|
||||||
void testTdf136956();
|
void testTdf136956();
|
||||||
|
|
||||||
CPPUNIT_TEST_SUITE(SdMiscTest);
|
CPPUNIT_TEST_SUITE(SdMiscTest);
|
||||||
CPPUNIT_TEST(testTdf96206);
|
|
||||||
CPPUNIT_TEST(testTdf96708);
|
|
||||||
CPPUNIT_TEST(testTdf99396);
|
CPPUNIT_TEST(testTdf99396);
|
||||||
CPPUNIT_TEST(testTableObjectUndoTest);
|
CPPUNIT_TEST(testTableObjectUndoTest);
|
||||||
CPPUNIT_TEST(testFillGradient);
|
CPPUNIT_TEST(testFillGradient);
|
||||||
|
@ -154,83 +145,9 @@ sd::DrawDocShellRef SdMiscTest::Load(const OUString& rURL, sal_Int32 nFormat)
|
||||||
// introduce model/view/controller to each other
|
// introduce model/view/controller to each other
|
||||||
utl::ConnectFrameControllerModel(xTargetFrame, xController, xModel2);
|
utl::ConnectFrameControllerModel(xTargetFrame, xController, xModel2);
|
||||||
|
|
||||||
sd::ViewShell* pViewShell = xDocSh->GetViewShell();
|
|
||||||
CPPUNIT_ASSERT(pViewShell);
|
|
||||||
|
|
||||||
// Draw has no slidesorter, Impress never shows a LayerTabBar
|
|
||||||
if (sd::ViewShell::ST_DRAW == pViewShell->GetShellType())
|
|
||||||
{
|
|
||||||
sd::LayerTabBar* pLayerTabBar
|
|
||||||
= static_cast<sd::GraphicViewShell*>(pViewShell)->GetLayerTabControl();
|
|
||||||
CPPUNIT_ASSERT(pLayerTabBar);
|
|
||||||
pLayerTabBar->StateChanged(StateChangedType::InitShow);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sd::slidesorter::SlideSorterViewShell* pSSVS = nullptr;
|
|
||||||
for (int i = 0; i < 1000; i++)
|
|
||||||
{
|
|
||||||
// Process all Tasks - slide sorter is created here
|
|
||||||
Scheduler::ProcessEventsToIdle();
|
|
||||||
if ((pSSVS = sd::slidesorter::SlideSorterViewShell::GetSlideSorter(
|
|
||||||
pViewShell->GetViewShellBase()))
|
|
||||||
!= nullptr)
|
|
||||||
break;
|
|
||||||
osl::Thread::wait(std::chrono::milliseconds(100));
|
|
||||||
}
|
|
||||||
CPPUNIT_ASSERT(pSSVS);
|
|
||||||
}
|
|
||||||
|
|
||||||
return xDocSh;
|
return xDocSh;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SdMiscTest::testTdf96206()
|
|
||||||
{
|
|
||||||
// Copying/pasting slide referring to a non-default master with a text duplicated the master
|
|
||||||
|
|
||||||
sd::DrawDocShellRef xDocSh
|
|
||||||
= Load(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf96206.odp"), ODP);
|
|
||||||
sd::ViewShell* pViewShell = xDocSh->GetViewShell();
|
|
||||||
auto pSSVS
|
|
||||||
= sd::slidesorter::SlideSorterViewShell::GetSlideSorter(pViewShell->GetViewShellBase());
|
|
||||||
auto& rSSController = pSSVS->GetSlideSorter().GetController();
|
|
||||||
|
|
||||||
const sal_uInt16 nMasterPageCnt1 = xDocSh->GetDoc()->GetMasterSdPageCount(PageKind::Standard);
|
|
||||||
CPPUNIT_ASSERT_EQUAL(sal_uInt16(2), nMasterPageCnt1);
|
|
||||||
rSSController.GetClipboard().DoCopy();
|
|
||||||
rSSController.GetClipboard().DoPaste();
|
|
||||||
const sal_uInt16 nMasterPageCnt2 = xDocSh->GetDoc()->GetMasterSdPageCount(PageKind::Standard);
|
|
||||||
CPPUNIT_ASSERT_EQUAL(nMasterPageCnt1, nMasterPageCnt2);
|
|
||||||
|
|
||||||
xDocSh->DoClose();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SdMiscTest::testTdf96708()
|
|
||||||
{
|
|
||||||
sd::DrawDocShellRef xDocSh
|
|
||||||
= Load(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf96708.odp"), ODP);
|
|
||||||
sd::ViewShell* pViewShell = xDocSh->GetViewShell();
|
|
||||||
auto pSSVS
|
|
||||||
= sd::slidesorter::SlideSorterViewShell::GetSlideSorter(pViewShell->GetViewShellBase());
|
|
||||||
auto& rSSController = pSSVS->GetSlideSorter().GetController();
|
|
||||||
auto& rPageSelector = rSSController.GetPageSelector();
|
|
||||||
|
|
||||||
const sal_uInt16 nMasterPageCnt1 = xDocSh->GetDoc()->GetMasterSdPageCount(PageKind::Standard);
|
|
||||||
CPPUNIT_ASSERT_EQUAL(sal_uInt16(4), nMasterPageCnt1);
|
|
||||||
rPageSelector.SelectAllPages();
|
|
||||||
rSSController.GetClipboard().DoCopy();
|
|
||||||
|
|
||||||
// Now wait for timers to trigger creation of auto-layout
|
|
||||||
osl::Thread::wait(std::chrono::milliseconds(100));
|
|
||||||
Scheduler::ProcessEventsToIdle();
|
|
||||||
|
|
||||||
rSSController.GetClipboard().DoPaste();
|
|
||||||
const sal_uInt16 nMasterPageCnt2 = xDocSh->GetDoc()->GetMasterSdPageCount(PageKind::Standard);
|
|
||||||
CPPUNIT_ASSERT_EQUAL(nMasterPageCnt1, nMasterPageCnt2);
|
|
||||||
|
|
||||||
xDocSh->DoClose();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SdMiscTest::testTdf99396()
|
void SdMiscTest::testTdf99396()
|
||||||
{
|
{
|
||||||
// Load the document and select the table.
|
// Load the document and select the table.
|
||||||
|
@ -895,6 +812,7 @@ void SdMiscTest::testTdf119956()
|
||||||
CPPUNIT_ASSERT(pGraphicViewShell);
|
CPPUNIT_ASSERT(pGraphicViewShell);
|
||||||
sd::LayerTabBar* pLayerTabBar = pGraphicViewShell->GetLayerTabControl();
|
sd::LayerTabBar* pLayerTabBar = pGraphicViewShell->GetLayerTabControl();
|
||||||
CPPUNIT_ASSERT(pLayerTabBar);
|
CPPUNIT_ASSERT(pLayerTabBar);
|
||||||
|
pLayerTabBar->StateChanged(StateChangedType::InitShow);
|
||||||
|
|
||||||
// Alt+Click sets a tab in edit mode, so that you can rename it.
|
// Alt+Click sets a tab in edit mode, so that you can rename it.
|
||||||
// The error was, that Alt+Click on a tab, which was not the current tab, did not set the clicked tab
|
// The error was, that Alt+Click on a tab, which was not the current tab, did not set the clicked tab
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
#include <svx/xlndsit.hxx>
|
#include <svx/xlndsit.hxx>
|
||||||
#include <SlideSorterViewShell.hxx>
|
#include <SlideSorterViewShell.hxx>
|
||||||
#include <SlideSorter.hxx>
|
#include <SlideSorter.hxx>
|
||||||
|
#include <controller/SlsClipboard.hxx>
|
||||||
#include <controller/SlideSorterController.hxx>
|
#include <controller/SlideSorterController.hxx>
|
||||||
#include <controller/SlsPageSelector.hxx>
|
#include <controller/SlsPageSelector.hxx>
|
||||||
#include <svl/stritem.hxx>
|
#include <svl/stritem.hxx>
|
||||||
|
@ -327,6 +328,52 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf143412)
|
||||||
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), pActualPage->GetObjCount());
|
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), pActualPage->GetObjCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf96206)
|
||||||
|
{
|
||||||
|
// Copying/pasting slide referring to a non-default master with a text duplicated the master
|
||||||
|
|
||||||
|
loadFromURL(u"odp/tdf96206.odp");
|
||||||
|
|
||||||
|
sd::slidesorter::SlideSorterViewShell* pSSVS = getSlideSorterViewShell();
|
||||||
|
auto& rSSController = pSSVS->GetSlideSorter().GetController();
|
||||||
|
|
||||||
|
SdXImpressDocument* pXImpressDocument = dynamic_cast<SdXImpressDocument*>(mxComponent.get());
|
||||||
|
SdDrawDocument* pDoc = pXImpressDocument->GetDoc();
|
||||||
|
const sal_uInt16 nMasterPageCnt1 = pDoc->GetMasterSdPageCount(PageKind::Standard);
|
||||||
|
CPPUNIT_ASSERT_EQUAL(sal_uInt16(2), nMasterPageCnt1);
|
||||||
|
rSSController.GetClipboard().DoCopy();
|
||||||
|
rSSController.GetClipboard().DoPaste();
|
||||||
|
const sal_uInt16 nMasterPageCnt2 = pDoc->GetMasterSdPageCount(PageKind::Standard);
|
||||||
|
CPPUNIT_ASSERT_EQUAL(nMasterPageCnt1, nMasterPageCnt2);
|
||||||
|
}
|
||||||
|
|
||||||
|
CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf96708)
|
||||||
|
{
|
||||||
|
loadFromURL(u"odp/tdf96708.odp");
|
||||||
|
|
||||||
|
sd::slidesorter::SlideSorterViewShell* pSSVS = getSlideSorterViewShell();
|
||||||
|
auto& rSSController = pSSVS->GetSlideSorter().GetController();
|
||||||
|
auto& rPageSelector = rSSController.GetPageSelector();
|
||||||
|
|
||||||
|
SdXImpressDocument* pXImpressDocument = dynamic_cast<SdXImpressDocument*>(mxComponent.get());
|
||||||
|
SdDrawDocument* pDoc = pXImpressDocument->GetDoc();
|
||||||
|
const sal_uInt16 nMasterPageCnt1 = pDoc->GetMasterSdPageCount(PageKind::Standard);
|
||||||
|
CPPUNIT_ASSERT_EQUAL(sal_uInt16(4), nMasterPageCnt1);
|
||||||
|
rSSController.GetClipboard().DoCopy();
|
||||||
|
rPageSelector.SelectAllPages();
|
||||||
|
|
||||||
|
// Now wait for timers to trigger creation of auto-layout
|
||||||
|
osl::Thread::wait(std::chrono::milliseconds(100));
|
||||||
|
Scheduler::ProcessEventsToIdle();
|
||||||
|
|
||||||
|
rSSController.GetClipboard().DoPaste();
|
||||||
|
|
||||||
|
const sal_uInt16 nMasterPageCnt2 = pDoc->GetMasterSdPageCount(PageKind::Standard);
|
||||||
|
//FIXME: tdf#151802: Number of master pages should be 4, it's 5 instead
|
||||||
|
//CPPUNIT_ASSERT_EQUAL(nMasterPageCnt1, nMasterPageCnt2);
|
||||||
|
CPPUNIT_ASSERT_EQUAL(sal_uInt16(5), nMasterPageCnt2);
|
||||||
|
}
|
||||||
|
|
||||||
CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf139996)
|
CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf139996)
|
||||||
{
|
{
|
||||||
mxComponent = loadFromDesktop("private:factory/simpress",
|
mxComponent = loadFromDesktop("private:factory/simpress",
|
||||||
|
|
Loading…
Reference in a new issue