jmonkeyengine
jmonkeyengine copied to clipboard
Make tests more android friendly
Hey Guys,
As I was working on the Tests in the sdk today I discovered that some tests have dependencies on jme3-desktop, which makes them useless for Android.
A) TestFancyCar had some old SettingsDialog imports which were unusued actually. See 479392f
B) TestMipMapGen: We have two MipMapGenerator's. One in jme3-desktop and one in jme3-core. The Desktop pendant uses AWT, which doesn't work on Android. Technically they should do the same so the question is if there is a valid reason to still keep the one in jme3-desktop? See 10b23db
Those commits are only applied to 3.1 because I actually pushed them by mistake (my old git tool always asked for the appropriate remote, for this one you have to set it in the settings), so sorry for the inconvenience.
C) TestRenderToMemory uses jme3-desktop's com.jme3.util.Screenshots.
By looking into Screenshots it seems to me that it only depends on AWT for the Buffers however we already have our own buffer implementations so we might be independent from AWT here?
Apart from that convertScreenShot2 is a horrible name for jme buffer to Image Object and the name Screenshot itself is also a bit misleading.
I don't know what to do there since I am unfamiliar with the classes, though.
D) TestAbsoluteLocators depends on AWTLoader for the textures however I don't think it's possible to have some conditional code for Android there? Maybe we could add a TestAbsoluteLocatorsAndroid and the SDK deletes the relevant test?
E) The whole jme3test.awt package is useless on Android. There are neither Applets nor AWT Canvases to use. The SDK will simply remove the AWT package when creating the Android Tests. Is that okay?
At least a couple of these can still be fixed for v3.2.2 .
I'm unsure what to do about parts C thru E, so I'll unassign myself.
I have very simple beginner testcases ready to be integrated into the engine, but just a note : integrating android apps directly into the engine have its downsides (because that will mandate the user to use the NDK to build android native dependency before running the app), so i recommend integrating simple testcases on a different repo within jme3 organization.
I agree that Android examples should go in a separate repository. That should make things less awkward for JME developers who don't have Android Studio installed. Perhaps you should commit your Android examples to a new public GitHub repository for review. If they look good, we can fork your repo to JMonkeyEngine or jMonkeyEngine-Contributions.
@stephengold I think we are not on hurry on this, we can do this after v3.5.0, so i would have fixed things like AndroidHarness and FragmentHarness.
You can assign me to do this as of after v3.5.0.
I am currently working on this, here is the repository, it's still WIP waiting to fix the current surfaceview bug : https://github.com/Monkey-Droid/jme3-Simple-Examples