mirror of https://github.com/apache/poi.git
update tests
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1895703 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b174eb5770
commit
548dfb37f5
|
@ -204,7 +204,7 @@ public class DataFormatter {
|
||||||
private final Map<String,Format> formats = new HashMap<>();
|
private final Map<String,Format> formats = new HashMap<>();
|
||||||
|
|
||||||
/** whether CSV friendly adjustments should be made to the formatted text **/
|
/** whether CSV friendly adjustments should be made to the formatted text **/
|
||||||
private final boolean emulateCSV;
|
private boolean emulateCSV = false;
|
||||||
|
|
||||||
/** whether years in dates should be displayed with 4 digits even if the formatString specifies only 2 **/
|
/** whether years in dates should be displayed with 4 digits even if the formatString specifies only 2 **/
|
||||||
private boolean use4DigitYearsInAllDateFormats = false;
|
private boolean use4DigitYearsInAllDateFormats = false;
|
||||||
|
@ -275,6 +275,22 @@ public class DataFormatter {
|
||||||
this.emulateCSV = emulateCSV;
|
this.emulateCSV = emulateCSV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param emulateCSV whether to emulate CSV output (default false).
|
||||||
|
* @since POI 5.2.0
|
||||||
|
*/
|
||||||
|
public void setEmulateCSV(boolean emulateCSV) {
|
||||||
|
this.emulateCSV = emulateCSV;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return whether to emulate CSV output (default false).
|
||||||
|
* @since POI 5.2.0
|
||||||
|
*/
|
||||||
|
public boolean isEmulateCSV() {
|
||||||
|
return emulateCSV;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param useCachedValuesForFormulaCells if set to true, when you do not provide a {@link FormulaEvaluator},
|
* @param useCachedValuesForFormulaCells if set to true, when you do not provide a {@link FormulaEvaluator},
|
||||||
* for cells with formulas, we will return the cached value for the cell (if available),
|
* for cells with formulas, we will return the cached value for the cell (if available),
|
||||||
|
|
|
@ -83,6 +83,36 @@ class TestDataFormatter {
|
||||||
+ "Having: " + System.getProperty("user.language") + "/" + System.getProperty("user.country"));
|
+ "Having: " + System.getProperty("user.language") + "/" + System.getProperty("user.country"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void setEmulateCSV() {
|
||||||
|
DataFormatter dataFormatter = new DataFormatter();
|
||||||
|
assertFalse(dataFormatter.isEmulateCSV());
|
||||||
|
dataFormatter.setEmulateCSV(true);
|
||||||
|
assertTrue(dataFormatter.isEmulateCSV());
|
||||||
|
dataFormatter.setEmulateCSV(false);
|
||||||
|
assertFalse(dataFormatter.isEmulateCSV());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void setUse4DigitYearsInAllDateFormats() {
|
||||||
|
DataFormatter dataFormatter = new DataFormatter();
|
||||||
|
assertFalse(dataFormatter.use4DigitYearsInAllDateFormats());
|
||||||
|
dataFormatter.setUse4DigitYearsInAllDateFormats(true);
|
||||||
|
assertTrue(dataFormatter.use4DigitYearsInAllDateFormats());
|
||||||
|
dataFormatter.setUse4DigitYearsInAllDateFormats(false);
|
||||||
|
assertFalse(dataFormatter.use4DigitYearsInAllDateFormats());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void useCachedValuesForFormulaCells() {
|
||||||
|
DataFormatter dataFormatter = new DataFormatter();
|
||||||
|
assertFalse(dataFormatter.useCachedValuesForFormulaCells());
|
||||||
|
dataFormatter.setUseCachedValuesForFormulaCells(true);
|
||||||
|
assertTrue(dataFormatter.useCachedValuesForFormulaCells());
|
||||||
|
dataFormatter.setUseCachedValuesForFormulaCells(false);
|
||||||
|
assertFalse(dataFormatter.useCachedValuesForFormulaCells());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test that we use the specified locale when deciding
|
* Test that we use the specified locale when deciding
|
||||||
* how to format normal numbers
|
* how to format normal numbers
|
||||||
|
|
Loading…
Reference in New Issue