Files
Terminal.Gui/UnitTests/Core/EscSeqReqTests.cs
BDisp 1d2dc40c8a Fixes #2305. Improves the handling of escape sequence. (#2375)
* Changed ansi esc sequence used on exit.

* Changed ansi esc sequence used on exit.

* Improves HeightAsBuffer although currently only works on Windows.

* Fixes #2267. Toplevel.EnsureVisibleBounds throws an exception if border is null.

* Changing comment as requested.

* Fixes indentation.

* Seems not needed for now, maybe some update, comment for now.

* Renamed HeightAsBuffer to EnableConsoleScrolling and made it obsolete.

* Add comment on remarks for EnableConsoleScrolling.

* merged @bdisp's EnableConsoleScrolling PR

* Fixes buffer for Windows Terminal.

* Fixes issue in Windows Terminal on resizing causing some lines not be drawing after exceptions.

* merge #9

* merged #9

* use ESC [ ? 1047

* Tweaks with new esc codes

* Fixed curses driver to not nuke scroll buffer and to resize properly

* merge

* Cleand up netdriver escape codes

* fixed spaces->tabs

* fixed spaces->tabs

* fixed spaces->tabs

* fixed spaces->tabs

* fixed merge issue and  spaces->tabs

* fixed spaces->tabs

* fixed spaces->tabs

* fixed spaces->tabs

* fixed  build error

* removed old comments

* Resolving merge conflicts.

* Ensuring reset the EnableConsoleScrolling.

* Changing from HeightAsBuffer to EnableConsoleScrolling.

* Done requested changes.

* Reformatting.

* Rename to EscSeqReqStatus.

* Removing Console.Out.Flush ();

---------

Co-authored-by: Charlie Kindel <tig@users.noreply.github.com>
Co-authored-by: Tig Kindel <tig@kindel.com>
2023-02-25 15:30:44 -07:00

79 lines
2.3 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;
namespace Terminal.Gui.CoreTests {
public class EscSeqReqTests {
[Fact]
public void Constructor_Defaults ()
{
var escSeqReq = new EscSeqReqProc ();
Assert.NotNull (escSeqReq.EscSeqReqStats);
Assert.Empty (escSeqReq.EscSeqReqStats);
}
[Fact]
public void Add_Tests ()
{
var escSeqReq = new EscSeqReqProc ();
escSeqReq.Add ("t");
Assert.Single (escSeqReq.EscSeqReqStats);
Assert.Equal ("t", escSeqReq.EscSeqReqStats [^1].Terminating);
Assert.Equal (1, escSeqReq.EscSeqReqStats [^1].NumRequests);
Assert.Equal (1, escSeqReq.EscSeqReqStats [^1].NumOutstanding);
escSeqReq.Add ("t", 2);
Assert.Single (escSeqReq.EscSeqReqStats);
Assert.Equal ("t", escSeqReq.EscSeqReqStats [^1].Terminating);
Assert.Equal (1, escSeqReq.EscSeqReqStats [^1].NumRequests);
Assert.Equal (1, escSeqReq.EscSeqReqStats [^1].NumOutstanding);
escSeqReq = new EscSeqReqProc ();
escSeqReq.Add ("t", 2);
Assert.Single (escSeqReq.EscSeqReqStats);
Assert.Equal ("t", escSeqReq.EscSeqReqStats [^1].Terminating);
Assert.Equal (2, escSeqReq.EscSeqReqStats [^1].NumRequests);
Assert.Equal (2, escSeqReq.EscSeqReqStats [^1].NumOutstanding);
escSeqReq.Add ("t", 3);
Assert.Single (escSeqReq.EscSeqReqStats);
Assert.Equal ("t", escSeqReq.EscSeqReqStats [^1].Terminating);
Assert.Equal (2, escSeqReq.EscSeqReqStats [^1].NumRequests);
Assert.Equal (2, escSeqReq.EscSeqReqStats [^1].NumOutstanding);
}
[Fact]
public void Remove_Tests ()
{
var escSeqReq = new EscSeqReqProc ();
escSeqReq.Add ("t");
escSeqReq.Remove ("t");
Assert.Empty (escSeqReq.EscSeqReqStats);
escSeqReq.Add ("t", 2);
escSeqReq.Remove ("t");
Assert.Single (escSeqReq.EscSeqReqStats);
Assert.Equal ("t", escSeqReq.EscSeqReqStats [^1].Terminating);
Assert.Equal (2, escSeqReq.EscSeqReqStats [^1].NumRequests);
Assert.Equal (1, escSeqReq.EscSeqReqStats [^1].NumOutstanding);
escSeqReq.Remove ("t");
Assert.Empty (escSeqReq.EscSeqReqStats);
}
[Fact]
public void Requested_Tests ()
{
var escSeqReq = new EscSeqReqProc ();
Assert.False (escSeqReq.Requested ("t"));
escSeqReq.Add ("t");
Assert.False (escSeqReq.Requested ("r"));
Assert.True (escSeqReq.Requested ("t"));
}
}
}