本文整理汇总了C++中Proxy::removeChild方法的典型用法代码示例。如果您正苦于以下问题:C++ Proxy::removeChild方法的具体用法?C++ Proxy::removeChild怎么用?C++ Proxy::removeChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Proxy
的用法示例。
在下文中一共展示了Proxy::removeChild方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testUndo
//.........这里部分代码省略.........
// another check that the addProxy() did not change anything
CPPUNIT_ASSERT_EQUAL(true, checkWorldsAreEqual(&undoWorld, &referenceWorld));
undoWorld.undoStep();
CPPUNIT_ASSERT_EQUAL(true, checkWorldsAreEqual(&undoWorld, &referenceWorld));
//////////////////////////////////////
// add grand-children to the hierarchy
//////////////////////////////////////
Proxy* grandChildUndoWorld = undoWorld.createProxy(new Box(10, 10, 10));
Proxy* grandChildReferenceWorld = referenceWorld.createProxy(new Box(10, 10, 10));
grandChildUndoWorld->translate(0, 0, 100);
grandChildReferenceWorld->translate(0, 0, 100);
grandChildUndoWorld->rotate(100, 0, 0, 1);
grandChildReferenceWorld->rotate(100, 0, 0, 1);
childUndoWorld->addChild(grandChildUndoWorld);
childReferenceWorld->addChild(grandChildReferenceWorld);
////////////////////////////////////////////
// add grand-children to the hierarchy (end)
////////////////////////////////////////////
// check that grand-children adding did not change anything
CPPUNIT_ASSERT_EQUAL(true, checkWorldsAreEqual(&undoWorld, &referenceWorld));
undoWorld.undoStep();
CPPUNIT_ASSERT_EQUAL(true, checkWorldsAreEqual(&undoWorld, &referenceWorld));
// check for undo on children
childUndoWorld->translate(60, 0, 0);
undoWorld.undoStep();
CPPUNIT_ASSERT_EQUAL(true, checkWorldsAreEqual(&undoWorld, &referenceWorld));
// check for undo on grand-children
grandChildUndoWorld->translate(60, 0, 0);
undoWorld.undoStep();
CPPUNIT_ASSERT_EQUAL(true, checkWorldsAreEqual(&undoWorld, &referenceWorld));
// check for undo on the whole hierarchy
proxyUndoWorld->translate(5, 5, 5);
childUndoWorld->rotate(54, 1, 0, 0);
m = Matrix();
m.translate(10, 10, 10);
m.rotate(44, 1, 0, 0);
grandChildUndoWorld->setTransformation(m);
grandChildUndoWorld->translate(60, 0, 0);
undoWorld.undoStep();
CPPUNIT_ASSERT_EQUAL(true, checkWorldsAreEqual(&undoWorld, &referenceWorld));
// check that removeProxy() is NOT undone
undoWorld.removeProxy(dummyUndoProxy);
referenceWorld.removeProxy(dummyReferenceProxy);
delete dummyUndoProxy;
delete dummyReferenceProxy;
CPPUNIT_ASSERT_EQUAL(true, checkWorldsAreEqual(&undoWorld, &referenceWorld));
undoWorld.undoStep();
CPPUNIT_ASSERT_EQUAL(true, checkWorldsAreEqual(&undoWorld, &referenceWorld));
proxyUndoWorld->translate(10, 10, 10);
proxyReferenceWorld->translate(10, 10, 10);
// undo should cause the worlds NOT to be equal
undoWorld.undoStep();
CPPUNIT_ASSERT_EQUAL(false, checkWorldsAreEqual(&undoWorld, &referenceWorld));
proxyUndoWorld->translate(10, 10, 10);
CPPUNIT_ASSERT_EQUAL(true, checkWorldsAreEqual(&undoWorld, &referenceWorld));
// check that that startNextStep() actually works as intended, i.e. we undo
// the things _after_ the startNextStep(), not the ones before
undoWorld.startNextStep();
// startNextStep() should not undo anything (except the moveflags)
CPPUNIT_ASSERT_EQUAL(true, checkWorldsAreEqual(&undoWorld, &referenceWorld));
// startNextStep() should clear all possible "undo" values, i.e. this
// should be a noop
undoWorld.undoStep();
CPPUNIT_ASSERT_EQUAL(true, checkWorldsAreEqual(&undoWorld, &referenceWorld));
// things _after_ a startNextStep() should be undone again
proxyUndoWorld->translate(10, 10, 10);
undoWorld.undoStep();
CPPUNIT_ASSERT_EQUAL(true, checkWorldsAreEqual(&undoWorld, &referenceWorld));
// check that removing of grand-children does not change anything
childUndoWorld->removeChild(grandChildUndoWorld);
childReferenceWorld->removeChild(grandChildReferenceWorld);
delete grandChildUndoWorld;
delete grandChildReferenceWorld;
CPPUNIT_ASSERT_EQUAL(true, checkWorldsAreEqual(&undoWorld, &referenceWorld));
undoWorld.undoStep();
CPPUNIT_ASSERT_EQUAL(true, checkWorldsAreEqual(&undoWorld, &referenceWorld));
// check that calls to startNextStep() after removeChild() still works
undoWorld.startNextStep();
CPPUNIT_ASSERT_EQUAL(true, checkWorldsAreEqual(&undoWorld, &referenceWorld));
undoWorld.undoStep();
CPPUNIT_ASSERT_EQUAL(true, checkWorldsAreEqual(&undoWorld, &referenceWorld));
// TODO: check that deformations are un-done?
// open question: do we want to support un-doing of deformations?
}