public void AssFontEventsLast() { var text = @"[Script Info] ; test [Aegisub Project Garbage] Last Style Storage: Default [V4+ Styles] Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding Style: Segoe Script Red shadow alpha 160,Segoe Script,77,&H006EBAB4,&H0300FFFF,&H00000000,&HA00000FF,0,0,0,0,100,100,0,0,1,5,5,2,170,170,29,1 [Fonts] fontname: AGENCYR_0.TTF !!% [Events] Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text Dialogue: 0,0:00:01.80,0:00:04.93,Segoe Script Red shadow alpha 160,,0,0,0,,Die met de zuurstof\Ngezichtsbehandeling? Geweldig! Dialogue: 0,0:00:05.02,0:00:07.94,Segoe Script Red shadow alpha 160,,0,0,0,,Dit wordt de trip van ons leven."; var target = new AdvancedSubStationAlpha(); var subtitle = new Subtitle(); target.LoadSubtitle(subtitle, text.SplitToLines(), null); var output = new AdvancedSubStationAlpha().ToText(subtitle, string.Empty); Assert.IsTrue(output.Contains("[Events]")); Assert.AreEqual(2, subtitle.Paragraphs.Count); }
private string GetDefaultHeader() { SubtitleFormat format = new AdvancedSubStationAlpha(); var sub = new Subtitle(); string text = format.ToText(sub, string.Empty); var lines = text.SplitToLines(); format.LoadSubtitle(sub, lines, string.Empty); return(sub.Header.Trim()); }
public void AssSizeAndOtherTags() { var target = new AdvancedSubStationAlpha(); var subtitle = new Subtitle(); target.LoadSubtitle(subtitle, GetAssLines(@"{\fs20\pos(1,1)\blur5}Bla-bla-bla"), null); string actual = subtitle.Paragraphs[0].Text; const string expected = @"{\fs20\pos(1,1)\blur5}Bla-bla-bla"; 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 AssSimpleFontColor4() { var target = new AdvancedSubStationAlpha(); var subtitle = new Subtitle(); target.LoadSubtitle(subtitle, GetAssLines(@"{\c&HFFFFFF&}Font"), null); string actual = subtitle.Paragraphs[0].Text; const string expected = "<font color=\"#ffffff\">Font</font>"; Assert.AreEqual(expected, actual); }
public void AssSimpleFontNameMultiple() { var target = new AdvancedSubStationAlpha(); var subtitle = new Subtitle(); target.LoadSubtitle(subtitle, GetAssLines(@"{\fnArial}Font1{\fnTahoma}Font2"), null); string actual = subtitle.Paragraphs[0].Text; const string expected = "<font face=\"Arial\">Font1</font><font face=\"Tahoma\">Font2</font>"; Assert.AreEqual(expected, actual); }
public void AssFontNameWithSpace() { var target = new AdvancedSubStationAlpha(); var subtitle = new Subtitle(); target.LoadSubtitle(subtitle, GetAssLines(@"{\fnArial Bold}Font"), null); string actual = subtitle.Paragraphs[0].Text; const string expected = "<font face=\"Arial Bold\">Font</font>"; Assert.AreEqual(expected, actual); }
public void AssSimpleFontSizeMultiple() { var target = new AdvancedSubStationAlpha(); var subtitle = new Subtitle(); target.LoadSubtitle(subtitle, GetAssLines(@"{\fs1}T{\fs2}E{\fs3}S{\fs4}T"), null); string actual = subtitle.Paragraphs[0].Text; const string expected = "<font size=\"1\">T</font><font size=\"2\">E</font><font size=\"3\">S</font><font size=\"4\">T</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 AssSimpleBold() { var target = new AdvancedSubStationAlpha(); var subtitle = new Subtitle(); target.LoadSubtitle(subtitle, GetAssLines(@"{\b1}Bold{\b0}"), null); string actual = subtitle.Paragraphs[0].Text; const string expected = "<b>Bold</b>"; 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); }
public void AssSimpleFontSize() { var target = new AdvancedSubStationAlpha(); var subtitle = new Subtitle(); target.LoadSubtitle(subtitle, GetAssLines(@"{\fs28}Font"), null); string actual = subtitle.Paragraphs[0].Text; string expected = "<font size=\"28\">Font</font>"; Assert.AreEqual(expected, actual); }
private void ButtonRemoveAll_Click(object sender, EventArgs e) { this.listViewStyles.Items.Clear(); var sub = new Subtitle(); if (this.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); this.header = this.header.Remove(this.header.IndexOf("[V4 Styles]", StringComparison.Ordinal)) + sub.Header.Substring(sub.Header.IndexOf("[V4 Styles]", StringComparison.Ordinal)); } 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); this.header = this.header.Remove(this.header.IndexOf("[V4+ Styles]", StringComparison.Ordinal)) + sub.Header.Substring(sub.Header.IndexOf("[V4+ Styles]", StringComparison.Ordinal)); } this.InitializeListView(); }