Missing Fields on XInputId in Tests

57 views
Skip to first unread message

Ashiq A.

unread,
Mar 28, 2016, 12:07:59 AM3/28/16
to haxef...@googlegroups.com
Hi,

I'm starting down the (perhaps wrong) path of writing munit tests for my FlxState classes in HaxeFlixel.

When I try to compile/run tests on Neko, I first get an error (presumably from Lime) about not being able to access the flash package on Neko.

Adding this line to test.hxml helps: --remap flash:openfl

Then, I get a number of errors about missing fields on XInput. A few samples follow:

HaxeWrapper.hx:73: /usr/lib/haxe/lib/flixel/4,0,0/flixel/input/gamepad/mappings/XInputMapping.hx:68: characters 27-53 : Class<flixel.input.gamepad.id.XInputID> has no field RIGHT_STICK_CLICK

HaxeWrapper.hx:73: /usr/lib/haxe/lib/flixel/4,0,0/flixel/input/gamepad/mappings/XInputMapping.hx:69: characters 23-34 : Class<flixel.input.gamepad.id.XInputID> has no field LB

HaxeWrapper.hx:73: /usr/lib/haxe/lib/flixel/4,0,0/flixel/input/gamepad/mappings/XInputMapping.hx:70: characters 24-35 : Class<flixel.input.gamepad.id.XInputID> has no field RB

I looked (briefly) into the specified class (XInputMapping.hx), and didn't see anything unusual.

What am I doing wrong?


Gama11

unread,
Mar 28, 2016, 4:57:05 AM3/28/16
to HaxeFlixel
The problem with munit is that it only supports pure haxe builds, however, Flixel projects depend on the Lime build system, which does things like take include.xml files of libraries into consideration. Flixel's include.xml calls an initialization macro which adds a number of haxedefs and does some other checks, which is most likely what's causing these errors.

Flixel (OpenFL as well) works around this by still compiling the unit tests with Lime. For cpp and neko, this works out of the box. For web targets (Flash and HTML5), munit has to be tricked into using the output from Lime's build for the test report. So if you want to test both web targets, you need a test.hxml that looks like this and be sure to run "lime build flash" and "lime build html5" beforehand.

Ashiq A.

unread,
Mar 28, 2016, 8:05:19 AM3/28/16
to haxef...@googlegroups.com
I'm not clear on how you use lime to build the unit tests (and why I need this for Neko). Could you clarify?

I passed the macro and a couple of defines (FLX_NO_GAMEPAD and FLX_NO_MOUSE_ADVANCED) to munit. That's okay, because I won't need to test that functionality. I checked the include.xml file; there are no other libraries missing (except hscript).

I now get a very small set of compiler errors, still related to FlxGamepadManager; which makes me think I'm still missing something in my test.hxml.

What do I need to do to make this work on Neko?


--
HaxeFlixel Development Community
See our github https://github.com/haxeflixel/ and our documentation http://haxeflixel.com/documentation/
---
You received this message because you are subscribed to the Google Groups "HaxeFlixel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to haxeflixel+...@googlegroups.com.
Visit this group at https://groups.google.com/group/haxeflixel.
To view this discussion on the web visit https://groups.google.com/d/msgid/haxeflixel/9c3f83d7-9d96-405d-ae7e-21ce361d1119%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Gama11

unread,
Mar 28, 2016, 8:07:31 AM3/28/16
to HaxeFlixel
You need a project.xml like with any other Lime project, and then just run "lime test neko" (instead of munit test or whatever that command is).
To unsubscribe from this group and stop receiving emails from it, send an email to haxeflixel+unsubscribe@googlegroups.com.

Ashiq A.

unread,
Mar 28, 2016, 8:29:47 AM3/28/16
to haxef...@googlegroups.com
Ah, sorry, I understand now; you're using lime to build/run the "test" directory as a HaxeFlixel project, not running it through munit.

I noticed that FlxG.width, FlxG.keys, etc are null, and I see references to FlxGame in the source.  Is there some common setup code I need to run (perhaps in all tests suites that use HaxeFlixel code) to fully initialize HaxeFlixel?

I'm trying to unit test code in states that use these values. (I'm not trying to simulate keyboard/mouse presses yet in tests.)



To unsubscribe from this group and stop receiving emails from it, send an email to haxeflixel+...@googlegroups.com.

--
HaxeFlixel Development Community
See our github https://github.com/haxeflixel/ and our documentation http://haxeflixel.com/documentation/
---
You received this message because you are subscribed to the Google Groups "HaxeFlixel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to haxeflixel+...@googlegroups.com.

Gama11

unread,
Mar 28, 2016, 8:39:49 AM3/28/16
to HaxeFlixel
Well, yeah, you need to create a FlxGame instance like usual. In general, I recommend you have a closer look at Flixel's unit tests.
To unsubscribe from this group and stop receiving emails from it, send an email to haxeflixel+unsubscribe@googlegroups.com.

--
HaxeFlixel Development Community
See our github https://github.com/haxeflixel/ and our documentation http://haxeflixel.com/documentation/
---
You received this message because you are subscribed to the Google Groups "HaxeFlixel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to haxeflixel+unsubscribe@googlegroups.com.

Ashiq A.

unread,
Mar 28, 2016, 10:25:33 AM3/28/16
to haxef...@googlegroups.com
That's very helpful -- I got it working. Thanks! I'll take a closer look at the Flixel unit tests next time before asking for help.

To unsubscribe from this group and stop receiving emails from it, send an email to haxeflixel+...@googlegroups.com.

--
HaxeFlixel Development Community
See our github https://github.com/haxeflixel/ and our documentation http://haxeflixel.com/documentation/
---
You received this message because you are subscribed to the Google Groups "HaxeFlixel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to haxeflixel+...@googlegroups.com.

--
HaxeFlixel Development Community
See our github https://github.com/haxeflixel/ and our documentation http://haxeflixel.com/documentation/
---
You received this message because you are subscribed to the Google Groups "HaxeFlixel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to haxeflixel+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages