Example #1
0
        public void SplitLongLinesInSubtitleTest()
        {
            var procSubtitle = SplitLongLinesHelper.SplitLongLinesInSubtitle(_subtitle, _maxLineLength * 2, _maxLineLength);

            Assert.AreEqual("We have never been to Asia,\r\nnor have we visited Africa.", procSubtitle.Paragraphs[0].Text);
            Assert.AreEqual("We have never been to Asia,\r\nnor have we visited Africa.", procSubtitle.Paragraphs[1].Text);
            Assert.AreEqual(_subtitle.Paragraphs[2].Text, procSubtitle.Paragraphs[2].Text);

            Assert.AreNotEqual(_subtitle.Paragraphs.Count, procSubtitle.Paragraphs.Count);

            // too long (dialog)
            Assert.AreEqual(Utilities.AutoBreakLine("Sometimes, all you need to do is completely make an ass?", "en"), procSubtitle.Paragraphs[3].Text);
            Assert.AreEqual(Utilities.AutoBreakLine("Of yourself and laugh it off to realise that life isn’t so bad after all.", "en"), procSubtitle.Paragraphs[4].Text);

            // too long
            Assert.AreEqual("Sometimes, all you need to do is\r\ncompletely make an ass of yourself", procSubtitle.Paragraphs[5].Text);
            Assert.AreEqual("and laugh it off to realise that\r\nlife isn’t so bad after all.", procSubtitle.Paragraphs[6].Text);

            // timing test
            if (procSubtitle.Paragraphs[5].Duration.TotalMilliseconds > procSubtitle.Paragraphs[6].Duration.TotalMilliseconds)
            {
                Assert.IsTrue(procSubtitle.Paragraphs[5].Text.Length > procSubtitle.Paragraphs[6].Text.Length);
            }
            if (procSubtitle.Paragraphs[5].Duration.TotalMilliseconds < procSubtitle.Paragraphs[6].Duration.TotalMilliseconds)
            {
                Assert.IsTrue(procSubtitle.Paragraphs[5].Text.Length < procSubtitle.Paragraphs[6].Text.Length);
            }
        }
Example #2
0
        public void SplitLongLinesInSubtitleTest2()
        {
            Configuration.Settings.Tools.AutoBreakUsePixelWidth = false;
            var sub = new Subtitle();

            sub.Paragraphs.Add(new Paragraph("Hi Joes, how are you feeling after the match yesterday?" + Environment.NewLine + "I know you must be pretty smashed up.", 0, 5000));
            var procSubtitle = SplitLongLinesHelper.SplitLongLinesInSubtitle(sub, _maxLineLength * 2, _maxLineLength);

            Assert.AreEqual("Hi Joes, how are you feeling" + Environment.NewLine + "after the match yesterday?", procSubtitle.Paragraphs[0].Text);
            Assert.AreEqual("I know you must be" + Environment.NewLine + "pretty smashed up.", procSubtitle.Paragraphs[1].Text);
        }