use of com.codename1.io.Log in project CodenameOne by codenameone.
the class TestUtils method clickButtonByLabel.
/**
* Clicks the button with the given label
* @param text the text on the button
*/
public static void clickButtonByLabel(String text) {
if (verbose) {
log("clickButtonByLabel(" + text + ")");
}
Button b = (Button) findLabelText(text);
waitFor(20);
b.pressed();
waitFor(20);
b.released();
waitFor(20);
}
use of com.codename1.io.Log in project CodenameOne by codenameone.
the class TestUtils method setText.
/**
* Sets the text for the given component
* @param path the path to the component
* @param text the text to set
*/
public static void setText(int[] path, String text) {
if (verbose) {
log("setText(" + toString(path) + ", " + text + ")");
}
Component c = getComponentByPath(path);
if (c instanceof Label) {
((Label) c).setText(text);
return;
}
((TextArea) c).setText(text);
}
use of com.codename1.io.Log in project CodenameOne by codenameone.
the class TestUtils method findByName.
/**
* Finds a component with the given name, works even with UI's that weren't created with the GUI builder
* @param componentName the name of the component to find
* @return the component with the given name within the tree
*/
private static Component findByName(Container root, String componentName) {
if (verbose) {
log("findByName(" + root + ", " + componentName + ")");
}
int count = root.getComponentCount();
for (int iter = 0; iter < count; iter++) {
Component c = root.getComponentAt(iter);
String n = c.getName();
if (n != null && n.equals(componentName)) {
return c;
}
if (c instanceof Container) {
c = findByName((Container) c, componentName);
if (c != null) {
return c;
}
}
}
return null;
}
use of com.codename1.io.Log in project CodenameOne by codenameone.
the class TestUtils method clickButtonByName.
/**
* Clicks the button with the given label
* @param name the name of the button
*/
public static void clickButtonByName(String name) {
if (verbose) {
log("clickButtonByName(" + name + ")");
}
Button b = (Button) findByName(name);
waitFor(20);
b.pressed();
waitFor(20);
b.released();
waitFor(20);
}
use of com.codename1.io.Log in project CodenameOne by codenameone.
the class TestUtils method assertTextAreaEndingWith.
/**
* Asserts that we have a TextArea with the a text ending with the given text and with the given name
* @param name the name of the TextArea
* @param text the suffix to search for in the TextArea
*/
public static void assertTextAreaEndingWith(String name, String text) {
if (verbose) {
log("assertTextAreaEndingWith(" + name + ", " + text + ")");
}
TextArea l = (TextArea) findByName(name);
assertBool(l != null, "Null area " + text);
assertBool(l.getText().endsWith(text), "assertTextArea: \"" + l.getText() + "\" is not ending with: \"" + text + "\"");
}
Aggregations