| java.lang.Object com.sun.midp.i3test.TestCase javax.microedition.lcdui.CustomItemTest
Method Summary | |
public void | runTests() check that the viewport scrolls to make the
returned vis_Rect from traverse method visible
This test is specific to platform_widget. | void | testCustomItemInternalTraversal() |
vpY_AfterScroll | int vpY_AfterScroll(Code) | | |
vpY_beforeScroll | int vpY_beforeScroll(Code) | | |
runTests | public void runTests()(Code) | | check that the viewport scrolls to make the
returned vis_Rect from traverse method visible
This test is specific to platform_widget. Enable it only
for platform-widget if possible.
void testCustomItemInternalTraversal2() {
Display display = DisplayTestUtils.createDisplay();
Form mainForm = new Form("CustomItem 2 Demo");
TextField tf = new TextField("Text Field", "some text", 100, 0);
CustomItemImpl customItem1 =
new CustomItemImpl("CustomItem1", 80, display, false);
customItem1.setLayout(Item.LAYOUT_LEFT | Item.LAYOUT_NEWLINE_BEFORE |
Item.LAYOUT_NEWLINE_AFTER);
CustomItemImpl customItem2 =
new CustomItemImpl("CustomItem2", 80, display, false);
customItem2.setLayout(Item.LAYOUT_LEFT | Item.LAYOUT_NEWLINE_BEFORE |
Item.LAYOUT_NEWLINE_AFTER);
StringItem si = new StringItem("a string", "some text");
mainForm.append(tf);
mainForm.append(customItem1);
mainForm.append(si);
mainForm.append(customItem2);
display.setCurrentItem(customItem2);
// make sure the form is visible
try {
Thread.sleep(2000);
} catch (Exception e) {}
assertSame(display.getCurrent(), mainForm);
// part of the custom item is made visible
CustomItemLF customItemLF = customItem2.customItemLF;
Item myitem = ((CustomItemLFImpl)customItemLF).item;
Screen owner = myitem.owner;
if (owner != null) {
ownerLFImpl =
(FormLFImpl)owner.getLF();
}
// vpY1 the y coordinate of the top left visible pixel
// current scroll position
vpY_beforeScroll = ownerLFImpl.getScrollPosition0();
// call key down
// KEYCODE_DOWN Value="-2"
((CustomItemLFImpl)customItemLF).uCallKeyPressed(-2);
((CustomItemLFImpl)customItemLF).uCallKeyReleased(-2);
assertTrue("traverse not called: first call",
customItem2.traverse_flag);
((CustomItemLFImpl)customItemLF).uCallKeyPressed(-2);
((CustomItemLFImpl)customItemLF).uCallKeyReleased(-2);
assertTrue("traverse not called: second call",
customItem2.traverse_flag);
// check that the viewport scrolls to make the
// returned vis_Rect visible
// vpY1 the y coordinate of the top left visible pixel
vpY_AfterScroll = ownerLFImpl.getScrollPosition0();
boolean screenScrolled =
vpY_AfterScroll > vpY_beforeScroll ? true : false;
assertTrue("screen not Scrolled", screenScrolled);
Display.displayManagerImpl.uRequestForegroundNone();
assertSame(Display.displayManagerImpl.noForeground,
Display.displayManagerImpl.foreground);
}
|
testCustomItemInternalTraversal | void testCustomItemInternalTraversal()(Code) | | |
Methods inherited from com.sun.midp.i3test.TestCase | public void assertEquals(Object expected, Object actual)(Code)(Java Doc) public void assertEquals(String message, Object expected, Object actual)(Code)(Java Doc) public void assertEquals(int expected, int actual)(Code)(Java Doc) public void assertEquals(String message, int expected, int actual)(Code)(Java Doc) public void assertFalse(boolean condition)(Code)(Java Doc) public void assertFalse(String message, boolean condition)(Code)(Java Doc) public void assertNotNull(Object object)(Code)(Java Doc) public void assertNotNull(String message, Object object)(Code)(Java Doc) public void assertNotSame(Object expected, Object actual)(Code)(Java Doc) public void assertNotSame(String message, Object expected, Object actual)(Code)(Java Doc) public void assertNull(Object object)(Code)(Java Doc) public void assertNull(String message, Object object)(Code)(Java Doc) public void assertSame(Object expected, Object actual)(Code)(Java Doc) public void assertSame(String message, Object expected, Object actual)(Code)(Java Doc) public void assertTrue(String message, boolean condition)(Code)(Java Doc) public void assertTrue(boolean condition)(Code)(Java Doc) public void declare(String testName)(Code)(Java Doc) public void fail()(Code)(Java Doc) public void fail(String message)(Code)(Java Doc) protected SecurityToken getSecurityToken()(Code)(Java Doc) protected boolean getVerbose()(Code)(Java Doc) public void info(String s)(Code)(Java Doc) abstract public void runTests() throws Throwable(Code)(Java Doc)
|
|
|