Пример #1
0
 public void ExtractMeasurement_Negative_Inches()
 {
     Assert.AreEqual(-230400, (int)Math.Round(
                         MeasurementUtils.ExtractMeasurementInMillipoints("-3.2\"", MsrSysType.Point, -1)));
     Assert.AreEqual(-230400, (int)Math.Round(
                         MeasurementUtils.ExtractMeasurementInMillipoints("-3.2 in", MsrSysType.Point, -1)));
 }
Пример #2
0
 public void ExtractMeasurement_Positive_Inches()
 {
     Assert.AreEqual(230400, (int)Math.Round(
                         MeasurementUtils.ExtractMeasurementInMillipoints("3.2\"", MsrSysType.Point, -1)));
     Assert.AreEqual(3600, (int)Math.Round(
                         MeasurementUtils.ExtractMeasurementInMillipoints("0.05 in", MsrSysType.Point, -1)));
 }
Пример #3
0
 public void ExtractMeasurement_WeirdSpaces()
 {
     Assert.AreEqual(288000, (int)Math.Round(
                         MeasurementUtils.ExtractMeasurementInMillipoints("101.6mm", MsrSysType.Point, -1)));
     Assert.AreEqual(255118, (int)Math.Round(
                         MeasurementUtils.ExtractMeasurementInMillipoints(" 9 cm", MsrSysType.Point, -1)));
     Assert.AreEqual(144000, (int)Math.Round(
                         MeasurementUtils.ExtractMeasurementInMillipoints("2 in ", MsrSysType.Point, -1)));
 }
Пример #4
0
 public void ExtractMeasurement_NoUnits()
 {
     Assert.AreEqual(2000, (int)Math.Round(
                         MeasurementUtils.ExtractMeasurementInMillipoints("2", MsrSysType.Point, -1)));
     Assert.AreEqual(288000, (int)Math.Round(
                         MeasurementUtils.ExtractMeasurementInMillipoints("101.6", MsrSysType.Mm, -1)));
     Assert.AreEqual(255118, (int)Math.Round(
                         MeasurementUtils.ExtractMeasurementInMillipoints("9", MsrSysType.Cm, -1)));
     Assert.AreEqual(144000, (int)Math.Round(
                         MeasurementUtils.ExtractMeasurementInMillipoints("2", MsrSysType.Inch, -1)));
 }
Пример #5
0
 public void ExtractMeasurement_Bogus()
 {
     // double negative
     Assert.AreEqual(999,
                     MeasurementUtils.ExtractMeasurementInMillipoints("--4\"", MsrSysType.Point, 999));
     // bogus units
     Assert.AreEqual(999,
                     MeasurementUtils.ExtractMeasurementInMillipoints("4.5 mc", MsrSysType.Point, 999));
     // wrong decimal point symbol
     Assert.AreEqual(999,
                     MeasurementUtils.ExtractMeasurementInMillipoints("4>4", MsrSysType.Point, 999));
     // too many decimal point symbols
     Assert.AreEqual(999,
                     MeasurementUtils.ExtractMeasurementInMillipoints("4.0.1", MsrSysType.Point, 999));
     // internal space
     Assert.AreEqual(999,
                     MeasurementUtils.ExtractMeasurementInMillipoints("4 1", MsrSysType.Point, 999));
 }
Пример #6
0
 public void ExtractMeasurement_Negative_Millimeters()
 {
     Assert.AreEqual(-288000, (int)Math.Round(
                         MeasurementUtils.ExtractMeasurementInMillipoints("-101.6 mm", MsrSysType.Point, -1)));
 }
Пример #7
0
 public void ExtractMeasurement_Negative_Centimeter()
 {
     Assert.AreEqual(-255118, (int)Math.Round(
                         MeasurementUtils.ExtractMeasurementInMillipoints("-9 cm", MsrSysType.Point, -1)));
 }
Пример #8
0
 public void ExtractMeasurement_Negative_Point()
 {
     Assert.AreEqual(-28346, (int)Math.Round(
                         MeasurementUtils.ExtractMeasurementInMillipoints("-28.346 pt", MsrSysType.Inch, -1)));
 }
Пример #9
0
 public void ExtractMeasurement_Positive_Point()
 {
     Assert.AreEqual(2000, (int)Math.Round(
                         MeasurementUtils.ExtractMeasurementInMillipoints("2 pt", MsrSysType.Mm, -1)));
 }