boolean wait_status;
int i, j;
declare("test FG/BG Display");
for (i = 0; i < NUMBER; ++i) {
dummyId[i] = NamsManager.startInternalMidlet(
"com.sun.midp.main.DummyNamsMIDlet" + (i+1), true, true);
wait_status = namsNotifier.waitForState(
dummyId[i], NamsStorage.NAMS_STATE_PAUSED, WAIT_MS);
assertTrue(" Wait interrupted !", wait_status);
}
for (i = 0; i < NUMBER; ++i) {
NamsManager.midletResume(dummyId[i]);
wait_status = namsNotifier.waitForState(
dummyId[i], NamsStorage.NAMS_STATE_ACTIVE, WAIT_MS);
assertTrue(" Wait interrupted !", wait_status);
NamsManager.midletSetForeground(dummyId[i]);
wait_status = namsNotifier.waitForFG(dummyId[i], WAIT_MS);
assertTrue(" Wait interrupted !", wait_status);
for (j = 0; j < NUMBER; ++j) {
if (i == j) {
assertTrue("#" + (i+1) + " Dummy" + (j+1) + " in FG",
NamsStorage.getDisplayStatus(dummyId[j]));
assertFalse("#" + (i+1) + " Dummy" + (j+1) + " state !",
(NamsStorage.getMIDletState(dummyId[j]) ==
NamsStorage.NAMS_STATE_PAUSED));
}
else
assertFalse("#" + (i+1) + " Dummy"+ (j+1) + " in BG",
NamsStorage.getDisplayStatus(dummyId[j]));
}
}
delay();
for (i = 0; i < NUMBER; ++i) {
NamsManager.midletPause(dummyId[i]);
wait_status = namsNotifier.waitForState(
dummyId[i], NamsStorage.NAMS_STATE_PAUSED, WAIT_MS);
assertTrue(" Wait interrupted !", wait_status);
}
for (i = 0; i < NUMBER; ++i) {
assertFalse("#Paused Dummy" + (i+1) + " in BG !",
NamsStorage.getDisplayStatus(dummyId[i]));
assertTrue("#Paused Dummy" + (i+1) + " state !",
(NamsStorage.getMIDletState(dummyId[i]) ==
NamsStorage.NAMS_STATE_PAUSED));
}
delay();
for (i = 0; i < NUMBER; ++i) {
NamsManager.midletDestroy(dummyId[i]);
wait_status = namsNotifier.waitForState(
dummyId[i], NamsStorage.NAMS_STATE_DESTROYED, WAIT_MS);
assertTrue(" Wait interrupted !", wait_status);
}
for (i = 0; i < NUMBER; ++i) {
assertFalse("#Destroyed Dummy" + (i+1) + " in BG !",
NamsStorage.getDisplayStatus(dummyId[i]));
assertTrue("#Destroyed Dummy" + (i+1) + " state !",
(NamsStorage.getMIDletState(dummyId[i]) ==
NamsStorage.NAMS_STATE_DESTROYED));
}
delay();