< prev index next >
tests/system/src/test/java/test/robot/com/sun/glass/ui/monocle/ScrollTestBase.java
Print this page
rev 9504 : need to fix test log and others
*** 23,33 ****
* questions.
*/
package test.robot.com.sun.glass.ui.monocle;
! import com.sun.glass.ui.monocle.TestLog;
import test.robot.com.sun.glass.ui.monocle.TestApplication;
import test.robot.com.sun.glass.ui.monocle.input.devices.TestTouchDevice;
import test.robot.com.sun.glass.ui.monocle.input.devices.TestTouchDevices;
import org.junit.After;
import org.junit.Assert;
--- 23,33 ----
* questions.
*/
package test.robot.com.sun.glass.ui.monocle;
! import com.sun.glass.ui.monocle.TestLogShim;
import test.robot.com.sun.glass.ui.monocle.TestApplication;
import test.robot.com.sun.glass.ui.monocle.input.devices.TestTouchDevice;
import test.robot.com.sun.glass.ui.monocle.input.devices.TestTouchDevices;
import org.junit.After;
import org.junit.Assert;
*** 100,170 ****
}
}
protected void pressFirstFinger() throws Exception {
Assert.assertEquals(0, device.getPressedPoints());
! TestLog.reset();
p1 = device.addPoint(point1X, point1Y);
device.sync();
! TestLog.waitForLogContaining("TouchPoint: PRESSED %d, %d", point1X, point1Y);
}
protected void pressSecondFinger() throws Exception {
Assert.assertEquals(1, device.getPressedPoints());
! TestLog.reset();
point2X = point1X + 40;
point2Y = point1Y;
p2 = device.addPoint(point2X, point2Y);
device.sync();
//verify fingers pressed
! TestLog.waitForLogContaining("TouchPoint: STATIONARY %d, %d",
point1X, point1Y);
! TestLog.waitForLogContaining("TouchPoint: PRESSED %d, %d",
point2X, point2Y);
}
/**
* The method drags one finger
* @param firstMove - reflects if it's the first action in the drag sequence.
*/
protected void moveOneFinger(int deltaX, int deltaY, int numOfIterations,
boolean firstMove) throws Exception {
! TestLog.reset();
Assert.assertEquals(1, device.getPressedPoints());
Assert.assertTrue(paramsValid(deltaX, deltaY, numOfIterations,
point1X, point1Y));
point1X += deltaX;
point1Y += deltaY;
device.setPoint(p1, point1X, point1Y);
device.sync();
! TestLog.waitForLogContaining("TouchPoint: MOVED %d, %d", point1X,
point1Y);
if (firstMove) {
totalDeltaX = deltaX;
totalDeltaY = deltaY;
if (Math.abs(deltaX) > getScrollThreshold()
|| Math.abs(deltaY) > getScrollThreshold()) {
! TestLog.waitForLogContaining("Scroll started, DeltaX: " + 0
+ ", DeltaY: " + 0
+ ", totalDeltaX: " + 0
+ ", totalDeltaY: " + 0
+ ", touch points: " + 1
+ ", inertia value: false");
! TestLog.waitForLogContaining("Scroll, DeltaX: " + deltaX
+ ", DeltaY: " + deltaY
+ ", totalDeltaX: " + totalDeltaX
+ ", totalDeltaY: " + totalDeltaY
+ ", touch points: " + 1
+ ", inertia value: false");
} else {
! Assert.assertEquals(0, TestLog.countLogContaining("Scroll started"));
! Assert.assertEquals(0, TestLog.countLogContaining("Scroll, DeltaX:"));
}
} else {
totalDeltaX += deltaX;
totalDeltaY += deltaY;
! TestLog.waitForLogContaining("Scroll, DeltaX: " + deltaX
+ ", DeltaY: " + deltaY
+ ", totalDeltaX: " + totalDeltaX
+ ", totalDeltaY: " + totalDeltaY
+ ", touch points: " + 1
+ ", inertia value: false");
--- 100,170 ----
}
}
protected void pressFirstFinger() throws Exception {
Assert.assertEquals(0, device.getPressedPoints());
! TestLogShim.reset();
p1 = device.addPoint(point1X, point1Y);
device.sync();
! TestLogShim.waitForLogContaining("TouchPoint: PRESSED %d, %d", point1X, point1Y);
}
protected void pressSecondFinger() throws Exception {
Assert.assertEquals(1, device.getPressedPoints());
! TestLogShim.reset();
point2X = point1X + 40;
point2Y = point1Y;
p2 = device.addPoint(point2X, point2Y);
device.sync();
//verify fingers pressed
! TestLogShim.waitForLogContaining("TouchPoint: STATIONARY %d, %d",
point1X, point1Y);
! TestLogShim.waitForLogContaining("TouchPoint: PRESSED %d, %d",
point2X, point2Y);
}
/**
* The method drags one finger
* @param firstMove - reflects if it's the first action in the drag sequence.
*/
protected void moveOneFinger(int deltaX, int deltaY, int numOfIterations,
boolean firstMove) throws Exception {
! TestLogShim.reset();
Assert.assertEquals(1, device.getPressedPoints());
Assert.assertTrue(paramsValid(deltaX, deltaY, numOfIterations,
point1X, point1Y));
point1X += deltaX;
point1Y += deltaY;
device.setPoint(p1, point1X, point1Y);
device.sync();
! TestLogShim.waitForLogContaining("TouchPoint: MOVED %d, %d", point1X,
point1Y);
if (firstMove) {
totalDeltaX = deltaX;
totalDeltaY = deltaY;
if (Math.abs(deltaX) > getScrollThreshold()
|| Math.abs(deltaY) > getScrollThreshold()) {
! TestLogShim.waitForLogContaining("Scroll started, DeltaX: " + 0
+ ", DeltaY: " + 0
+ ", totalDeltaX: " + 0
+ ", totalDeltaY: " + 0
+ ", touch points: " + 1
+ ", inertia value: false");
! TestLogShim.waitForLogContaining("Scroll, DeltaX: " + deltaX
+ ", DeltaY: " + deltaY
+ ", totalDeltaX: " + totalDeltaX
+ ", totalDeltaY: " + totalDeltaY
+ ", touch points: " + 1
+ ", inertia value: false");
} else {
! Assert.assertEquals(0, TestLogShim.countLogContaining("Scroll started"));
! Assert.assertEquals(0, TestLogShim.countLogContaining("Scroll, DeltaX:"));
}
} else {
totalDeltaX += deltaX;
totalDeltaY += deltaY;
! TestLogShim.waitForLogContaining("Scroll, DeltaX: " + deltaX
+ ", DeltaY: " + deltaY
+ ", totalDeltaX: " + totalDeltaX
+ ", totalDeltaY: " + totalDeltaY
+ ", touch points: " + 1
+ ", inertia value: false");
*** 173,186 ****
boolean passedTheThreshold =false;
if (numOfIterations >= 2) {
for (int i = 2; i <= numOfIterations; i++) {
point1X += deltaX;
point1Y += deltaY;
! TestLog.reset();
device.setPoint(p1, point1X, point1Y);
device.sync();
! TestLog.waitForLogContaining("TouchPoint: MOVED %d, %d",
point1X, point1Y);
totalDeltaX += deltaX;
totalDeltaY += deltaY;
expectedLog = "Scroll, DeltaX: " + deltaX + ", DeltaY: " + deltaY
+ ", totalDeltaX: " + totalDeltaX
--- 173,186 ----
boolean passedTheThreshold =false;
if (numOfIterations >= 2) {
for (int i = 2; i <= numOfIterations; i++) {
point1X += deltaX;
point1Y += deltaY;
! TestLogShim.reset();
device.setPoint(p1, point1X, point1Y);
device.sync();
! TestLogShim.waitForLogContaining("TouchPoint: MOVED %d, %d",
point1X, point1Y);
totalDeltaX += deltaX;
totalDeltaY += deltaY;
expectedLog = "Scroll, DeltaX: " + deltaX + ", DeltaY: " + deltaY
+ ", totalDeltaX: " + totalDeltaX
*** 202,212 ****
}
} else {
expectedLog = "sync";
}
}
! TestLog.waitForLogContaining(expectedLog);
}
}
}
/**
--- 202,212 ----
}
} else {
expectedLog = "sync";
}
}
! TestLogShim.waitForLogContaining(expectedLog);
}
}
}
/**
*** 216,226 ****
* different number of touch-points
*/
protected void moveTwoFingers(int deltaX, int deltaY, int numOfIterations,
boolean firstMove, boolean fingersChanged)
throws Exception {
! TestLog.reset();
Assert.assertEquals(2, device.getPressedPoints());
Assert.assertTrue(paramsValid(deltaX, deltaY, numOfIterations,
point1X, point1Y) && paramsValid(deltaX, deltaY, numOfIterations,
point2X, point2Y));
point1X += deltaX;
--- 216,226 ----
* different number of touch-points
*/
protected void moveTwoFingers(int deltaX, int deltaY, int numOfIterations,
boolean firstMove, boolean fingersChanged)
throws Exception {
! TestLogShim.reset();
Assert.assertEquals(2, device.getPressedPoints());
Assert.assertTrue(paramsValid(deltaX, deltaY, numOfIterations,
point1X, point1Y) && paramsValid(deltaX, deltaY, numOfIterations,
point2X, point2Y));
point1X += deltaX;
*** 228,271 ****
point2X += deltaX;
point2Y += deltaY;
device.setPoint(p1, point1X, point1Y);
device.setPoint(p2, point2X, point2Y);
device.sync();
! TestLog.waitForLogContaining("TouchPoint: MOVED %d, %d", point1X, point1Y);
! TestLog.waitForLogContaining("TouchPoint: MOVED %d, %d", point2X, point2Y);
boolean passedTheThreshold = false;
if (firstMove) {
totalDeltaX = deltaX;
totalDeltaY = deltaY;
if (Math.abs(deltaX) > getScrollThreshold()
|| Math.abs(deltaY) > getScrollThreshold()) {
! TestLog.waitForLogContaining("Scroll started, DeltaX: " + 0
+ ", DeltaY: " + 0
+ ", totalDeltaX: " + 0
+ ", totalDeltaY: " + 0
+ ", touch points: " + 2
+ ", inertia value: false");
! TestLog.waitForLogContaining("Scroll, DeltaX: " + deltaX
+ ", DeltaY: " + deltaY
+ ", totalDeltaX: " + totalDeltaX
+ ", totalDeltaY: " + totalDeltaY
+ ", touch points: " + 2
+ ", inertia value: false");
} else {
! Assert.assertEquals(0, TestLog.countLogContaining("Scroll " +
"started"));
! Assert.assertEquals(0, TestLog.countLogContaining("Scroll, DeltaX:"));
}
} else {
if (fingersChanged) {
totalDeltaX = deltaX;
totalDeltaY = deltaY;
} else {
totalDeltaX += deltaX;
totalDeltaY += deltaY;
}
! TestLog.waitForLogContaining("Scroll, DeltaX: " + deltaX
+ ", DeltaY: " + deltaY
+ ", totalDeltaX: " + totalDeltaX
+ ", totalDeltaY: " + totalDeltaY
+ ", touch points: " + 2
+ ", inertia value: false");
--- 228,271 ----
point2X += deltaX;
point2Y += deltaY;
device.setPoint(p1, point1X, point1Y);
device.setPoint(p2, point2X, point2Y);
device.sync();
! TestLogShim.waitForLogContaining("TouchPoint: MOVED %d, %d", point1X, point1Y);
! TestLogShim.waitForLogContaining("TouchPoint: MOVED %d, %d", point2X, point2Y);
boolean passedTheThreshold = false;
if (firstMove) {
totalDeltaX = deltaX;
totalDeltaY = deltaY;
if (Math.abs(deltaX) > getScrollThreshold()
|| Math.abs(deltaY) > getScrollThreshold()) {
! TestLogShim.waitForLogContaining("Scroll started, DeltaX: " + 0
+ ", DeltaY: " + 0
+ ", totalDeltaX: " + 0
+ ", totalDeltaY: " + 0
+ ", touch points: " + 2
+ ", inertia value: false");
! TestLogShim.waitForLogContaining("Scroll, DeltaX: " + deltaX
+ ", DeltaY: " + deltaY
+ ", totalDeltaX: " + totalDeltaX
+ ", totalDeltaY: " + totalDeltaY
+ ", touch points: " + 2
+ ", inertia value: false");
} else {
! Assert.assertEquals(0, TestLogShim.countLogContaining("Scroll " +
"started"));
! Assert.assertEquals(0, TestLogShim.countLogContaining("Scroll, DeltaX:"));
}
} else {
if (fingersChanged) {
totalDeltaX = deltaX;
totalDeltaY = deltaY;
} else {
totalDeltaX += deltaX;
totalDeltaY += deltaY;
}
! TestLogShim.waitForLogContaining("Scroll, DeltaX: " + deltaX
+ ", DeltaY: " + deltaY
+ ", totalDeltaX: " + totalDeltaX
+ ", totalDeltaY: " + totalDeltaY
+ ", touch points: " + 2
+ ", inertia value: false");
*** 276,292 ****
for (int i = 2; i <= numOfIterations; i++) {
point1X += deltaX;
point1Y += deltaY;
point2X += deltaX;
point2Y += deltaY;
! TestLog.reset();
device.setPoint(p1, point1X, point1Y);
device.setPoint(p2, point2X, point2Y);
device.sync();
! TestLog.waitForLogContaining("TouchPoint: MOVED %d, %d",
point1X, point1Y);
! TestLog.waitForLogContaining("TouchPoint: MOVED %d, %d",
point2X, point2Y);
totalDeltaX += deltaX;
totalDeltaY += deltaY;
expectedLog = "Scroll, DeltaX: " + deltaX + ", DeltaY: " + deltaY
+ ", totalDeltaX: " + totalDeltaX
--- 276,292 ----
for (int i = 2; i <= numOfIterations; i++) {
point1X += deltaX;
point1Y += deltaY;
point2X += deltaX;
point2Y += deltaY;
! TestLogShim.reset();
device.setPoint(p1, point1X, point1Y);
device.setPoint(p2, point2X, point2Y);
device.sync();
! TestLogShim.waitForLogContaining("TouchPoint: MOVED %d, %d",
point1X, point1Y);
! TestLogShim.waitForLogContaining("TouchPoint: MOVED %d, %d",
point2X, point2Y);
totalDeltaX += deltaX;
totalDeltaY += deltaY;
expectedLog = "Scroll, DeltaX: " + deltaX + ", DeltaY: " + deltaY
+ ", totalDeltaX: " + totalDeltaX
*** 308,391 ****
}
} else {
expectedLog = "sync";
}
}
! TestLog.waitForLogContaining(expectedLog);
}
}
}
/**
* The method releases one finger that is currently pressing on the screen
*/
protected void releaseFirstFinger() throws Exception {
Assert.assertEquals(1, device.getPressedPoints());
String expectedLog;
! TestLog.reset();
device.removePoint(p1);
device.sync();
//verify finger release
int expectedValue = 0;
expectedLog = "Scroll finished, DeltaX: " + 0
+ ", DeltaY: " + 0
+ ", totalDeltaX: " + totalDeltaX
+ ", totalDeltaY: " + totalDeltaY
+ ", touch points: " + 1
+ ", inertia value: false";
! TestLog.waitForLogContaining("TouchPoint: RELEASED %d, %d",
point1X, point1Y);
if (Math.abs(totalDeltaX) > getScrollThreshold()
|| Math.abs(totalDeltaY) > getScrollThreshold()) {
expectedValue = 1;
! TestLog.waitForLogContaining(expectedLog);
}
totalDeltaX = 0;
totalDeltaY = 0;
! Assert.assertEquals(expectedValue, TestLog.countLogContaining(expectedLog));
! if (TestLog.countLogContaining("Scroll finished") > 0) {
! TestLog.waitForLogContainingSubstrings("Scroll", "inertia value: true");
}
}
/**
* The method releases second of two fingers that are currently
* pressing on the screen
*/
protected void releaseSecondFinger() throws Exception {
Assert.assertEquals(2, device.getPressedPoints());
String expectedLog;
! TestLog.reset();
device.removePoint(p2);
device.sync();
//verify finger release
int expectedValue = 0;
expectedLog = "Scroll finished, DeltaX: " + 0
+ ", DeltaY: " + 0
+ ", totalDeltaX: " + totalDeltaX
+ ", totalDeltaY: " + totalDeltaY
+ ", touch points: " + 2
+ ", inertia value: false";
! TestLog.waitForLogContaining("TouchPoint: RELEASED %d, %d",
point2X, point2Y);
if (Math.abs(totalDeltaX) > getScrollThreshold()
|| Math.abs(totalDeltaY) > getScrollThreshold()) {
expectedValue = 1;
! TestLog.waitForLogContaining(expectedLog);
}
totalDeltaX = 0;
totalDeltaY = 0;
! Assert.assertEquals(expectedValue, TestLog.countLogContaining(expectedLog));
}
/**
* The method releases two fingers that are currently pressing on the screen
*/
protected void releaseAllFingers() throws Exception {
Assert.assertEquals(2, device.getPressedPoints());
String expectedLog;
! TestLog.reset();
device.removePoint(p1);
device.removePoint(p2);
device.sync();
//verify finger release
int expectedValue = 0;
--- 308,391 ----
}
} else {
expectedLog = "sync";
}
}
! TestLogShim.waitForLogContaining(expectedLog);
}
}
}
/**
* The method releases one finger that is currently pressing on the screen
*/
protected void releaseFirstFinger() throws Exception {
Assert.assertEquals(1, device.getPressedPoints());
String expectedLog;
! TestLogShim.reset();
device.removePoint(p1);
device.sync();
//verify finger release
int expectedValue = 0;
expectedLog = "Scroll finished, DeltaX: " + 0
+ ", DeltaY: " + 0
+ ", totalDeltaX: " + totalDeltaX
+ ", totalDeltaY: " + totalDeltaY
+ ", touch points: " + 1
+ ", inertia value: false";
! TestLogShim.waitForLogContaining("TouchPoint: RELEASED %d, %d",
point1X, point1Y);
if (Math.abs(totalDeltaX) > getScrollThreshold()
|| Math.abs(totalDeltaY) > getScrollThreshold()) {
expectedValue = 1;
! TestLogShim.waitForLogContaining(expectedLog);
}
totalDeltaX = 0;
totalDeltaY = 0;
! Assert.assertEquals(expectedValue, TestLogShim.countLogContaining(expectedLog));
! if (TestLogShim.countLogContaining("Scroll finished") > 0) {
! TestLogShim.waitForLogContainingSubstrings("Scroll", "inertia value: true");
}
}
/**
* The method releases second of two fingers that are currently
* pressing on the screen
*/
protected void releaseSecondFinger() throws Exception {
Assert.assertEquals(2, device.getPressedPoints());
String expectedLog;
! TestLogShim.reset();
device.removePoint(p2);
device.sync();
//verify finger release
int expectedValue = 0;
expectedLog = "Scroll finished, DeltaX: " + 0
+ ", DeltaY: " + 0
+ ", totalDeltaX: " + totalDeltaX
+ ", totalDeltaY: " + totalDeltaY
+ ", touch points: " + 2
+ ", inertia value: false";
! TestLogShim.waitForLogContaining("TouchPoint: RELEASED %d, %d",
point2X, point2Y);
if (Math.abs(totalDeltaX) > getScrollThreshold()
|| Math.abs(totalDeltaY) > getScrollThreshold()) {
expectedValue = 1;
! TestLogShim.waitForLogContaining(expectedLog);
}
totalDeltaX = 0;
totalDeltaY = 0;
! Assert.assertEquals(expectedValue, TestLogShim.countLogContaining(expectedLog));
}
/**
* The method releases two fingers that are currently pressing on the screen
*/
protected void releaseAllFingers() throws Exception {
Assert.assertEquals(2, device.getPressedPoints());
String expectedLog;
! TestLogShim.reset();
device.removePoint(p1);
device.removePoint(p2);
device.sync();
//verify finger release
int expectedValue = 0;
*** 393,422 ****
+ ", DeltaY: " + 0
+ ", totalDeltaX: " + totalDeltaX
+ ", totalDeltaY: " + totalDeltaY
+ ", touch points: " + 2
+ ", inertia value: false";
! TestLog.waitForLogContaining("TouchPoint: RELEASED %d, %d", point1X, point1Y);
! TestLog.waitForLogContaining("TouchPoint: RELEASED %d, %d", point2X, point2Y);
if (Math.abs(totalDeltaX) > getScrollThreshold() ||
Math.abs(totalDeltaY) > getScrollThreshold()) {
expectedValue = 1;
! TestLog.waitForLogContaining(expectedLog);
}
totalDeltaX = 0;
totalDeltaY = 0;
! Assert.assertEquals(expectedValue, TestLog.countLogContaining(expectedLog));
! if (TestLog.countLogContaining("Scroll finished") > 0) {
! TestLog.waitForLogContainingSubstrings("Scroll", "inertia value: true");
}
}
protected void tapToStopInertia() throws Exception {
Assert.assertEquals(0, device.getPressedPoints());
! TestLog.reset();
int p = device.addPoint(point1X, point1Y);
device.sync();
device.removePoint(p);
device.sync();
! TestLog.waitForLogContaining("TouchPoint: RELEASED %d, %d", point1X, point1Y);
}
}
--- 393,422 ----
+ ", DeltaY: " + 0
+ ", totalDeltaX: " + totalDeltaX
+ ", totalDeltaY: " + totalDeltaY
+ ", touch points: " + 2
+ ", inertia value: false";
! TestLogShim.waitForLogContaining("TouchPoint: RELEASED %d, %d", point1X, point1Y);
! TestLogShim.waitForLogContaining("TouchPoint: RELEASED %d, %d", point2X, point2Y);
if (Math.abs(totalDeltaX) > getScrollThreshold() ||
Math.abs(totalDeltaY) > getScrollThreshold()) {
expectedValue = 1;
! TestLogShim.waitForLogContaining(expectedLog);
}
totalDeltaX = 0;
totalDeltaY = 0;
! Assert.assertEquals(expectedValue, TestLogShim.countLogContaining(expectedLog));
! if (TestLogShim.countLogContaining("Scroll finished") > 0) {
! TestLogShim.waitForLogContainingSubstrings("Scroll", "inertia value: true");
}
}
protected void tapToStopInertia() throws Exception {
Assert.assertEquals(0, device.getPressedPoints());
! TestLogShim.reset();
int p = device.addPoint(point1X, point1Y);
device.sync();
device.removePoint(p);
device.sync();
! TestLogShim.waitForLogContaining("TouchPoint: RELEASED %d, %d", point1X, point1Y);
}
}
< prev index next >