public void IsToPrint_NegativePage_ThrowsException() { var pd = new PrintDefinition(); pd.SetPrintAttribute(new PrintOnAllPagesAttribute(PrintAppendixes.Footer)); Assert.That(() => pd.IsToPrint(PrintAppendixes.Footer, -1, false), Throws.InstanceOf <ArgumentOutOfRangeException>()); }
public void SetPrintAttribute() { var pd = new PrintDefinition(); pd.SetPrintAttribute(new PrintOnPageAttribute(PrintAppendixes.Footer, 1)); Assert.That(pd.IsDefined(PrintAppendixes.Footer), Is.True); }
public void IsToPrint_CheckLastPage() { var pd = new PrintDefinition(); Assert.That(pd.IsToPrint(PrintAppendixes.Footer, 2, true), Is.False); pd.SetPrintAttribute(new PrintOnPageAttribute(PrintAppendixes.Footer, PrintPartDefinitionAttribute.LastPage)); Assert.That(pd.IsToPrint(PrintAppendixes.Footer, 2, true), Is.True); }
private void SetPrintOnAttributes() { var customPageAttributes = (IPrintPartDefinition[])GetType().GetCustomAttributes(typeof(IPrintPartDefinition), true); foreach (var printOnAttribute in customPageAttributes) { PrintDefinition.SetPrintAttribute(printOnAttribute); } PrintDimension.InternalPrintDefinition = PrintDefinition; }
public void IsToPrint_IncludePage() { var pd = new PrintDefinition(); Assert.That(pd.IsToPrint(PrintAppendixes.Footer, 1, false), Is.False); pd.SetPrintAttribute(new PrintOnPageAttribute(PrintAppendixes.Footer, 2)); Assert.That(pd.IsToPrint(PrintAppendixes.Footer, 1, false), Is.False); Assert.That(pd.IsToPrint(PrintAppendixes.Footer, 2, false), Is.True); }
public void IsToPrint_CheckSinglePage() { var pd = new PrintDefinition(); pd.SetPrintAttribute(new PrintOnPageAttribute(PrintAppendixes.Footer, PrintPartDefinitionAttribute.LastPage)); // do not print on page #1 Assert.That(pd.IsToPrint(PrintAppendixes.Footer, 1, false), Is.False); // but print on last page Assert.That(pd.IsToPrint(PrintAppendixes.Footer, 1, true), Is.True); }
protected override void PreparePrint() { base.PreparePrint(); PrintDimension.Margin = new Thickness(50); if (_printingAppendix.HasFlag(PrintAppendixes.Summary)) { PrintDefinition.SetPrintAttribute(new PrintOnAllPagesAttribute(PrintAppendixes.Summary)); } if (_printingAppendix.HasFlag(PrintAppendixes.Footer)) { PrintDefinition.SetPrintAttribute(new PrintOnAllPagesAttribute(PrintAppendixes.Footer)); } if (_printingAppendix.HasFlag(PrintAppendixes.Header)) { PrintDefinition.SetPrintAttribute(new PrintOnAllPagesAttribute(PrintAppendixes.Header)); } }
protected override void PreparePrint() { base.PreparePrint(); PrintDimension.Margin = new Thickness(50); if (_printingAppendix.HasFlag(PrintAppendixes.Summary)) { PrintDefinition.SetPrintAttribute(new PrintOnAllPagesAttribute(PrintAppendixes.Summary)); PrintDimension.SummaryHeight = GetSummary().ComputeDesiredSize().Height; } if (_printingAppendix.HasFlag(PrintAppendixes.Footer)) { PrintDefinition.SetPrintAttribute(new PrintOnAllPagesAttribute(PrintAppendixes.Footer)); PrintDimension.FooterHeight = GetFooter().ComputeDesiredSize().Height; } if (_printingAppendix.HasFlag(PrintAppendixes.Header)) { PrintDefinition.SetPrintAttribute(new PrintOnAllPagesAttribute(PrintAppendixes.Header)); PrintDimension.HeaderHeight = GetHeader().ComputeDesiredSize().Height; } }
public void IsToPrint_InvalidArgumentException() { var pd = new PrintDefinition(); Assert.That(() => pd.IsToPrint((PrintAppendixes)(-1), 1, false), Throws.ArgumentException); }
public void SetPrintAttribute_Null_ThrowsException() { var pd = new PrintDefinition(); Assert.That(() => pd.SetPrintAttribute(null), Throws.ArgumentNullException); }