Skip to content

Commit

Permalink
I18NMessageTest needs to reset I18NBundle static state. (#7101)
Browse files Browse the repository at this point in the history
* Mark PauseableThread as excluded on GWT.

* Minor typo corrections.

* Fix atan2() when it should produce 0f.

Without this small change (which has essentially no performance impact that I could measure), calling atan2() with a point on the x-axis would produce a small but non-zero result, which is incorrect.

* Add atan, atan2, asin, acos for degrees.

This also includes atan2Deg360(), which in my opinion is the most useful of these because it does something differently from Math.atan2(), and can often save some effort.

* Approximations for tan() and tanDeg().

Sorry this is so long-winded, but the error isn't as straightforward to express as with sin() or cos().

* Apply formatter

* Add to MathUtilsTest.

* Apply formatter

* Stop trying to load defaults from wrong dir.

This old behavior broke Flame's effect-open dialog when any particle effect used the default billlboard or model particle. Now Flame tries to load a file given its absolute path (like before), but if it fails, it falls back to trying the default filenames as internal files.

* I18NMessageTest needs to reset I18NBundle state.

If you run I18NSimpleMessageTest and then I18NMessageTest without this PR, then the first test will have called I18NBundle.setSimpleFormatter(true), but the second test needs it to be set to false.

Because the tests are still perfectly usable if you run them on their own (or use LWJGL2, I think, because it might not share static state), this is not at all a priority to merge; it just makes running many tests in one session not throw an Exception.

---------

Co-authored-by: GitHub Action <action@github.com>
  • Loading branch information
tommyettinger and actions-user committed Apr 5, 2023
1 parent 9c6a913 commit e1d1fdc
Showing 1 changed file with 2 additions and 0 deletions.
Expand Up @@ -48,6 +48,8 @@ public void create () {
font = new BitmapFont();
batch = new SpriteBatch();

I18NBundle.setSimpleFormatter(false);

try {
FileHandle bfh = Gdx.files.internal("data/i18n/message1");
rb_root = I18NBundle.createBundle(bfh, new Locale("", "", "")); // Locale.ROOT doesn't exist in Android API level 8
Expand Down

0 comments on commit e1d1fdc

Please sign in to comment.