lullaby/tests/sort_order_test.cc
// Test that the default offsets for root level entities are not 0 and varying.
Test that the default offsets for root level entities are not 0 and varying.
Test that the default offsets for root level entities are not 0 and varying .
TEST(SortOrderTest, DefaultRootLevelOffsets) {
  Registry registry;
  SortOrderManager manager(&registry);
  const int kNumEntities = 17;
  CreateTransformSystemWithEntities(&registry, kNumEntities);
  manager.SetOffset(Entity(1), kUseDefaultOffset);
  manager.SetOffset(Entity(5), kUseDefaultOffset);
  EXPECT_THAT(manager.CalculateSortOrder(Entity(1)),
              Eq(RootSortOrderFromOffset(1)));
  EXPECT_THAT(manager.CalculateSortOrder(Entity(2)),
              Eq(RootSortOrderFromOffset(2)));
  EXPECT_THAT(manager.CalculateSortOrder(Entity(3)),
              Eq(RootSortOrderFromOffset(3)));
  EXPECT_THAT(manager.CalculateSortOrder(Entity(4)),
              Eq(RootSortOrderFromOffset(4)));
  EXPECT_THAT(manager.CalculateSortOrder(Entity(5)),
              Eq(RootSortOrderFromOffset(5)));
  EXPECT_THAT(manager.CalculateSortOrder(Entity(6)),
              Eq(RootSortOrderFromOffset(6)));
  EXPECT_THAT(manager.CalculateSortOrder(Entity(7)),
              Eq(RootSortOrderFromOffset(7)));
  EXPECT_THAT(manager.CalculateSortOrder(Entity(8)),
              Eq(RootSortOrderFromOffset(8)));
  EXPECT_THAT(manager.CalculateSortOrder(Entity(9)),
              Eq(RootSortOrderFromOffset(9)));
  EXPECT_THAT(manager.CalculateSortOrder(Entity(10)),
              Eq(RootSortOrderFromOffset(10)));
  EXPECT_THAT(manager.CalculateSortOrder(Entity(11)),
              Eq(RootSortOrderFromOffset(11)));
  EXPECT_THAT(manager.CalculateSortOrder(Entity(12)),
              Eq(RootSortOrderFromOffset(12)));
  EXPECT_THAT(manager.CalculateSortOrder(Entity(13)),
              Eq(RootSortOrderFromOffset(13)));
  EXPECT_THAT(manager.CalculateSortOrder(Entity(14)),
              Eq(RootSortOrderFromOffset(14)));
  EXPECT_THAT(manager.CalculateSortOrder(Entity(15)),
              Eq(RootSortOrderFromOffset(15)));
  EXPECT_THAT(manager.CalculateSortOrder(Entity(16)),
              Eq(RootSortOrderFromOffset(1)));
}
TEST ( SortOrderTest , DefaultRootLevelOffsets ) { Registry registry ; SortOrderManager manager ( & registry ) ; const int kNumEntities = 17 ; CreateTransformSystemWithEntities ( & registry , kNumEntities ) ; manager . SetOffset ( Entity ( 1 ) , kUseDefaultOffset ) ; manager . SetOffset ( Entity ( 5 ) , kUseDefaultOffset ) ; EXPECT_THAT ( manager . CalculateSortOrder ( Entity ( 1 ) ) , Eq ( RootSortOrderFromOffset ( 1 ) ) ) ; EXPECT_THAT ( manager . CalculateSortOrder ( Entity ( 2 ) ) , Eq ( RootSortOrderFromOffset ( 2 ) ) ) ; EXPECT_THAT ( manager . CalculateSortOrder ( Entity ( 3 ) ) , Eq ( RootSortOrderFromOffset ( 3 ) ) ) ; EXPECT_THAT ( manager . CalculateSortOrder ( Entity ( 4 ) ) , Eq ( RootSortOrderFromOffset ( 4 ) ) ) ; EXPECT_THAT ( manager . CalculateSortOrder ( Entity ( 5 ) ) , Eq ( RootSortOrderFromOffset ( 5 ) ) ) ; EXPECT_THAT ( manager . CalculateSortOrder ( Entity ( 6 ) ) , Eq ( RootSortOrderFromOffset ( 6 ) ) ) ; EXPECT_THAT ( manager . CalculateSortOrder ( Entity ( 7 ) ) , Eq ( RootSortOrderFromOffset ( 7 ) ) ) ; EXPECT_THAT ( manager . CalculateSortOrder ( Entity ( 8 ) ) , Eq ( RootSortOrderFromOffset ( 8 ) ) ) ; EXPECT_THAT ( manager . CalculateSortOrder ( Entity ( 9 ) ) , Eq ( RootSortOrderFromOffset ( 9 ) ) ) ; EXPECT_THAT ( manager . CalculateSortOrder ( Entity ( 10 ) ) , Eq ( RootSortOrderFromOffset ( 10 ) ) ) ; EXPECT_THAT ( manager . CalculateSortOrder ( Entity ( 11 ) ) , Eq ( RootSortOrderFromOffset ( 11 ) ) ) ; EXPECT_THAT ( manager . CalculateSortOrder ( Entity ( 12 ) ) , Eq ( RootSortOrderFromOffset ( 12 ) ) ) ; EXPECT_THAT ( manager . CalculateSortOrder ( Entity ( 13 ) ) , Eq ( RootSortOrderFromOffset ( 13 ) ) ) ; EXPECT_THAT ( manager . CalculateSortOrder ( Entity ( 14 ) ) , Eq ( RootSortOrderFromOffset ( 14 ) ) ) ; EXPECT_THAT ( manager . CalculateSortOrder ( Entity ( 15 ) ) , Eq ( RootSortOrderFromOffset ( 15 ) ) ) ; EXPECT_THAT ( manager . CalculateSortOrder ( Entity ( 16 ) ) , Eq ( RootSortOrderFromOffset ( 1 ) ) ) ; }
Test that the default offsets for root level entities are not 0 and varying.
Test that the default offsets for root level entities are not 0 and varying .
// Set some offsets to kUseDefaultOffset, which shouldn't change anything.