Flutter Engine
The Flutter Engine
shell
platform
common
text_editing_delta_unittests.cc
Go to the documentation of this file.
1
// Copyright 2013 The Flutter Authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style license that can be
3
// found in the LICENSE file.
4
5
#include "flutter/shell/platform/common/text_editing_delta.h"
6
7
#include "gtest/gtest.h"
8
9
namespace
flutter
{
10
11
TEST
(TextEditingDeltaTest, TestTextEditingDeltaConstructor) {
12
// Here we are simulating inserting an "o" at the end of "hell".
13
std::string old_text =
"hell"
;
14
std::string replacement_text =
"hello"
;
15
TextRange
range(0, 4);
16
17
TextEditingDelta
delta
=
TextEditingDelta
(old_text, range, replacement_text);
18
19
EXPECT_EQ(
delta
.old_text(), old_text);
20
EXPECT_EQ(
delta
.delta_text(),
"hello"
);
21
EXPECT_EQ(
delta
.delta_start(), 0);
22
EXPECT_EQ(
delta
.delta_end(), 4);
23
}
24
25
TEST
(TextEditingDeltaTest, TestTextEditingDeltaNonTextConstructor) {
26
// Here we are simulating inserting an "o" at the end of "hell".
27
std::string old_text =
"hello"
;
28
29
TextEditingDelta
delta
=
TextEditingDelta
(old_text);
30
31
EXPECT_EQ(
delta
.old_text(), old_text);
32
EXPECT_EQ(
delta
.delta_text(),
""
);
33
EXPECT_EQ(
delta
.delta_start(), -1);
34
EXPECT_EQ(
delta
.delta_end(), -1);
35
}
36
37
}
// namespace flutter
flutter::TextRange
Definition:
text_range.h:19
flutter
Definition:
asset_manager.cc:10
flutter::TEST
TEST(FrameTimingsRecorderTest, RecordVsync)
Definition:
frame_timings_recorder_unittests.cc:20
generate_fir_coeff.delta
int delta
Definition:
generate_fir_coeff.py:92
flutter::TextEditingDelta
A change in the state of an input field.
Definition:
text_editing_delta.h:16
Generated on Sun Jun 23 2024 21:55:11 for Flutter Engine by
1.9.4