[poincare] Add asserts in removePointedChildAtIndexAndMoveCursor.

Change-Id: Ifc49b79f18ad53a96a4675d1c6edad69e1c6258f
This commit is contained in:
Léa Saviot
2018-01-19 09:58:59 +01:00
parent 1ad4e6e744
commit 865060e2e9
4 changed files with 4 additions and 1 deletions

View File

@@ -95,6 +95,7 @@ void ConjugateLayout::replaceChildAndMoveCursor(const ExpressionLayout * oldChil
void ConjugateLayout::removePointedChildAtIndexAndMoveCursor(int index, bool deleteAfterRemoval, ExpressionLayoutCursor * cursor) {
assert(index >= 0 && index < numberOfChildren());
assert((cursor->pointedExpressionLayout() == child(index)) || (cursor->pointedExpressionLayout()->hasAncestor(child(index))));
replaceChildAndMoveCursor(child(index), new EmptyVisibleLayout(), deleteAfterRemoval, cursor);
}

View File

@@ -116,7 +116,7 @@ void DynamicLayoutHierarchy::removeChildAtIndex(int index, bool deleteAfterRemov
void DynamicLayoutHierarchy::removePointedChildAtIndexAndMoveCursor(int index, bool deleteAfterRemoval, ExpressionLayoutCursor * cursor) {
assert(index >= 0 && index < numberOfChildren());
assert(cursor->pointedExpressionLayout() == child(index));
assert((cursor->pointedExpressionLayout() == child(index)) || (cursor->pointedExpressionLayout()->hasAncestor(child(index))));
if (numberOfChildren() == 1) {
if (m_parent) {
if (!deleteAfterRemoval) {

View File

@@ -205,6 +205,7 @@ void ExpressionLayout::removeChildAtIndex(int index, bool deleteAfterRemoval) {
void ExpressionLayout::removePointedChildAtIndexAndMoveCursor(int index, bool deleteAfterRemoval, ExpressionLayoutCursor * cursor) {
assert(index >= 0 && index < numberOfChildren());
assert((cursor->pointedExpressionLayout() == child(index)) || (cursor->pointedExpressionLayout()->hasAncestor(child(index))));
removeChildAtIndex(index, deleteAfterRemoval);
if (index < numberOfChildren()) {
cursor->setPointedExpressionLayout(editableChild(index));

View File

@@ -125,6 +125,7 @@ void MatrixLayout::replaceChildAndMoveCursor(const ExpressionLayout * oldChild,
void MatrixLayout::removePointedChildAtIndexAndMoveCursor(int index, bool deleteAfterRemoval, ExpressionLayoutCursor * cursor) {
assert(index >= 0 && index < numberOfChildren());
assert((cursor->pointedExpressionLayout() == child(index)) || (cursor->pointedExpressionLayout()->hasAncestor(child(index))));
replaceChildAndMoveCursor(child(index), new EmptyVisibleLayout(), deleteAfterRemoval, cursor);
}