#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "ui/gfx/text_elider.h"
#include <stddef.h>
#include <memory>
#include <vector>
#include "base/files/file_path.h"
#include "base/i18n/rtl.h"
#include "base/logging.h"
#include "base/run_loop.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/task_environment.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/font.h"
#include "ui/gfx/font_list.h"
#include "ui/gfx/font_render_params.h"
#include "ui/gfx/text_utils.h"
namespace gfx {
namespace {
struct FileTestcase { … };
struct Testcase { … };
}
TEST(TextEliderTest, ElideEmail) { … }
TEST(TextEliderTest, ElideEmailMoreSpace) { … }
TEST(TextEliderTest, TestFilenameEliding) { … }
TEST(TextEliderTest, ElideTextTruncate) { … }
TEST(TextEliderTest, ElideTextEllipsis) { … }
TEST(TextEliderTest, ElideTextEllipsisFront) { … }
static void CheckCodeUnitPairs(const std::u16string& text,
char16_t first_char,
char16_t second_char) { … }
TEST(TextEliderTest, ElideTextAtomicSequences) { … }
TEST(TextEliderTest, ElideTextLongStrings) { … }
TEST(TextEliderTest, StringSlicerBasicTest) { … }
TEST(TextEliderTest, StringSlicerWhitespace_UseDefault) { … }
TEST(TextEliderTest, StringSlicerWhitespace_NoTrim) { … }
TEST(TextEliderTest, StringSlicerWhitespace_Trim) { … }
TEST(TextEliderTest, StringSlicer_ElideMiddle_MultipleWhitespace) { … }
TEST(TextEliderTest, StringSlicerSurrogate) { … }
TEST(TextEliderTest, StringSlicerCombining) { … }
TEST(TextEliderTest, StringSlicerCombiningSurrogate) { … }
TEST(TextEliderTest, ElideString) { … }
TEST(TextEliderTest, ElideRectangleText) { … }
TEST(TextEliderTest, ElideRectangleTextFirstWordTruncated) { … }
TEST(TextEliderTest, ElideRectangleTextPunctuation) { … }
TEST(TextEliderTest, ElideRectangleTextLongWords) { … }
TEST(TextEliderTest, ElideRectangleTextCheckLineWidth) { … }
#if BUILDFLAG(IS_CHROMEOS_ASH)
TEST(TextEliderTest, ElideRectangleTextCheckConcatWidthEqualsSumOfWidths) {
FontList font_list;
font_list = FontList("Noto Sans UI,ui-sans, 12px");
SetFontRenderParamsDeviceScaleFactor(1.25f);
#define WIDTH …
EXPECT_EQ(WIDTH(u"The administrator for this account has"),
WIDTH(u"The ") + WIDTH(u"administrator ") + WIDTH(u"for ") +
WIDTH(u"this ") + WIDTH(u"account ") + WIDTH(u"has"));
#undef WIDTH
SetFontRenderParamsDeviceScaleFactor(1.0f);
}
#endif
TEST(TextEliderTest, ElideRectangleString) { … }
TEST(TextEliderTest, ElideRectangleStringNotStrict) { … }
TEST(TextEliderTest, ElideRectangleWide16) { … }
TEST(TextEliderTest, ElideRectangleWide32) { … }
TEST(TextEliderTest, TruncateString) { … }
}