public void TestAddSeveralEntries()
        {
            var logFile = new InMemoryLogFile();
            var index   = new PresentationLogFile(_scheduler, logFile, TimeSpan.Zero);

            logFile.Add(new LogEntry2 {
                RawContent = "Foo"
            });
            _scheduler.RunOnce();
            index.MaximumWidth.Should().BeApproximately(19.8, 0.1);
            index.LineCount.Should().Be(1);

            logFile.Add(new LogEntry2 {
                RawContent = "Hello,\r\nWorld!"
            });
            _scheduler.RunOnce();
            index.MaximumWidth.Should().BeApproximately(46.2, 0.1);
            index.LineCount.Should().Be(3);

            logFile.Add(new LogEntry2 {
                RawContent = "Bar"
            });
            _scheduler.RunOnce();
            index.MaximumWidth.Should().BeApproximately(46.2, 0.1);
            index.LineCount.Should().Be(4);
        }
        public void TestEmptyFile()
        {
            var index = new PresentationLogFile(_scheduler, new InMemoryLogFile());

            _scheduler.RunOnce();
            index.MaximumWidth.Should().Be(0);
            index.LineCount.Should().Be(0);
        }
Esempio n. 3
0
 private void FlushPrevious()
 {
     TimeConversion         = new TimeFrameConverter(this);
     DifferenceBetweenFiles = null;
     CurrentAction          = null;
     EDFPlusHandle          = null;
     PresentationLogHandle  = null;
 }
        public void TestTwoLines()
        {
            var logFile = new InMemoryLogFile();
            var index   = new PresentationLogFile(_scheduler, logFile, TimeSpan.Zero);

            logFile.Add(new LogEntry2 {
                RawContent = "Hello,\r\nWorld!"
            });

            _scheduler.RunOnce();
            index.MaximumWidth.Should().BeApproximately(46, 1);
            index.LineCount.Should().Be(2);
        }
        public void TestOneLine()
        {
            var logFile = new InMemoryLogFile();
            var index   = new PresentationLogFile(_scheduler, logFile, TimeSpan.Zero, TextSettings.Default);

            logFile.Add(new LogEntry2 {
                RawContent = "Hello, World!"
            });

            _scheduler.RunOnce();
            index.MaximumWidth.Should().BeApproximately(85, 1);
            index.LineCount.Should().Be(1);
        }
        public void TestPartialInvalidate()
        {
            var logFile = new InMemoryLogFile();
            var index   = new PresentationLogFile(_scheduler, logFile, TimeSpan.Zero, TextSettings.Default);

            logFile.Add(new LogEntry2 {
                RawContent = "Foo"
            });
            _scheduler.RunOnce();
            index.MaximumWidth.Should().BeApproximately(19.8, 0.1);
            index.LineCount.Should().Be(1);

            logFile.Add(new LogEntry2 {
                RawContent = "Hello,\r\nWorld!"
            });
            _scheduler.RunOnce();
            index.MaximumWidth.Should().BeApproximately(46.2, 0.1);
            index.LineCount.Should().Be(3);

            logFile.RemoveFrom(1);
            _scheduler.RunOnce();
            index.MaximumWidth.Should().BeApproximately(19.8, 0.1);
            index.LineCount.Should().Be(1);
        }