car/src/androidTest/java/androidx/car/widget/ActionBarTest.java
@Test
    public void testNormalSlotUsage() {
        for (int items = 1; items < NUM_COLS - 1; items++) {
            setUpActionBarItems(items);
            final int numItems = items;
            onView(withId(androidx.car.test.R.id.action_bar))
                    .check((view, noViewFoundException) -> {
                        Preconditions.checkNotNull(view);
                        // Top row should be empty
                        assertLeftItemsNotEmpty(TOP_ROW_IDX, 0);
                        // Expand/collapse slot should be empty
                        assertNull("Expand/collapse should be empty" ,
                                mActionBar.getViewAt(BOTTOM_ROW_IDX, NUM_COLS - 1));
                        // Slots on the bottom left should be taken while the rest should be empty.
                        assertLeftItemsNotEmpty(BOTTOM_ROW_IDX, numItems);
                    });
        }
    }
/**
     * Tests that slots are used from left to right and from bottom to top
     */
Tests that slots are used from left to right and from bottom to top
Tests that slots are used from left to right and from bottom to top
@Test
    public void testNormalSlotUsage() {
        for (int items = 1; items < NUM_COLS - 1; items++) {
            setUpActionBarItems(items);
            final int numItems = items;
            onView(withId(androidx.car.test.R.id.action_bar))
                    .check((view, noViewFoundException) -> {
                        Preconditions.checkNotNull(view);
                        assertLeftItemsNotEmpty(TOP_ROW_IDX, 0);
                        assertNull("Expand/collapse should be empty" ,
                                mActionBar.getViewAt(BOTTOM_ROW_IDX, NUM_COLS - 1));
                        assertLeftItemsNotEmpty(BOTTOM_ROW_IDX, numItems);
                    });
        }
    }
@ Test public void testNormalSlotUsage ( ) { for ( int items = 1 ; items < NUM_COLS - 1 ; items ++ ) { setUpActionBarItems ( items ) ; final int numItems = items ; onView ( withId ( androidx . car . test . R . id . action_bar ) ) . check ( ( view , noViewFoundException ) -> { Preconditions . checkNotNull ( view ) ; assertLeftItemsNotEmpty ( TOP_ROW_IDX , 0 ) ; assertNull ( "Expand/collapse should be empty" , mActionBar . getViewAt ( BOTTOM_ROW_IDX , NUM_COLS - 1 ) ) ; assertLeftItemsNotEmpty ( BOTTOM_ROW_IDX , numItems ) ; } ) ; } }
Tests that slots are used from left to right and from bottom to top
Tests that slots are used from left to right and from bottom to top
// Top row should be empty // Expand/collapse slot should be empty // Slots on the bottom left should be taken while the rest should be empty.