|
|
@ -1061,26 +1061,26 @@ protected static function SubTest_ChangeFormattingRegular() |
|
|
|
Issue("Formatting is not changed correctly."); |
|
|
|
Issue("Formatting is not changed correctly."); |
|
|
|
template = __().text.FromFormattedString( |
|
|
|
template = __().text.FromFormattedString( |
|
|
|
"Normal part, {#ff0000 red part}, {#00ff00 green part}!!!"); |
|
|
|
"Normal part, {#ff0000 red part}, {#00ff00 green part}!!!"); |
|
|
|
testText = template.MutableCopy().ChangeFormatting(3, 4, greenFormatting); |
|
|
|
testText = template.MutableCopy().ChangeFormatting(greenFormatting, 3, 4); |
|
|
|
TEST_ExpectTrue(testText.ToFormattedString() == |
|
|
|
TEST_ExpectTrue(testText.ToFormattedString() == |
|
|
|
("Nor{rgb(0,255,0) mal }part, {rgb(255,0,0) red part}, {rgb(0,255,0)" |
|
|
|
("Nor{rgb(0,255,0) mal }part, {rgb(255,0,0) red part}, {rgb(0,255,0)" |
|
|
|
@ "green part}!!!")); |
|
|
|
@ "green part}!!!")); |
|
|
|
testText = template.MutableCopy().ChangeFormatting(12, 10, greenFormatting); |
|
|
|
testText = template.MutableCopy().ChangeFormatting(greenFormatting, 12, 10); |
|
|
|
TEST_ExpectTrue(testText.ToFormattedString() == |
|
|
|
TEST_ExpectTrue(testText.ToFormattedString() == |
|
|
|
"Normal part,{rgb(0,255,0) red part,} {rgb(0,255,0) green part}!!!"); |
|
|
|
"Normal part,{rgb(0,255,0) red part,} {rgb(0,255,0) green part}!!!"); |
|
|
|
testText = template.MutableCopy().ChangeFormatting(12, 11, greenFormatting); |
|
|
|
testText = template.MutableCopy().ChangeFormatting(greenFormatting, 12, 11); |
|
|
|
TEST_ExpectTrue(testText.ToFormattedString() == |
|
|
|
TEST_ExpectTrue(testText.ToFormattedString() == |
|
|
|
"Normal part,{rgb(0,255,0) red part, green part}!!!"); |
|
|
|
"Normal part,{rgb(0,255,0) red part, green part}!!!"); |
|
|
|
// This test was added because it produced `none` access errors in the |
|
|
|
// This test was added because it produced `none` access errors in the |
|
|
|
// old implementation of `ChangeFormatting()` |
|
|
|
// old implementation of `ChangeFormatting()` |
|
|
|
testText = template.MutableCopy().ChangeFormatting(0, 35, greenFormatting); |
|
|
|
testText = template.MutableCopy().ChangeFormatting(greenFormatting, 0, 35); |
|
|
|
TEST_ExpectTrue(testText.ToFormattedString() == |
|
|
|
TEST_ExpectTrue(testText.ToFormattedString() == |
|
|
|
"{rgb(0,255,0) Normal part, red part, green part!!}!"); |
|
|
|
"{rgb(0,255,0) Normal part, red part, green part!!}!"); |
|
|
|
testText = template.MutableCopy().ChangeFormatting(3, 4, defaultFormatting); |
|
|
|
testText = template.MutableCopy().ChangeFormatting(defaultFormatting, 3, 4); |
|
|
|
TEST_ExpectTrue(testText.ToFormattedString() == |
|
|
|
TEST_ExpectTrue(testText.ToFormattedString() == |
|
|
|
"Normal part, {rgb(255,0,0) red part}, {rgb(0,255,0) green part}!!!"); |
|
|
|
"Normal part, {rgb(255,0,0) red part}, {rgb(0,255,0) green part}!!!"); |
|
|
|
testText = template.MutableCopy() |
|
|
|
testText = template.MutableCopy() |
|
|
|
.ChangeFormatting(16, 13, defaultFormatting); |
|
|
|
.ChangeFormatting(defaultFormatting, 16, 13); |
|
|
|
TEST_ExpectTrue(testText.ToFormattedString() == |
|
|
|
TEST_ExpectTrue(testText.ToFormattedString() == |
|
|
|
"Normal part, {rgb(255,0,0) red} part, green {rgb(0,255,0) part}!!!"); |
|
|
|
"Normal part, {rgb(255,0,0) red} part, green {rgb(0,255,0) part}!!!"); |
|
|
|
} |
|
|
|
} |
|
|
@ -1095,19 +1095,19 @@ protected static function SubTest_ChangeFormattingEdgeCases() |
|
|
|
@ "near index boundaries."); |
|
|
|
@ "near index boundaries."); |
|
|
|
template = __().text.FromFormattedString( |
|
|
|
template = __().text.FromFormattedString( |
|
|
|
"Normal part, {#ff0000 red part}, {#00ff00 green part}!!!"); |
|
|
|
"Normal part, {#ff0000 red part}, {#00ff00 green part}!!!"); |
|
|
|
testText = template.MutableCopy().ChangeFormatting(33, 3, greenFormatting); |
|
|
|
testText = template.MutableCopy().ChangeFormatting(greenFormatting, 33, 3); |
|
|
|
TEST_ExpectTrue(testText.ToFormattedString() == |
|
|
|
TEST_ExpectTrue(testText.ToFormattedString() == |
|
|
|
"Normal part, {rgb(255,0,0) red part}, {rgb(0,255,0) green part!!!}"); |
|
|
|
"Normal part, {rgb(255,0,0) red part}, {rgb(0,255,0) green part!!!}"); |
|
|
|
testText = template.MutableCopy().ChangeFormatting(36, 5, greenFormatting); |
|
|
|
testText = template.MutableCopy().ChangeFormatting(greenFormatting, 36, 5); |
|
|
|
TEST_ExpectTrue(testText.ToFormattedString() == |
|
|
|
TEST_ExpectTrue(testText.ToFormattedString() == |
|
|
|
"Normal part, {rgb(255,0,0) red part}, {rgb(0,255,0) green part}!!!"); |
|
|
|
"Normal part, {rgb(255,0,0) red part}, {rgb(0,255,0) green part}!!!"); |
|
|
|
|
|
|
|
|
|
|
|
testText = template.MutableCopy() |
|
|
|
testText = template.MutableCopy() |
|
|
|
.ChangeFormatting(-10, 100, defaultFormatting); |
|
|
|
.ChangeFormatting(defaultFormatting, -10, 100); |
|
|
|
TEST_ExpectTrue(testText.ToFormattedString() == |
|
|
|
TEST_ExpectTrue(testText.ToFormattedString() == |
|
|
|
"Normal part, red part, green part!!!"); |
|
|
|
"Normal part, red part, green part!!!"); |
|
|
|
testText = template.MutableCopy() |
|
|
|
testText = template.MutableCopy() |
|
|
|
.ChangeFormatting(-10, 16, greenFormatting); |
|
|
|
.ChangeFormatting(greenFormatting, -10, 16); |
|
|
|
TEST_ExpectTrue(testText.ToFormattedString() == |
|
|
|
TEST_ExpectTrue(testText.ToFormattedString() == |
|
|
|
("{rgb(0,255,0) Normal} part, {rgb(255,0,0) red part}, {rgb(0,255,0)" |
|
|
|
("{rgb(0,255,0) Normal} part, {rgb(255,0,0) red part}, {rgb(0,255,0)" |
|
|
|
@ "green part}!!!")); |
|
|
|
@ "green part}!!!")); |
|
|
|