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
.UIFormShelf
;
13 import cc
.squirreljme
.jvm
.mle
.brackets
.UIDisplayBracket
;
14 import cc
.squirreljme
.jvm
.mle
.constants
.UIMetricType
;
15 import cc
.squirreljme
.jvm
.mle
.constants
.UIPixelFormat
;
16 import cc
.squirreljme
.runtime
.lcdui
.mle
.UIBackend
;
17 import cc
.squirreljme
.runtime
.lcdui
.mle
.fb
.FBUIBackend
;
18 import cc
.squirreljme
.runtime
.lcdui
.mle
.headless
.HeadlessAttachment
;
19 import cc
.squirreljme
.runtime
.lcdui
.mle
.pure
.NativeUIBackend
;
20 import net
.multiphasicapps
.tac
.TestConsumer
;
21 import net
.multiphasicapps
.tac
.UntestableException
;
24 * Base for all backend tests.
28 public abstract class BaseBackend
29 extends TestConsumer
<String
>
32 * Performs the testing of the given backend.
34 * @param __backend The backend to test.
35 * @param __display The display to test on.
36 * @throws Throwable On any exception.
39 public abstract void test(UIBackend __backend
,
40 UIDisplayBracket __display
)
48 public void test(String __backend
)
52 /*DebugShelf.verbose(VerboseDebugFlag.ALL);
53 DebugShelf.verboseInternalThread(VerboseDebugFlag.ALL);*/
55 UIBackend backend
= BaseBackend
.__getBackend(__backend
);
56 this.test(backend
, backend
.displays()[0]);
60 * Returns the backend used for tests.
62 * @param __backend The backend to get.
63 * @return The resultant backend.
64 * @throws NullPointerException On null arguments.
65 * @throws UntestableException If the backend is not operational.
68 private static UIBackend
__getBackend(String __backend
)
69 throws NullPointerException
, UntestableException
74 UIDisplayBracket
[] displays
= UIFormShelf
.displays();
75 if (displays
!= null && displays
.length
> 0 &&
76 0 != UIFormShelf
.metric(displays
[0],
77 UIMetricType
.UIFORMS_SUPPORTED
))
78 return new NativeUIBackend();
79 throw new UntestableException(__backend
);
82 return new FBUIBackend(new HeadlessAttachment(
83 UIPixelFormat
.INT_RGB888
, 240, 320));
86 throw new IllegalArgumentException(__backend
);