public void testSound()
{
solo.waitForWebElement(By.textContent("Audio Play/Record"), 10, false);
solo.clickOnWebElement(By.textContent("Audio Play/Record"));
solo.waitForWebElement(By.textContent("Play"), 10, false);
solo.clickOnWebElement(By.textContent("Play"));
WebElement result = solo.getWebElement(By.textContent("Running"), 0);
assertNotNull(result);
}
public void touch(int x, int y)
{
int realX = getRealCoord(x);
int realY = getRealCoord(y);
long downTime = SystemClock.uptimeMillis();
// event time MUST be retrieved only by this way!
long eventTime = SystemClock.uptimeMillis();
if(!fingerDown)
{
MotionEvent downEvent = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_DOWN, realX, realY, 0);
inst.sendPointerSync(downEvent);
}
MotionEvent upEvent = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_UP, realX, realY, 0);
inst.sendPointerSync(upEvent);
}
public void testSound()
{
sleep(5000);
clicker.touch(200, 400);
sleep(1000);
clicker.touch(75, 325);
sleep(10000);
clicker.touch(75, 400);
sleep(3000);
}
public Purity(Context ctx, Instrumentation i)
{
inst = i;
DisplayMetrics display = ctx.getResources().getDisplayMetrics();
density = display.density;
width = display.widthPixels;
height = display.heightPixels;
}
private int getRealCoord(int coord)
{
return (int) (coord * density);
}