Flutter Engine
The Flutter Engine
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
9namespace flutter {
10
11TEST(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
25TEST(TextEditingDeltaTest, TestTextEditingDeltaNonTextConstructor) {
26 // Here we are simulating inserting an "o" at the end of "hell".
27 std::string old_text = "hello";
28
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
TEST(FrameTimingsRecorderTest, RecordVsync)
A change in the state of an input field.