problem with link error in unit test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

I have added a unit test
ScShapeTest::testTdf134355_DragCreateCustomShape()
in /sc/qa/unit/scshapetest.cxx
https://git.libreoffice.org/core/+/02e4f6c44295004f5c7201a7aa2744fd0518ba9d

Now I want to do the same with a form control. But I get link errors
'unresolved external symbol' about FuConstruct::MouseMove, FuConstUnoControl::MouseButtonUp, FuConstUnoControl::MouseButtonDo
wn and FuConstUnoControl::Deactivate

Can please someone help me? I have no idea what makes a FuConstUnoControl different from a FuConstCustomShape.

The new test is below.

Kind regards
Regina


void ScShapeTest::testTdf140252_DragCreateFormControl()
{
// Error was, that drag-created form controls were initially not on layer 'controls' and thus
    // other shapes could be placed in front of form controls.
    // Load an empty document.
    OUString aFileURL;
    createFileURL(u"ManualColWidthRowHeight.ods", aFileURL);
uno::Reference<css::lang::XComponent> xComponent = loadFromDesktop(aFileURL);
    CPPUNIT_ASSERT(xComponent.is());

    // Get ScTabView
    ScDocShell* pDocSh = lcl_getScDocShellWithAssert(xComponent);
ScTabViewShell* pTabViewShell = lcl_getScTabViewShellWithAssert(pDocSh);
    ScTabView* pTabView = pTabViewShell->GetViewData().GetView();
    CPPUNIT_ASSERT(pTabView);

    // drag-create a push button as example of form control
    uno::Sequence<beans::PropertyValue> aPropertyValues = {
        comphelper::makePropertyValue("Pushbutton", true),
    };
    dispatchCommand(xComponent, ".uno:Pushbutton", aPropertyValues);
// above includes creation of FuConstUnoControl and call of its Activate() method FuConstUnoControl* pFuConstUC = static_cast<FuConstUnoControl*>(pTabView->GetDrawFuncPtr());
    CPPUNIT_ASSERT(pFuConstUC);

    // points are in pixel
MouseEvent aMouseEvent(Point(50, 100), 1, MouseEventModifiers::NONE, MOUSE_LEFT, 0);
    pFuConstUC->MouseButtonDown(aMouseEvent);
aMouseEvent = MouseEvent(Point(200, 250), 1, MouseEventModifiers::DRAGMOVE, MOUSE_LEFT, 0);
    pFuConstUC->MouseMove(aMouseEvent);
aMouseEvent = MouseEvent(Point(200, 250), 1, MouseEventModifiers::NONE, MOUSE_LEFT, 0);
    pFuConstUC->MouseButtonUp(aMouseEvent);
    pFuConstUC->Deactivate();
    pTabViewShell->SetDrawShell(false);

    // Get document and newly created push button.
    ScDocument& rDoc = pDocSh->GetDocument();
SdrUnoObj* pObj = static_cast<SdrUnoObj*>(lcl_getSdrObjectWithAssert(rDoc, 0));

// Without the fix in place, the shape would be on layer SC_LAYER_FRONT (0)
    sal_uInt8 nExpectedID = sal_uInt8(SC_LAYER_CONTROLS);
    sal_uInt8 nActualID = pObj->GetLayer().get();
    CPPUNIT_ASSERT_EQUAL(nExpectedID, nActualID);

    pDocSh->DoClose();
}

_______________________________________________
LibreOffice mailing list
LibreOffice@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/libreoffice



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux