private FailOnPartialLine ( int ichMin, int ichLim ) : void | ||
ichMin | int | |
ichLim | int | |
return | void |
/// <summary> /// Given three groups of words, sets up the mock engine so that the first line is a single segment consisting of the first three words of the first group; /// the second line contains the remaining word of the first group; then two words (in another WS) from the second group; /// the third line contains the rest of the second group; /// the last line contains the third group. /// For now it has some assumptions about the number of words in each group. Typically the correspond to the static variables with similar names. /// </summary> /// <param name="firstGroupWords"></param> /// <param name="secondGroupWords"></param> /// <param name="thirdGroupWords"></param> /// <param name="engine"></param> internal static void SetupMockEngineForThreeStringsPara(string[] firstGroupWords, string[] secondGroupWords, string[] thirdGroupWords, LayoutInfo layoutArgs) { string contents1 = AssembleStrings(firstGroupWords); string contents2 = AssembleStrings(secondGroupWords); string contents3 = AssembleStrings(thirdGroupWords); int totalLength = contents1.Length + contents2.Length + contents3.Length; var factory = (MockRendererFactory) layoutArgs.RendererFactory; var engine1 = new MockRenderEngine(); factory.SetRenderer(s_simpleStringWs, engine1); var engine2 = new MockRenderEngine(); factory.SetRenderer(s_secondGroupWs, engine2); int lenFirstSeg = SumStringLengths(s_simpleStringWords, 0, 3); engine1.AddMockSeg(0, contents1.Length, lenFirstSeg, s_widthFirstMockSeg, s_simpleStringWs, LgEndSegmentType.kestMoreLines); // Asked to break the rest of the first WS run we answer a segment with the last word, and indicate that we broke at a ws boundary. engine1.AddMockSeg(lenFirstSeg, contents1.Length, SumStringLengths(firstGroupWords, 3, 4), s_widthSecondLineFirstMockSeg, s_simpleStringWs, LgEndSegmentType.kestWsBreak); // Asked to break at the start of the second WS run we answer a segment with two more words (in the other writing system). This continues and completes the second line. engine2.AddMockSeg(contents1.Length, contents1.Length + contents2.Length, SumStringLengths(secondGroupWords, 0, 2), s_widthSecondLineSecondMockSeg, s_secondGroupWs, LgEndSegmentType.kestMoreLines); // Asked to break after that we answer a segment with the rest of the second string. This makes the third line. engine2.AddMockSeg(contents1.Length + SumStringLengths(secondGroupWords, 0, 2), contents1.Length + contents2.Length, SumStringLengths(secondGroupWords, 2, 5), s_widthThirdLineMockSeg, s_secondGroupWs, LgEndSegmentType.kestWsBreak); // Asked to put more on that third line, nothing fits. engine1.FailOnPartialLine(contents1.Length + contents2.Length, totalLength); // Asked to make a new (fourth) line, all the last string fits. engine1.AddMockSeg(contents1.Length + contents2.Length, totalLength, contents3.Length, s_widthFourthLineMockSeg, s_secondGroupWs, LgEndSegmentType.kestNoMore); }