mirror of
https://github.com/danieldemus/openhab-core.git
synced 2025-01-10 13:21:53 +01:00
[Units] Add MK⁻¹ unit alias (#4433)
* Add unit alias for Micro Reciprocal Kelvin Signed-off-by: AndrewFG <software@whitebear.ch>
This commit is contained in:
parent
bc6731157c
commit
591d8d956a
@ -293,7 +293,9 @@ public final class Units extends CustomUnits {
|
|||||||
SimpleUnitFormat.getInstance().label(MILLIAMPERE_HOUR, "mAh");
|
SimpleUnitFormat.getInstance().label(MILLIAMPERE_HOUR, "mAh");
|
||||||
SimpleUnitFormat.getInstance().label(MILLIBAR, "mbar");
|
SimpleUnitFormat.getInstance().label(MILLIBAR, "mbar");
|
||||||
SimpleUnitFormat.getInstance().label(MILLIMETRE_OF_MERCURY, MILLIMETRE_OF_MERCURY.getSymbol());
|
SimpleUnitFormat.getInstance().label(MILLIMETRE_OF_MERCURY, MILLIMETRE_OF_MERCURY.getSymbol());
|
||||||
SimpleUnitFormat.getInstance().label(MIRED, "mired");
|
SimpleUnitFormat.getInstance().label(MIRED, "MK⁻¹");
|
||||||
|
SimpleUnitFormat.getInstance().alias(MIRED, "mired");
|
||||||
|
SimpleUnitFormat.getInstance().alias(MIRED, "mirek");
|
||||||
SimpleUnitFormat.getInstance().label(PARTS_PER_BILLION, "ppb");
|
SimpleUnitFormat.getInstance().label(PARTS_PER_BILLION, "ppb");
|
||||||
SimpleUnitFormat.getInstance().label(PARTS_PER_MILLION, "ppm");
|
SimpleUnitFormat.getInstance().label(PARTS_PER_MILLION, "ppm");
|
||||||
SimpleUnitFormat.getInstance().label(PETABYTE, "PB");
|
SimpleUnitFormat.getInstance().label(PETABYTE, "PB");
|
||||||
|
@ -431,6 +431,17 @@ public class UnitsTest {
|
|||||||
assertThat(converted2.doubleValue(), is(closeTo(12.0, DEFAULT_ERROR)));
|
assertThat(converted2.doubleValue(), is(closeTo(12.0, DEFAULT_ERROR)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testColorTemperatureAliases() {
|
||||||
|
QuantityType<?> value;
|
||||||
|
value = QuantityType.valueOf("20 mired");
|
||||||
|
assertEquals(Units.MIRED, value.getUnit());
|
||||||
|
value = QuantityType.valueOf("20 mirek");
|
||||||
|
assertEquals(Units.MIRED, value.getUnit());
|
||||||
|
value = QuantityType.valueOf("20 MK⁻¹");
|
||||||
|
assertEquals(Units.MIRED, value.getUnit());
|
||||||
|
}
|
||||||
|
|
||||||
private static class QuantityEquals extends IsEqual<Quantity<?>> {
|
private static class QuantityEquals extends IsEqual<Quantity<?>> {
|
||||||
private Quantity<?> quantity;
|
private Quantity<?> quantity;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user