File tree Expand file tree Collapse file tree 3 files changed +42
-2
lines changed
itext.tests/itext.kernel.tests/itext/kernel/geom
itext/itext.kernel/itext/kernel/geom Expand file tree Collapse file tree 3 files changed +42
-2
lines changed Original file line number Diff line number Diff line change @@ -611,5 +611,19 @@ public virtual void CloneTest() {
611
611
NUnit . Framework . Assert . AreEqual ( typeof ( PageSize ) , copyAsPageSize . GetType ( ) ) ;
612
612
NUnit . Framework . Assert . AreEqual ( typeof ( PageSize ) , copyAsRectangle . GetType ( ) ) ;
613
613
}
614
+
615
+ [ NUnit . Framework . Test ]
616
+ public virtual void DecreaseWidthTest ( ) {
617
+ Rectangle rectangle = new Rectangle ( 100 , 200 ) ;
618
+ rectangle . DecreaseWidth ( 10 ) ;
619
+ NUnit . Framework . Assert . AreEqual ( 90 , rectangle . GetWidth ( ) , Rectangle . EPS ) ;
620
+ }
621
+
622
+ [ NUnit . Framework . Test ]
623
+ public virtual void IncreaseWidthTest ( ) {
624
+ Rectangle rectangle = new Rectangle ( 100 , 200 ) ;
625
+ rectangle . IncreaseWidth ( 10 ) ;
626
+ NUnit . Framework . Assert . AreEqual ( 110 , rectangle . GetWidth ( ) , Rectangle . EPS ) ;
627
+ }
614
628
}
615
629
}
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ source product.
51
51
namespace iText . Kernel . Geom {
52
52
/// <summary>Class that represent rectangle object.</summary>
53
53
public class Rectangle {
54
- private static float EPS = 1e-4f ;
54
+ internal static float EPS = 1e-4f ;
55
55
56
56
protected internal float x ;
57
57
@@ -412,6 +412,32 @@ public virtual iText.Kernel.Geom.Rectangle DecreaseHeight(float extra) {
412
412
return this ;
413
413
}
414
414
415
+ /// <summary>Increases the width of rectangle by the given value.</summary>
416
+ /// <remarks>Increases the width of rectangle by the given value. May be used in chain.</remarks>
417
+ /// <param name="extra">the value of the extra wudth to be added.</param>
418
+ /// <returns>
419
+ /// this
420
+ /// <see cref="Rectangle"/>
421
+ /// instance.
422
+ /// </returns>
423
+ public virtual iText . Kernel . Geom . Rectangle IncreaseWidth ( float extra ) {
424
+ this . width += extra ;
425
+ return this ;
426
+ }
427
+
428
+ /// <summary>Decreases the width of rectangle by the given value.</summary>
429
+ /// <remarks>Decreases the width of rectangle by the given value. May be used in chain.</remarks>
430
+ /// <param name="extra">the value of the extra width to be subtracted.</param>
431
+ /// <returns>
432
+ /// this
433
+ /// <see cref="Rectangle"/>
434
+ /// instance.
435
+ /// </returns>
436
+ public virtual iText . Kernel . Geom . Rectangle DecreaseWidth ( float extra ) {
437
+ this . width -= extra ;
438
+ return this ;
439
+ }
440
+
415
441
/// <summary>Gets the X coordinate of the left edge of the rectangle.</summary>
416
442
/// <remarks>
417
443
/// Gets the X coordinate of the left edge of the rectangle. Same as:
Original file line number Diff line number Diff line change 1
- f895f395b8dda88bfd0c4a4fa669683268ba2742
1
+ e83df626e1a8ca26e1bc0e8b03a54d3dc9110cf0
You can’t perform that action at this time.
0 commit comments