|
|
|
|
@@ -1234,6 +1234,16 @@ TEST(TextInputModel, MoveCursorToBeginningStart) {
|
|
|
|
|
EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(TextInputModel, SelectToBeginningStart) {
|
|
|
|
|
auto model = std::make_unique<TextInputModel>();
|
|
|
|
|
model->SetText("ABCDE");
|
|
|
|
|
EXPECT_TRUE(model->SetSelection(TextRange(0)));
|
|
|
|
|
EXPECT_FALSE(model->SelectToBeginning());
|
|
|
|
|
EXPECT_EQ(model->selection(), TextRange(0));
|
|
|
|
|
EXPECT_EQ(model->composing_range(), TextRange(0));
|
|
|
|
|
EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(TextInputModel, MoveCursorToBeginningMiddle) {
|
|
|
|
|
auto model = std::make_unique<TextInputModel>();
|
|
|
|
|
model->SetText("ABCDE");
|
|
|
|
|
@@ -1244,6 +1254,16 @@ TEST(TextInputModel, MoveCursorToBeginningMiddle) {
|
|
|
|
|
EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(TextInputModel, SelectToBeginningMiddle) {
|
|
|
|
|
auto model = std::make_unique<TextInputModel>();
|
|
|
|
|
model->SetText("ABCDE");
|
|
|
|
|
EXPECT_TRUE(model->SetSelection(TextRange(2)));
|
|
|
|
|
EXPECT_TRUE(model->SelectToBeginning());
|
|
|
|
|
EXPECT_EQ(model->selection(), TextRange(2, 0));
|
|
|
|
|
EXPECT_EQ(model->composing_range(), TextRange(0));
|
|
|
|
|
EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(TextInputModel, MoveCursorToBeginningEnd) {
|
|
|
|
|
auto model = std::make_unique<TextInputModel>();
|
|
|
|
|
model->SetText("ABCDE");
|
|
|
|
|
@@ -1254,6 +1274,16 @@ TEST(TextInputModel, MoveCursorToBeginningEnd) {
|
|
|
|
|
EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(TextInputModel, SelectToBeginningEnd) {
|
|
|
|
|
auto model = std::make_unique<TextInputModel>();
|
|
|
|
|
model->SetText("ABCDE");
|
|
|
|
|
EXPECT_TRUE(model->SetSelection(TextRange(5)));
|
|
|
|
|
EXPECT_TRUE(model->SelectToBeginning());
|
|
|
|
|
EXPECT_EQ(model->selection(), TextRange(5, 0));
|
|
|
|
|
EXPECT_EQ(model->composing_range(), TextRange(0));
|
|
|
|
|
EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(TextInputModel, MoveCursorToBeginningSelection) {
|
|
|
|
|
auto model = std::make_unique<TextInputModel>();
|
|
|
|
|
model->SetText("ABCDE");
|
|
|
|
|
@@ -1264,6 +1294,16 @@ TEST(TextInputModel, MoveCursorToBeginningSelection) {
|
|
|
|
|
EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(TextInputModel, SelectToBeginningSelection) {
|
|
|
|
|
auto model = std::make_unique<TextInputModel>();
|
|
|
|
|
model->SetText("ABCDE");
|
|
|
|
|
EXPECT_TRUE(model->SetSelection(TextRange(1, 4)));
|
|
|
|
|
EXPECT_TRUE(model->SelectToBeginning());
|
|
|
|
|
EXPECT_EQ(model->selection(), TextRange(1, 0));
|
|
|
|
|
EXPECT_EQ(model->composing_range(), TextRange(0));
|
|
|
|
|
EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(TextInputModel, MoveCursorToBeginningReverseSelection) {
|
|
|
|
|
auto model = std::make_unique<TextInputModel>();
|
|
|
|
|
model->SetText("ABCDE");
|
|
|
|
|
@@ -1274,6 +1314,16 @@ TEST(TextInputModel, MoveCursorToBeginningReverseSelection) {
|
|
|
|
|
EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(TextInputModel, SelectToBeginningReverseSelection) {
|
|
|
|
|
auto model = std::make_unique<TextInputModel>();
|
|
|
|
|
model->SetText("ABCDE");
|
|
|
|
|
EXPECT_TRUE(model->SetSelection(TextRange(4, 1)));
|
|
|
|
|
EXPECT_TRUE(model->SelectToBeginning());
|
|
|
|
|
EXPECT_EQ(model->selection(), TextRange(4, 0));
|
|
|
|
|
EXPECT_EQ(model->composing_range(), TextRange(0));
|
|
|
|
|
EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(TextInputModel, MoveCursorToBeginningStartComposing) {
|
|
|
|
|
auto model = std::make_unique<TextInputModel>();
|
|
|
|
|
model->SetText("ABCDE");
|
|
|
|
|
@@ -1285,6 +1335,17 @@ TEST(TextInputModel, MoveCursorToBeginningStartComposing) {
|
|
|
|
|
EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(TextInputModel, SelectToBeginningStartComposing) {
|
|
|
|
|
auto model = std::make_unique<TextInputModel>();
|
|
|
|
|
model->SetText("ABCDE");
|
|
|
|
|
model->BeginComposing();
|
|
|
|
|
EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 0));
|
|
|
|
|
EXPECT_FALSE(model->SelectToBeginning());
|
|
|
|
|
EXPECT_EQ(model->selection(), TextRange(1));
|
|
|
|
|
EXPECT_EQ(model->composing_range(), TextRange(1, 4));
|
|
|
|
|
EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(TextInputModel, MoveCursorToBeginningStartReverseComposing) {
|
|
|
|
|
auto model = std::make_unique<TextInputModel>();
|
|
|
|
|
model->SetText("ABCDE");
|
|
|
|
|
@@ -1296,6 +1357,17 @@ TEST(TextInputModel, MoveCursorToBeginningStartReverseComposing) {
|
|
|
|
|
EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(TextInputModel, SelectToBeginningStartReverseComposing) {
|
|
|
|
|
auto model = std::make_unique<TextInputModel>();
|
|
|
|
|
model->SetText("ABCDE");
|
|
|
|
|
model->BeginComposing();
|
|
|
|
|
EXPECT_TRUE(model->SetComposingRange(TextRange(4, 1), 0));
|
|
|
|
|
EXPECT_FALSE(model->SelectToBeginning());
|
|
|
|
|
EXPECT_EQ(model->selection(), TextRange(1));
|
|
|
|
|
EXPECT_EQ(model->composing_range(), TextRange(4, 1));
|
|
|
|
|
EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(TextInputModel, MoveCursorToBeginningMiddleComposing) {
|
|
|
|
|
auto model = std::make_unique<TextInputModel>();
|
|
|
|
|
model->SetText("ABCDE");
|
|
|
|
|
@@ -1307,6 +1379,17 @@ TEST(TextInputModel, MoveCursorToBeginningMiddleComposing) {
|
|
|
|
|
EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(TextInputModel, SelectToBeginningMiddleComposing) {
|
|
|
|
|
auto model = std::make_unique<TextInputModel>();
|
|
|
|
|
model->SetText("ABCDE");
|
|
|
|
|
model->BeginComposing();
|
|
|
|
|
EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 1));
|
|
|
|
|
EXPECT_TRUE(model->SelectToBeginning());
|
|
|
|
|
EXPECT_EQ(model->selection(), TextRange(2, 1));
|
|
|
|
|
EXPECT_EQ(model->composing_range(), TextRange(1, 4));
|
|
|
|
|
EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(TextInputModel, MoveCursorToBeginningMiddleReverseComposing) {
|
|
|
|
|
auto model = std::make_unique<TextInputModel>();
|
|
|
|
|
model->SetText("ABCDE");
|
|
|
|
|
@@ -1318,6 +1401,17 @@ TEST(TextInputModel, MoveCursorToBeginningMiddleReverseComposing) {
|
|
|
|
|
EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(TextInputModel, SelectToBeginningMiddleReverseComposing) {
|
|
|
|
|
auto model = std::make_unique<TextInputModel>();
|
|
|
|
|
model->SetText("ABCDE");
|
|
|
|
|
model->BeginComposing();
|
|
|
|
|
EXPECT_TRUE(model->SetComposingRange(TextRange(4, 1), 1));
|
|
|
|
|
EXPECT_TRUE(model->SelectToBeginning());
|
|
|
|
|
EXPECT_EQ(model->selection(), TextRange(2, 1));
|
|
|
|
|
EXPECT_EQ(model->composing_range(), TextRange(4, 1));
|
|
|
|
|
EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(TextInputModel, MoveCursorToBeginningEndComposing) {
|
|
|
|
|
auto model = std::make_unique<TextInputModel>();
|
|
|
|
|
model->SetText("ABCDE");
|
|
|
|
|
@@ -1329,6 +1423,17 @@ TEST(TextInputModel, MoveCursorToBeginningEndComposing) {
|
|
|
|
|
EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(TextInputModel, SelectToBeginningEndComposing) {
|
|
|
|
|
auto model = std::make_unique<TextInputModel>();
|
|
|
|
|
model->SetText("ABCDE");
|
|
|
|
|
model->BeginComposing();
|
|
|
|
|
EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 3));
|
|
|
|
|
EXPECT_TRUE(model->MoveCursorToBeginning());
|
|
|
|
|
EXPECT_EQ(model->selection(), TextRange(1));
|
|
|
|
|
EXPECT_EQ(model->composing_range(), TextRange(1, 4));
|
|
|
|
|
EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(TextInputModel, MoveCursorToBeginningEndReverseComposing) {
|
|
|
|
|
auto model = std::make_unique<TextInputModel>();
|
|
|
|
|
model->SetText("ABCDE");
|
|
|
|
|
@@ -1340,6 +1445,17 @@ TEST(TextInputModel, MoveCursorToBeginningEndReverseComposing) {
|
|
|
|
|
EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(TextInputModel, SelectToBeginningEndReverseComposing) {
|
|
|
|
|
auto model = std::make_unique<TextInputModel>();
|
|
|
|
|
model->SetText("ABCDE");
|
|
|
|
|
model->BeginComposing();
|
|
|
|
|
EXPECT_TRUE(model->SetComposingRange(TextRange(4, 1), 3));
|
|
|
|
|
EXPECT_TRUE(model->SelectToBeginning());
|
|
|
|
|
EXPECT_EQ(model->selection(), TextRange(4, 1));
|
|
|
|
|
EXPECT_EQ(model->composing_range(), TextRange(4, 1));
|
|
|
|
|
EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(TextInputModel, MoveCursorToEndStart) {
|
|
|
|
|
auto model = std::make_unique<TextInputModel>();
|
|
|
|
|
model->SetText("ABCDE");
|
|
|
|
|
@@ -1350,6 +1466,16 @@ TEST(TextInputModel, MoveCursorToEndStart) {
|
|
|
|
|
EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(TextInputModel, SelectToEndStart) {
|
|
|
|
|
auto model = std::make_unique<TextInputModel>();
|
|
|
|
|
model->SetText("ABCDE");
|
|
|
|
|
EXPECT_TRUE(model->SetSelection(TextRange(0)));
|
|
|
|
|
EXPECT_TRUE(model->SelectToEnd());
|
|
|
|
|
EXPECT_EQ(model->selection(), TextRange(0, 5));
|
|
|
|
|
EXPECT_EQ(model->composing_range(), TextRange(0));
|
|
|
|
|
EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(TextInputModel, MoveCursorToEndMiddle) {
|
|
|
|
|
auto model = std::make_unique<TextInputModel>();
|
|
|
|
|
model->SetText("ABCDE");
|
|
|
|
|
@@ -1360,6 +1486,16 @@ TEST(TextInputModel, MoveCursorToEndMiddle) {
|
|
|
|
|
EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(TextInputModel, SelectToEndMiddle) {
|
|
|
|
|
auto model = std::make_unique<TextInputModel>();
|
|
|
|
|
model->SetText("ABCDE");
|
|
|
|
|
EXPECT_TRUE(model->SetSelection(TextRange(2)));
|
|
|
|
|
EXPECT_TRUE(model->SelectToEnd());
|
|
|
|
|
EXPECT_EQ(model->selection(), TextRange(2, 5));
|
|
|
|
|
EXPECT_EQ(model->composing_range(), TextRange(0));
|
|
|
|
|
EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(TextInputModel, MoveCursorToEndEnd) {
|
|
|
|
|
auto model = std::make_unique<TextInputModel>();
|
|
|
|
|
model->SetText("ABCDE");
|
|
|
|
|
@@ -1370,6 +1506,16 @@ TEST(TextInputModel, MoveCursorToEndEnd) {
|
|
|
|
|
EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(TextInputModel, SelectToEndEnd) {
|
|
|
|
|
auto model = std::make_unique<TextInputModel>();
|
|
|
|
|
model->SetText("ABCDE");
|
|
|
|
|
EXPECT_TRUE(model->SetSelection(TextRange(5)));
|
|
|
|
|
EXPECT_FALSE(model->SelectToEnd());
|
|
|
|
|
EXPECT_EQ(model->selection(), TextRange(5));
|
|
|
|
|
EXPECT_EQ(model->composing_range(), TextRange(0));
|
|
|
|
|
EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(TextInputModel, MoveCursorToEndSelection) {
|
|
|
|
|
auto model = std::make_unique<TextInputModel>();
|
|
|
|
|
model->SetText("ABCDE");
|
|
|
|
|
@@ -1380,6 +1526,16 @@ TEST(TextInputModel, MoveCursorToEndSelection) {
|
|
|
|
|
EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(TextInputModel, SelectToEndSelection) {
|
|
|
|
|
auto model = std::make_unique<TextInputModel>();
|
|
|
|
|
model->SetText("ABCDE");
|
|
|
|
|
EXPECT_TRUE(model->SetSelection(TextRange(1, 4)));
|
|
|
|
|
EXPECT_TRUE(model->SelectToEnd());
|
|
|
|
|
EXPECT_EQ(model->selection(), TextRange(1, 5));
|
|
|
|
|
EXPECT_EQ(model->composing_range(), TextRange(0));
|
|
|
|
|
EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(TextInputModel, MoveCursorToEndReverseSelection) {
|
|
|
|
|
auto model = std::make_unique<TextInputModel>();
|
|
|
|
|
model->SetText("ABCDE");
|
|
|
|
|
@@ -1390,6 +1546,16 @@ TEST(TextInputModel, MoveCursorToEndReverseSelection) {
|
|
|
|
|
EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(TextInputModel, SelectToEndReverseSelection) {
|
|
|
|
|
auto model = std::make_unique<TextInputModel>();
|
|
|
|
|
model->SetText("ABCDE");
|
|
|
|
|
EXPECT_TRUE(model->SetSelection(TextRange(4, 1)));
|
|
|
|
|
EXPECT_TRUE(model->SelectToEnd());
|
|
|
|
|
EXPECT_EQ(model->selection(), TextRange(4, 5));
|
|
|
|
|
EXPECT_EQ(model->composing_range(), TextRange(0));
|
|
|
|
|
EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(TextInputModel, MoveCursorToEndStartComposing) {
|
|
|
|
|
auto model = std::make_unique<TextInputModel>();
|
|
|
|
|
model->SetText("ABCDE");
|
|
|
|
|
@@ -1401,6 +1567,17 @@ TEST(TextInputModel, MoveCursorToEndStartComposing) {
|
|
|
|
|
EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(TextInputModel, SelectToEndStartComposing) {
|
|
|
|
|
auto model = std::make_unique<TextInputModel>();
|
|
|
|
|
model->SetText("ABCDE");
|
|
|
|
|
model->BeginComposing();
|
|
|
|
|
EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 0));
|
|
|
|
|
EXPECT_TRUE(model->SelectToEnd());
|
|
|
|
|
EXPECT_EQ(model->selection(), TextRange(1, 4));
|
|
|
|
|
EXPECT_EQ(model->composing_range(), TextRange(1, 4));
|
|
|
|
|
EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(TextInputModel, MoveCursorToEndStartReverseComposing) {
|
|
|
|
|
auto model = std::make_unique<TextInputModel>();
|
|
|
|
|
model->SetText("ABCDE");
|
|
|
|
|
@@ -1412,6 +1589,17 @@ TEST(TextInputModel, MoveCursorToEndStartReverseComposing) {
|
|
|
|
|
EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(TextInputModel, SelectToEndStartReverseComposing) {
|
|
|
|
|
auto model = std::make_unique<TextInputModel>();
|
|
|
|
|
model->SetText("ABCDE");
|
|
|
|
|
model->BeginComposing();
|
|
|
|
|
EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 0));
|
|
|
|
|
EXPECT_TRUE(model->SelectToEnd());
|
|
|
|
|
EXPECT_EQ(model->selection(), TextRange(1, 4));
|
|
|
|
|
EXPECT_EQ(model->composing_range(), TextRange(1, 4));
|
|
|
|
|
EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(TextInputModel, MoveCursorToEndMiddleComposing) {
|
|
|
|
|
auto model = std::make_unique<TextInputModel>();
|
|
|
|
|
model->SetText("ABCDE");
|
|
|
|
|
@@ -1423,6 +1611,17 @@ TEST(TextInputModel, MoveCursorToEndMiddleComposing) {
|
|
|
|
|
EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(TextInputModel, SelectToEndMiddleComposing) {
|
|
|
|
|
auto model = std::make_unique<TextInputModel>();
|
|
|
|
|
model->SetText("ABCDE");
|
|
|
|
|
model->BeginComposing();
|
|
|
|
|
EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 1));
|
|
|
|
|
EXPECT_TRUE(model->SelectToEnd());
|
|
|
|
|
EXPECT_EQ(model->selection(), TextRange(2, 4));
|
|
|
|
|
EXPECT_EQ(model->composing_range(), TextRange(1, 4));
|
|
|
|
|
EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(TextInputModel, MoveCursorToEndMiddleReverseComposing) {
|
|
|
|
|
auto model = std::make_unique<TextInputModel>();
|
|
|
|
|
model->SetText("ABCDE");
|
|
|
|
|
@@ -1434,6 +1633,17 @@ TEST(TextInputModel, MoveCursorToEndMiddleReverseComposing) {
|
|
|
|
|
EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(TextInputModel, SelectToEndMiddleReverseComposing) {
|
|
|
|
|
auto model = std::make_unique<TextInputModel>();
|
|
|
|
|
model->SetText("ABCDE");
|
|
|
|
|
model->BeginComposing();
|
|
|
|
|
EXPECT_TRUE(model->SetComposingRange(TextRange(4, 1), 1));
|
|
|
|
|
EXPECT_TRUE(model->SelectToEnd());
|
|
|
|
|
EXPECT_EQ(model->selection(), TextRange(2, 4));
|
|
|
|
|
EXPECT_EQ(model->composing_range(), TextRange(4, 1));
|
|
|
|
|
EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(TextInputModel, MoveCursorToEndEndComposing) {
|
|
|
|
|
auto model = std::make_unique<TextInputModel>();
|
|
|
|
|
model->SetText("ABCDE");
|
|
|
|
|
@@ -1445,6 +1655,17 @@ TEST(TextInputModel, MoveCursorToEndEndComposing) {
|
|
|
|
|
EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(TextInputModel, SelectToEndEndComposing) {
|
|
|
|
|
auto model = std::make_unique<TextInputModel>();
|
|
|
|
|
model->SetText("ABCDE");
|
|
|
|
|
model->BeginComposing();
|
|
|
|
|
EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 3));
|
|
|
|
|
EXPECT_FALSE(model->SelectToEnd());
|
|
|
|
|
EXPECT_EQ(model->selection(), TextRange(4));
|
|
|
|
|
EXPECT_EQ(model->composing_range(), TextRange(1, 4));
|
|
|
|
|
EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(TextInputModel, MoveCursorToEndEndReverseComposing) {
|
|
|
|
|
auto model = std::make_unique<TextInputModel>();
|
|
|
|
|
model->SetText("ABCDE");
|
|
|
|
|
@@ -1456,6 +1677,17 @@ TEST(TextInputModel, MoveCursorToEndEndReverseComposing) {
|
|
|
|
|
EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(TextInputModel, SelectToEndEndReverseComposing) {
|
|
|
|
|
auto model = std::make_unique<TextInputModel>();
|
|
|
|
|
model->SetText("ABCDE");
|
|
|
|
|
model->BeginComposing();
|
|
|
|
|
EXPECT_TRUE(model->SetComposingRange(TextRange(4, 1), 3));
|
|
|
|
|
EXPECT_FALSE(model->SelectToEnd());
|
|
|
|
|
EXPECT_EQ(model->selection(), TextRange(4));
|
|
|
|
|
EXPECT_EQ(model->composing_range(), TextRange(4, 1));
|
|
|
|
|
EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(TextInputModel, GetCursorOffset) {
|
|
|
|
|
auto model = std::make_unique<TextInputModel>();
|
|
|
|
|
// These characters take 1, 2, 3 and 4 bytes in UTF-8.
|
|
|
|
|
|