Пример #1
0
		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));
		}
Пример #2
0
        public void PlainText()
        {
            BaseTextItem bti = new BaseTextItem();

            bti.Text = "abc";
            Assert.AreEqual("abc", bti.Text);
        }
Пример #3
0
        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);
        }
Пример #5
0
        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);
        }
Пример #7
0
		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);
        }
Пример #9
0
        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);
        }
Пример #10
0
        public void GetSetFormatString()
        {
            BaseTextItem bti = new BaseTextItem();

            bti.FormatString = "H";
            Assert.AreEqual("H", bti.FormatString,
                            "StringTrimming should be equal <H>");
        }
Пример #11
0
        public void ChangeName()
        {
            var newName = "changed";
            var ti      = new BaseTextItem();

            ti.Name = newName;
            Assert.That(ti.Name, Is.EqualTo(newName));
        }
Пример #12
0
        public void GetSetStringTrimming()
        {
            BaseTextItem bti = new BaseTextItem();

            bti.StringTrimming = StringTrimming.Character;
            Assert.AreEqual(StringTrimming.Character, bti.StringTrimming,
                            "StringTrimming should be equal <StringTrimming.Character>");
        }
Пример #13
0
        public void TypeofExportShouldBeExportText()
        {
            BaseTextItem     bt  = new BaseTextItem();
            BaseExportColumn bec = bt.CreateExportColumn();
            Type             t   = typeof(ExportText);

            Assert.AreEqual(t, bec.GetType(), "Type should be 'ExportText");
        }
Пример #14
0
        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));
        }
Пример #15
0
        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));
        }
Пример #16
0
        public void TextValueEqualExportedText()
        {
            BaseTextItem bt = new BaseTextItem();

            bt.Text = "Text";
            ExportText bec = (ExportText)bt.CreateExportColumn();

            bec.Text = bt.Text;
        }
Пример #17
0
        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>");
        }
Пример #18
0
        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));
        }
Пример #19
0
        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);
        }
Пример #20
0
        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);
        }
Пример #21
0
        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);
        }
Пример #22
0
        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);
        }
Пример #23
0
        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);
        }
Пример #24
0
        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"));
        }
Пример #25
0
        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);
        }
Пример #26
0
        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");
        }
Пример #27
0
        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);
        }
Пример #28
0
        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);
        }
Пример #29
0
        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);
        }
Пример #30
0
        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);
        }
Пример #32
0
        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);
        }
Пример #33
0
		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;
		}
Пример #34
0
		public override void Initialize(IComponent component)
		{
			base.Initialize(component);
			GetService();
			this.ctrl = (BaseTextItem) component;
		}
Пример #35
0
		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;
		}