1 // -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
4 // Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
5 // ---------------------------------------------------------------------------
6 // SquirrelJME is under the GNU General Public License v3+, or later.
7 // See license.mkd for licensing and copyright information.
8 // ---------------------------------------------------------------------------
12 import cc
.squirreljme
.jvm
.mle
.brackets
.UIDisplayBracket
;
13 import cc
.squirreljme
.jvm
.mle
.brackets
.UIFormBracket
;
14 import cc
.squirreljme
.jvm
.mle
.brackets
.UIItemBracket
;
15 import cc
.squirreljme
.jvm
.mle
.constants
.UIItemPosition
;
16 import cc
.squirreljme
.jvm
.mle
.constants
.UIItemType
;
17 import cc
.squirreljme
.runtime
.lcdui
.mle
.UIBackend
;
20 * Drags an item across the form to ensure that it gets reassigned properly
21 * and the item only appears at the given index.
25 public class TestItemDragging
33 protected void test(UIBackend __backend
, UIDisplayBracket __display
,
36 // This item will be dragged around
37 UIItemBracket item
= __backend
.itemNew(UIItemType
.BUTTON
);
39 // Move around each position!
40 int oldPos
= UIItemPosition
.NOT_ON_FORM
;
41 for (int pos
= UIItemPosition
.MIN_VALUE
; pos
<= 0; pos
++)
43 // Is the old position null?
44 if (oldPos
!= UIItemPosition
.NOT_ON_FORM
)
45 this.secondary("old-isnull-" + pos
, __backend
46 .formItemAtPosition(__form
, oldPos
) == null);
48 // The position of the item then
49 this.secondary("then-pos-" + pos
,
50 __backend
.formItemPosition(__form
, item
));
52 // Set new item position
53 __backend
.formItemPosition(__form
, item
, pos
);
55 // Is the item at this position, this one?
56 this.secondary("now-isthis-" + pos
,
57 __backend
.equals(__backend
.formItemAtPosition(__form
, pos
),
60 // The position of the item now
61 this.secondary("now-pos-" + pos
,
62 __backend
.formItemPosition(__form
, item
));
64 // Old position becomes the current one
68 this.secondary("zero-isthis", __backend
.equals(
69 __backend
.formItemAtPosition(__form
, 0), item
));
70 this.secondary("zero-pos",
71 __backend
.formItemPosition(__form
, item
));