Commit d392b364 authored by Stephanie Gawroriski's avatar Stephanie Gawroriski
Browse files

Run full screen test multiple times until passing.

parent a6da2d82
Pipeline #39184 passed with stages
in 1 minute and 57 seconds
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
package lcdui.canvas; package lcdui.canvas;
import cc.squirreljme.runtime.cldc.debug.Debugging;
import javax.microedition.lcdui.Canvas; import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Command; import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.Display; import javax.microedition.lcdui.Display;
...@@ -28,6 +29,14 @@ public class TestCanvasFullScreen ...@@ -28,6 +29,14 @@ public class TestCanvasFullScreen
*/ */
@Override @Override
public void test(Display __display, CanvasPlatform __platform) public void test(Display __display, CanvasPlatform __platform)
{
// This test can fail multiple times due to tight timings
for (int i = 0; i < 3; i++)
if (this.runSequence(__display, __platform))
return;
}
public boolean runSequence(Display __display, CanvasPlatform __platform)
{ {
// Add a button, it should go away // Add a button, it should go away
__platform.addCommand( __platform.addCommand(
...@@ -48,16 +57,31 @@ public class TestCanvasFullScreen ...@@ -48,16 +57,31 @@ public class TestCanvasFullScreen
__platform.repaint(); __platform.repaint();
__platform.serviceRepaints(); __platform.serviceRepaints();
// Wait a bit to allow this to stay on
try
{
Thread.sleep(1000);
}
catch (InterruptedException ignored)
{
}
// Query the sizes again for checking // Query the sizes again for checking
int newWidth = __platform.getWidth(); int newWidth = __platform.getWidth();
int newHeight = __platform.getHeight(); int newHeight = __platform.getHeight();
// Full-screen should cause the canvas to grow in size // Full-screen should cause the canvas to grow in size
this.secondary("width", newWidth >= width); boolean didWidth = newWidth >= width;
this.secondary("height", newHeight >= height); boolean didHeight = newHeight >= height;
this.secondary("width", didWidth);
this.secondary("height", didHeight);
// The canvas should be smaller or at the maximum display resolution // The canvas should be smaller or at the maximum display resolution
this.secondary("wdisp", newWidth <= __display.getWidth()); boolean widthSmaller = newWidth <= __display.getWidth();
this.secondary("hdisp", newHeight <= __display.getHeight()); boolean heightSmaller = newHeight <= __display.getHeight();
this.secondary("wdisp", widthSmaller);
this.secondary("hdisp", heightSmaller);
return didWidth && didHeight && widthSmaller && heightSmaller;
} }
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment