private float method_68(RelativeWidth A_0, float A_1) { float width = 0f; float clientWidth = 0f; DocumentObject owner = base.Owner; while (owner != null) { if (owner is Section) { break; } owner = owner.Owner; } if (owner is Section) { Section section = owner as Section; float left = section.PageSetup.Margins.Left; float right = section.PageSetup.Margins.Right; float top = section.PageSetup.Margins.Top; float bottom = section.PageSetup.Margins.Bottom; float height = section.PageSetup.PageSize.Height; width = section.PageSetup.PageSize.Width; clientWidth = section.PageSetup.ClientWidth; } switch (A_0) { case RelativeWidth.Margin: return((clientWidth * A_1) / 1000f); case RelativeWidth.Page: return((width * A_1) / 1000f); } return((float)base.Width); }
public void ConvertBackThrowsException() { // Arrange var conv = new RelativeWidth(); // Act // Assert ExceptionAssert.Throws <NotSupportedException>(() => conv.ConvertBack(null, null, null, null)); }
public void ConvertMultipliesCorrectValues() { // Arrange var conv = new RelativeWidth(); // Act object converted = conv.Convert(100.0, null, "80", null); // Assert Assert.AreEqual(80.0, converted); }
public void ConvertWithInvalidParameterReturnsUnset() { // Arrange var conv = new RelativeWidth(); // Act object empty = conv.Convert(1.3, null, null, null); object invalid = conv.Convert(1.3, null, string.Empty, null); // Assert Assert.AreEqual(DependencyProperty.UnsetValue, empty); Assert.AreEqual(DependencyProperty.UnsetValue, invalid); }