In regards to the Rectangle
constructor, I discovered that the constructor sometimes assigns the wrong property values (or not at all).
Consider these unit tests:
using Microsoft.VisualStudio.TestTools.UnitTesting;
[TestClass]
public class GeneralTests
{
[TestMethod]
public void TestMethod1()
{
var r = new Aspose.Pdf.Rectangle(1, 2, 3, 4);
Assert.AreEqual(1, r.LLX);
Assert.AreEqual(2, r.LLY);
Assert.AreEqual(3, r.URX);
Assert.AreEqual(4, r.URY);
}
[TestMethod]
public void TestMethod2()
{
var r = new Aspose.Pdf.Rectangle(0, 0, 0, 0);
Assert.AreEqual(0, r.LLX);
Assert.AreEqual(0, r.LLY);
Assert.AreEqual(0, r.URX);
Assert.AreEqual(0, r.URY);
}
[TestMethod]
public void TestMethod3()
{
var r = new Aspose.Pdf.Rectangle(10_000, 10_000, 0, 0);
Assert.AreEqual(10_000, r.LLX);
Assert.AreEqual(10_000, r.LLY);
Assert.AreEqual(0, r.URX);
Assert.AreEqual(0, r.URY);
}
[TestMethod]
public void TestMethod4()
{
var r = new Aspose.Pdf.Rectangle(0, 0, 0, 0);
r.LLX = 10_000;
r.LLY = 10_000;
Assert.AreEqual(10_000, r.LLX);
Assert.AreEqual(10_000, r.LLY);
Assert.AreEqual(0, r.URX);
Assert.AreEqual(0, r.URY);
}
[TestMethod]
public void TestMethod5()
{
var r = new Aspose.Pdf.Rectangle(1_000, 1_000, 0, 0);
Assert.AreEqual(1_000, r.LLX);
Assert.AreEqual(1_000, r.LLY);
Assert.AreEqual(0, r.URX);
Assert.AreEqual(0, r.URY);
}
[TestMethod]
public void TestMethod6()
{
var r = new Aspose.Pdf.Rectangle(100, 200, 300, 400);
Assert.AreEqual(100, r.LLX);
Assert.AreEqual(200, r.LLY);
Assert.AreEqual(300, r.URX);
Assert.AreEqual(400, r.URY);
}
[TestMethod]
public void TestMethod7()
{
var r = new Aspose.Pdf.Rectangle(10_000, 10_000, 200, 200);
Assert.AreEqual(10_000, r.LLX);
Assert.AreEqual(10_000, r.LLY);
Assert.AreEqual(200, r.URX);
Assert.AreEqual(200, r.URY);
}
}
Here, the following tests succeed:
- Test Method 1
- Test Method 2
- Test Method 4
- Test Method 6
Whereas the following tests fail:
- Test Method 3
- Test Method 5
- Test Method 7
image.png (8.9 KB)
My questions
Am I doing something wrong?
If not, any fix/workaround to always have the constructor work correctly?