|Summary:||TestFonts fails on Mac|
|Product:||POI||Reporter:||Wolfgang Fahl <wf>|
|Component:||POI Overall||Assignee:||POI Developers List <dev>|
|OS:||Mac OS X 10.1|
Description Wolfgang Fahl 2018-01-24 09:45:11 UTC
[java] There was 1 failure: [java] 1) resizeToFitTextXSLF(org.apache.poi.sl.TestFonts) [java] java.lang.AssertionError: 391 wasn't within the expected sizes: [304, 306, 311, 312, 313, 318, 348, 362, 372, 377, 398, 399, 406] [java] at org.junit.Assert.fail(Assert.java:88) [java] at org.junit.Assert.assertTrue(Assert.java:41) [java] at org.apache.poi.sl.TestFonts.resizeToFitText(TestFonts.java:143) [java] at org.apache.poi.sl.TestFonts.resizeToFitTextXSLF(TestFonts.java:106) ... [java] at org.apache.poi.util.OOXMLLite.build(OOXMLLite.java:149) [java] at org.apache.poi.util.OOXMLLite.main(OOXMLLite.java:94) [java] [java] FAILURES!!! [java] Tests run: 2354, Failures: 1 [java] [java] Exception in thread "main" java.lang.RuntimeException: Tests did not succeed, cannot build ooxml-lite jar [java] at org.apache.poi.util.OOXMLLite.build(OOXMLLite.java:151) [java] at org.apache.poi.util.OOXMLLite.main(OOXMLLite.java:94) BUILD FAILED /Users/wf/Documents/workspace/poi/build.xml:1519: Java returned: 1
Comment 1 Nick Burch 2018-01-24 10:05:56 UTC
Which JDK are you using, and on what platform?
Comment 2 Wolfgang Fahl 2018-01-24 10:08:34 UTC
same as for the gradle build This is on High Sierra Mac Os 10.13.2 javac 1.8.0_152 Additionally I do not have a workaround at this time. I'd love to build without running the tests. I tried ant jar -Dooxml.lite.test.notRequired=true but then get /Users/wf/Documents/workspace/poi/build.xml:1811: The following error occurred while executing this line: /Users/wf/Documents/workspace/poi/build.xml:1798: /Users/wf/Documents/workspace/poi/build/ooxml-lite-classes does not exist.
Comment 3 Wolfgang Fahl 2018-01-24 10:28:22 UTC
echo "testok" > build/ooxml-lite-testokfile.txt;ant jar also does not work - the build logic seems to be forcing the tests even if the corresponding flag is set to not to do this.
Comment 4 Alain Fagot Bearez 2018-01-24 19:25:27 UTC
You are the lucky owner of a new OS. Please open a pull request adding the value `391` to the list of accepted sizes in `org.apache.poi.sl.TestFonts`.
Comment 5 Andreas Beeker 2018-01-24 19:51:47 UTC
Actually we probably should simply skip those platform dependent test on Mac OS ...
Comment 6 Alain Fagot Bearez 2018-01-24 20:46:03 UTC
MacOS is contributing only 3, now 4 of these magic values, out of 14. Or would the test only support one version of some arbitrary OS? And then all developers should run the tests in a container on their machine? What about variations on the continuous integration infrastructure? At least we should document the workaround for devs wanting to run locally with reduced overhead.
Comment 7 Andreas Beeker 2018-01-24 22:28:11 UTC
When I've initially written the test, I hoped that there are only minimal differences on the various platforms. I wanted to have something simple to validate if the line-breaks, the font loading/rendering and other issues work, therefore I've used the textbox height. Furthermore the fixed list (opposed to a range of e.g. 300-450) would fail faster if something in the rendering changes. But when you look at the list of values now, we have a spread from 304 to 406 so that's not really validating anything of the above and eventually also lead to failing tests, especially with the interesting font handling on Mac OS  So currently I think using the range 300-450 would be a compromise and hopefully minimize failing builds ... or the other solution would be to skip the assert on Mac OS, in the assumption that the font selection is mysterious there and more users are using Linux/Windows and might have already complaint  https://stackoverflow.com/questions/26063828
Comment 8 Wolfgang Fahl 2018-05-19 09:52:37 UTC
I added 391 and now get [java] java.lang.AssertionError: 391 wasn't within the expected sizes: [304, 306, 311, 312, 313, 318, 348, 362, 372, 377, 398, 391, 399, 406] so I now have to fix the source again since obviously there is an assumption that the values are in ascending order ...
Comment 9 Wolfgang Fahl 2018-05-19 09:54:57 UTC
with 391 in the correct place the compile works. I'd now like to use the created jar file in my maven projects. There seem to be three build options: - ant - gradle - maven which of these will get me to make the new poi-4.0.0-SNAPSHOT.jar available locally?
Comment 10 PJ Fanning 2018-05-19 11:22:43 UTC
Hi Wolfgang, The poi build is not very newbie friendly. I would suggest the easiest thing to do is to use `ant jar` to build the jars and if you need to access them from another local project, most build tools facilitate this. For example, gradle has support like this: https://stackoverflow.com/a/20956456/987959 compile files('/path/to/poi-4.0.0-SNAPSHOT.jar') You will need to explicitly reference all the poi snapshot jars that your build depends on.
Comment 11 Andreas Beeker 2018-05-20 22:27:14 UTC
I've added the 391 now to TestFonts via r1831948 On the next font size complaint, I'll change the assert to a range check. If you have further problems with failing tests on the Mac, please reopen this issue. For further assistance on the build, please use the dev mailing list.