public void Equals_Test() { PDFThickness target = new PDFThickness(10, 20, 30, 40); PDFThickness other = new PDFThickness(10, 20, 30, 40); bool expected = true; bool actual; actual = target.Equals(other); Assert.AreEqual(expected, actual); other = new PDFThickness(20, 30, 40, 50); expected = false; actual = target.Equals(other); Assert.AreEqual(expected, actual); other = new PDFThickness(0, 20, 30, 40); expected = false; actual = target.Equals(other); Assert.AreEqual(expected, actual); other = new PDFThickness(10, 0, 30, 40); expected = false; actual = target.Equals(other); Assert.AreEqual(expected, actual); other = new PDFThickness(10, 20, 0, 40); expected = false; actual = target.Equals(other); Assert.AreEqual(expected, actual); other = new PDFThickness(10, 20, 30, 0); expected = false; actual = target.Equals(other); Assert.AreEqual(expected, actual); }
public void Padding_TryGetThicknessTest() { PaddingStyle target = new PaddingStyle(); PDFThickness actual; PDFThickness expected = PDFThickness.Empty(); bool result = target.TryGetThickness(out actual); Assert.IsFalse(result); Assert.AreEqual(expected, actual); target.All = 12; expected = new PDFThickness(12); result = target.TryGetThickness(out actual); Assert.IsTrue(result); Assert.AreEqual(expected, actual); target.Left = 13; target.Right = 14; target.Top = 15; target.Bottom = 16; expected = new PDFThickness(15, 14, 16, 13); result = target.TryGetThickness(out actual); Assert.IsTrue(result); Assert.AreEqual(expected, actual); target.RemoveAllValues(); expected = PDFThickness.Empty(); result = target.TryGetThickness(out actual); Assert.IsFalse(result); Assert.AreEqual(expected, actual); }
public void GetHashCode_Test() { PDFThickness target = new PDFThickness(10, 20, 30, 40); PDFThickness other = new PDFThickness(10, 20, 30, 40); int expected = other.GetHashCode(); int actual; actual = target.GetHashCode(); Assert.AreEqual(expected, actual); other = new PDFThickness(10, 20, 30, 50); expected = other.GetHashCode(); actual = target.GetHashCode(); Assert.AreNotEqual(expected, actual); other = new PDFThickness(0, 20, 30, 40); expected = other.GetHashCode(); actual = target.GetHashCode(); Assert.AreNotEqual(expected, actual); other = new PDFThickness(10, 0, 30, 40); expected = other.GetHashCode(); actual = target.GetHashCode(); Assert.AreNotEqual(expected, actual); other = new PDFThickness(10, 20, 0, 40); expected = other.GetHashCode(); actual = target.GetHashCode(); Assert.AreNotEqual(expected, actual); }
public void IsEmpty_Test() { PDFThickness target = new PDFThickness(0, 0, 0, 0); bool actual = target.IsEmpty; Assert.IsTrue(actual); target = new PDFThickness(1, 0, 0, 0); actual = target.IsEmpty; Assert.IsFalse(actual); target = new PDFThickness(0, 1, 0, 0); actual = target.IsEmpty; Assert.IsFalse(actual); target = new PDFThickness(0, 0, 1, 0); actual = target.IsEmpty; Assert.IsFalse(actual); target = new PDFThickness(0, 0, 0, 1); actual = target.IsEmpty; Assert.IsFalse(actual); target = new PDFThickness(1, 0, 0, -1); actual = target.IsEmpty; Assert.IsFalse(actual); }
/// <summary> /// Overrides the base method to close the current list block, and set up a new block in the provided region. /// Updates the references in this engine. /// </summary> /// <param name="blockToClose"></param> /// <param name="joinToRegion"></param> /// <returns></returns> public override PDFLayoutBlock CloseCurrentBlockAndStartNewInRegion(PDFLayoutBlock blockToClose, PDFLayoutRegion joinToRegion) { PDFLayoutBlock orig = this.CurrentBlock; PDFRect avail = this._listBlock.AvailableBounds; avail.Height = joinToRegion.AvailableHeight; PDFThickness margins = _listBlock.Position.Margins; PDFLayoutBlock newList = base.CloseCurrentBlockAndStartNewInRegion(blockToClose, joinToRegion); this.CurrentBlock = (PDFLayoutBlock)newList.Parent; this._listBlock = newList; avail.Y = 0; avail.Width -= margins.Left + margins.Right; avail.Height -= margins.Top + margins.Bottom; avail.X += margins.Left; avail.Y += margins.Top; this._listBlock.AvailableBounds = avail; this._itemoffset = 0; return(newList); }
public void Empty_Test() { PDFThickness expected = new PDFThickness(0, 0, 0, 0); PDFThickness actual; actual = PDFThickness.Empty(); Assert.AreEqual(expected, actual); }
public void Clone_Test() { PDFThickness target = new PDFThickness(10, 20, 30, 40); PDFThickness expected = new PDFThickness(10, 20, 30, 40); PDFThickness actual; actual = target.Clone(); Assert.AreEqual(expected, actual); }
public void Add_Test() { PDFThickness one = new PDFThickness(10, 20, 30, 40); PDFThickness two = new PDFThickness(20, 30, 40, 50); PDFThickness expected = new PDFThickness(30, 50, 70, 90); PDFThickness actual; actual = PDFThickness.Add(one, two); Assert.AreEqual(expected, actual); }
public void Outset_Test() { PDFRect target = new PDFRect(10, 20, 30, 40); PDFThickness thickness = new PDFThickness(1, 2, 3, 4); PDFRect expected = new PDFRect(6, 19, 36, 44); PDFRect actual; actual = target.Outset(thickness); Assert.AreEqual(expected, actual); }
protected override object DoGetNativeValue(string key, string qsValue, IPDFComponent comp) { PDFThickness val; if (string.IsNullOrEmpty(qsValue) || !PDFThickness.TryParse(qsValue, out val)) { val = this.Value; } return(val); }
public void PDFThicknessConstructor_Test() { PDFUnit all = new PDFUnit(10); PDFThickness target = new PDFThickness(all); Assert.AreEqual(all, target.Left); Assert.AreEqual(all, target.Top); Assert.AreEqual(all, target.Bottom); Assert.AreEqual(all, target.Right); }
protected override void DoSetNativeValue(object value, IPDFComponent owner) { if (null == value) { this.Value = PDFThickness.Empty(); } else { this.Value = (PDFThickness)value; } }
public void Inset_Test() { PDFRect target = new PDFRect(10, 20, 30, 40); PDFThickness thickness = new PDFThickness(1, 2, 3, 4); PDFRect expected = new PDFRect(14, 21, 24, 36); PDFRect actual; actual = target.Inset(thickness); Assert.AreEqual(expected, actual); }
public void ToString_Test() { PDFUnit t = 10; PDFUnit r = 20; PDFUnit b = 40; PDFUnit l = 30; PDFThickness target = new PDFThickness(t, r, b, l); string expected = "[10 20 40 30]"; string actual; actual = target.ToString(); Assert.AreEqual(expected, actual); }
protected override void DoSetNativeValueFromString(string value, IPDFComponent owner) { PDFThickness val; if (PDFThickness.TryParse(value, out val)) { this.Value = val; } else { this.Value = PDFThickness.Empty(); } }
public void PDFThicknessConstructor_Test1() { PDFUnit top = new PDFUnit(10); PDFUnit left = new PDFUnit(20); PDFUnit bottom = new PDFUnit(30); PDFUnit right = new PDFUnit(40); PDFThickness target = new PDFThickness(top, right, bottom, left); Assert.AreEqual(left, target.Left); Assert.AreEqual(top, target.Top); Assert.AreEqual(bottom, target.Bottom); Assert.AreEqual(right, target.Right); }
public void Clone_Test1() { PDFUnit t = 10; PDFUnit r = 20; PDFUnit b = 40; PDFUnit l = 30; PDFThickness one = new PDFThickness(t, r, b, l); ICloneable target = one; object expected = new PDFThickness(t, r, b, l); object actual; actual = target.Clone(); Assert.AreEqual(expected, actual); }
public void op_Addition_Test() { PDFUnit t = 10; PDFUnit l = 20; PDFUnit b = 40; PDFUnit r = 30; PDFThickness one = new PDFThickness(t, r, b, l); PDFThickness two = new PDFThickness(1, 2, 3, 4); PDFThickness expected = new PDFThickness(t + 1, r + 2, b + 3, l + 4); PDFThickness actual; actual = (one + two); Assert.AreEqual(expected, actual); }
public void Equals_Test1() { PDFThickness target = new PDFThickness(10, 20, 30, 40); object obj = null; bool expected = false; bool actual; actual = target.Equals(obj); Assert.AreEqual(expected, actual); obj = new PDFThickness(10, 20, 30, 40); expected = true; actual = target.Equals(obj); Assert.AreEqual(expected, actual); }
public void Subtract_Test() { PDFUnit t = 10; PDFUnit r = 20; PDFUnit b = 40; PDFUnit l = 30; PDFThickness one = new PDFThickness(t, r, b, l); PDFThickness two = new PDFThickness(1, 2, 3, 4); PDFThickness expected = new PDFThickness(t - 1, r - 2, b - 3, l - 4); PDFThickness actual; actual = PDFThickness.Subtract(one, two); Assert.AreEqual(expected, actual); }
public void Inflate_Test2() { PDFUnit t = 10; PDFUnit r = 20; PDFUnit b = 40; PDFUnit l = 30; PDFThickness target = new PDFThickness(t, r, b, l); target.Inflate(t, r, b, l); Assert.AreEqual(l + l, target.Left); Assert.AreEqual(r + r, target.Right); Assert.AreEqual(t + t, target.Top); Assert.AreEqual(b + b, target.Bottom); }
public void Subtract_Test() { PDFUnit width = new PDFUnit(10, PageUnits.Millimeters); PDFUnit height = new PDFUnit(20, PageUnits.Millimeters); PDFSize target = new PDFSize(width, height); PDFUnit m = new PDFUnit(5, PageUnits.Millimeters); PDFThickness margins = new PDFThickness(m, m, m, m); PDFSize expected = new PDFSize(new PDFUnit(0, PageUnits.Millimeters), new PDFUnit(10, PageUnits.Millimeters)); PDFSize actual; actual = target.Subtract(margins); Assert.AreEqual(expected.Width.PointsValue, actual.Width.PointsValue); Assert.AreEqual(Math.Round(expected.Height.PointsValue, 2), Math.Round(actual.Height.PointsValue, 2)); }
public void Parse_Test() { string value = "[10mm 20mm 30 40in]"; PDFThickness expected = new PDFThickness(new PDFUnit(10, PageUnits.Millimeters), new PDFUnit(20, PageUnits.Millimeters), new PDFUnit(30), new PDFUnit(40, PageUnits.Inches)); PDFThickness actual; actual = PDFThickness.Parse(value); Assert.AreEqual(expected, actual); value = "[20mm]"; PDFUnit all = new PDFUnit(20, PageUnits.Millimeters); expected = new PDFThickness(all); actual = PDFThickness.Parse(value); Assert.AreEqual(expected, actual); }
public void Inflate_Test1() { PDFUnit t = 10; PDFUnit r = 20; PDFUnit b = 40; PDFUnit l = 30; PDFThickness target = new PDFThickness(t, r, b, l); PDFUnit all = new PDFUnit(10); target.Inflate(all); Assert.AreEqual(l + all, target.Left); Assert.AreEqual(r + all, target.Right); Assert.AreEqual(t + all, target.Top); Assert.AreEqual(b + all, target.Bottom); }
public void Inflate_Test() { PDFUnit t = 10; PDFUnit r = 20; PDFUnit b = 40; PDFUnit l = 30; PDFThickness target = new PDFThickness(t, r, b, l); PDFUnit w = new PDFUnit(5); PDFUnit h = new PDFUnit(10); target.Inflate(w, h); Assert.AreEqual(l + w, target.Left); Assert.AreEqual(r + w, target.Right); Assert.AreEqual(t + h, target.Top); Assert.AreEqual(b + h, target.Bottom); }
public void SetAll_Test() { PDFUnit t = 10; PDFUnit r = 20; PDFUnit b = 40; PDFUnit l = 30; PDFThickness target = new PDFThickness(t, r, b, l); PDFUnit all = new PDFUnit(10); target.SetAll(all); Assert.AreEqual(all, target.Left); Assert.AreEqual(all, target.Right); Assert.AreEqual(all, target.Top); Assert.AreEqual(all, target.Bottom); }
public void Top_Test() { PDFUnit t = 10; PDFUnit l = 20; PDFUnit b = 40; PDFUnit r = 30; PDFThickness one = new PDFThickness(t, r, b, l); PDFUnit expected = t; PDFUnit actual = one.Top; Assert.AreEqual(expected, actual); t = 50; one.Top = t; actual = one.Top; Assert.AreEqual(t, actual); }
public void Right_Test() { PDFUnit t = 10; PDFUnit l = 20; PDFUnit b = 40; PDFUnit r = 30; PDFThickness one = new PDFThickness(t, r, b, l); PDFUnit expected = r; PDFUnit actual = one.Right; Assert.AreEqual(expected, actual); r = 50; one.Right = r; actual = one.Right; Assert.AreEqual(r, actual); }
public void Left_Test() { PDFUnit t = 10; PDFUnit l = 20; PDFUnit b = 40; PDFUnit r = 30; PDFThickness one = new PDFThickness(t, r, b, l); PDFUnit expected = l; PDFUnit actual = one.Left; Assert.AreEqual(expected, actual); l = 50; one.Left = l; actual = one.Left; Assert.AreEqual(l, actual); }
public void Bottom_Test() { PDFUnit t = 10; PDFUnit l = 20; PDFUnit b = 40; PDFUnit r = 30; PDFThickness one = new PDFThickness(t, r, b, l); PDFUnit expected = b; PDFUnit actual = one.Bottom; Assert.AreEqual(expected, actual); b = 50; one.Bottom = b; actual = one.Bottom; Assert.AreEqual(b, actual); }