public void UserLanguageFunction () { BaseTextItem bti = new BaseTextItem(); bti.Text = "User!Language"; IExpression compiled = this.compiler.CompileExpression<object>(bti.Text); Assert.That(compiled.Evaluate(null), Is.EqualTo(System.Globalization.CultureInfo.CurrentCulture.ThreeLetterISOLanguageName)); }
public void PlainText() { BaseTextItem bti = new BaseTextItem(); bti.Text = "abc"; Assert.AreEqual("abc", bti.Text); }
void CreatePageHeader(ReportWizardContext context) { var pushModelContext = (PushModelContext)context.PushModelContext; foreach (var element in pushModelContext.Items) { var dataItem = new BaseTextItem() { Name = element.ColumnName, Text = element.ColumnName }; ReportModel.PageHeader.Items.Add(dataItem); } AdjustItems(ReportModel.PageHeader.Items, startLocation); var line = new BaseLineItem() { Location = new Point(2, 35), FromPoint = new Point(1, 1), ToPoint = new Point(ReportModel.ReportSettings.PrintableWidth() - 10, 1), Size = new Size(ReportModel.ReportSettings.PrintableWidth() - 5, 5) }; ReportModel.PageHeader.Items.Add(line); }
public void Convert_SimpleItems_Should_Calculate_Correct_Locations() { ReportItemCollection ri = new ReportItemCollection(); Point itemLocation = new Point(10, 10); BaseReportItem r = new BaseTextItem() { Location = itemLocation, Size = new Size(20, 100) }; ri.Add(r); Point offset = new Point(20, 20); Rectangle parentRectangle = new Rectangle(50, 50, 700, 50); Sut.ParentRectangle = parentRectangle; ExporterCollection ec = Sut.ConvertSimpleItems(offset, ri); BaseExportColumn be = ec[0]; // this.ParentRectangle.Location.X + lineItem.StyleDecorator.Location.X, // lineItem.StyleDecorator.Location.Y + offset.Y); Point resultLocation = new Point(parentRectangle.Location.X + itemLocation.X, itemLocation.Y + offset.Y); Assert.AreEqual(resultLocation, be.StyleDecorator.Location); }
public void ExportColumnIsNotNull() { BaseTextItem bt = new BaseTextItem(); BaseExportColumn bec = bt.CreateExportColumn(); Assert.IsNotNull(bec); }
public static Size MeasureReportItem(Graphics graphics, IReportItem item) { BaseTextItem textItem = item as BaseTextItem; if (textItem != null) { string str = String.Empty; BaseDataItem dataItem = item as BaseDataItem; if (dataItem != null) { str = dataItem.DBValue; } else { BaseTextItem it = item as BaseTextItem; if (it != null) { str = it.Text; } } SizeF sf = graphics.MeasureString(str.TrimEnd(), textItem.Font, textItem.Size.Width); return(sf.ToSize()); } return(item.Size); }
public void UserNameFunction () { BaseTextItem bti = new BaseTextItem(); bti.Text = "User!UserID"; IExpression compiled = this.compiler.CompileExpression<object>(bti.Text); Assert.That(compiled.Evaluate(null), Is.EqualTo(Environment.UserName)); }
public void Init() { container = new BaseSection() { Size = new Size(720, 60), Location = new Point(50, 50), Name = "Section" }; var item1 = new BaseTextItem() { Name = "Item1", Location = new Point(10, 10), Size = new Size(60, 20) }; var item2 = new BaseTextItem() { Name = "Item2", Location = new Point(80, 10), Size = new Size(60, 20) }; container.Items.Add(item1); container.Items.Add(item2); Bitmap bitmap = new Bitmap(700, 1000); graphics = Graphics.FromImage(bitmap); }
public void DefaultSettings() { BaseTextItem bti = new BaseTextItem(); Assert.IsTrue(String.IsNullOrEmpty(bti.Text), "Text should be 'String.IsNullOrEmpty'"); Assert.AreEqual(ContentAlignment.TopLeft, bti.ContentAlignment); Assert.AreEqual(StringTrimming.None, bti.StringTrimming); }
public void GetSetFormatString() { BaseTextItem bti = new BaseTextItem(); bti.FormatString = "H"; Assert.AreEqual("H", bti.FormatString, "StringTrimming should be equal <H>"); }
public void ChangeName() { var newName = "changed"; var ti = new BaseTextItem(); ti.Name = newName; Assert.That(ti.Name, Is.EqualTo(newName)); }
public void GetSetStringTrimming() { BaseTextItem bti = new BaseTextItem(); bti.StringTrimming = StringTrimming.Character; Assert.AreEqual(StringTrimming.Character, bti.StringTrimming, "StringTrimming should be equal <StringTrimming.Character>"); }
public void TypeofExportShouldBeExportText() { BaseTextItem bt = new BaseTextItem(); BaseExportColumn bec = bt.CreateExportColumn(); Type t = typeof(ExportText); Assert.AreEqual(t, bec.GetType(), "Type should be 'ExportText"); }
public void UserLanguageFunction() { BaseTextItem bti = new BaseTextItem(); bti.Text = "=User!Language"; IExpression compiled = this.compiler.CompileExpression <object>(bti.Text); Assert.That(compiled.Evaluate(null), Is.EqualTo(System.Globalization.CultureInfo.CurrentCulture.ThreeLetterISOLanguageName)); }
public void UserNameFunction() { BaseTextItem bti = new BaseTextItem(); bti.Text = "=User!UserID"; IExpression compiled = this.compiler.CompileExpression <object>(bti.Text); Assert.That(compiled.Evaluate(null), Is.EqualTo(Environment.UserName)); }
public void TextValueEqualExportedText() { BaseTextItem bt = new BaseTextItem(); bt.Text = "Text"; ExportText bec = (ExportText)bt.CreateExportColumn(); bec.Text = bt.Text; }
public void GetSetContendAlignment() { BaseTextItem bti = new BaseTextItem(); bti.ContentAlignment = System.Drawing.ContentAlignment.BottomCenter; Assert.AreEqual(System.Drawing.ContentAlignment.BottomCenter, bti.ContentAlignment, "ContendAlignement should be equal <ContentAlignment.BottomCenter>"); }
public void CreateExportText() { var ti = new BaseTextItem(); var exportText = (ExportText)ti.CreateExportColumn(); Assert.That(exportText.Name, Is.EqualTo(ti.Name)); Assert.That(exportText.Location, Is.EqualTo(ti.Location)); Assert.That(exportText.Size, Is.EqualTo(ti.Size)); Assert.That(exportText.Font, Is.EqualTo(GlobalValues.DefaultFont)); }
public void GetSetStringFormat() { BaseTextItem bti = new BaseTextItem(); bti.StringTrimming = StringTrimming.Character; bti.ContentAlignment = System.Drawing.ContentAlignment.BottomCenter; StringFormat f = bti.StringFormat; Assert.AreEqual(StringAlignment.Center, f.Alignment); }
public void Layouter_Return_SectionSize_If_Items_Fit_In_Section() { Rectangle sectionRect = new Rectangle(section.Location, section.Size); BaseTextItem item = CreateSmallItem(); section.Items.Add(item); Rectangle resultRec = Sut.Layout(this.graphics, section); BaseReportItem resultItem = section.Items[0]; Assert.That(resultItem.Size.Height == item.Size.Height); Assert.AreEqual(sectionRect, resultRec); }
void CreatePageFooter() { var lineNrField = new BaseTextItem() { Text = "='Page : ' + Globals!PageNumber + ' of ' + Globals!Pages + ' Page(s)'", Name = "LineNumber", Location = new Point(300, 10), Size = new Size(GlobalValues.PreferedSize.Width * 2, GlobalValues.PreferedSize.Height) }; ReportModel.PageFooter.Items.Add(lineNrField); }
private BaseTextItem CreateSmallItem() { BaseTextItem item = new BaseTextItem() { CanGrow = true, Location = new Point(5, 5), Size = new Size(100, 20), Text = "hi i'm the text" }; return(item); }
private BaseTextItem CreateBigItem() { BaseTextItem item = new BaseTextItem() { CanGrow = true, Location = new Point(5, 5), Size = new Size(100, 20), Text = "hi i'm the text, this text didn't fit in rectangle" }; return(item); }
public void FormatTimeSpanfromTime() { var ti = new BaseTextItem(); ti.DataType = "System.TimeSpan"; ti.FormatString = "hh:mm:ss"; ti.Text = new TimeSpan(7, 17, 20).ToString(); var exportColumn = (ExportText)ti.CreateExportColumn(); StandardFormatter.FormatOutput(exportColumn); Assert.That(ti.Text, Is.EqualTo("07:17:20")); }
void CreatePageFooter() { var lineNrField = new BaseTextItem() { Text = "='Page : ' + Globals!PageNumber + ' of ' + Globals!Pages + ' Page(s)'", Name = "LineNumber", Size = new Size(GlobalValues.PreferedSize.Width * 2, GlobalValues.PreferedSize.Height) }; var xLoc = DesignerHelper.AlignRight(ReportModel.ReportSettings.PrintableWidth(), lineNrField.Size.Width) - 5; lineNrField.Location = new Point(xLoc, 10); ReportModel.PageFooter.Items.Add(lineNrField); }
public void Layouter_Extend_SectionSize_If_Items_Not_Fit_In_Section() { Rectangle sectionRect = new Rectangle(section.Location, section.Size); BaseTextItem item = CreateBigItem(); section.Items.Add(item); Rectangle resultRec = Sut.Layout(this.graphics, section); BaseReportItem resultItem = section.Items[0]; Assert.That(resultItem.Size.Height > CreateBigItem().Size.Height, "Result Rectangle should be extendend"); Assert.That(sectionRect.Height < resultRec.Height, "result Rectangle should be higher than standard"); }
void CreateReportHeader() { var headerText = new BaseTextItem(); headerText.Text = "Header"; headerText.Size = GlobalValues.PreferedSize; var printableWith = ReportModel.ReportSettings.PageSize.Width - ReportModel.ReportSettings.LeftMargin - ReportModel.ReportSettings.RightMargin; var x = (int)(printableWith - headerText.Size.Width) / 2; headerText.Location = new Point(x, 4); ReportModel.ReportHeader.Items.Add(headerText); Console.WriteLine(""); Console.WriteLine("Createreportheader Size {0}", ReportModel.ReportHeader.Size); }
private ReportItemCollection PlainCollection() { ReportItemCollection ri = new ReportItemCollection(); BaseTextItem t1 = new BaseTextItem(); t1.Name = "t1"; ri.Add(t1); t1 = new BaseTextItem(); t1.Name = "t2"; ri.Add(t1); t1 = new BaseTextItem(); t1.Name = "t3"; ri.Add(t1); return(ri); }
private BaseSection ConfigurePlainSection() { BaseSection section = new BaseSection(); BaseTextItem bti = new BaseTextItem { Name = "TextItem" }; BaseImageItem bii = new BaseImageItem() { Name = "ImageItem" }; section.Items.Add(bti); section.Items.Add(bii); return(section); }
public void Layouter_Return_SectionSize_If_No_Item_Is_CanGrow_Shrink() { Rectangle sectionRect = new Rectangle(section.Location, section.Size); BaseTextItem item = new BaseTextItem() { Location = new Point(5, 5), Size = new Size(100, 20), Text = "hi i'm the text" }; section.Items.Add(item); Rectangle resultRec = Sut.Layout(this.graphics, section); BaseReportItem resultItem = section.Items[0]; Assert.That(resultItem.Size.Height == item.Size.Height); Assert.AreEqual(sectionRect, resultRec); }
public void Convert_SimpleItems_Should_Return_Valid_Collection() { ReportItemCollection ri = new ReportItemCollection(); BaseReportItem r = new BaseTextItem() { Location = new Point(10, 10), Size = new Size(20, 100) }; ri.Add(r); IExportItemsConverter sut = new ExportItemsConverter(); ExporterCollection ec = sut.ConvertSimpleItems(new Point(10, 10), ri); Assert.IsNotNull(ec); Assert.AreEqual(1, ec.Count); }
private BaseSection ConfigureSectionWithRow() { BaseSection section = new BaseSection(); BaseRowItem row = new BaseRowItem(); BaseTextItem bti = new BaseTextItem { Name = "TextItem" }; BaseImageItem bii = new BaseImageItem() { Name = "ImageItem" }; row.Items.Add(bti); row.Items.Add(bii); section.Items.Add(row); return(section); }
private BaseSection ConfigureSectionWithRow () { BaseSection section = new BaseSection(); BaseRowItem row = new BaseRowItem(); BaseTextItem bti = new BaseTextItem{ Name = "TextItem" }; BaseImageItem bii = new BaseImageItem(){ Name = "ImageItem" }; row.Items.Add(bti); row.Items.Add(bii); section.Items.Add(row); return section; }
public override void Initialize(IComponent component) { base.Initialize(component); GetService(); this.ctrl = (BaseTextItem) component; }
private BaseSection ConfigurePlainSection () { BaseSection section = new BaseSection(); BaseTextItem bti = new BaseTextItem{ Name = "TextItem" }; BaseImageItem bii = new BaseImageItem(){ Name = "ImageItem" }; section.Items.Add(bti); section.Items.Add(bii); return section; }
private ReportItemCollection PlainCollection() { ReportItemCollection ri = new ReportItemCollection(); BaseTextItem t1 = new BaseTextItem(); t1.Name = "t1"; ri.Add(t1); t1 = new BaseTextItem(); t1.Name = "t2"; ri.Add(t1); t1 = new BaseTextItem(); t1.Name = "t3"; ri.Add(t1); return ri; }