public void AssSimpleFontColor1()
 {
     var target = new AdvancedSubStationAlpha();
     var subtitle = new Subtitle();
     target.LoadSubtitle(subtitle, GetAssLines(@"{\c&HFF&}Font"), null);
     string actual = subtitle.Paragraphs[0].Text;
     string expected = "<font color=\"#ff0000\">Font</font>";
     Assert.AreEqual(expected, actual);
 }
 public void AssSimpleBold()
 {
     var target = new AdvancedSubStationAlpha();
     var subtitle = new Subtitle();
     target.LoadSubtitle(subtitle, GetAssLines(@"{\b1}Bold{\b0}"), null);
     string actual = subtitle.Paragraphs[0].Text;
     string expected = "<b>Bold</b>";
     Assert.AreEqual(expected, actual);
 }
 public void AssFontNameAndSize()
 {
     var target = new AdvancedSubStationAlpha();
     var subtitle = new Subtitle();
     target.LoadSubtitle(subtitle, GetAssLines(@"{\fnViner Hand ITC\fs28}Testing"), null);
     string actual = subtitle.Paragraphs[0].Text;
     const string expected = "<font face=\"Viner Hand ITC\" size=\"28\">Testing</font>";
     Assert.AreEqual(expected, actual);
 }
 public void AssSimpleFontColorAndItalic()
 {
     var target = new AdvancedSubStationAlpha();
     var subtitle = new Subtitle();
     target.LoadSubtitle(subtitle, GetAssLines(@"{\1c&HFFFF00&\i1}CYAN{\i0}"), null);
     string actual = subtitle.Paragraphs[0].Text;
     const string expected = "<font color=\"#00ffff\"><i>CYAN</i></font>";
     Assert.AreEqual(expected, actual);
 }
 public void AssSimpleFontName()
 {
     var target = new AdvancedSubStationAlpha();
     var subtitle = new Subtitle();
     target.LoadSubtitle(subtitle, GetAssLines(@"{\fnArial}Font"), null);
     string actual = subtitle.Paragraphs[0].Text;
     const string expected = "<font face=\"Arial\">Font</font>";
     Assert.AreEqual(expected, actual);
 }
 public void AssSimpleUnderline()
 {
     var target = new AdvancedSubStationAlpha();
     var subtitle = new Subtitle();
     target.LoadSubtitle(subtitle, GetAssLines(@"{\u1}Underline{\u0}"), null);
     string actual = subtitle.Paragraphs[0].Text;
     const string expected = "<u>Underline</u>";
     Assert.AreEqual(expected, actual);
 }
 public void AssSimpleItalic()
 {
     var target = new AdvancedSubStationAlpha();
     var subtitle = new Subtitle();
     target.LoadSubtitle(subtitle, GetAssLines(@"{\i1}Italic{\i0}"), null);
     string actual = subtitle.Paragraphs[0].Text;
     const string expected = "<i>Italic</i>";
     Assert.AreEqual(expected, actual);
 }
Пример #8
0
 private void buttonRemoveAll_Click(object sender, EventArgs e)
 {
     listViewStyles.Items.Clear();
     var sub = new Subtitle();
     if (_isSubStationAlpha)
     {
         var ssa = new SubStationAlpha();
         string text = ssa.ToText(sub, string.Empty);
         string[] lineArray = text.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
         var lines = new List<string>();
         foreach (string line in lineArray)
             lines.Add(line);
         ssa.LoadSubtitle(sub, lines, string.Empty);
         Header = Header.Remove(Header.IndexOf("[V4 Styles]")) + sub.Header.Substring(sub.Header.IndexOf("[V4 Styles]"));
     }
     else
     {
         var ass = new AdvancedSubStationAlpha();
         string text = ass.ToText(sub, string.Empty);
         string[] lineArray = text.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
         var lines = new List<string>();
         foreach (string line in lineArray)
             lines.Add(line);
         ass.LoadSubtitle(sub, lines, string.Empty);
         Header = Header.Remove(Header.IndexOf("[V4+ Styles]")) + sub.Header.Substring(sub.Header.IndexOf("[V4+ Styles]"));
     }
     InitializeListView();
 }