lullaby/tests/layout_system_test.cc
// Test that the LayoutSystem will SetActualBox and children SetDesiredSize
// in response to a DesiredSizeChangedEvent.
// The source is not known so the parent uses SetActualBox() as normal.
Test that the LayoutSystem will SetActualBox and children SetDesiredSize
in response to a DesiredSizeChangedEvent.
The source is not known so the parent uses SetActualBox() as normal.
Test that the LayoutSystem will SetActualBox and children SetDesiredSize in response to a DesiredSizeChangedEvent . The source is not known so the parent uses SetActualBox () as normal .
TEST_F(QueuedLayoutSystemTest, DesiredBox) {
  const Entity parent = CreateParent();
  const Entity child = CreateChild(parent, 1.0f);
  dispatcher_->Dispatch();
  ClearListeners();
  layout_box_system_->SetDesiredSize(parent, 123, 1.f, 1.f, Optional<float>());
  AssertListenerEmpty(original_boxes_);
  AssertListenerMatch({ {parent, 1} }, desired_sizes_);
  AssertSourcesMatch({ {parent, 123} }, desired_sources_);;
  AssertListenerEmpty(actual_boxes_);
  dispatcher_->Dispatch();
  AssertListenerEmpty(original_boxes_);
  AssertListenerMatch({ {parent, 1}, {child, 1} }, desired_sizes_);
  AssertListenerMatch({ {parent, 1} }, actual_boxes_);
  AssertSourcesMatch({ {parent, 123}, {child, 123} }, desired_sources_);
  AssertSourcesMatch({ {parent, 123} }, actual_sources_);
}
TEST_F ( QueuedLayoutSystemTest , DesiredBox ) { const Entity parent = CreateParent ( ) ; const Entity child = CreateChild ( parent , 1.0f ) ; dispatcher_ -> Dispatch ( ) ; ClearListeners ( ) ; layout_box_system_ -> SetDesiredSize ( parent , 123 , 1.f , 1.f , Optional < float > ( ) ) ; AssertListenerEmpty ( original_boxes_ ) ; AssertListenerMatch ( { { parent , 1 } } , desired_sizes_ ) ; AssertSourcesMatch ( { { parent , 123 } } , desired_sources_ ) ; ; AssertListenerEmpty ( actual_boxes_ ) ; dispatcher_ -> Dispatch ( ) ; AssertListenerEmpty ( original_boxes_ ) ; AssertListenerMatch ( { { parent , 1 } , { child , 1 } } , desired_sizes_ ) ; AssertListenerMatch ( { { parent , 1 } } , actual_boxes_ ) ; AssertSourcesMatch ( { { parent , 123 } , { child , 123 } } , desired_sources_ ) ; AssertSourcesMatch ( { { parent , 123 } } , actual_sources_ ) ; }
Test that the LayoutSystem will SetActualBox and children SetDesiredSize
in response to a DesiredSizeChangedEvent.
Test that the LayoutSystem will SetActualBox and children SetDesiredSize in response to a DesiredSizeChangedEvent .
// SetDesiredSize triggers immediately, but Layout aggregates dirty_layouts_ // until ProcessDirty.