lullaby/tests/layout_system_test.cc
// Test that if the LayoutSystem receives multiple ActualBoxChangedEvents, it
// keeps the closest parent's source.
Test that if the LayoutSystem receives multiple ActualBoxChangedEvents, it
keeps the closest parent's source.
Test that if the LayoutSystem receives multiple ActualBoxChangedEvents it keeps the closest parent ' s source .
TEST_F(QueuedLayoutSystemTest, ActualBoxClosestSource_First) {
  const Entity grandgrandparent = CreateParent();
  const Entity grandparent = CreateChild(grandgrandparent, 1.0f);
  const Entity parent = CreateChild(grandparent, 1.0f, true);
  const Entity child = CreateChild(parent, 1.0f);
  dispatcher_->Dispatch();
  ClearListeners();
  layout_box_system_->SetActualBox(child, grandparent,
                                   Aabb({-1.f, -1.f, 0.f}, {1.f, 1.f, 0.f}));
  layout_box_system_->SetActualBox(child, grandgrandparent,
                                   Aabb({-1.f, -1.f, 0.f}, {1.f, 1.f, 0.f}));
  AssertListenersEmpty();
  dispatcher_->Dispatch();
  AssertListenerEmpty(original_boxes_);
  AssertListenerEmpty(desired_sizes_);
  AssertListenerMatch({ {parent, 1}, {child, 2} }, actual_boxes_);
  AssertSourcesMatch({ {parent, grandparent}, {child, grandgrandparent} },
                     actual_sources_);
}
TEST_F ( QueuedLayoutSystemTest , ActualBoxClosestSource_First ) { const Entity grandgrandparent = CreateParent ( ) ; const Entity grandparent = CreateChild ( grandgrandparent , 1.0f ) ; const Entity parent = CreateChild ( grandparent , 1.0f , true ) ; const Entity child = CreateChild ( parent , 1.0f ) ; dispatcher_ -> Dispatch ( ) ; ClearListeners ( ) ; layout_box_system_ -> SetActualBox ( child , grandparent , Aabb ( { -1.f , -1.f , 0.f } , { 1.f , 1.f , 0.f } ) ) ; layout_box_system_ -> SetActualBox ( child , grandgrandparent , Aabb ( { -1.f , -1.f , 0.f } , { 1.f , 1.f , 0.f } ) ) ; AssertListenersEmpty ( ) ; dispatcher_ -> Dispatch ( ) ; AssertListenerEmpty ( original_boxes_ ) ; AssertListenerEmpty ( desired_sizes_ ) ; AssertListenerMatch ( { { parent , 1 } , { child , 2 } } , actual_boxes_ ) ; AssertSourcesMatch ( { { parent , grandparent } , { child , grandgrandparent } } , actual_sources_ ) ; }
Test that if the LayoutSystem receives multiple ActualBoxChangedEvents, it
keeps the closest parent's source.
Test that if the LayoutSystem receives multiple ActualBoxChangedEvents it keeps the closest parent ' s source .