Bump version to 6.4-15
[LibreOffice.git] / starmath / qa / cppunit / test_starmath.cxx
blob668e7dc8a66dcac3a81962b3ed29b3eca61cb39d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #include <sal/config.h>
12 #include <config_features.h>
13 #include <vcl/print.hxx>
15 #include <test/bootstrapfixture.hxx>
17 #include <smdll.hxx>
18 #include <document.hxx>
19 #include <view.hxx>
21 #include <tmpdevice.hxx>
23 #include <sfx2/sfxmodelfactory.hxx>
24 #include <sfx2/bindings.hxx>
25 #include <sfx2/request.hxx>
26 #include <sfx2/dispatch.hxx>
28 #include <editeng/editeng.hxx>
30 #include <sfx2/zoomitem.hxx>
31 #include <starmath.hrc>
32 #include <memory>
34 typedef tools::SvRef<SmDocShell> SmDocShellRef;
36 using namespace ::com::sun::star;
38 namespace {
40 class Test : public test::BootstrapFixture
42 public:
43 Test();
45 // init
46 virtual void setUp() override;
47 virtual void tearDown() override;
49 // tests
50 void editUndoRedo();
51 void editMarker();
52 void editFailure();
53 void ParseErrorUnexpectedToken();
54 void ParseErrorPoundExpected();
55 void ParseErrorColorExpected();
56 void ParseErrorLgroupExpected();
57 void ParseErrorRgroupExpected();
58 void ParseErrorLbraceExpected();
59 void ParseErrorRbraceExpected();
60 void ParseErrorParentMismatch();
61 void ParseErrorRightExpected();
62 void ParseErrorFontExpected();
63 void ParseErrorSizeExpected();
64 void ParseErrorDoubleAlign();
65 void ParseErrorDoubleSubsupscript();
67 void replacePlaceholder();
68 void viewZoom();
70 #if HAVE_MORE_FONTS
71 void testSmTmpDeviceRestoreFont();
72 #endif
74 CPPUNIT_TEST_SUITE(Test);
75 CPPUNIT_TEST(editUndoRedo);
76 CPPUNIT_TEST(editMarker);
77 CPPUNIT_TEST(editFailure);
78 CPPUNIT_TEST(ParseErrorUnexpectedToken);
79 CPPUNIT_TEST(ParseErrorPoundExpected);
80 CPPUNIT_TEST(ParseErrorColorExpected);
81 CPPUNIT_TEST(ParseErrorLgroupExpected);
82 CPPUNIT_TEST(ParseErrorRgroupExpected);
83 CPPUNIT_TEST(ParseErrorLbraceExpected);
84 CPPUNIT_TEST(ParseErrorRbraceExpected);
85 CPPUNIT_TEST(ParseErrorParentMismatch);
86 CPPUNIT_TEST(ParseErrorRightExpected);
87 CPPUNIT_TEST(ParseErrorFontExpected);
88 CPPUNIT_TEST(ParseErrorSizeExpected);
89 CPPUNIT_TEST(ParseErrorDoubleAlign);
90 CPPUNIT_TEST(ParseErrorDoubleSubsupscript);
91 CPPUNIT_TEST(replacePlaceholder);
92 CPPUNIT_TEST(viewZoom);
93 #if HAVE_MORE_FONTS
94 CPPUNIT_TEST(testSmTmpDeviceRestoreFont);
95 #endif
96 CPPUNIT_TEST_SUITE_END();
98 private:
99 SfxBindings m_aBindings;
100 std::unique_ptr<SfxDispatcher> m_pDispatcher;
101 VclPtr<SmCmdBoxWindow> m_pSmCmdBoxWindow;
102 VclPtr<SmEditWindow> m_pEditWindow;
103 SmDocShellRef m_xDocShRef;
104 SmViewShell *m_pViewShell;
107 Test::Test()
108 : m_pViewShell(nullptr)
112 void Test::setUp()
114 BootstrapFixture::setUp();
116 SmGlobals::ensure();
118 m_xDocShRef = new SmDocShell(
119 SfxModelFlags::EMBEDDED_OBJECT |
120 SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS |
121 SfxModelFlags::DISABLE_DOCUMENT_RECOVERY);
122 m_xDocShRef->DoInitNew();
124 SfxViewFrame *pViewFrame = SfxViewFrame::LoadHiddenDocument(*m_xDocShRef, SFX_INTERFACE_NONE);
126 CPPUNIT_ASSERT_MESSAGE("Should have a SfxViewFrame", pViewFrame);
128 m_pDispatcher.reset(new SfxDispatcher(pViewFrame));
129 m_aBindings.SetDispatcher(m_pDispatcher.get());
130 m_aBindings.EnterRegistrations();
131 m_pSmCmdBoxWindow.reset(VclPtr<SmCmdBoxWindow>::Create(&m_aBindings, nullptr, nullptr));
132 m_aBindings.LeaveRegistrations();
133 m_pEditWindow = VclPtr<SmEditWindow>::Create(*m_pSmCmdBoxWindow);
134 m_pViewShell = m_pEditWindow->GetView();
135 CPPUNIT_ASSERT_MESSAGE("Should have a SmViewShell", m_pViewShell);
138 void Test::tearDown()
140 m_pEditWindow.disposeAndClear();
141 m_pSmCmdBoxWindow.disposeAndClear();
142 m_pDispatcher.reset();
143 m_xDocShRef->DoClose();
144 m_xDocShRef.clear();
146 BootstrapFixture::tearDown();
149 #if HAVE_MORE_FONTS
150 void Test::testSmTmpDeviceRestoreFont()
152 ScopedVclPtrInstance<Printer> pPrinter;
153 bool bUseMap100th_mm = true;
155 OUString aFontName("Linux Libertine G");
156 CPPUNIT_ASSERT(pPrinter->IsFontAvailable(aFontName));
158 vcl::Font aOriginalFont = pPrinter->GetFont();
159 aOriginalFont.SetColor(COL_RED);
160 pPrinter->SetTextColor(COL_RED);
162 vcl::Font aNewFont;
165 SmTmpDevice aTmpDev(*pPrinter.get(), bUseMap100th_mm);
167 aNewFont = pPrinter->GetFont();
168 aNewFont.SetFamilyName(aFontName);
169 aTmpDev.SetFont(aNewFont);
171 CPPUNIT_ASSERT_EQUAL(aFontName, pPrinter->GetFont().GetFamilyName());
172 CPPUNIT_ASSERT_EQUAL(COL_BLACK, pPrinter->GetTextColor());
175 CPPUNIT_ASSERT(aNewFont != pPrinter->GetFont());
176 CPPUNIT_ASSERT_EQUAL(COL_RED, pPrinter->GetTextColor());
178 #endif
180 void Test::editMarker()
183 OUString sMarkedText("<?> under <?> under <?>");
184 m_pEditWindow->SetText(sMarkedText);
185 m_pEditWindow->Flush();
186 OUString sFinalText = m_pEditWindow->GetText();
187 CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be equal text", sMarkedText, sFinalText);
191 OUString const sTargetText("a under b under c");
192 ESelection aSelection;
194 m_pEditWindow->SelNextMark();
195 m_pEditWindow->Delete();
196 m_pEditWindow->InsertText("a");
198 m_pEditWindow->SelNextMark();
199 m_pEditWindow->SelNextMark();
200 m_pEditWindow->Delete();
201 m_pEditWindow->InsertText("c");
203 // should be safe i.e. do nothing
204 m_pEditWindow->SelNextMark();
205 aSelection = m_pEditWindow->GetSelection();
206 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aSelection.nStartPara);
207 CPPUNIT_ASSERT_EQUAL(sal_Int32(19), aSelection.nStartPos);
208 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aSelection.nEndPara);
209 CPPUNIT_ASSERT_EQUAL(sal_Int32(19), aSelection.nEndPos);
211 m_pEditWindow->SelPrevMark();
212 m_pEditWindow->Delete();
213 m_pEditWindow->InsertText("b");
215 // tdf#106116: should be safe i.e. do nothing
216 m_pEditWindow->SelPrevMark();
217 aSelection = m_pEditWindow->GetSelection();
218 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aSelection.nStartPara);
219 CPPUNIT_ASSERT_EQUAL(sal_Int32(9), aSelection.nStartPos);
220 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aSelection.nEndPara);
221 CPPUNIT_ASSERT_EQUAL(sal_Int32(9), aSelection.nEndPos);
223 m_pEditWindow->Flush();
224 OUString sFinalText = m_pEditWindow->GetText();
225 CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be a under b under c", sTargetText, sFinalText);
229 m_pEditWindow->SetText(OUString());
230 m_pEditWindow->Flush();
234 void Test::editFailure()
236 m_xDocShRef->SetText("color a b over {a/}");
238 const SmErrorDesc *pErrorDesc = m_xDocShRef->GetParser().NextError();
240 CPPUNIT_ASSERT_MESSAGE("Should be a SmParseError::ColorExpected",
241 pErrorDesc && pErrorDesc->m_eType == SmParseError::ColorExpected);
243 pErrorDesc = m_xDocShRef->GetParser().PrevError();
245 CPPUNIT_ASSERT_MESSAGE("Should be a SmParseError::UnexpectedChar",
246 pErrorDesc && pErrorDesc->m_eType == SmParseError::UnexpectedChar);
248 pErrorDesc = m_xDocShRef->GetParser().PrevError();
250 CPPUNIT_ASSERT_MESSAGE("Should be a SmParseError::RgroupExpected",
251 pErrorDesc && pErrorDesc->m_eType == SmParseError::RgroupExpected);
253 const SmErrorDesc *pLastErrorDesc = m_xDocShRef->GetParser().PrevError();
255 CPPUNIT_ASSERT_MESSAGE("Should be three syntax errors",
256 pLastErrorDesc && pLastErrorDesc == pErrorDesc);
259 void Test::ParseErrorUnexpectedToken()
261 m_xDocShRef->SetText("\\foo");
262 const SmErrorDesc *pErrorDesc = m_xDocShRef->GetParser().NextError();
263 CPPUNIT_ASSERT(pErrorDesc);
264 CPPUNIT_ASSERT_EQUAL_MESSAGE("SmParseError::UnexpectedToken expected",
265 SmParseError::UnexpectedToken, pErrorDesc->m_eType);
268 void Test::ParseErrorPoundExpected()
270 m_xDocShRef->SetText("matrix {1#2##a##b#c}");
271 const SmErrorDesc *pErrorDesc = m_xDocShRef->GetParser().NextError();
272 CPPUNIT_ASSERT(pErrorDesc);
273 CPPUNIT_ASSERT_EQUAL_MESSAGE("SmParseError::PoundExpected expected",
274 SmParseError::PoundExpected, pErrorDesc->m_eType);
277 void Test::ParseErrorColorExpected()
279 m_xDocShRef->SetText("color 42 x");
280 const SmErrorDesc *pErrorDesc = m_xDocShRef->GetParser().NextError();
281 CPPUNIT_ASSERT(pErrorDesc);
282 CPPUNIT_ASSERT_EQUAL_MESSAGE("SmParseError::ColorExpected expected",
283 SmParseError::ColorExpected, pErrorDesc->m_eType);
286 void Test::ParseErrorLgroupExpected()
288 m_xDocShRef->SetText("stack 42");
289 const SmErrorDesc *pErrorDesc = m_xDocShRef->GetParser().NextError();
290 CPPUNIT_ASSERT(pErrorDesc);
291 CPPUNIT_ASSERT_EQUAL_MESSAGE("SmParseError::LgroupExpected expected",
292 SmParseError::LgroupExpected, pErrorDesc->m_eType);
295 void Test::ParseErrorRgroupExpected()
297 m_xDocShRef->SetText("stack {a#b#c)");
298 const SmErrorDesc *pErrorDesc = m_xDocShRef->GetParser().NextError();
299 CPPUNIT_ASSERT(pErrorDesc);
300 CPPUNIT_ASSERT_EQUAL_MESSAGE("SmParseError::RgroupExpected expected",
301 SmParseError::RgroupExpected, pErrorDesc->m_eType);
304 void Test::ParseErrorLbraceExpected()
306 m_xDocShRef->SetText("left 42");
307 const SmErrorDesc *pErrorDesc = m_xDocShRef->GetParser().NextError();
308 CPPUNIT_ASSERT(pErrorDesc);
309 CPPUNIT_ASSERT_EQUAL_MESSAGE("SmParseError::LbraceExpected expected",
310 SmParseError::LbraceExpected, pErrorDesc->m_eType);
313 void Test::ParseErrorRbraceExpected()
315 m_xDocShRef->SetText("left ( foo right x");
316 const SmErrorDesc *pErrorDesc = m_xDocShRef->GetParser().NextError();
317 CPPUNIT_ASSERT(pErrorDesc);
318 CPPUNIT_ASSERT_EQUAL_MESSAGE("SmParseError::RbraceExpected expected",
319 SmParseError::RbraceExpected, pErrorDesc->m_eType);
322 void Test::ParseErrorParentMismatch()
324 m_xDocShRef->SetText("lbrace foo rceil");
325 const SmErrorDesc *pErrorDesc = m_xDocShRef->GetParser().NextError();
326 CPPUNIT_ASSERT(pErrorDesc);
327 CPPUNIT_ASSERT_EQUAL_MESSAGE("SmParseError::ParentMismatch expected",
328 SmParseError::ParentMismatch, pErrorDesc->m_eType);
331 void Test::ParseErrorRightExpected()
333 m_xDocShRef->SetText("left ( x mline y )");
334 const SmErrorDesc *pErrorDesc = m_xDocShRef->GetParser().NextError();
335 CPPUNIT_ASSERT(pErrorDesc);
336 CPPUNIT_ASSERT_EQUAL_MESSAGE("SmParseError::RightExpected expected",
337 SmParseError::RightExpected, pErrorDesc->m_eType);
340 void Test::ParseErrorFontExpected()
342 m_xDocShRef->SetText("font small bar");
343 const SmErrorDesc *pErrorDesc = m_xDocShRef->GetParser().NextError();
344 CPPUNIT_ASSERT(pErrorDesc);
345 CPPUNIT_ASSERT_EQUAL_MESSAGE("SmParseError::FontExpected expected",
346 SmParseError::FontExpected, pErrorDesc->m_eType);
349 void Test::ParseErrorSizeExpected()
351 m_xDocShRef->SetText("size small baz");
352 const SmErrorDesc *pErrorDesc = m_xDocShRef->GetParser().NextError();
353 CPPUNIT_ASSERT(pErrorDesc);
354 CPPUNIT_ASSERT_EQUAL_MESSAGE("SmParseError::SizeExpected expected",
355 SmParseError::SizeExpected, pErrorDesc->m_eType);
358 void Test::ParseErrorDoubleAlign()
360 m_xDocShRef->SetText("alignl alignc x");
361 const SmErrorDesc *pErrorDesc = m_xDocShRef->GetParser().NextError();
362 CPPUNIT_ASSERT(pErrorDesc);
363 CPPUNIT_ASSERT_EQUAL_MESSAGE("SmParseError::DoubleAlign expected",
364 SmParseError::DoubleAlign, pErrorDesc->m_eType);
367 void Test::ParseErrorDoubleSubsupscript()
369 m_xDocShRef->SetText("x_y_z");
370 const SmErrorDesc *pErrorDesc = m_xDocShRef->GetParser().NextError();
371 CPPUNIT_ASSERT(pErrorDesc);
372 CPPUNIT_ASSERT_EQUAL_MESSAGE("SmParseError::DoubleSubsupscript expected",
373 SmParseError::DoubleSubsupscript, pErrorDesc->m_eType);
376 void Test::editUndoRedo()
378 EditEngine &rEditEngine = m_xDocShRef->GetEditEngine();
380 OUString sStringOne("a under b");
382 rEditEngine.SetText(0, sStringOne);
383 m_xDocShRef->UpdateText();
384 OUString sFinalText = m_xDocShRef->GetText();
385 CPPUNIT_ASSERT_EQUAL_MESSAGE("Strings must match", sFinalText, sStringOne);
388 OUString sStringTwo("a over b");
390 rEditEngine.SetText(0, sStringTwo);
391 m_xDocShRef->UpdateText();
392 OUString sFinalText = m_xDocShRef->GetText();
393 CPPUNIT_ASSERT_EQUAL_MESSAGE("Strings must match", sFinalText, sStringTwo);
396 SfxRequest aUndo(SID_UNDO, SfxCallMode::SYNCHRON, SmDocShell::GetPool());
399 m_xDocShRef->Execute(aUndo);
400 m_xDocShRef->UpdateText();
401 OUString sFinalText = m_xDocShRef->GetText();
402 CPPUNIT_ASSERT_EQUAL_MESSAGE("Strings much match", sFinalText, sStringOne);
406 m_xDocShRef->Execute(aUndo);
407 m_xDocShRef->UpdateText();
408 OUString sFinalText = m_xDocShRef->GetText();
409 CPPUNIT_ASSERT_MESSAGE("Must now be empty", sFinalText.isEmpty());
412 SfxRequest aRedo(SID_REDO, SfxCallMode::SYNCHRON, SmDocShell::GetPool());
414 m_xDocShRef->Execute(aRedo);
415 m_xDocShRef->UpdateText();
416 OUString sFinalText = m_xDocShRef->GetText();
417 CPPUNIT_ASSERT_EQUAL_MESSAGE("Strings much match", sFinalText, sStringOne);
421 rEditEngine.SetText(0, OUString());
422 m_xDocShRef->UpdateText();
423 rEditEngine.ClearModifyFlag();
424 OUString sFinalText = m_xDocShRef->GetText();
425 CPPUNIT_ASSERT_MESSAGE("Must be empty", sFinalText.isEmpty());
430 void Test::replacePlaceholder()
432 // Test the placeholder replacement. In this case, testing 'a + b', it
433 // should return '+a + b' when selecting '+<?>' in ElementsDock
434 m_pEditWindow->SetText("a + b");
435 m_pEditWindow->SelectAll();
436 m_pEditWindow->InsertText("+<?>");
437 OUString sFinalText = m_pEditWindow->GetText();
438 CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be '+a + b'", OUString("+a + b"), sFinalText);
441 void Test::viewZoom()
443 sal_uInt16 nOrigZoom, nNextZoom, nFinalZoom;
445 EditEngine &rEditEngine = m_xDocShRef->GetEditEngine();
447 OUString sStringOne("a under b");
449 rEditEngine.SetText(0, sStringOne);
450 m_xDocShRef->UpdateText();
451 OUString sFinalText = m_xDocShRef->GetText();
452 CPPUNIT_ASSERT_EQUAL_MESSAGE("Strings must match", sFinalText, sStringOne);
455 SmGraphicWindow &rGraphicWindow = m_pViewShell->GetGraphicWindow();
456 rGraphicWindow.SetSizePixel(Size(1024, 800));
457 nOrigZoom = rGraphicWindow.GetZoom();
460 SfxRequest aZoomIn(SID_ZOOMIN, SfxCallMode::SYNCHRON, m_pViewShell->GetPool());
461 m_pViewShell->Execute(aZoomIn);
462 nNextZoom = rGraphicWindow.GetZoom();
463 CPPUNIT_ASSERT_MESSAGE("Should be bigger", nNextZoom > nOrigZoom);
467 SfxRequest aZoomOut(SID_ZOOMOUT, SfxCallMode::SYNCHRON, m_pViewShell->GetPool());
468 m_pViewShell->Execute(aZoomOut);
469 nFinalZoom = rGraphicWindow.GetZoom();
470 CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be equal", nOrigZoom, nFinalZoom);
473 sal_uInt16 nOptimalZoom=0;
476 SfxRequest aZoom(SID_ZOOM_OPTIMAL, SfxCallMode::SYNCHRON, m_pViewShell->GetPool());
477 m_pViewShell->Execute(aZoom);
478 nOptimalZoom = rGraphicWindow.GetZoom();
479 CPPUNIT_ASSERT_MESSAGE("Should be about 800%", nOptimalZoom > nOrigZoom);
483 SfxItemSet aSet(SmDocShell::GetPool(), svl::Items<SID_ATTR_ZOOM, SID_ATTR_ZOOM>{});
484 aSet.Put(SvxZoomItem(SvxZoomType::OPTIMAL, 0));
485 SfxRequest aZoom(SID_ATTR_ZOOM, SfxCallMode::SYNCHRON, aSet);
486 m_pViewShell->Execute(aZoom);
487 nFinalZoom = rGraphicWindow.GetZoom();
488 CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be optimal zoom", nOptimalZoom, nFinalZoom);
491 //To-Do: investigate GetPrinter logic of SvxZoomType::PAGEWIDTH/SvxZoomType::WHOLEPAGE to ensure
492 //consistent value regardless of
493 #if 0
495 SfxRequest aZoomOut(SID_ZOOMOUT, SfxCallMode::SYNCHRON, m_pViewShell->GetPool());
496 m_pViewShell->Execute(aZoomOut);
497 nFinalZoom = rGraphicWindow.GetZoom();
498 CPPUNIT_ASSERT_MESSAGE("Should not be optimal zoom", nFinalZoom != nOptimalZoom);
500 SfxItemSet aSet(m_xDocShRef->GetPool(), SID_ATTR_ZOOM, SID_ATTR_ZOOM);
501 aSet.Put(SvxZoomItem(SvxZoomType::PAGEWIDTH, 0));
502 SfxRequest aZoom(SID_ATTR_ZOOM, SfxCallMode::SYNCHRON, aSet);
503 m_pViewShell->Execute(aZoom);
504 nFinalZoom = rGraphicWindow.GetZoom();
505 CPPUNIT_ASSERT_MESSAGE("Should be same as optimal zoom", nFinalZoom == nOptimalZoom);
509 SfxRequest aZoomOut(SID_ZOOMOUT, SfxCallMode::SYNCHRON, m_pViewShell->GetPool());
510 m_pViewShell->Execute(aZoomOut);
511 nFinalZoom = rGraphicWindow.GetZoom();
512 CPPUNIT_ASSERT_MESSAGE("Should not be optimal zoom", nFinalZoom != nOptimalZoom);
514 SfxItemSet aSet(m_xDocShRef->GetPool(), SID_ATTR_ZOOM, SID_ATTR_ZOOM);
515 aSet.Put(SvxZoomItem(SvxZoomType::WHOLEPAGE, 0));
516 SfxRequest aZoom(SID_ATTR_ZOOM, SfxCallMode::SYNCHRON, aSet);
517 m_pViewShell->Execute(aZoom);
518 nFinalZoom = rGraphicWindow.GetZoom();
519 CPPUNIT_ASSERT_MESSAGE("Should be same as optimal zoom", nFinalZoom == nOptimalZoom);
521 #endif
524 SfxRequest aZoomOut(SID_ZOOMOUT, SfxCallMode::SYNCHRON, m_pViewShell->GetPool());
525 m_pViewShell->Execute(aZoomOut);
526 nFinalZoom = rGraphicWindow.GetZoom();
527 CPPUNIT_ASSERT_MESSAGE("Should not be optimal zoom", nFinalZoom != nOptimalZoom);
529 SfxItemSet aSet(SmDocShell::GetPool(), svl::Items<SID_ATTR_ZOOM, SID_ATTR_ZOOM>{});
530 aSet.Put(SvxZoomItem(SvxZoomType::PERCENT, 50));
531 SfxRequest aZoom(SID_ATTR_ZOOM, SfxCallMode::SYNCHRON, aSet);
532 m_pViewShell->Execute(aZoom);
533 nFinalZoom = rGraphicWindow.GetZoom();
534 CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be 50%", static_cast<sal_uInt16>(50), nFinalZoom);
538 SfxItemSet aSet(SmDocShell::GetPool(), svl::Items<SID_ATTR_ZOOM, SID_ATTR_ZOOM>{});
539 aSet.Put(SvxZoomItem(SvxZoomType::PERCENT, 5));
540 SfxRequest aZoom(SID_ATTR_ZOOM, SfxCallMode::SYNCHRON, aSet);
541 m_pViewShell->Execute(aZoom);
542 nFinalZoom = rGraphicWindow.GetZoom();
543 CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be Clipped to 25%", static_cast<sal_uInt16>(25), nFinalZoom);
547 SfxItemSet aSet(SmDocShell::GetPool(), svl::Items<SID_ATTR_ZOOM, SID_ATTR_ZOOM>{});
548 aSet.Put(SvxZoomItem(SvxZoomType::PERCENT, 1000));
549 SfxRequest aZoom(SID_ATTR_ZOOM, SfxCallMode::SYNCHRON, aSet);
550 m_pViewShell->Execute(aZoom);
551 nFinalZoom = rGraphicWindow.GetZoom();
552 CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be Clipped to 800%", static_cast<sal_uInt16>(800), nFinalZoom);
557 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
561 CPPUNIT_PLUGIN_IMPLEMENT();
563 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */