FileDocCategorySizeDatePackage
RadioGroupPreCheckedTest.javaAPI DocAndroid 5.1 API2413Thu Mar 12 22:22:12 GMT 2015android.widget

RadioGroupPreCheckedTest

public class RadioGroupPreCheckedTest extends android.test.ActivityInstrumentationTestCase2
Exercises {@link android.widget.RadioGroup}'s check feature.

Fields Summary
Constructors Summary
public RadioGroupPreCheckedTest()

        super(RadioGroupActivity.class);
    
Methods Summary
public voidtestRadioButtonChangePreChecked()

        final RadioGroupActivity activity = getActivity();

        RadioButton radio = (RadioButton) activity.findViewById(R.id.value_two);
        TouchUtils.clickView(this, radio);
        
        RadioButton old = (RadioButton) activity.findViewById(R.id.value_one);

        assertFalse("The first radio button should not be checked", old.isChecked());
        assertTrue("The second radio button should be checked", radio.isChecked());

        RadioGroup group = (RadioGroup) activity.findViewById(R.id.group);
        assertEquals("The second radio button should be checked", R.id.value_two,
                group.getCheckedRadioButtonId());
    
public voidtestRadioButtonPreChecked()

        final RadioGroupActivity activity = getActivity();

        RadioButton radio = (RadioButton) activity.findViewById(R.id.value_one);
        assertTrue("The first radio button should be checked", radio.isChecked());

        RadioGroup group = (RadioGroup) activity.findViewById(R.id.group);
        assertEquals("The first radio button should be checked", R.id.value_one,
                group.getCheckedRadioButtonId());