mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
During multi-step text input composing, such as with Chinese, Japanese, and Korean text input, the framework sends embedders cursor rect updates in the form of two messages: * TextInput.setMarkedTextRect: notifies the embedder the size and position of the composing text rect (or cursor when not composing) in local coordinates. * TextInput.setEditableSizeAndTransform: notifies the embedder of the size of the EditableText and 4x4 transform matrix from local to PipelineOwner.rootNode coordinates. On receipt of either message, we cache a local copy on the TextInputPlugin and notify the Win32FlutterWindow of the updated cursor rect. In a followup patch, we update Win32FlutterWindow to implement the Win32 input manager (IMM) calls required to position the IME candidates window while editing.
56 lines
1.3 KiB
C++
56 lines
1.3 KiB
C++
// Copyright 2013 The Flutter Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#include "flutter/shell/platform/common/cpp/geometry.h"
|
|
|
|
#include "gtest/gtest.h"
|
|
|
|
namespace flutter {
|
|
|
|
TEST(Point, SetsCoordinates) {
|
|
Point point(-30.0, 42.0);
|
|
EXPECT_DOUBLE_EQ(-30.0, point.x());
|
|
EXPECT_DOUBLE_EQ(42.0, point.y());
|
|
}
|
|
|
|
TEST(Size, SetsDimensions) {
|
|
Size size(20.0, 42.0);
|
|
EXPECT_DOUBLE_EQ(20.0, size.width());
|
|
EXPECT_DOUBLE_EQ(42.0, size.height());
|
|
}
|
|
|
|
TEST(Size, ClampsDimensionsPositive) {
|
|
Size size(-20.0, -42.0);
|
|
EXPECT_DOUBLE_EQ(0.0, size.width());
|
|
EXPECT_DOUBLE_EQ(0.0, size.height());
|
|
}
|
|
|
|
TEST(Rect, SetsOriginAndSize) {
|
|
Point origin(-30.0, 42.0);
|
|
Size size(20.0, 22.0);
|
|
Rect rect(origin, size);
|
|
EXPECT_EQ(origin, rect.origin());
|
|
EXPECT_EQ(size, rect.size());
|
|
}
|
|
|
|
TEST(Rect, ReturnsLTRB) {
|
|
Point origin(-30.0, 42.0);
|
|
Size size(20.0, 22.0);
|
|
Rect rect(origin, size);
|
|
EXPECT_DOUBLE_EQ(-30.0, rect.left());
|
|
EXPECT_DOUBLE_EQ(42.0, rect.top());
|
|
EXPECT_DOUBLE_EQ(-10.0, rect.right());
|
|
EXPECT_DOUBLE_EQ(64.0, rect.bottom());
|
|
}
|
|
|
|
TEST(Rect, ReturnsWidthHeight) {
|
|
Point origin(-30.0, 42.0);
|
|
Size size(20.0, 22.0);
|
|
Rect rect(origin, size);
|
|
EXPECT_DOUBLE_EQ(20.0, rect.width());
|
|
EXPECT_DOUBLE_EQ(22.0, rect.height());
|
|
}
|
|
|
|
} // namespace flutter
|