MCPcopy Create free account
hub / github.com/MITK/MITK / TestInvariants

Method TestInvariants

Plugins/org.blueberry.ui.qt/src/internal/berryPartStack.cpp:334–412  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

332}
333
334void PartStack::TestInvariants()
335{
336 QWidget* focusControl =
337 Tweaklets::Get(GuiWidgetsTweaklet::KEY)->GetFocusControl();
338
339 bool currentFound = false;
340
341 ChildVector children = this->GetChildren();
342
343 for (ChildVector::iterator iter = children.begin(); iter != children.end(); ++iter)
344 {
345 LayoutPart::Pointer child = *iter;
346
347 // No 0 children allowed
348 poco_assert(child != 0)
349; // "0 children are not allowed in PartStack"
350
351 // Ensure that all the PartPanes have an associated presentable part
352 IPresentablePart::Pointer part = this->GetPresentablePart(child);
353 if (!child->IsPlaceHolder())
354 {
355 poco_assert(part != 0); // "All PartPanes must have a non-0 IPresentablePart"
356 }
357
358 // Ensure that the child's backpointer points to this stack
359 ILayoutContainer::Pointer childContainer = child->GetContainer();
360
361 // Disable tests for placeholders -- PartPlaceholder backpointers don't
362 // obey the usual rules -- they sometimes point to a container placeholder
363 // for this stack instead of the real stack.
364 if (!child->IsPlaceHolder())
365 {
366
367 // If the widgetry exists, the child's backpointer must point to us
368 poco_assert(childContainer.GetPointer() == this); // "PartStack has a child that thinks it has a different parent"
369
370 // If this child has focus, then ensure that it is selected and that we have
371 // the active appearance.
372
373 if (focusControl && Tweaklets::Get(GuiWidgetsTweaklet::KEY)->IsChild(child->GetControl(), focusControl))
374 {
375 poco_assert(child == current); // "The part with focus is not the selected part"
376 // focus check commented out since it fails when focus workaround in LayoutPart.setVisible is not present
377 // Assert.isTrue(getActive() == StackPresentation.AS_ACTIVE_FOCUS);
378 }
379
380 }
381
382 // Ensure that "current" points to a valid child
383 if (child == current)
384 {
385 currentFound = true;
386 }
387
388 // Test the child's internal state
389 child->TestInvariants();
390 }
391

Callers

nothing calls this directly

Calls 15

GetChildrenMethod · 0.95
GetPresentablePartMethod · 0.95
GetPresentablePartsMethod · 0.95
GetPresentationMethod · 0.95
GetActiveMethod · 0.95
GetPointerMethod · 0.80
GetFunction · 0.70
GetFocusControlMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
IsPlaceHolderMethod · 0.45
GetContainerMethod · 0.45

Tested by

no test coverage detected