mirror of https://github.com/apache/poi.git
[github-488] Round up seconds in CellElapsedFormatter. Thanks to Anthony Schott. This closes #488
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1911254 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1f446e0aef
commit
c6aa3a1318
|
@ -59,7 +59,7 @@ public class CellElapsedFormatter extends CellFormatter {
|
|||
val = elapsed / factor;
|
||||
else
|
||||
val = elapsed / factor % modBy;
|
||||
if (type == '0')
|
||||
if (type == '0' || type == 's')
|
||||
return Math.round(val);
|
||||
else
|
||||
return (long) val;
|
||||
|
|
|
@ -1046,4 +1046,11 @@ class TestCellFormat {
|
|||
.map(CellFormatPart.NAMED_COLORS::get)
|
||||
.forEach(Assertions::assertNotNull);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testElapsedSecondsRound() {
|
||||
CellFormatPart part = new CellFormatPart("[h]\\h m\\m s\\s");
|
||||
assertNotNull(part);
|
||||
assertEquals("0h 0m 9s", part.apply(0.0001).text);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue