CompoundButton performClick - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for CompoundButton performClick method.

This code example shows how to use the following methods:isChecked, performClick
        assertFalse(radioButton.isChecked());
    } 
 
    @Test 
    public void canBeClickedToToggleCheckedState() throws Exception { 
        RadioButton radioButton = new RadioButton(null);
        assertFalse(radioButton.isChecked());
 
        radioButton.performClick();
        assertTrue(radioButton.isChecked());
 
        radioButton.performClick();
        assertFalse(radioButton.isChecked());
    } 
 
    @Test 
    public void shouldInformRadioGroupThatItIsChecked() throws Exception { 
        RadioButton radioButton1 = new RadioButton(null);
        radioButton1.setId(99);
        RadioButton radioButton2 = new RadioButton(null);
7
CodeRank
This code example shows how to use the following methods:isChecked, performClick
				dateLayout.getVisibility(), View.GONE);
	} 
 
	@UiThreadTest 
	public void testToggleContacts() { 
		contactsCheck.performClick();
		assertTrue(contactsCheck.isChecked());
		assertEquals("Contacts layout visibility",
				contactsLayout.getVisibility(), View.VISIBLE);
		contactsCheck.performClick();
		assertTrue(!contactsCheck.isChecked());
		assertEquals("Contacts layout visibility",
				contactsLayout.getVisibility(), View.GONE);
	} 
 
	@UiThreadTest 
	public void testToggleSentReceived() { 
		sentCheck.performClick();
		assertTrue(sentCheck.isChecked());
		assertEquals("Sent/received layout visibility",
5
CodeRank
This code example shows how to use the following methods:isChecked, performClick
		assertNotNull(sentCheck);
	} 
 
	@UiThreadTest 
	public void testToggleDate() { 
		dateCheck.performClick();
		assertTrue(dateCheck.isChecked());
		assertEquals("Date layout visibility",
				dateLayout.getVisibility(), View.VISIBLE);
		dateCheck.performClick();
		assertTrue(!dateCheck.isChecked());
		assertEquals("Date layout visibility",
				dateLayout.getVisibility(), View.GONE);
	} 
 
	@UiThreadTest 
	public void testToggleContacts() { 
		contactsCheck.performClick();
		assertTrue(contactsCheck.isChecked());
		assertEquals("Contacts layout visibility",
5
CodeRank
This code example shows how to use the following methods:performClick
		assertNotNull(mButtonNext);
	} 
	 
	@UiThreadTest 
	public void testButtonAuto() { 
		mButtonOnOff.performClick();
		assertTrue(true);
	} 
	 
	@UiThreadTest 
	public void testButtonClear() { 
		mButtonClear.performClick();
		assertTrue(true);
	} 
	 
	@UiThreadTest 
	public void testButtonNext() { 
		mButtonNext.performClick();
		assertTrue(true);
	} 
5
CodeRank
This code example shows how to use the following methods:performClick
		JokeView jv3 = (JokeView)m_jokeAdapter.getView(2, null, null);
		final RadioButton m_vwLikeButton3 = (RadioButton)jv3.findViewById(R.id.likeButton);
		assertFalse("Check Like Unchecked", m_vwLikeButton3.isChecked());
		getActivity().runOnUiThread(new Runnable() {
		public void run() { 
			m_vwLikeButton3.performClick();
		} 
		}); 
		getInstrumentation().waitForIdleSync();
		assertTrue("Check Like Checked", m_vwLikeButton3.isChecked());
		 
		//Check Unrated on first jokeView still 
		JokeView jv1 = (JokeView)m_jokeAdapter.getView(0, null, null);
		RadioGroup m_vwLikeGroup1 = (RadioGroup)jv1.findViewById(R.id.ratingRadioGroup);
		assertEquals("Check Unrated", m_vwLikeGroup1.getCheckedRadioButtonId(), -1);
		 
		Menu menu = null;
		menu = this.retrieveHiddenMember("m_vwMenu", menu, getActivity());
		MenuItem filter = menu.getItem(0);
		SubMenu sm = filter.getSubMenu();
3
CodeRank
This code example shows how to use the following methods:performClick
 
        this.runTestOnUiThread(new Runnable() {
            @Override 
            public void run() { 
                Log.d(TAG, "Running on UI Thread");
                Assert.assertFalse(filterRadioButton.performClick());
                Assert.assertTrue(FilterOptionsTest.this.okButton.performClick());
            } 
        }); 
 
        Activity filterActivity = this.inst.waitForMonitorWithTimeout(filterActivityMonitor, TIME_OUT);
        Assert.assertNotNull(filterActivity);
        Assert.assertEquals(filterActivityClass, filterActivity.getClass());
        filterActivity.finish();
        Assert.assertTrue(filterActivity.isFinishing());
    } 
 
    /** 
     * Test that {@link YearFilter} starts when the user selects the "Year" 
     * radio button and clicks "OK". 
4
CodeRank
This code example shows how to use the following methods:performClick
		assertEquals("14th joke is 'This is new joke #11'", "This is new joke #11", m_arrFilteredJokeList.get(13).getJoke());
		final RadioButton m_vwLikeButton14 = (RadioButton)jv14.findViewById(R.id.likeButton);
		assertFalse("Check Like Unchecked", m_vwLikeButton14.isChecked());
		getActivity().runOnUiThread(new Runnable() {
		public void run() { 
			m_vwLikeButton14.performClick();
		} 
		}); 
		getInstrumentation().waitForIdleSync();
		assertTrue("Check Like Checked", m_vwLikeButton14.isChecked());
		 
		//Check Unrated on third jokeView still 
		JokeView jv3 = (JokeView)m_jokeAdapter.getView(2, null, null);
		RadioGroup m_vwLikeGroup3 = (RadioGroup)jv3.findViewById(R.id.ratingRadioGroup);
		assertEquals("Check Unrated", m_vwLikeGroup3.getCheckedRadioButtonId(), -1);
		 
		//Filter jokes by dislike 
		Menu menu = null;
		menu = this.retrieveHiddenMember("m_vwMenu", menu, getActivity());
		MenuItem filter = menu.getItem(0);
3
CodeRank
This code example shows how to use the following methods:performClick
		final RadioButton m_vwLikeButton = (RadioButton)jv.findViewById(R.id.likeButton);
		assertFalse("Check Like Unchecked",m_vwLikeButton.isChecked());
 
		getActivity().runOnUiThread(new Runnable() {
		public void run() { 
			m_vwLikeButton.performClick();
		} 
		}); 
		getInstrumentation().waitForIdleSync();
		assertTrue("Check Like Checked",m_vwLikeButton.isChecked());
 
		//expand second button 
		JokeView jv2 = (JokeView)adapter.getView(1, null, null);
		Button m_vwExpandButton2 = (Button)jv2.findViewById(R.id.expandButton);
		assertEquals("Check Expand Button"," + ",m_vwExpandButton2.getText());
		jv2.toggle();
		assertEquals("Check Collapse Second Button"," - ",m_vwExpandButton2.getText());
 
		final RadioButton m_vwDislikeButton2 = (RadioButton)jv2.findViewById(R.id.dislikeButton);
		assertFalse("Check Dislike Unchecked",m_vwDislikeButton2.isChecked());
4
CodeRank
This code example shows how to use the following methods:performClick
		final RadioButton m_vwDislikeButton2 = (RadioButton)jv2.findViewById(R.id.dislikeButton);
		assertFalse("Check Dislike Unchecked",m_vwDislikeButton2.isChecked());
 
		getActivity().runOnUiThread(new Runnable() {
		public void run() { 
			m_vwDislikeButton2.performClick();
		} 
		}); 
		getInstrumentation().waitForIdleSync();
		assertTrue("Check Dislike Checked",m_vwDislikeButton2.isChecked());
		jv.toggle();
		assertTrue("Check Like Checked",m_vwLikeButton.isChecked());
		assertTrue("Check Dislike Checked",m_vwDislikeButton2.isChecked());
} 
 
	/*************************************/ 
	/**	Java Friend-Class Helper Method **/ 
	/*************************************/ 
	@SuppressWarnings("unchecked") 
	public <T> T retrieveHiddenMember(String memberName, T type, Object sourceObj) {
4
CodeRank

Related CompoundButton performClick Questions & Answers:

performClick Method Overview
Call this view's OnClickListener, if it is defined.
See Code Examples for other Android CompoundButton Methods: