private static void assertTabControl(TabControl tabControl, TabPage... tabPages) {
   Assert.assertEquals(tabPages.length, tabControl.getTabPages().size());
   int index = 0;
   for (TabPage tabPage : tabControl.getTabPages()) {
     Assert.assertSame(tabPages[index++], tabPage);
   }
 }
  @Test
  public void testContravarianceList() {

    TabControl tabControl = new TabControl();
    TabPage tabPage1 = new TabPage();
    TabPage tabPage2 = new TabPage();
    TabPage tabPage3 = new TabPage();
    TabPage tabPage4 = new TabPage();

    assertTabControl(tabControl);
    assertContainer(tabControl);

    tabControl.getTabPages().addAll(MACollections.wrap(tabPage1, tabPage2, tabPage3, tabPage4));

    assertTabControl(tabControl, tabPage1, tabPage2, tabPage3, tabPage4);
    assertContainer(tabControl, tabPage1, tabPage2, tabPage3, tabPage4);
  }
Example #3
0
 public void onResume() {
   mActivityPaused = false;
   // check if we exited without setting active tab
   // b: 5188145
   final Tab ct = mTabControl.getCurrentTab();
   if (ct != null) {
     setActiveTab(ct);
   }
 }
Example #4
0
 private void init() {
   LayoutInflater.from(getContext()).inflate(R.layout.nav_screen, this);
   setContentDescription(
       getContext().getResources().getString(R.string.accessibility_transition_navscreen));
   System.out.println("================= NavScreen init 11111111 ====================");
   // mApplication = (Browser) mActivity.getApplication();
   mNewTab = (ImageButton) findViewById(R.id.newtab);
   mClearAllTab = (ImageButton) findViewById(R.id.clearall);
   mFullScreen = (ImageButton) findViewById(R.id.fullscreen);
   mClearAllTab.setOnClickListener(this);
   mFullScreen.setOnClickListener(this);
   mNewTab.setOnClickListener(this);
   mTc = mUiController.getTabControl();
   mTabViews = new HashMap<Tab, View>(mTc.getTabCount());
   mBuilder = (NavTabViewPagerBuilder) findViewById(R.id.viewPagerBuilder);
   mBuilder.makeViewPager(mUi, mTc);
   mNeedsMenu = !ViewConfiguration.get(getContext()).hasPermanentMenuKey();
   changeIncogStyle(mTc.getIncogMode());
 }
 @Test(expected = IllegalArgumentException.class)
 public void testCovarianceListFailed() {
   TabControl tabControl = new TabControl();
   tabControl.getComponents().add(new Button());
 }