Browse Source

Adujst Test's

reports
Peter Forstmeier 12 years ago
parent
commit
60cbaa9342
  1. 67
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Arrange/ArrangeStrategy.cs
  2. 1
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Arrange/MeasurementStrategy.cs
  3. 4
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/MeasureArrange/ContainerArrangeStrategyFixture.cs

67
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Arrange/ArrangeStrategy.cs

@ -47,11 +47,20 @@ namespace ICSharpCode.Reporting.Arrange @@ -47,11 +47,20 @@ namespace ICSharpCode.Reporting.Arrange
static Size ArrangeInternal(IExportContainer container)
{
var containerRectangle = container.DisplayRectangle;
Rectangle elementRectangle = Rectangle.Empty;
foreach (var element in container.ExportedItems) {
var elementRectangle = new Rectangle(element.DisplayRectangle.Left + containerRectangle.Left,
element.DisplayRectangle.Top + containerRectangle.Top,
element.DesiredSize.Width,
element.DesiredSize.Height);
var con = element as IExportContainer;
if (con != null) {
var keep = containerRectangle;
con.DesiredSize = ArrangeInternal(con);
elementRectangle = AdujstRectangles(keep,con.DisplayRectangle);
containerRectangle = keep;
} else {
elementRectangle = AdujstRectangles(containerRectangle,element.DisplayRectangle);
}
if (!containerRectangle.Contains(elementRectangle)) {
containerRectangle = Rectangle.Union(containerRectangle,elementRectangle);
}
@ -60,6 +69,14 @@ namespace ICSharpCode.Reporting.Arrange @@ -60,6 +69,14 @@ namespace ICSharpCode.Reporting.Arrange
}
static Rectangle AdujstRectangles (Rectangle container,Rectangle element) {
return new Rectangle(container.Left + element.Left,
container.Top + element.Top,
element.Size.Width,
element.Size.Height);
}
static List<IExportColumn> CreateCanGrowList(IExportContainer container)
{
var l1 = new List<IExportColumn>();
@ -70,48 +87,6 @@ namespace ICSharpCode.Reporting.Arrange @@ -70,48 +87,6 @@ namespace ICSharpCode.Reporting.Arrange
}
return l1;
}
static Size old_ArrangeInternal(IExportContainer container)
{
var result = container.DisplayRectangle;
Console.WriteLine();
Console.WriteLine("enter arrange for <{0}> with {1}",container.Name,result);
if (container.Name.Contains("Det")) {
Console.WriteLine(container.Name);
}
foreach (var element in container.ExportedItems) {
var con = element as IExportContainer;
if (con != null) {
Console.WriteLine("recursive");
// con.DesiredSize = result.Size;
ArrangeInternal(con);
}
var testRext = new Rectangle(element.DisplayRectangle.Left + result.Left,
element.DisplayRectangle.Top + result.Top,
element.DesiredSize.Width,
element.DesiredSize.Height);
Console.WriteLine("<<<<<<<{0}",element.DisplayRectangle);
if (!result.Contains(testRext)) {
// Console.WriteLine("No fit do arrange container {0} - elem {1}",result.Bottom,testRext.Bottom);
// Console.WriteLine("{0} - {1}",result.Bottom,testRext.Bottom);
var r1 = Rectangle.Union(result,testRext);
result = new Rectangle(result.Left,
result.Top,
container.DisplayRectangle.Width,
element.DisplayRectangle.Size.Height);
Console.WriteLine("Union {0}",r1);
Console.WriteLine("{0} - {1}",result.Bottom,testRext.Bottom);
result = r1;
// container.DesiredSize = result.Size;
// container.DesiredSize = r1.Size;
} else {
Console.WriteLine("Nothing to arrange {0} - {1}",result.Bottom,testRext.Bottom);
}
}
Console.WriteLine("Retval for {0} - {1}",container.Name,result);
return result.Size;
}
}

1
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Arrange/MeasurementStrategy.cs

@ -39,6 +39,7 @@ namespace ICSharpCode.Reporting.Arrange @@ -39,6 +39,7 @@ namespace ICSharpCode.Reporting.Arrange
element.DesiredSize = MeasurementService.Measure(tbi,graphics);
}
}
exportColumn.DesiredSize = exportColumn.Size;
return exportColumn.DesiredSize;
}
}

4
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/MeasureArrange/ContainerArrangeStrategyFixture.cs

@ -21,7 +21,7 @@ namespace ICSharpCode.Reporting.Test.MeasureArrange @@ -21,7 +21,7 @@ namespace ICSharpCode.Reporting.Test.MeasureArrange
[TestFixture]
public class ContainerArrangeStrategyFixture
{
Graphics graphics = CreateGraphics.FromSize (new Size(1000,1000));
readonly Graphics graphics = CreateGraphics.FromSize (new Size(1000,1000));
ContainerArrangeStrategy strategy;
@ -85,7 +85,7 @@ namespace ICSharpCode.Reporting.Test.MeasureArrange @@ -85,7 +85,7 @@ namespace ICSharpCode.Reporting.Test.MeasureArrange
var arrangedRect = CreateItemRectangle(container);
Assert.That(containerRect.Bottom,Is.EqualTo(arrangedRect.Bottom + 5));
Assert.That(containerRect.Bottom,Is.EqualTo(arrangedRect.Bottom));
}

Loading…
Cancel
Save