mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-07-15 17:40:58 +08:00
53 lines
1.4 KiB
C#
53 lines
1.4 KiB
C#
![]() |
namespace UglyToad.Pdf.Tests.Graphics.Operations.SpecialGraphicsState
|
|||
|
{
|
|||
|
using System;
|
|||
|
using Pdf.Graphics;
|
|||
|
using Pdf.Graphics.Operations.SpecialGraphicsState;
|
|||
|
using Xunit;
|
|||
|
|
|||
|
public class PopTests
|
|||
|
{
|
|||
|
private readonly TestResourceStore resourceStore = new TestResourceStore();
|
|||
|
private readonly TestOperationContext context = new TestOperationContext();
|
|||
|
|
|||
|
[Fact]
|
|||
|
public void PopSymbolCorrect()
|
|||
|
{
|
|||
|
Assert.Equal("Q", Pop.Symbol);
|
|||
|
Assert.Equal("Q", Pop.Value.Operator);
|
|||
|
}
|
|||
|
|
|||
|
[Fact]
|
|||
|
public void CannotPopWithSingleFrame()
|
|||
|
{
|
|||
|
Action action = () => Pop.Value.Run(context, resourceStore);
|
|||
|
|
|||
|
Assert.Throws<InvalidOperationException>(action);
|
|||
|
}
|
|||
|
|
|||
|
[Fact]
|
|||
|
public void CannotPopWithNoFrames()
|
|||
|
{
|
|||
|
context.StateStack.Pop();
|
|||
|
|
|||
|
Action action = () => Pop.Value.Run(context, resourceStore);
|
|||
|
|
|||
|
Assert.Throws<InvalidOperationException>(action);
|
|||
|
}
|
|||
|
|
|||
|
[Fact]
|
|||
|
public void PopsTopFrame()
|
|||
|
{
|
|||
|
context.StateStack.Push(new CurrentGraphicsState
|
|||
|
{
|
|||
|
LineWidth = 23
|
|||
|
});
|
|||
|
|
|||
|
Pop.Value.Run(context, resourceStore);
|
|||
|
|
|||
|
Assert.Equal(1, context.StackSize);
|
|||
|
Assert.Equal(1, context.GetCurrentState().LineWidth);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|