Exemplo n.º 1
0
        public void CalcEntryIndexTestOob()
        {
            var testRuler = new Rule() { EndValue = 575, StartValue = 775 };
            var testEntry = new Entry()
                            {
                                Text = "XXII Dyn. 935-725",
                                StartValue = 935,
                                EndValue = 725,
                                Ruler = testRuler,
                                Location = PrintLocation.Left
                            };
            System.Diagnostics.Debug.WriteLine(testEntry);
            System.Diagnostics.Debug.WriteLine(testEntry.CalcHeight());
            var testResult = testRuler.CalcEntryIndex(testEntry);

            Assert.AreNotEqual(-1, testResult.Item1);
            Assert.AreNotEqual(-1, testResult.Item2);

            System.Diagnostics.Debug.WriteLine("Start Index '{0}', End Index '{1}'", testResult.Item1, testResult.Item2);
        }
Exemplo n.º 2
0
        public void MergeToTextCanvasTest()
        {
            var testRuler = new NoFuture.Timeline.Rule() { EndValue = 25, StartValue = 90 };
            var testSubjectA = new NoFuture.Timeline.Entry
                               {
                                   Ruler = testRuler,
                                   StartValue = 73,
                                   EndValue = 71,
                                   Text = "Slave revolt led by Spartacus"
                               };

            var testSubjectB = new NoFuture.Timeline.Entry
                               {
                                   Ruler = testRuler,
                                   StartValue = 74,
                                   EndValue = 27,
                                   Text = "Collapse of Republic",
                                   Location = PrintLocation.Left
                               };

            var testResult = testSubjectA.ToTextCanvas(testRuler).Merge(testSubjectB.ToTextCanvas(testRuler), testRuler);
            Assert.IsNotNull(testResult);

            System.Diagnostics.Debug.WriteLine(testResult);
        }
Exemplo n.º 3
0
        public void PrintEntriesToCanvasTest()
        {
            var testRuler = new Rule() { EndValue = 575, StartValue = 775 };
            var testBlock1 = new Block() { EndValue = 575, StartValue = 775, Title = "Judah", Ruler = testRuler };

            var testEntry1 = new Entry()
                             {
                                 EndValue = 687,
                                 StartValue = 732,
                                 Ruler = testRuler,
                                 Text = "(Isaiah)",
                                 Location = PrintLocation.Center
                             };
            var testEntry2 = new Entry()
                             {
                                 EndValue = 702,
                                 StartValue = 733,
                                 Ruler = testRuler,
                                 Text = "(Micah)",
                                 Location = PrintLocation.Right
                             };

            var testEntry3 = new Entry() {EndValue = 735, StartValue = 735, Ruler = testRuler, Text = "Ahaz 735-715"};
            var testEntry4 = new Entry()
                             {
                                 EndValue = 715,
                                 StartValue = 715,
                                 Ruler = testRuler,
                                 Text = "Hezekiah 715-687"
                             };

            testBlock1.AddEntry(testEntry1);
            testBlock1.AddEntry(testEntry2);
            testBlock1.AddEntry(testEntry3);
            testBlock1.AddEntry(testEntry4);
            var testResult = testBlock1.PrintEntriesOnCanvas();

            Assert.IsNotNull(testResult);

            System.Diagnostics.Debug.WriteLine(testResult);
        }
Exemplo n.º 4
0
        public void MergeBlockToEntryTest()
        {
            var testRuler = new NoFuture.Timeline.Rule() { EndValue = 20, StartValue = 90 };
            var testSubjectB = new NoFuture.Timeline.Block()
            {
                EmptyChar = '.',
                EndValue = 26,
                Ruler = testRuler,
                StartValue = 90,
                Title = "Roman Republic"
            };

            var testSubjectA = new NoFuture.Timeline.Entry {Ruler = testRuler, Text = "Ceaser assassinated", StartValue = 44, EndValue = 44};

            var testResult = testSubjectA.ToTextCanvas(testRuler).Merge(testSubjectB.ToTextCanvas(testRuler), testRuler);

            System.Diagnostics.Debug.WriteLine(testResult);
        }
Exemplo n.º 5
0
        public void EntryPrintTest()
        {
            var testSubject = new NoFuture.Timeline.Entry();

            testSubject.Text = "Slave revolt led by Spartacus";

            var testResult = testSubject.ToString();

            System.Diagnostics.Debug.WriteLine(testResult);

            Assert.IsNotNull(testResult);

            testSubject.Location = PrintLocation.Left;
            testResult = testSubject.ToString();

            System.Diagnostics.Debug.WriteLine(testResult);
            Assert.IsNotNull(testResult);

            testSubject.Location = PrintLocation.Right;
            testResult = testSubject.ToString();

            System.Diagnostics.Debug.WriteLine(testResult);
            Assert.IsNotNull(testResult);

            testSubject.Text = "Late Republic";
            testSubject._height = 8;

            testResult = testSubject.ToString();

            System.Diagnostics.Debug.WriteLine(testResult);

            Assert.IsNotNull(testResult);

            testSubject.Location = PrintLocation.Left;
            testResult = testSubject.ToString();

            System.Diagnostics.Debug.WriteLine(testResult);
            Assert.IsNotNull(testResult);

            testSubject.Location = PrintLocation.Right;
            testResult = testSubject.ToString();

            System.Diagnostics.Debug.WriteLine(testResult);
            Assert.IsNotNull(testResult);
        }
Exemplo n.º 6
0
        public void ToTextCanvasTest()
        {
            var testD00 = new NoFuture.Timeline.Rule() { EndValue = 750, StartValue = 950 };
            var testSubject = new NoFuture.Timeline.Entry();
            testSubject.Ruler = testD00;
            testSubject.StartValue = 902;
            testSubject.EndValue = 845;
            testSubject.Text = "Late Republic";

            var testResult = testSubject.ToTextCanvas(testSubject.Ruler);

            Assert.IsNotNull(testResult);
            Assert.IsNotNull(testResult.Items);
            Assert.AreNotEqual(0, testResult.Items.Count);

            foreach (var item in testResult.Items)
            {
                var text = new string(item.Text.ToArray());
                var index = item.Index;
                var hashMark = item.HashMarkValue;

                System.Diagnostics.Debug.WriteLine("[{0}] - [{1,-18}] '{2}'",index, hashMark,text);
            }
        }
Exemplo n.º 7
0
        public void EntryCalcHeightTest()
        {
            var testD00 = new NoFuture.Timeline.Rule() { EndValue = 750, StartValue = 950 };
            var testSubject = new NoFuture.Timeline.Entry();
            testSubject.Ruler = testD00;
            testSubject.StartValue = 902;
            testSubject.EndValue = 845;

            var testCtrl = testD00.CalcEntryIndex(testSubject);
            System.Diagnostics.Debug.WriteLine("Start Index '{0}', End Index '{1}'", testCtrl.Item1, testCtrl.Item2);

            var testResult = testSubject.CalcHeight();
            Assert.AreNotEqual(0, testResult);

            System.Diagnostics.Debug.WriteLine("Test result calc height '{0}'",testResult);
        }
Exemplo n.º 8
0
        public virtual void AddEntry(Entry entry)
        {
            entry.Ruler = Ruler;
            entry.Width = Width;
            _entries.Add(entry);

            var reqW = GetRequiredWidth();
            if (Width < reqW)
                Width = reqW;
        }