コード例 #1
0
  public void TestDecimalStringAttributeLocaleEffect_Float_DefaultLocale() throws Exception {
    float value1 = 39.76f;
    float value2 = -56356.457457f;
    float value3 = 0f;
    float value4 = 7.45345345e-21f;

    {
      Attribute a = new DecimalStringAttribute(TagFromName.ContourData);
      a.addValue(value1);
      a.addValue(value2);
      a.addValue(value3);
      a.addValue(value4);

      float[] returnedValues = a.getFloatValues();
      assertEquals("Default", value1, returnedValues[0]);
      assertEquals("Default", value2, returnedValues[1]);
      assertEquals("Default", value3, returnedValues[2]);
      assertEquals("Default", value4, returnedValues[3]);
    }
  }
コード例 #2
0
  public void TestDecimalStringAttributeLocaleEffect_Float_AllAvailableLocales() throws Exception {
    float value1 = 39.76f;
    float value2 = -56356.457457f;
    float value3 = 0f;
    float value4 = 7.45345345e-21f;

    Locale[] localesToTest = Locale.getAvailableLocales();
    for (Locale l : localesToTest) {
      // System.err.println("Testing effect on DS getFloatValues() of default locale "+l);
      Locale.setDefault(l);
      Attribute a = new DecimalStringAttribute(TagFromName.ContourData);
      a.addValue(value1);
      a.addValue(value2);
      a.addValue(value3);
      a.addValue(value4);

      float[] returnedValues = a.getFloatValues();
      assertEquals(l.toString(), value1, returnedValues[0]);
      assertEquals(l.toString(), value2, returnedValues[1]);
      assertEquals(l.toString(), value3, returnedValues[2]);
      assertEquals(l.toString(), value4, returnedValues[3]);
    }
  }