procedure testGetSetText; var StrList: TTestMyStringList; begin StrList := TTestMyStringList.Create; try StrList.SetText(''); Check(0, StrList.Count); Check('', StrList.GetText); StrList.SetText(' '); Check(1, StrList.Count); Check(GetIndexString(StrList, 0), ' '); Check(' ', StrList.GetText); StrList.SetText('あいうえお'); Check(1, StrList.Count); Check(GetIndexString(StrList, 0), 'あいうえお'); Check('あいうえお', StrList.GetText); StrList.SetText('あいうえお'#13#10); Check(1, StrList.Count); Check(GetIndexString(StrList, 0), 'あいうえお'#13#10); Check('あいうえお'#13#10, StrList.GetText); StrList.SetText('あいうえお'#13#10'かきくけこ'); Check(2, StrList.Count); Check(GetIndexString(StrList, 0), 'あいうえお'#13#10); Check(GetIndexString(StrList, 1), 'かきくけこ'); Check('あいうえお'#13#10'かきくけこ', StrList.GetText); StrList.SetText('あいうえお'#13#10'かきくけこ'#13#10); Check(2, StrList.Count); Check(GetIndexString(StrList, 0), 'あいうえお'#13#10); Check(GetIndexString(StrList, 1), 'かきくけこ'#13#10); Check('あいうえお'#13#10'かきくけこ'#13#10, StrList.GetText); StrList.SetText('あいうえお'#13#10'かきくけこ'#13#10'さしすせそ'); Check(3, StrList.Count); Check(GetIndexString(StrList, 0), 'あいうえお'#13#10); Check(GetIndexString(StrList, 1), 'かきくけこ'#13#10); Check(GetIndexString(StrList, 2), 'さしすせそ'); Check('あいうえお'#13#10'かきくけこ'#13#10'さしすせそ', StrList.GetText); StrList.SetText(#13#10#13#10#13#10#13#10'あいうえお'#13#10#13#10); Check(6, StrList.Count); Check(GetIndexString(StrList, 0), #13#10); Check(GetIndexString(StrList, 1), #13#10); Check(GetIndexString(StrList, 2), #13#10); Check(GetIndexString(StrList, 3), #13#10); Check(GetIndexString(StrList, 4), 'あいうえお'#13#10); Check(GetIndexString(StrList, 5), #13#10); Check(#13#10#13#10#13#10#13#10'あいうえお'#13#10#13#10, StrList.GetText); StrList.SetText('あいうえお'#13); Check(1, StrList.Count); Check(GetIndexString(StrList, 0), 'あいうえお'#13); Check('あいうえお'#13, StrList.GetText); StrList.SetText('あいうえお'#13'かきくけこ'); Check(2, StrList.Count); Check(GetIndexString(StrList, 0), 'あいうえお'#13); Check(GetIndexString(StrList, 1), 'かきくけこ'); Check('あいうえお'#13'かきくけこ', StrList.GetText); StrList.SetText('あいうえお'#13'かきくけこ'#13); Check(2, StrList.Count); Check(GetIndexString(StrList, 0), 'あいうえお'#13); Check(GetIndexString(StrList, 1), 'かきくけこ'#13); Check('あいうえお'#13'かきくけこ'#13, StrList.GetText); StrList.SetText('あいうえお'#13'かきくけこ'#13'さしすせそ'); Check(3, StrList.Count); Check(GetIndexString(StrList, 0), 'あいうえお'#13); Check(GetIndexString(StrList, 1), 'かきくけこ'#13); Check(GetIndexString(StrList, 2), 'さしすせそ'); Check('あいうえお'#13'かきくけこ'#13'さしすせそ', StrList.GetText); StrList.SetText(#13#13#13#13'あいうえお'#13#13); Check(6, StrList.Count); Check(GetIndexString(StrList, 0), #13); Check(GetIndexString(StrList, 1), #13); Check(GetIndexString(StrList, 2), #13); Check(GetIndexString(StrList, 3), #13); Check(GetIndexString(StrList, 4), 'あいうえお'#13); Check(GetIndexString(StrList, 5), #13); Check(#13#13#13#13'あいうえお'#13#13, StrList.GetText); StrList.SetText('あいうえお'#10); Check(1, StrList.Count); Check(GetIndexString(StrList, 0), 'あいうえお'#10); Check('あいうえお'#10, StrList.GetText); StrList.SetText('あいうえお'#10'かきくけこ'); Check(2, StrList.Count); Check(GetIndexString(StrList, 0), 'あいうえお'#10); Check(GetIndexString(StrList, 1), 'かきくけこ'); Check('あいうえお'#10'かきくけこ', StrList.GetText); StrList.SetText('あいうえお'#10'かきくけこ'#10); Check(2, StrList.Count); Check(GetIndexString(StrList, 0), 'あいうえお'#10); Check(GetIndexString(StrList, 1), 'かきくけこ'#10); Check('あいうえお'#10'かきくけこ'#10, StrList.GetText); StrList.SetText('あいうえお'#10'かきくけこ'#10'さしすせそ'); Check(3, StrList.Count); Check(GetIndexString(StrList, 0), 'あいうえお'#10); Check(GetIndexString(StrList, 1), 'かきくけこ'#10); Check(GetIndexString(StrList, 2), 'さしすせそ'); Check('あいうえお'#10'かきくけこ'#10'さしすせそ', StrList.GetText); StrList.SetText(#10#10#10#10'あいうえお'#10#10); Check(6, StrList.Count); Check(GetIndexString(StrList, 0), #10); Check(GetIndexString(StrList, 1), #10); Check(GetIndexString(StrList, 2), #10); Check(GetIndexString(StrList, 3), #10); Check(GetIndexString(StrList, 4), 'あいうえお'#10); Check(GetIndexString(StrList, 5), #10); Check(#10#10#10#10'あいうえお'#10#10, StrList.GetText); StrList.SetText(StringOfChar(' ', 250)); Check(1, StrList.Count); Check(StringOfChar(' ', 250), StrList.GetText); StrList.SetText(StringOfChar(' ', 2500)); Check(1, StrList.Count); Check(StringOfChar(' ', 2500), StrList.GetText); //誤った仕様な気がする // StrList.SetDelimitedText('', ['']); // Check(0, StrList.Count); // Check('', StrList.GetText); // // StrList.SetDelimitedText(' ', ['']); // Check(1, StrList.Count); // Check(GetIndexString(StrList, 0), ' '); // Check(' ', StrList.GetText); // // StrList.SetDelimitedText(' ', [' ']); // Check(1, StrList.Count); // Check(GetIndexString(StrList, 0), ''); // Check('', StrList.GetText); case 2 of 1: begin //空文字を代入すると要素0になる仕様の場合 StrList.SetDelimitedText('', ['']); Check(0, StrList.Count); Check('', StrList.GetText); end; 2: begin //空文字を代入すると要素1で空文字を返す仕様の場合 StrList.SetDelimitedText('', ['']); Check(1, StrList.Count); Check(GetIndexString(StrList, 0), ''); Check('', StrList.GetText); end; end; StrList.SetDelimitedText(' ', ['']); Check(1, StrList.Count); Check(GetIndexString(StrList, 0), ' '); Check(' ', StrList.GetText); case 2 of 1: begin //空文字を代入すると要素0になる仕様の場合 StrList.SetDelimitedText('', [',']); Check(0, StrList.Count); Check('', StrList.GetText); end; 2: begin //空文字を代入すると要素1で空文字を返す仕様の場合 StrList.SetDelimitedText('', [',']); Check(1, StrList.Count); Check(GetIndexString(StrList, 0), ''); Check('', StrList.GetText); end; end; StrList.SetDelimitedText(',', [';']); Check(1, StrList.Count); Check(GetIndexString(StrList, 0), ','); Check(',', StrList.GetText); StrList.SetDelimitedText(',', [',']); Check(2, StrList.Count); Check(GetIndexString(StrList, 0), ''); Check(GetIndexString(StrList, 1), ''); Check('', StrList.GetText); StrList.SetDelimitedText('A,B', [',']); Check(2, StrList.Count); Check(GetIndexString(StrList, 0), 'A'); Check(GetIndexString(StrList, 1), 'B'); Check('AB', StrList.GetText); StrList.SetDelimitedText('A,,B', [',']); Check(3, StrList.Count); Check(GetIndexString(StrList, 0), 'A'); Check(GetIndexString(StrList, 1), ''); Check(GetIndexString(StrList, 2), 'B'); Check('AB', StrList.GetText); StrList.SetDelimitedText('A'#13#10#13#10'B', [#13#10]); Check(3, StrList.Count); Check(GetIndexString(StrList, 0), 'A'); Check(GetIndexString(StrList, 1), ''); Check(GetIndexString(StrList, 2), 'B'); Check('AB', StrList.GetText); StrList.SetDelimitedText('A'#13#10#13#13#10'B', [#13#10]); Check(3, StrList.Count); Check(GetIndexString(StrList, 0), 'A'); Check(GetIndexString(StrList, 1), #13); Check(GetIndexString(StrList, 2), 'B'); Check('A'#13'B', StrList.GetText); StrList.SetDelimitedText('A'#13#10#10#13#10'B', [#13#10]); Check(3, StrList.Count); Check(GetIndexString(StrList, 0), 'A'); Check(GetIndexString(StrList, 1), #10); Check(GetIndexString(StrList, 2), 'B'); Check('A'#10'B', StrList.GetText); StrList.SetDelimitedText('A'#13#10#13#10, [#13#10]); Check(3, StrList.Count); Check(GetIndexString(StrList, 0), 'A'); Check(GetIndexString(StrList, 1), ''); Check(GetIndexString(StrList, 2), ''); Check('A', StrList.GetText); StrList.SetDelimitedText('A,,', [',']); Check(3, StrList.Count); Check(GetIndexString(StrList, 0), 'A'); Check(GetIndexString(StrList, 1), ''); Check(GetIndexString(StrList, 2), ''); Check('A', StrList.GetText); StrList.SetDelimitedText(',,', [',']); Check(3, StrList.Count); Check(GetIndexString(StrList, 0), ''); Check(GetIndexString(StrList, 1), ''); Check(GetIndexString(StrList, 2), ''); Check('', StrList.GetText); StrList.SetDelimitedText('あいうえお', ['']); Check(1, StrList.Count); Check(GetIndexString(StrList, 0), 'あいうえお'); Check('あいうえお', StrList.GetText); StrList.SetDelimitedText('あいうえお', [' ']); Check(1, StrList.Count); Check(GetIndexString(StrList, 0), 'あいうえお'); Check('あいうえお', StrList.GetText); StrList.SetDelimitedText('あいうえお'#13#10, [#13#10]); Check(2, StrList.Count); Check(GetIndexString(StrList, 0), 'あいうえお'); Check(GetIndexString(StrList, 1), ''); Check('あいうえお', StrList.GetText); StrList.SetDelimitedText('あいうえお'#13#10'かきくけこ', [#13#10]); Check(2, StrList.Count); Check(GetIndexString(StrList, 0), 'あいうえお'); Check(GetIndexString(StrList, 1), 'かきくけこ'); Check('あいうえおかきくけこ', StrList.GetText); // StrList.SetDelimitedText('あいうえお'#13#10'かきくけこ'#13#10); // Check(2, StrList.Count); // Check(GetIndexString(StrList, 0), 'あいうえお'#13#10); // Check(GetIndexString(StrList, 1), 'かきくけこ'#13#10); // Check('あいうえお'#13#10'かきくけこ'#13#10, StrList.GetText); // // StrList.SetDelimitedText('あいうえお'#13#10'かきくけこ'#13#10'さしすせそ'); // Check(3, StrList.Count); // Check(GetIndexString(StrList, 0), 'あいうえお'#13#10); // Check(GetIndexString(StrList, 1), 'かきくけこ'#13#10); // Check(GetIndexString(StrList, 2), 'さしすせそ'); // Check('あいうえお'#13#10'かきくけこ'#13#10'さしすせそ', StrList.GetText); // // StrList.SetDelimitedText(#13#10#13#10#13#10#13#10'あいうえお'#13#10#13#10); // Check(6, StrList.Count); // Check(GetIndexString(StrList, 0), #13#10); // Check(GetIndexString(StrList, 1), #13#10); // Check(GetIndexString(StrList, 2), #13#10); // Check(GetIndexString(StrList, 3), #13#10); // Check(GetIndexString(StrList, 4), 'あいうえお'#13#10); // Check(GetIndexString(StrList, 5), #13#10); // Check(#13#10#13#10#13#10#13#10'あいうえお'#13#10#13#10, StrList.GetText); // // StrList.SetDelimitedText('あいうえお'#13); // Check(1, StrList.Count); // Check(GetIndexString(StrList, 0), 'あいうえお'#13); // Check('あいうえお'#13, StrList.GetText); // // StrList.SetDelimitedText('あいうえお'#13'かきくけこ'); // Check(2, StrList.Count); // Check(GetIndexString(StrList, 0), 'あいうえお'#13); // Check(GetIndexString(StrList, 1), 'かきくけこ'); // Check('あいうえお'#13'かきくけこ', StrList.GetText); // // StrList.SetDelimitedText('あいうえお'#13'かきくけこ'#13); // Check(2, StrList.Count); // Check(GetIndexString(StrList, 0), 'あいうえお'#13); // Check(GetIndexString(StrList, 1), 'かきくけこ'#13); // Check('あいうえお'#13'かきくけこ'#13, StrList.GetText); // // StrList.SetDelimitedText('あいうえお'#13'かきくけこ'#13'さしすせそ'); // Check(3, StrList.Count); // Check(GetIndexString(StrList, 0), 'あいうえお'#13); // Check(GetIndexString(StrList, 1), 'かきくけこ'#13); // Check(GetIndexString(StrList, 2), 'さしすせそ'); // Check('あいうえお'#13'かきくけこ'#13'さしすせそ', StrList.GetText); // // StrList.SetDelimitedText(#13#13#13#13'あいうえお'#13#13); // Check(6, StrList.Count); // Check(GetIndexString(StrList, 0), #13); // Check(GetIndexString(StrList, 1), #13); // Check(GetIndexString(StrList, 2), #13); // Check(GetIndexString(StrList, 3), #13); // Check(GetIndexString(StrList, 4), 'あいうえお'#13); // Check(GetIndexString(StrList, 5), #13); // Check(#13#13#13#13'あいうえお'#13#13, StrList.GetText); // // StrList.SetDelimitedText('あいうえお'#10); // Check(1, StrList.Count); // Check(GetIndexString(StrList, 0), 'あいうえお'#10); // Check('あいうえお'#10, StrList.GetText); // // StrList.SetDelimitedText('あいうえお'#10'かきくけこ'); // Check(2, StrList.Count); // Check(GetIndexString(StrList, 0), 'あいうえお'#10); // Check(GetIndexString(StrList, 1), 'かきくけこ'); // Check('あいうえお'#10'かきくけこ', StrList.GetText); // // StrList.SetDelimitedText('あいうえお'#10'かきくけこ'#10); // Check(2, StrList.Count); // Check(GetIndexString(StrList, 0), 'あいうえお'#10); // Check(GetIndexString(StrList, 1), 'かきくけこ'#10); // Check('あいうえお'#10'かきくけこ'#10, StrList.GetText); // // StrList.SetDelimitedText('あいうえお'#10'かきくけこ'#10'さしすせそ'); // Check(3, StrList.Count); // Check(GetIndexString(StrList, 0), 'あいうえお'#10); // Check(GetIndexString(StrList, 1), 'かきくけこ'#10); // Check(GetIndexString(StrList, 2), 'さしすせそ'); // Check('あいうえお'#10'かきくけこ'#10'さしすせそ', StrList.GetText); // // StrList.SetDelimitedText(#10#10#10#10'あいうえお'#10#10); // Check(6, StrList.Count); // Check(GetIndexString(StrList, 0), #10); // Check(GetIndexString(StrList, 1), #10); // Check(GetIndexString(StrList, 2), #10); // Check(GetIndexString(StrList, 3), #10); // Check(GetIndexString(StrList, 4), 'あいうえお'#10); // Check(GetIndexString(StrList, 5), #10); // Check(#10#10#10#10'あいうえお'#10#10, StrList.GetText); StrList.SetDelimitedText(StringOfChar(' ', 250), ['']); Check(1, StrList.Count); Check(StringOfChar(' ', 250), StrList.GetText); StrList.SetDelimitedText(StringOfChar(' ', 250), [' ']); Check(251, StrList.Count); Check('', StrList.GetText); StrList.SetDelimitedText(StringOfChar(' ', 250), ['', ' ']); Check(251, StrList.Count); Check('', StrList.GetText); StrList.SetDelimitedText(StringOfChar(' ', 250), [' ', '']); Check(251, StrList.Count); Check('', StrList.GetText); StrList.SetDelimitedText(StringOfChar(' ', 250), [' ', ',', ';']); Check(251, StrList.Count); Check('', StrList.GetText); StrList.SetDelimitedText(StringOfChar(' ', 250), [',', ';']); Check(1, StrList.Count); Check(StringOfChar(' ', 250), StrList.GetText); finally StrList.Free; end; end;