diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/ICSharpCode.Reporting.csproj b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/ICSharpCode.Reporting.csproj index de04539749..51ab7b81d2 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/ICSharpCode.Reporting.csproj +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/ICSharpCode.Reporting.csproj @@ -58,17 +58,24 @@ + + + + + + + @@ -83,6 +90,8 @@ + + diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/BaseClasses/Page.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/BaseClasses/Page.cs index 7fb4437ead..338140109c 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/BaseClasses/Page.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/BaseClasses/Page.cs @@ -7,6 +7,8 @@ * To change this template use Tools | Options | Coding | Edit Standard Headers. */ using System; +using System.Collections.Generic; +using ICSharpCode.Reporting.Interfaces; namespace ICSharpCode.Reporting.BaseClasses { @@ -22,6 +24,7 @@ namespace ICSharpCode.Reporting.BaseClasses public interface IPage{ bool IsFirstPage {get;set;} IPageInfo PageInfo {get;} + List Items {get; set;} } @@ -35,6 +38,7 @@ namespace ICSharpCode.Reporting.BaseClasses throw new ArgumentNullException("pageInfo"); } PageInfo = pageInfo; + Items = new List(); } public bool IsFirstPage {get;set;} @@ -42,5 +46,6 @@ namespace ICSharpCode.Reporting.BaseClasses public IPageInfo PageInfo {get;private set;} + public List Items {get; set;} } } diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Factories/ExportColumnFactory.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Factories/ExportColumnFactory.cs new file mode 100644 index 0000000000..f5dbfffdda --- /dev/null +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Factories/ExportColumnFactory.cs @@ -0,0 +1,29 @@ +/* + * Created by SharpDevelop. + * User: Peter Forstmeier + * Date: 09.04.2013 + * Time: 19:51 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +using System; +using ICSharpCode.Reporting.Interfaces; +using ICSharpCode.Reporting.Items; +using ICSharpCode.Reporting.PageBuilder.ExportColumns; + +namespace ICSharpCode.Reporting.Factories +{ + /// + /// Description of ExportColumnFactory. + /// + public class ExportColumnFactory + { + public ExportColumnFactory() + { + } + + public IExportColumn CreateItem (IReportItem item) { + return item.CreateExportColumn(); + } + } +} diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IExportColumn.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IExportColumn.cs new file mode 100644 index 0000000000..5b9d213c5b --- /dev/null +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IExportColumn.cs @@ -0,0 +1,20 @@ +/* + * Created by SharpDevelop. + * User: Peter Forstmeier + * Date: 08.04.2013 + * Time: 20:10 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +using System; + +namespace ICSharpCode.Reporting.Interfaces +{ + /// + /// Description of IExportColumn. + /// + public interface IExportColumn + { + + } +} diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IReportItem.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IReportItem.cs index e88f10a3ae..861d15616b 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IReportItem.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IReportItem.cs @@ -7,6 +7,7 @@ * To change this template use Tools | Options | Coding | Edit Standard Headers. */ using System; +using System.Drawing; namespace ICSharpCode.Reporting.Interfaces { @@ -16,8 +17,8 @@ namespace ICSharpCode.Reporting.Interfaces public interface IReportItem { string Name{get;set;} -// Size Size {get;set;} -// Point Location {get;set;} + Size Size {get;set;} + Point Location {get;set;} // Font Font {get;set;} //// bool VisibleInReport {get;set;} // Color BackColor {get;set;} @@ -25,5 +26,6 @@ namespace ICSharpCode.Reporting.Interfaces // int SectionOffset {get;set;} // bool CanGrow {get;set;} // bool CanShrink {get;set;} +IExportColumn CreateExportColumn(); } } diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IReportModel.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IReportModel.cs index fea77db5c1..1d813dd2dd 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IReportModel.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IReportModel.cs @@ -19,15 +19,15 @@ namespace ICSharpCode.Reporting.Interfaces { ReportSettings ReportSettings {get;set;} List SectionCollection {get;} - /* - BaseSection ReportHeader {get;} - BaseSection PageHeader {get;} - BasistSection DetailSection {get;} - BaseSection PageFooter {get;} - BaseSection ReportFooter {get;} + ISection ReportHeader {get;} + ISection PageHeader {get;} + ISection DetailSection {get;} + ISection PageFooter {get;} + ISection ReportFooter {get;} + /* GlobalEnums.PushPullModel DataModel {get;} - */ + } } diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/ISection.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/ISection.cs new file mode 100644 index 0000000000..3c81b7fd42 --- /dev/null +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/ISection.cs @@ -0,0 +1,22 @@ +/* + * Created by SharpDevelop. + * User: Peter Forstmeier + * Date: 08.04.2013 + * Time: 19:50 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +using System; +using System.Collections.Generic; +using ICSharpCode.Reporting.Items; + +namespace ICSharpCode.Reporting.Interfaces +{ + /// + /// Description of ISection. + /// + public interface ISection:IReportItem + { + List Items {get;} + } +} diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/BaseSection.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/BaseSection.cs index 5df31f701f..97ace09839 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/BaseSection.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/BaseSection.cs @@ -7,6 +7,7 @@ * To change this template use Tools | Options | Coding | Edit Standard Headers. */ using System; +using System.Collections.Generic; using ICSharpCode.Reporting.Interfaces; namespace ICSharpCode.Reporting.Items @@ -14,18 +15,22 @@ namespace ICSharpCode.Reporting.Items /// /// Description of BaseSection. /// - public class BaseSection:ReportItem + public class BaseSection:ReportItem,ISection { #region Constructors public BaseSection() - {} + { + Console.WriteLine("---------- baseSection -------"); + Items = new List(); + } public BaseSection (string sectionName) { base.Name = sectionName; } + public List Items {get;private set;} #endregion } } diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/BaseTextItem.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/BaseTextItem.cs new file mode 100644 index 0000000000..3aea1edaf2 --- /dev/null +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/BaseTextItem.cs @@ -0,0 +1,36 @@ +/* + * Created by SharpDevelop. + * User: Peter Forstmeier + * Date: 07.04.2013 + * Time: 18:23 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +using System; +using System.Drawing; +using ICSharpCode.Reporting.Interfaces; +using ICSharpCode.Reporting.PageBuilder.ExportColumns; + +namespace ICSharpCode.Reporting.Items +{ + /// + /// Description of BaseTextItem. + /// + public interface ITextItem:IReportItem + { + Font Font {get;set;} + } + + public class BaseTextItem:ReportItem,ITextItem + { + public BaseTextItem(){ + } + + public Font Font {get;set;} + + public override IExportColumn CreateExportColumn() + { + return new ExportText(); + } + } +} diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/ReportItem.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/ReportItem.cs index 755ff0b4f9..a82d8a10ed 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/ReportItem.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/ReportItem.cs @@ -7,6 +7,7 @@ * To change this template use Tools | Options | Coding | Edit Standard Headers. */ using System; +using System.Drawing; using ICSharpCode.Reporting.Interfaces; namespace ICSharpCode.Reporting.Items @@ -23,5 +24,12 @@ namespace ICSharpCode.Reporting.Items public string Name {get;set;} + public Point Location {get;set;} + + public Size Size {get;set;} + + public virtual IExportColumn CreateExportColumn() { + return null; + } } } diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/ReportModel.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/ReportModel.cs index 30ffb8c5f5..7deca52706 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/ReportModel.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/ReportModel.cs @@ -22,15 +22,15 @@ namespace ICSharpCode.Reporting.Items public ReportModel() { SectionCollection = new List(); - foreach (GlobalEnums.ReportSection sec in Enum.GetValues(typeof(GlobalEnums.ReportSection))) { - SectionCollection.Add (SectionFactory.Create(sec.ToString())); - } +// foreach (GlobalEnums.ReportSection sec in Enum.GetValues(typeof(GlobalEnums.ReportSection))) { +// SectionCollection.Add (SectionFactory.Create(sec.ToString())); +// } } #region Sections - public BaseSection ReportHeader + public ISection ReportHeader { get { return (BaseSection)SectionCollection[0]; @@ -38,7 +38,7 @@ namespace ICSharpCode.Reporting.Items } - public BaseSection PageHeader + public ISection PageHeader { get { return (BaseSection)SectionCollection[1]; @@ -46,7 +46,7 @@ namespace ICSharpCode.Reporting.Items } - public BaseSection DetailSection + public ISection DetailSection { get { return (BaseSection)SectionCollection[2]; @@ -54,14 +54,14 @@ namespace ICSharpCode.Reporting.Items } - public BaseSection PageFooter + public ISection PageFooter { get { return (BaseSection)SectionCollection[3]; } } - public BaseSection ReportFooter + public ISection ReportFooter { get { return (BaseSection)SectionCollection[4]; diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/BasePageBuilder.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/BasePageBuilder.cs index 9cff6a13b4..8631ceb0b3 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/BasePageBuilder.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/BasePageBuilder.cs @@ -8,6 +8,8 @@ */ using System; using System.Collections.Generic; +using System.Drawing; + using ICSharpCode.Reporting.BaseClasses; using ICSharpCode.Reporting.Interfaces; @@ -40,7 +42,7 @@ namespace ICSharpCode.Reporting.PageBuilder var pi = new PageInfo(); pi.PageNumber = Pages.Count +1; pi.ReportName = ReportModel.ReportSettings.ReportName; - pi.ReportFileName = ReportModel.ReportSettings.FileName; + pi.ReportFileName = ReportModel.ReportSettings.FileName; // pi.ReportName = ReportModel.ReportSettings.ReportName; return pi; } @@ -61,6 +63,8 @@ namespace ICSharpCode.Reporting.PageBuilder protected IReportModel ReportModel {get; private set;} + protected Point CurrentLocation {get; set;} + public IPage CurrentPage {get; protected set;} public List Pages {get; private set;} diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/Converter/SectionConverter.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/Converter/SectionConverter.cs new file mode 100644 index 0000000000..3a4f864145 --- /dev/null +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/Converter/SectionConverter.cs @@ -0,0 +1,47 @@ +/* + * Created by SharpDevelop. + * User: Peter Forstmeier + * Date: 08.04.2013 + * Time: 19:49 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +using System; +using System.Collections.Generic; +using System.Drawing; + +using ICSharpCode.Reporting.Factories; +using ICSharpCode.Reporting.Interfaces; +using ICSharpCode.Reporting.PageBuilder.ExportColumns; + +namespace ICSharpCode.Reporting.PageBuilder.Converter +{ + /// + /// Description of SectionConverter. + /// + internal class SectionConverter + { + private Point currentPoint; + private ExportColumnFactory factory; + + public SectionConverter(ISection section,Point currentPoint ) + { + Section = section; + this.currentPoint = currentPoint; + factory = new ExportColumnFactory(); + } + + public List Convert(){ + var l = new List(); + foreach (var element in Section.Items) { + + var item = factory.CreateItem(element); + l.Add(item); + } + + return l; + } + + public ISection Section {get; private set;} + } +} diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/ExportColumns/BaseExportColumn.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/ExportColumns/BaseExportColumn.cs new file mode 100644 index 0000000000..d0c384ddad --- /dev/null +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/ExportColumns/BaseExportColumn.cs @@ -0,0 +1,21 @@ +/* + * Created by SharpDevelop. + * User: Peter Forstmeier + * Date: 08.04.2013 + * Time: 20:09 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +using System; +using ICSharpCode.Reporting.Interfaces; + +namespace ICSharpCode.Reporting.PageBuilder.ExportColumns +{ + /// + /// Description of BaseExportColumn. + /// + public class BaseExportColumn:IExportColumn + { + + } +} diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/ExportColumns/ExportText.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/ExportColumns/ExportText.cs new file mode 100644 index 0000000000..e2a542198f --- /dev/null +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/ExportColumns/ExportText.cs @@ -0,0 +1,22 @@ +/* + * Created by SharpDevelop. + * User: Peter Forstmeier + * Date: 10.04.2013 + * Time: 20:00 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +using System; + +namespace ICSharpCode.Reporting.PageBuilder.ExportColumns +{ + /// + /// Description of ExportText. + /// + public class ExportText:BaseExportColumn + { + public ExportText() + { + } + } +} diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/FormPageBuilder.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/FormPageBuilder.cs index 142f0e2358..f61fbe9ddc 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/FormPageBuilder.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/FormPageBuilder.cs @@ -7,8 +7,10 @@ * To change this template use Tools | Options | Coding | Edit Standard Headers. */ using System; +using System.Drawing; using ICSharpCode.Reporting.BaseClasses; using ICSharpCode.Reporting.Interfaces; +using ICSharpCode.Reporting.PageBuilder.Converter; namespace ICSharpCode.Reporting.PageBuilder { @@ -22,7 +24,6 @@ namespace ICSharpCode.Reporting.PageBuilder public FormPageBuilder(IReportModel reportModel):base(reportModel) { - } @@ -30,6 +31,19 @@ namespace ICSharpCode.Reporting.PageBuilder { base.BuildExportList(); WritePages (); + BuildReportHeader(); + } + + + void BuildReportHeader() + { + if (Pages.Count == 0) { + + CurrentLocation = new Point(10,10); + var sc = new SectionConverter(ReportModel.ReportHeader,base.CurrentLocation); + var itemsList = sc.Convert(); + CurrentPage.Items.AddRange(itemsList); + } } @@ -38,12 +52,7 @@ namespace ICSharpCode.Reporting.PageBuilder CurrentPage = base.InitNewPage(); this.BuildReportHeader(); base.AddPage(CurrentPage); + var x = ReportModel; } - - void BuildReportHeader() - { - - } - } } diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/ReportingFactory.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/ReportingFactory.cs index 15fa6a1aac..6a884669df 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/ReportingFactory.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/ReportingFactory.cs @@ -37,13 +37,8 @@ namespace ICSharpCode.Reporting if (reportModel.ReportSettings.DataModel == GlobalEnums.PushPullModel.FormSheet) { builder = new FormPageBuilder(reportModel); } -// else { -// CheckForParameters(reportModel,reportParameters); -// IDataManager dataMan = DataManagerFactory.CreateDataManager(reportModel,reportParameters); -// builder = DataPageBuilder.CreateInstance(reportModel, dataMan); -// } return builder; -// return null; + } diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/ICSharpCode.Reporting.Test.csproj b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/ICSharpCode.Reporting.Test.csproj index 1af20959b2..1fa451579b 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/ICSharpCode.Reporting.Test.csproj +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/ICSharpCode.Reporting.Test.csproj @@ -61,6 +61,8 @@ + + @@ -80,5 +82,8 @@ + + + \ No newline at end of file diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/Model/Report_TwoItemsFixture.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/Model/Report_TwoItemsFixture.cs new file mode 100644 index 0000000000..947171239a --- /dev/null +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/Model/Report_TwoItemsFixture.cs @@ -0,0 +1,76 @@ +/* + * Created by SharpDevelop. + * User: Peter Forstmeier + * Date: 07.04.2013 + * Time: 18:01 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +using System; +using System.Drawing; +using System.IO; +using System.Reflection; + +using ICSharpCode.Reporting.Items; +using NUnit.Framework; + +namespace ICSharpCode.Reporting.Test.Model +{ + [TestFixture] + public class Report_TwoItemsFixture + { + Stream stream; + + [Test] + public void LoadModelWithItems() + { + var rf = new ReportingFactory(); + var model = rf.LoadReportModel(stream); + Assert.That(model,Is.Not.Null); + } + + + [Test] + public void ReportHeaderOneItem () { + var rf = new ReportingFactory(); + var model = rf.LoadReportModel(stream); + var section = model.ReportHeader; + Assert.That(section.Items.Count,Is.EqualTo(1)); + } + + + [Test] + public void PageHeaderOneItem () { + var rf = new ReportingFactory(); + var model = rf.LoadReportModel(stream); + var section = model.ReportHeader; + Assert.That(section.Items.Count,Is.EqualTo(1)); + } + + + [Test] + public void ItemIsTextItem() { + var rf = new ReportingFactory(); + var model = rf.LoadReportModel(stream); + var item = model.ReportHeader.Items[0]; + Assert.That(item,Is.AssignableFrom(typeof(BaseTextItem))); + } + + + [Test] + public void IsLocationSet() { + var rf = new ReportingFactory(); + var model = rf.LoadReportModel(stream); + var item = model.ReportHeader.Items[0]; + Assert.That(item.Location,Is.Not.EqualTo(Point.Empty)); + } + + + [SetUp] + public void LoadFromStream() + { + System.Reflection.Assembly asm = Assembly.GetExecutingAssembly(); + stream = asm.GetManifestResourceStream(TestHelper.RepWithTwoItems); + } + } +} diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/PageBuilder/BaseConvertFixture.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/PageBuilder/BaseConvertFixture.cs new file mode 100644 index 0000000000..213c669031 --- /dev/null +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/PageBuilder/BaseConvertFixture.cs @@ -0,0 +1,49 @@ +/* + * Created by SharpDevelop. + * User: Peter Forstmeier + * Date: 08.04.2013 + * Time: 20:20 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +using System; +using System.Reflection; +using ICSharpCode.Reporting.Interfaces; +using ICSharpCode.Reporting.PageBuilder; +using ICSharpCode.Reporting.PageBuilder.ExportColumns; +using NUnit.Framework; + +namespace ICSharpCode.Reporting.Test.PageBuilder +{ + [TestFixture] + public class BaseConvertFixture + { + private IReportCreator reportCreator; + + + [Test] + public void CurrentPageContainOneItem() { + reportCreator.BuildExportList(); + var page = reportCreator.Pages[0]; + Assert.That(page.Items.Count, Is.EqualTo(1)); + } + + + [Test] + public void PageItemIsBaseExportColumn() { + reportCreator.BuildExportList(); + var page = reportCreator.Pages[0]; + Assert.That(page.Items[0],Is.InstanceOf(typeof(ExportText))); + } + + + [SetUp] + public void LoadFromStream() + { + System.Reflection.Assembly asm = Assembly.GetExecutingAssembly(); + var stream = asm.GetManifestResourceStream(TestHelper.RepWithTwoItems); + var reportingFactory = new ReportingFactory(); + reportCreator = reportingFactory.ReportCreator(stream); + } + } +} diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/PageBuilder/PageBuilderFixture.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/PageBuilder/PageBuilderFixture.cs index 90b80ccf50..a3e4450b62 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/PageBuilder/PageBuilderFixture.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/PageBuilder/PageBuilderFixture.cs @@ -22,6 +22,7 @@ namespace ICSharpCode.Reporting.Test.PageBuilder private IReportCreator reportCreator; + [Test] public void CanCreateFormsPageBuilder() { @@ -29,6 +30,9 @@ namespace ICSharpCode.Reporting.Test.PageBuilder } + + #region Pages + [Test] public void PagesCountIsZero () { Assert.That(reportCreator.Pages.Count,Is.EqualTo(0)); @@ -44,26 +48,22 @@ namespace ICSharpCode.Reporting.Test.PageBuilder [Test] public void CurrentPageIsSet() { - System.Reflection.Assembly asm = Assembly.GetExecutingAssembly(); - var stream = asm.GetManifestResourceStream(TestHelper.PlainReportFileName); - var reportingFactory = new ReportingFactory(); - var reportCreator = (FormPageBuilder)reportingFactory.ReportCreator(stream); + reportCreator.BuildExportList(); - Assert.That(reportCreator.CurrentPage,Is.Not.Null); + Assert.That(reportCreator.Pages[0],Is.Not.Null); } [Test] public void CurrentPageIsFirstPage() { - System.Reflection.Assembly asm = Assembly.GetExecutingAssembly(); - var stream = asm.GetManifestResourceStream(TestHelper.PlainReportFileName); - var reportingFactory = new ReportingFactory(); - var reportCreator = (FormPageBuilder)reportingFactory.ReportCreator(stream); reportCreator.BuildExportList(); - Assert.That(reportCreator.CurrentPage.IsFirstPage,Is.True); + Assert.That(reportCreator.Pages[0].IsFirstPage,Is.True); Assert.That(reportCreator.Pages[0].IsFirstPage,Is.True); } + #endregion + + #region PageInfo [Test] public void PageInfoPageNumberIsOne() { @@ -73,7 +73,6 @@ namespace ICSharpCode.Reporting.Test.PageBuilder } - [Test] public void PageInfoReportName() { reportCreator.BuildExportList(); @@ -81,12 +80,13 @@ namespace ICSharpCode.Reporting.Test.PageBuilder Assert.That(pi.ReportName,Is.EqualTo("Report1")); } + #endregion [SetUp] public void LoadFromStream() { System.Reflection.Assembly asm = Assembly.GetExecutingAssembly(); - var stream = asm.GetManifestResourceStream(TestHelper.PlainReportFileName); + var stream = asm.GetManifestResourceStream(TestHelper.RepWithTwoItems); var reportingFactory = new ReportingFactory(); reportCreator = reportingFactory.ReportCreator(stream); } diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/TestHelper.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/TestHelper.cs index 46e4baf68d..dee6e25142 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/TestHelper.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/TestHelper.cs @@ -17,6 +17,7 @@ namespace ICSharpCode.Reporting.Test { private const string nameSpace = "ICSharpCode.Reporting.Test.src.TestReports."; private const string plainReportName = "PlainModel.srd"; + private const string rr = "ReportWithTwoItems.srd"; public TestHelper() { @@ -25,5 +26,9 @@ namespace ICSharpCode.Reporting.Test public static string PlainReportFileName{ get{return nameSpace + plainReportName;} } + + public static string RepWithTwoItems { + get {return nameSpace + rr;} + } } } diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/TestReports/ReportWithTwoItems.srd b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/TestReports/ReportWithTwoItems.srd new file mode 100644 index 0000000000..d121d6de85 --- /dev/null +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/TestReports/ReportWithTwoItems.srd @@ -0,0 +1,144 @@ + + + + + Report1 + FormSheet + 50 + 50 + 50 + 50 + 827, 1169 + False + Millimeter + 5, 5, 5, 5 + + + + + + + + Text + FormSheet + No Data for this Report + Microsoft Sans Serif, 10pt + True + + + + + 50, 50 + 727, 60 + White + 0 + 0 + False + False + + + 313, 5 + 100, 20 + White + Microsoft Sans Serif, 10pt + None + TopLeft + False + False + System.String + No + Report1 + False + Black + Black + Report1 + + + Black + ReportHeader + + + 50, 125 + 727, 60 + White + 0 + 0 + False + False + + + 26, 22 + 100, 20 + White + Microsoft Sans Serif, 10pt + None + TopLeft + False + False + No + BaseTextItem2147483646 + False + Black + Black + BaseTextItem2147483646 + + + Black + ReportPageHeader + + + 50, 200 + 727, 60 + White + 0 + 0 + False + False + + Black + ReportDetail + + + 50, 275 + 727, 60 + White + 0 + 0 + False + False + + + 622, 5 + 100, 20 + White + Microsoft Sans Serif, 10pt + None + TopLeft + False + False + System.String + No + =Globals!PageNumber + False + Black + Black + PageNumber1 + + + Black + ReportPageFooter + + + 50, 350 + 727, 60 + White + 0 + 0 + False + False + + Black + ReportFooter + + + \ No newline at end of file