lullaby/tests/sort_order_test.cc
// Tests that the sort orders of an entire hierarchy without explicit offsets
// are calculated as expected.
Tests that the sort orders of an entire hierarchy without explicit offsets
are calculated as expected.
Tests that the sort orders of an entire hierarchy without explicit offsets are calculated as expected .
TEST(SortOrderTest, SiblingOrder) {
  Registry registry;
  SortOrderManager manager(&registry);
  auto* transform_system = CreateTransformSystemWithEntities(&registry, 8);
  transform_system->AddChild(1, 2);
  transform_system->AddChild(1, 3);
  transform_system->AddChild(3, 4);
  transform_system->AddChild(3, 5);
  transform_system->AddChild(5, 6);
  transform_system->AddChild(5, 7);
  transform_system->AddChild(5, 8);
  EXPECT_THAT(manager.CalculateSortOrder(Entity(1)).ToHexString(),
              Eq("0x10000000000000000000000000000000"));
  EXPECT_THAT(manager.CalculateSortOrder(Entity(2)).ToHexString(),
              Eq("0x11000000000000000000000000000000"));
  EXPECT_THAT(manager.CalculateSortOrder(Entity(3)).ToHexString(),
              Eq("0x12000000000000000000000000000000"));
  EXPECT_THAT(manager.CalculateSortOrder(Entity(4)).ToHexString(),
              Eq("0x12100000000000000000000000000000"));
  EXPECT_THAT(manager.CalculateSortOrder(Entity(5)).ToHexString(),
              Eq("0x12200000000000000000000000000000"));
  EXPECT_THAT(manager.CalculateSortOrder(Entity(6)).ToHexString(),
              Eq("0x12210000000000000000000000000000"));
  EXPECT_THAT(manager.CalculateSortOrder(Entity(7)).ToHexString(),
              Eq("0x12220000000000000000000000000000"));
  EXPECT_THAT(manager.CalculateSortOrder(Entity(8)).ToHexString(),
              Eq("0x12230000000000000000000000000000"));
}
TEST ( SortOrderTest , SiblingOrder ) { Registry registry ; SortOrderManager manager ( & registry ) ; auto * transform_system = CreateTransformSystemWithEntities ( & registry , 8 ) ; transform_system -> AddChild ( 1 , 2 ) ; transform_system -> AddChild ( 1 , 3 ) ; transform_system -> AddChild ( 3 , 4 ) ; transform_system -> AddChild ( 3 , 5 ) ; transform_system -> AddChild ( 5 , 6 ) ; transform_system -> AddChild ( 5 , 7 ) ; transform_system -> AddChild ( 5 , 8 ) ; EXPECT_THAT ( manager . CalculateSortOrder ( Entity ( 1 ) ) . ToHexString ( ) , Eq ( " " ) ) ; EXPECT_THAT ( manager . CalculateSortOrder ( Entity ( 2 ) ) . ToHexString ( ) , Eq ( " " ) ) ; EXPECT_THAT ( manager . CalculateSortOrder ( Entity ( 3 ) ) . ToHexString ( ) , Eq ( " " ) ) ; EXPECT_THAT ( manager . CalculateSortOrder ( Entity ( 4 ) ) . ToHexString ( ) , Eq ( " " ) ) ; EXPECT_THAT ( manager . CalculateSortOrder ( Entity ( 5 ) ) . ToHexString ( ) , Eq ( " " ) ) ; EXPECT_THAT ( manager . CalculateSortOrder ( Entity ( 6 ) ) . ToHexString ( ) , Eq ( " " ) ) ; EXPECT_THAT ( manager . CalculateSortOrder ( Entity ( 7 ) ) . ToHexString ( ) , Eq ( " " ) ) ; EXPECT_THAT ( manager . CalculateSortOrder ( Entity ( 8 ) ) . ToHexString ( ) , Eq ( " " ) ) ; }
Tests that the sort orders of an entire hierarchy without explicit offsets
are calculated as expected.
Tests that the sort orders of an entire hierarchy without explicit offsets are calculated as expected .
// Create a hierarchy without offsets like so: //   1 // 2    3 //    4    5 //       6 7 8