I have a very simple activity created with one seek bar. I'm trying
to figure out how best to unit test the events. Below is how I have
the seek bar wired up in my activity.
EditText billAmount = (EditText)findViewById(R.id.billAmountEditText);
tip = (SeekBar) findViewById(R.id.tipPercentSeekBar);
tip.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
public void onProgressChanged(SeekBar seekBar, int
progress,
boolean fromTouch) {
//tipPercent.setText(progress + "%");
billAmount.setText("1");
}
public void onStartTrackingTouch(SeekBar seekBar) {
billAmount.setText("2");
}
public void onStopTrackingTouch(SeekBar seekBar) {
billAmount.setText("3");
}
});
So with this I have a test class that extends
ActivityInstrumentationTestCase and I have test method.
Should I not be able to so something like this? Right now I'm getting
Test run failed: String resource ID #0x2 with this code.
@SmallTest
public void testSeekTipEvents(){
TouchUtils.tapView(this, tip);
assertEquals("1", billAmount.getText().toString());
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en