mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-07-15 08:03:50 +08:00
50 lines
1.3 KiB
C#
50 lines
1.3 KiB
C#
namespace UglyToad.PdfPig.Tests.Graphics.Operations.SpecialGraphicsState
|
|
{
|
|
using PdfPig.Graphics;
|
|
using PdfPig.Graphics.Operations.SpecialGraphicsState;
|
|
|
|
public class PopTests
|
|
{
|
|
private readonly TestOperationContext context = new TestOperationContext();
|
|
|
|
[Fact]
|
|
public void PopSymbolCorrect()
|
|
{
|
|
Assert.Equal("Q", Pop.Symbol);
|
|
Assert.Equal("Q", Pop.Value.Operator);
|
|
}
|
|
|
|
[Fact(Skip = "The stack size check has been moved out of the Pop Operation, and is now in BaseStreamProcessor.PopState().")]
|
|
public void CannotPopWithSingleFrame()
|
|
{
|
|
Action action = () => Pop.Value.Run(context);
|
|
|
|
Assert.Throws<InvalidOperationException>(action);
|
|
}
|
|
|
|
[Fact]
|
|
public void CannotPopWithNoFrames()
|
|
{
|
|
context.StateStack.Pop();
|
|
|
|
Action action = () => Pop.Value.Run(context);
|
|
|
|
Assert.Throws<InvalidOperationException>(action);
|
|
}
|
|
|
|
[Fact]
|
|
public void PopsTopFrame()
|
|
{
|
|
context.StateStack.Push(new CurrentGraphicsState
|
|
{
|
|
LineWidth = 23
|
|
});
|
|
|
|
Pop.Value.Run(context);
|
|
|
|
Assert.Equal(1, context.StackSize);
|
|
Assert.Equal(1, context.GetCurrentState().LineWidth);
|
|
}
|
|
}
|
|
}
|