Commit 90a2de3c authored by Boudewijn Rempt's avatar Boudewijn Rempt

"Fix" kisNodeModelTest

The KisNodeModelTest didn't set the image it was testing with on
the document. This broke in KisShapeController::setImage(KisImageWSP image),
which cleared all connections, then didn't use the image parameter
but the local doc's image object (which is 0) to reconnect the signals/slots,
and which then crashed in KisShapeController::slotUpdateDocumentResolution(),
where the image would still be 0.

Howewever, the question is: should this function even have this parameter?
If so, should the image then be set on the doc? Should this function even
exist since it makes it possible to have a local m_doc->image() that is
different from the image parameter?

There are still a bunch of warnings, too.

boud@boud-ThinkPad-T470p:~/dev/b-krita/libs/ui/tests$ ./kis_node_model_test
********* Start testing of KisNodeModelTest *********
Config: Using QtTest library 5.12.3, Qt 5.12.3 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 7.4.0)
PASS   : KisNodeModelTest::initTestCase()
QWARN  : KisNodeModelTest::testSetImage() KoColor debug runtime checks are active.
PASS   : KisNodeModelTest::testSetImage()
QWARN  : KisNodeModelTest::testAddNode() SAFE ASSERT (krita): "!newNode->parent()" in file /home/boud/dev/krita/libs/image/kis_node.cpp, line 500
QWARN  : KisNodeModelTest::testAddNode() SAFE ASSERT (krita): "!newNode->parent()" in file /home/boud/dev/krita/libs/image/kis_node.cpp, line 500
QWARN  : KisNodeModelTest::testAddNode() SAFE ASSERT (krita): "!newNode->parent()" in file /home/boud/dev/krita/libs/image/kis_node.cpp, line 500
QWARN  : KisNodeModelTest::testAddNode() SAFE ASSERT (krita): "!newNode->parent()" in file /home/boud/dev/krita/libs/image/kis_node.cpp, line 500
QWARN  : KisNodeModelTest::testAddNode() SAFE ASSERT (krita): "!newNode->parent()" in file /home/boud/dev/krita/libs/image/kis_node.cpp, line 500
PASS   : KisNodeModelTest::testAddNode()
QWARN  : KisNodeModelTest::testRemoveAllNodes() SAFE ASSERT (krita): "!newNode->parent()" in file /home/boud/dev/krita/libs/image/kis_node.cpp, line 500
QWARN  : KisNodeModelTest::testRemoveAllNodes() SAFE ASSERT (krita): "!newNode->parent()" in file /home/boud/dev/krita/libs/image/kis_node.cpp, line 500
QWARN  : KisNodeModelTest::testRemoveAllNodes() SAFE ASSERT (krita): "!newNode->parent()" in file /home/boud/dev/krita/libs/image/kis_node.cpp, line 500
QWARN  : KisNodeModelTest::testRemoveAllNodes() SAFE ASSERT (krita): "!newNode->parent()" in file /home/boud/dev/krita/libs/image/kis_node.cpp, line 500
QWARN  : KisNodeModelTest::testRemoveAllNodes() SAFE ASSERT (krita): "!newNode->parent()" in file /home/boud/dev/krita/libs/image/kis_node.cpp, line 500
PASS   : KisNodeModelTest::testRemoveAllNodes()
QWARN  : KisNodeModelTest::testRemoveIncludingRoot() SAFE ASSERT (krita): "!newNode->parent()" in file /home/boud/dev/krita/libs/image/kis_node.cpp, line 500
QWARN  : KisNodeModelTest::testRemoveIncludingRoot() SAFE ASSERT (krita): "!newNode->parent()" in file /home/boud/dev/krita/libs/image/kis_node.cpp, line 500
QWARN  : KisNodeModelTest::testRemoveIncludingRoot() SAFE ASSERT (krita): "!newNode->parent()" in file /home/boud/dev/krita/libs/image/kis_node.cpp, line 500
QWARN  : KisNodeModelTest::testRemoveIncludingRoot() SAFE ASSERT (krita): "!newNode->parent()" in file /home/boud/dev/krita/libs/image/kis_node.cpp, line 500
QWARN  : KisNodeModelTest::testRemoveIncludingRoot() SAFE ASSERT (krita): "!newNode->parent()" in file /home/boud/dev/krita/libs/image/kis_node.cpp, line 500
PASS   : KisNodeModelTest::testRemoveIncludingRoot()
PASS   : KisNodeModelTest::cleanupTestCase()
Totals: 6 passed, 0 failed, 0 skipped, 0 blacklisted, 1597ms
********* Finished testing of KisNodeModelTest *********
parent 1d268c5b
......@@ -268,8 +268,8 @@ void KisShapeController::setImage(KisImageWSP image)
{
m_d->imageConnections.clear();
m_d->imageConnections.addConnection(m_d->doc->image(), SIGNAL(sigResolutionChanged(double, double)), this, SLOT(slotUpdateDocumentResolution()));
m_d->imageConnections.addConnection(m_d->doc->image(), SIGNAL(sigSizeChanged(QPointF, QPointF)), this, SLOT(slotUpdateDocumentSize()));
m_d->imageConnections.addConnection(image, SIGNAL(sigResolutionChanged(double, double)), this, SLOT(slotUpdateDocumentResolution()));
m_d->imageConnections.addConnection(image, SIGNAL(sigSizeChanged(QPointF, QPointF)), this, SLOT(slotUpdateDocumentSize()));
slotUpdateDocumentResolution();
slotUpdateDocumentSize();
......
......@@ -41,6 +41,9 @@ void KisNodeModelTest::init()
m_nodeModel = new KisNodeModel(0);
initBase();
constructImage();
m_doc->setCurrentImage(m_image);
}
void KisNodeModelTest::cleanup()
......@@ -55,7 +58,6 @@ void KisNodeModelTest::cleanup()
void KisNodeModelTest::testSetImage()
{
constructImage();
m_shapeController->setImage(m_image);
m_nodeModel->setDummiesFacade(m_shapeController, m_image, 0, 0, 0);
new ModelTest(m_nodeModel, this);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment