Fixes required for libax to compile on Windows

This commit is contained in:
George Wright
2021-02-01 10:31:14 -08:00
committed by George Wright
parent fa1a5c2f1f
commit 1b171451d0
6 changed files with 16 additions and 5 deletions

View File

@@ -7,6 +7,10 @@ import("//flutter/testing/testing.gni")
config("accessibility_config") {
visibility = [ ":*" ]
if (is_win) {
# TODO: std::iterator class template is deprecated in C++17
defines = [ "_SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING" ]
}
include_dirs = [ "//flutter/third_party/accessibility" ]
}

View File

@@ -6,6 +6,7 @@
#include <stddef.h>
#include <algorithm>
#include <iterator>
#include <set>
#include <utility>

View File

@@ -5,6 +5,7 @@
#ifndef UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_H_
#define UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_H_
#include <functional>
#include <ostream>
#include <string>

View File

@@ -22,7 +22,10 @@ source_set("base") {
"string_utils.cc",
"string_utils.h",
]
if (is_win) {
# TODO: codecvt_utf8_utf16 is deprecated in C++17
defines = [ "_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS" ]
}
if (is_mac) {
sources += [
"platform/darwin/scoped_nsobject.h",

View File

@@ -4,6 +4,7 @@
#include "string_utils.h"
#include <cctype>
#include <codecvt>
#include <locale>
#include <regex>

View File

@@ -818,8 +818,8 @@ TEST(RectTest, BoundingRect) {
TEST(RectTest, IsExpressibleAsRect) {
EXPECT_TRUE(RectF().IsExpressibleAsRect());
float min = std::numeric_limits<int>::min();
float max = std::numeric_limits<int>::max();
float min = static_cast<float>(std::numeric_limits<int>::min());
float max = static_cast<float>(std::numeric_limits<int>::max());
float infinity = std::numeric_limits<float>::infinity();
EXPECT_TRUE(
@@ -1133,6 +1133,7 @@ TEST(RectTest, IntegerOverflow) {
TEST(RectTest, ScaleToEnclosingRectSafe) {
const int max_int = std::numeric_limits<int>::max();
const int min_int = std::numeric_limits<int>::min();
const float max_float = std::numeric_limits<float>::max();
Rect xy_underflow(-100000, -123456, 10, 20);
EXPECT_EQ(ScaleToEnclosingRectSafe(xy_underflow, 100000, 100000),
@@ -1159,13 +1160,13 @@ TEST(RectTest, ScaleToEnclosingRectSafe) {
Rect(100000, 200000, max_int - 100000, max_int - 200000));
Rect max_rect(max_int, max_int, max_int, max_int);
EXPECT_EQ(ScaleToEnclosingRectSafe(max_rect, max_int, max_int),
EXPECT_EQ(ScaleToEnclosingRectSafe(max_rect, max_float, max_float),
Rect(max_int, max_int, 0, 0));
Rect min_rect(min_int, min_int, max_int, max_int);
// Min rect can't be scaled up any further in any dimension.
EXPECT_EQ(ScaleToEnclosingRectSafe(min_rect, 2, 3.5), min_rect);
EXPECT_EQ(ScaleToEnclosingRectSafe(min_rect, max_int, max_int), min_rect);
EXPECT_EQ(ScaleToEnclosingRectSafe(min_rect, max_float, max_float), min_rect);
// Min rect scaled by min is an empty rect at (max, max)
EXPECT_EQ(ScaleToEnclosingRectSafe(min_rect, min_int, min_int), max_rect);
}