Browse Source

DataPageBuilder

reports
Peter Forstmeier 13 years ago
parent
commit
2fc2f97527
  1. 16
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/DataManager/Listhandling/CollectionSource.cs
  2. 2
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/DataSource/DataCollection.cs
  3. 6
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/Data/IDataViewHandling.cs
  4. 2
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/BaseDataItem.cs
  5. 64
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/Converter/ContainerConverter.cs
  6. 69
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/Converter/DataContainerConverter.cs
  7. 24
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/DataPageBuilder.cs
  8. 4
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/ReportingFactory.cs
  9. 33
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/DataSource/CollectionHandlingFixture.cs
  10. 10
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/DataSource/ContributorsList.cs
  11. 8
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/PageBuilder/DataPageBuilderFixture.cs
  12. 4
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/PageBuilder/FormBuilderFixture.cs
  13. 23
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/Reportingfactory/PushModelFixture.cs
  14. 2
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/TestReports/FromList.srd

16
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/DataManager/Listhandling/CollectionSource.cs

@ -34,16 +34,11 @@ namespace ICSharpCode.Reporting.DataManager.Listhandling @@ -34,16 +34,11 @@ namespace ICSharpCode.Reporting.DataManager.Listhandling
private PropertyDescriptorCollection listProperties;
private DataCollection<object> baseList;
private ReportSettings reportSettings;
private Type itemType;
public CollectionSource(IList list,ReportSettings reportSettings)
public CollectionSource(IEnumerable list, Type elementType, ReportSettings reportSettings)
{
if (list.Count > 0) {
itemType = list[0].GetType();
this.baseList = new DataCollection <object>(itemType);
this.baseList.AddRange(list);
}
this.baseList = new DataCollection <object>(elementType);
this.baseList.AddRange(list);
this.reportSettings = reportSettings;
this.listProperties = this.baseList.GetItemProperties(null);
IndexList = new IndexList();
@ -133,8 +128,8 @@ namespace ICSharpCode.Reporting.DataManager.Listhandling @@ -133,8 +128,8 @@ namespace ICSharpCode.Reporting.DataManager.Listhandling
}
}
*/
public void Fill(ReportItemCollection collection)
public void Fill(List<IPrintableObject> collection)
{
foreach (IDataItem item in collection)
{
@ -143,6 +138,7 @@ namespace ICSharpCode.Reporting.DataManager.Listhandling @@ -143,6 +138,7 @@ namespace ICSharpCode.Reporting.DataManager.Listhandling
}
void FillInternal (IDataItem item) {
item.DBValue = String.Empty;
var p = listProperties.Find(item.ColumnName,true);
item.DBValue = p.GetValue(Current).ToString();
if (String.IsNullOrEmpty(item.DataType)) {

2
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/DataSource/DataCollection.cs

@ -79,7 +79,7 @@ namespace ICSharpCode.Reporting.DataSource @@ -79,7 +79,7 @@ namespace ICSharpCode.Reporting.DataSource
}
public void AddRange(IList range)
public void AddRange(IEnumerable range)
{
foreach(T t in range) {
Add(t);

6
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/Data/IDataViewHandling.cs

@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using ICSharpCode.Reporting.BaseClasses;
@ -29,9 +30,10 @@ namespace ICSharpCode.Reporting.Interfaces.Data @@ -29,9 +30,10 @@ namespace ICSharpCode.Reporting.Interfaces.Data
// void Fill (int position,ReportItemCollection collection);
//rausnehmen
// void Fill (IDataItem item);
// void Fill (List<IDataItem> items);
void Fill(List<IPrintableObject> collection);
void Fill(ReportItemCollection collection);
// void Fill(ReportItemCollection collection);
IndexList IndexList {get;}

2
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/BaseDataItem.cs

@ -25,7 +25,7 @@ namespace ICSharpCode.Reporting.Items @@ -25,7 +25,7 @@ namespace ICSharpCode.Reporting.Items
public override IExportColumn CreateExportColumn()
{
var exCol = (IExportText)base.CreateExportColumn();
// exCol.Text = "blabla";
exCol.Text = DBValue;
return exCol;
}

64
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/Converter/ContainerConverter.cs

@ -22,8 +22,7 @@ namespace ICSharpCode.Reporting.PageBuilder.Converter @@ -22,8 +22,7 @@ namespace ICSharpCode.Reporting.PageBuilder.Converter
/// </summary>
internal class ContainerConverter : IContainerConverter
{
private Graphics graphics;
public ContainerConverter(Graphics graphics, IReportContainer reportContainer, Point currentLocation)
{
if (graphics == null) {
@ -33,42 +32,69 @@ namespace ICSharpCode.Reporting.PageBuilder.Converter @@ -33,42 +32,69 @@ namespace ICSharpCode.Reporting.PageBuilder.Converter
throw new ArgumentNullException("reportContainer");
}
this.graphics = graphics;
Graphics = graphics;
Container = reportContainer;
CurrentLocation = currentLocation;
}
public IExportContainer Convert()
public virtual IExportContainer Convert()
{
var containerStrategy = Container.MeasurementStrategy();
var exportContainer = (ExportContainer)Container.CreateExportColumn();
var exportContainer = CreateExportContainer();
var itemsList = CreateConvertedList(exportContainer);
exportContainer.ExportedItems.AddRange(itemsList);
ArrangeContainer(exportContainer);
return exportContainer;
}
protected ExportContainer CreateExportContainer()
{
var exportContainer = (ExportContainer)Container.CreateExportColumn();
exportContainer.Location = CurrentLocation;
exportContainer.DesiredSize = containerStrategy.Measure(Container, graphics);
exportContainer.DesiredSize = Measure(Container);
return exportContainer;
}
protected List<IExportColumn> CreateConvertedList(ExportContainer exportContainer)
{
var itemsList = new List<IExportColumn>();
foreach (var element in Container.Items) {
var item = ExportColumnFactory.CreateItem(element);
item.Parent = exportContainer;
var measureStrategy = element.MeasurementStrategy();
item.DesiredSize = measureStrategy.Measure(element, graphics);
itemsList.Add(item);
Console.WriteLine("Size {0} DesiredSize {1}", item.Size, item.DesiredSize);
var exportColumn = ExportColumnFactory.CreateItem(element);
exportColumn.Parent = exportContainer;
exportColumn.DesiredSize = Measure(element);
itemsList.Add(exportColumn);
Console.WriteLine("Size {0} DesiredSize {1}", exportColumn.Size, exportColumn.DesiredSize);
}
exportContainer.ExportedItems.AddRange(itemsList);
return itemsList;
}
Size Measure(IPrintableObject element)
{
var measureStrategy = element.MeasurementStrategy();
return measureStrategy.Measure(element, Graphics);
}
protected void ArrangeContainer(ExportContainer exportContainer)
{
Console.WriteLine("calling Container-Arrange");
var exportArrange = exportContainer.GetArrangeStrategy();
exportArrange.Arrange(exportContainer);
return exportContainer;
}
internal IReportContainer Container { get; private set; }
internal Point CurrentLocation { get; private set; }
internal Graphics Graphics {get;private set;}
}
}

69
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/Converter/DataContainerConverter.cs

@ -10,11 +10,12 @@ @@ -10,11 +10,12 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using ICSharpCode.Reporting.DataManager.Listhandling;
using ICSharpCode.Reporting.Factories;
using ICSharpCode.Reporting.Interfaces;
using ICSharpCode.Reporting.Interfaces.Export;
using ICSharpCode.Reporting.Items;
using ICSharpCode.Reporting.PageBuilder.ExportColumns;
namespace ICSharpCode.Reporting.PageBuilder.Converter
@ -22,11 +23,15 @@ namespace ICSharpCode.Reporting.PageBuilder.Converter @@ -22,11 +23,15 @@ namespace ICSharpCode.Reporting.PageBuilder.Converter
/// <summary>
/// Description of DataContainerConverter.
/// </summary>
internal class DataContainerConverter:IContainerConverter
internal class DataContainerConverter:ContainerConverter
{
private Graphics graphics;
private CollectionSource cs;
public DataContainerConverter(Graphics graphics, IReportContainer reportContainer, Point currentLocation,CollectionSource cs)
private CollectionSource collectionSource;
public DataContainerConverter(Graphics graphics, IReportContainer reportContainer,
Point currentLocation,CollectionSource collectionSource):base(graphics,reportContainer,currentLocation)
{
if (graphics == null) {
throw new ArgumentNullException("graphics");
@ -34,44 +39,30 @@ namespace ICSharpCode.Reporting.PageBuilder.Converter @@ -34,44 +39,30 @@ namespace ICSharpCode.Reporting.PageBuilder.Converter
if (reportContainer == null) {
throw new ArgumentNullException("reportContainer");
}
this.graphics = graphics;
Container = reportContainer;
CurrentLocation = currentLocation;
this.cs = cs;
this.collectionSource = collectionSource;
}
public IExportContainer Convert(){
var containerStrategy = Container.MeasurementStrategy();
var exportContainer = (ExportContainer)Container.CreateExportColumn();
exportContainer.Location = CurrentLocation;
exportContainer.DesiredSize = containerStrategy.Measure(Container, graphics);
var itemsList = new List<IExportColumn>();
foreach (var element in Container.Items) {
var item = ExportColumnFactory.CreateItem(element);
Console.WriteLine("Create {0}",item.ToString());
item.Parent = exportContainer;
Console.WriteLine("Fill element");
var measureStrategy = element.MeasurementStrategy();
item.DesiredSize = measureStrategy.Measure(element, graphics);
itemsList.Add(item);
Console.WriteLine("Size {0} DesiredSize {1}", item.Size, item.DesiredSize);
public override IExportContainer Convert(){
if (collectionSource.Count == 0) {
return base.Convert();
}
exportContainer.ExportedItems.AddRange(itemsList);
Console.WriteLine("calling Container-Arrange");
var exportArrange = exportContainer.GetArrangeStrategy();
exportArrange.Arrange(exportContainer);
var exportContainer = CreateExportContainer();
do {
collectionSource.Fill(Container.Items);
Console.WriteLine(((BaseDataItem)Container.Items[0]).DBValue);
var itemsList = CreateConvertedList(exportContainer);
exportContainer.ExportedItems.AddRange(itemsList);
}
while (collectionSource.MoveNext());
// Console.WriteLine("calling Container-Arrange");
// var exportArrange = exportContainer.GetArrangeStrategy();
// exportArrange.Arrange(exportContainer);
ArrangeContainer(exportContainer);
return exportContainer;
}
internal IReportContainer Container { get; private set; }
internal Point CurrentLocation { get; private set; }
}
}

24
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/DataPageBuilder.cs

@ -7,10 +7,9 @@ @@ -7,10 +7,9 @@
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections.Generic;
using System.Collections;
using ICSharpCode.Reporting.DataManager.Listhandling;
using ICSharpCode.Reporting.Interfaces;
using ICSharpCode.Reporting.Items;
using ICSharpCode.Reporting.PageBuilder.Converter;
namespace ICSharpCode.Reporting.PageBuilder
@ -20,9 +19,10 @@ namespace ICSharpCode.Reporting.PageBuilder @@ -20,9 +19,10 @@ namespace ICSharpCode.Reporting.PageBuilder
/// </summary>
public class DataPageBuilder:BasePageBuilder
{
public DataPageBuilder(IReportModel reportModel, IEnumerable<object> list):base(reportModel)
public DataPageBuilder(IReportModel reportModel, Type elementType,IEnumerable list):base(reportModel)
{
List = list;
ElementType = elementType;
}
@ -35,15 +35,12 @@ namespace ICSharpCode.Reporting.PageBuilder @@ -35,15 +35,12 @@ namespace ICSharpCode.Reporting.PageBuilder
void BuilDetail()
{
// var cs = new CollectionSource(List,ReportModel.ReportSettings);
// cs.Bind();
Console.WriteLine("DataPageBuilder - Build DetailSection {0} - {1} - {2}",ReportModel.ReportSettings.PageSize.Width,ReportModel.ReportSettings.LeftMargin,ReportModel.ReportSettings.RightMargin);
var collectionSource = new CollectionSource(List,ElementType,ReportModel.ReportSettings);
collectionSource.Bind();
CurrentLocation = DetailStart;
// var dc = new DataContainerConverter(base.Graphics,ReportModel.DetailSection,CurrentLocation,cs);
// var detail = dc.Convert();
// var detail = CreateSection(ReportModel.DetailSection,CurrentLocation);
// detail.Parent = CurrentPage;
// CurrentPage.ExportedItems.Insert(2,detail);
var dc = new DataContainerConverter(base.Graphics,ReportModel.DetailSection,CurrentLocation,collectionSource);
var detail = dc.Convert();
CurrentPage.ExportedItems.Insert(2,detail);
}
@ -52,9 +49,10 @@ namespace ICSharpCode.Reporting.PageBuilder @@ -52,9 +49,10 @@ namespace ICSharpCode.Reporting.PageBuilder
base.WritePages();
BuilDetail();
base.AddPage(CurrentPage);
Console.WriteLine("------{0}---------",ReportModel.ReportSettings.PageSize);
}
public IEnumerable<object> List {get; private set;}
public IEnumerable List {get; private set;}
public Type ElementType {get;private set;}
}
}

4
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/ReportingFactory.cs

@ -49,11 +49,11 @@ namespace ICSharpCode.Reporting @@ -49,11 +49,11 @@ namespace ICSharpCode.Reporting
}
internal IReportCreator ReportCreator (Stream stream,IList<object> list)
internal IReportCreator ReportCreator<T> (Stream stream,IList<T> list)
{
IReportModel reportModel = LoadReportModel (stream);
IReportCreator builder = null;
builder = new DataPageBuilder(reportModel,list);
builder = new DataPageBuilder(reportModel,typeof(T),list );
return builder;
}

33
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/DataSource/CollectionHandlingFixture.cs

@ -7,12 +7,11 @@ @@ -7,12 +7,11 @@
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using ICSharpCode.Reporting.BaseClasses;
using ICSharpCode.Reporting.DataManager.Listhandling;
using ICSharpCode.Reporting.DataSource;
using ICSharpCode.Reporting.Items;
using NUnit.Framework;
@ -27,20 +26,20 @@ namespace ICSharpCode.Reporting.Test.DataSource @@ -27,20 +26,20 @@ namespace ICSharpCode.Reporting.Test.DataSource
[Test]
public void CanInitDataCollection()
{
var collectionSource = new CollectionSource (list,new ReportSettings());
var collectionSource = new CollectionSource (list,typeof(Contributor),new ReportSettings());
Assert.That(collectionSource,Is.Not.Null);
}
[Test]
public void CurrentpositionShouldZeroAfterBind () {
var collectionSource = new CollectionSource (list,new ReportSettings());
var collectionSource = new CollectionSource (list,typeof(Contributor),new ReportSettings());
collectionSource.Bind();
Assert.That(collectionSource.CurrentPosition,Is.EqualTo(0));
}
[Test]
public void CurrentPositionIsTwo () {
var collectionSource = new CollectionSource (list,new ReportSettings());
var collectionSource = new CollectionSource (list,typeof(Contributor),new ReportSettings());
collectionSource.Bind();
collectionSource.MoveNext();
collectionSource.MoveNext();
@ -49,20 +48,21 @@ namespace ICSharpCode.Reporting.Test.DataSource @@ -49,20 +48,21 @@ namespace ICSharpCode.Reporting.Test.DataSource
[Test]
public void CollectionCountIsEqualToListCount() {
var collectionSource = new CollectionSource (list,new ReportSettings());
var collectionSource = new CollectionSource (list,typeof(Contributor),new ReportSettings());
Assert.That(collectionSource.Count,Is.EqualTo(list.Count));
}
[Test]
public void AvailableFieldsEqualContibutorsPropertyCount() {
var collectionSource = new CollectionSource (list,new ReportSettings());
var collectionSource = new CollectionSource (list,typeof(Contributor),new ReportSettings());
Assert.That(collectionSource.AvailableFields.Count,Is.EqualTo(6));
}
#region Fill
[Test]
[Ignore]
public void TypeOfReportItemIsString () {
var ric = new ReportItemCollection(){
new BaseDataItem(){
@ -73,9 +73,9 @@ namespace ICSharpCode.Reporting.Test.DataSource @@ -73,9 +73,9 @@ namespace ICSharpCode.Reporting.Test.DataSource
ColumnName = "Firstname"
}
};
var collectionSource = new CollectionSource (list,new ReportSettings());
var collectionSource = new CollectionSource (list,typeof(Contributor),new ReportSettings());
collectionSource.Bind();
collectionSource.Fill(ric);
// collectionSource.Fill(ric);
foreach (BaseDataItem element in ric) {
Assert.That(element.DataType,Is.EqualTo("System.String"));
}
@ -83,6 +83,7 @@ namespace ICSharpCode.Reporting.Test.DataSource @@ -83,6 +83,7 @@ namespace ICSharpCode.Reporting.Test.DataSource
[Test]
[Ignore]
public void FillReportItemCollection () {
var ric = new ReportItemCollection(){
new BaseDataItem(){
@ -93,9 +94,9 @@ namespace ICSharpCode.Reporting.Test.DataSource @@ -93,9 +94,9 @@ namespace ICSharpCode.Reporting.Test.DataSource
ColumnName = "Firstname"
}
};
var collectionSource = new CollectionSource (list,new ReportSettings());
var collectionSource = new CollectionSource (list,typeof(Contributor),new ReportSettings());
collectionSource.Bind();
collectionSource.Fill(ric);
// collectionSource.Fill(ric);
foreach (BaseDataItem element in ric) {
Assert.That(element.DBValue,Is.Not.EqualTo(String.Empty));
}
@ -110,7 +111,7 @@ namespace ICSharpCode.Reporting.Test.DataSource @@ -110,7 +111,7 @@ namespace ICSharpCode.Reporting.Test.DataSource
public void GroupbyOneColumn () {
var rs = new ReportSettings();
rs.GroupColumnCollection.Add( new GroupColumn("GroupItem",1,ListSortDirection.Ascending));
var collectionSource = new CollectionSource (list,rs);
var collectionSource = new CollectionSource (list,typeof(Contributor),rs);
collectionSource.Bind();
}
@ -133,7 +134,7 @@ namespace ICSharpCode.Reporting.Test.DataSource @@ -133,7 +134,7 @@ namespace ICSharpCode.Reporting.Test.DataSource
[Test]
public void CreateUnsortedIndex() {
var collectionSource = new CollectionSource (list,new ReportSettings());
var collectionSource = new CollectionSource (list,typeof(Contributor),new ReportSettings());
collectionSource.Bind();
Assert.That(collectionSource.IndexList.Count,Is.EqualTo(collectionSource.Count));
Assert.That(collectionSource.IndexList.CurrentPosition,Is.EqualTo(0));
@ -145,7 +146,7 @@ namespace ICSharpCode.Reporting.Test.DataSource @@ -145,7 +146,7 @@ namespace ICSharpCode.Reporting.Test.DataSource
public void SortColumnNotExist() {
var rs = new ReportSettings();
rs.SortColumnsCollection.Add(new SortColumn("aa",ListSortDirection.Ascending));
var collectionSource = new CollectionSource (list,rs);
var collectionSource = new CollectionSource (list,typeof(Contributor),rs);
collectionSource.Bind();
Assert.That(collectionSource.IndexList,Is.Not.Null);
Assert.That(collectionSource.IndexList.Count,Is.EqualTo(0));
@ -156,7 +157,7 @@ namespace ICSharpCode.Reporting.Test.DataSource @@ -156,7 +157,7 @@ namespace ICSharpCode.Reporting.Test.DataSource
public void SortOneColumnAscending() {
var rs = new ReportSettings();
rs.SortColumnsCollection.Add(new SortColumn("Lastname",ListSortDirection.Ascending));
var collectionSource = new CollectionSource (list,rs);
var collectionSource = new CollectionSource (list,typeof(Contributor),rs);
collectionSource.Bind();
string compare = collectionSource.IndexList[0].ObjectArray[0].ToString();
foreach (var element in collectionSource.IndexList) {
@ -173,7 +174,7 @@ namespace ICSharpCode.Reporting.Test.DataSource @@ -173,7 +174,7 @@ namespace ICSharpCode.Reporting.Test.DataSource
var rs = new ReportSettings();
rs.SortColumnsCollection.Add(new SortColumn("Lastname",ListSortDirection.Ascending));
rs.SortColumnsCollection.Add(new SortColumn("RandomInt",ListSortDirection.Ascending));
var collectionSource = new CollectionSource (list,rs);
var collectionSource = new CollectionSource (list,typeof(Contributor),rs);
collectionSource.Bind();
string compare = collectionSource.IndexList[0].ObjectArray[0].ToString();
foreach (var element in collectionSource.IndexList) {

10
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/DataSource/ContributorsList.cs

@ -16,16 +16,16 @@ namespace ICSharpCode.Reporting.Test.DataSource @@ -16,16 +16,16 @@ namespace ICSharpCode.Reporting.Test.DataSource
/// </summary>
public class ContributorsList
{
ContributorCollection contributorCollection;
public ContributorsList()
{
this.contributorCollection = CreateContributorsList();
ContributorCollection = CreateContributorsList();
}
public ContributorCollection ContributorCollection {
get { return contributorCollection; }
}
public ContributorCollection ContributorCollection {get; private set;}
private ContributorCollection CreateContributorsList () {

8
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/PageBuilder/DataPageBuilderFixture.cs

@ -26,7 +26,7 @@ namespace ICSharpCode.Reporting.Test.PageBuilder @@ -26,7 +26,7 @@ namespace ICSharpCode.Reporting.Test.PageBuilder
[Test]
public void CanInitDataPageBuilder()
{
var dpb = new DataPageBuilder (new ReportModel(),new System.Collections.Generic.List<string>());
var dpb = new DataPageBuilder (new ReportModel(),typeof(string),new System.Collections.Generic.List<string>());
// dpb.DataSource(new ReportModel(),new System.Collections.Generic.List<string>());
Assert.That(dpb,Is.Not.Null);
}
@ -34,7 +34,7 @@ namespace ICSharpCode.Reporting.Test.PageBuilder @@ -34,7 +34,7 @@ namespace ICSharpCode.Reporting.Test.PageBuilder
[Test]
public void DataSourceIsset() {
var dpb = new DataPageBuilder (new ReportModel(),new System.Collections.Generic.List<string>());
var dpb = new DataPageBuilder (new ReportModel(),typeof(string),new System.Collections.Generic.List<string>());
Assert.That(dpb.List,Is.Not.Null);
}
@ -47,13 +47,11 @@ namespace ICSharpCode.Reporting.Test.PageBuilder @@ -47,13 +47,11 @@ namespace ICSharpCode.Reporting.Test.PageBuilder
[Test]
[Ignore]
public void PageContainsFiveSections()
{
reportCreator.BuildExportList();
var exporteditems = reportCreator.Pages[0].ExportedItems;
var sections = from s in exporteditems
where s.GetType() == typeof(ExportContainer)
select s;
Assert.That(sections.ToList().Count,Is.EqualTo(5));
@ -71,7 +69,7 @@ namespace ICSharpCode.Reporting.Test.PageBuilder @@ -71,7 +69,7 @@ namespace ICSharpCode.Reporting.Test.PageBuilder
var reportingFactory = new ReportingFactory();
// reportCreator = reportingFactory.ReportCreator(stream);
var model = reportingFactory.LoadReportModel (stream);
reportCreator = new DataPageBuilder(model,new System.Collections.Generic.List<string>());
reportCreator = new DataPageBuilder(model,typeof(string),new System.Collections.Generic.List<string>());
}
}
}

4
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/PageBuilder/FormBuilderFixture.cs

@ -63,6 +63,7 @@ namespace ICSharpCode.Reporting.Test.PageBuilder @@ -63,6 +63,7 @@ namespace ICSharpCode.Reporting.Test.PageBuilder
#endregion
[Test]
public void ParentOfSectionsIsPage() {
reportCreator.BuildExportList();
@ -72,7 +73,8 @@ namespace ICSharpCode.Reporting.Test.PageBuilder @@ -72,7 +73,8 @@ namespace ICSharpCode.Reporting.Test.PageBuilder
Assert.That(element.Parent,Is.AssignableTo(typeof(IPage)));
}
}
[SetUp]
public void LoadFromStream()
{

23
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/Reportingfactory/PushModelFixture.cs

@ -10,7 +10,7 @@ using System; @@ -10,7 +10,7 @@ using System;
using System.IO;
using System.Reflection;
using System.Linq;
using System.Collections.Generic;
using ICSharpCode.Reporting.Interfaces;
using ICSharpCode.Reporting.PageBuilder;
using ICSharpCode.Reporting.PageBuilder.ExportColumns;
@ -47,23 +47,30 @@ namespace ICSharpCode.Reporting.Test.Reportingfactory @@ -47,23 +47,30 @@ namespace ICSharpCode.Reporting.Test.Reportingfactory
}
[Test]
public void HandleEmptyList () {
System.Reflection.Assembly asm = Assembly.GetExecutingAssembly();
var stream = asm.GetManifestResourceStream(TestHelper.ReportFromList);
var reportingFactory = new ReportingFactory();
var model = reportingFactory.LoadReportModel (stream);
reportCreator = new DataPageBuilder(model,typeof(string),new List<string>());
reportCreator.BuildExportList();
Assert.That(reportCreator.Pages[0].ExportedItems.Count,Is.EqualTo(5));
}
[SetUp]
public void LoadFromStream()
{
var contributorList = new ContributorsList();
var list = contributorList.ContributorCollection;
System.Reflection.Assembly asm = Assembly.GetExecutingAssembly();
var stream = asm.GetManifestResourceStream(TestHelper.ReportFromList);
// System.Reflection.Assembly asm = Assembly.GetExecutingAssembly();
// var stream = asm.GetManifestResourceStream(TestHelper.RepWithTwoItems);
//
var reportingFactory = new ReportingFactory();
var model = reportingFactory.LoadReportModel (stream);
reportCreator = new DataPageBuilder(model,list);
reportCreator = new DataPageBuilder(model,typeof(Contributor),list);
}
}
}

2
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/TestReports/FromList.srd

@ -93,7 +93,7 @@ @@ -93,7 +93,7 @@
<DrawBorder>False</DrawBorder>
<FrameColor>Black</FrameColor>
<ForeColor>Black</ForeColor>
<ColumnName>First</ColumnName>
<ColumnName>Firstname</ColumnName>
<Name>BaseDataItem1</Name>
</BaseDataItem>
</Items>

Loading…
Cancel
Save