protected TextTagEditSection() { // create list of text-tag text-box if bindable changed. TextTags.BindValueChanged(e => { Content.RemoveAll(x => x is LabelledTextTagTextBox); Content.AddRange(e.NewValue?.Select(x => { var relativeToLyricText = TextTagUtils.GetTextFromLyric(x, Lyric?.Text); var range = TextTagUtils.PositionFormattedString(x); return(new LabelledTextTagTextBox(x) { Label = relativeToLyricText, Description = range, OnDeleteButtonClick = () => { LyricUtils.RemoveTextTag(Lyric, x); }, TabbableContentContainer = this }); })); }); // add create button. AddCreateButton(); }
public void TestGetTextFromLyric(string textTag, string lyric, string actual) { var rubyTag = TestCaseTagHelper.ParseRubyTag(textTag); Assert.AreEqual(TextTagUtils.GetTextFromLyric(rubyTag, lyric), actual); }