summaryrefslogtreecommitdiff
path: root/core/fxcrt/widestring_unittest.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-11-16 21:45:18 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-16 21:45:18 +0000
commit3f1c832dda209cf6682bb75316c07d71332fe6c3 (patch)
tree79e274e65a500bc7964fe4328a6185c805274640 /core/fxcrt/widestring_unittest.cpp
parent40d522134a11867adb95f77c0b7891932e0739a2 (diff)
downloadpdfium-3f1c832dda209cf6682bb75316c07d71332fe6c3.tar.xz
Make WideString::{Format|FormatV} static
This CL moves the Format and FormatV methods from WideString to be static. Bug: pdfium:934 Change-Id: I9941d6a2a5bbf0a82087cd0ea5d0f8fc42eecd3e Reviewed-on: https://pdfium-review.googlesource.com/18630 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fxcrt/widestring_unittest.cpp')
-rw-r--r--core/fxcrt/widestring_unittest.cpp85
1 files changed, 13 insertions, 72 deletions
diff --git a/core/fxcrt/widestring_unittest.cpp b/core/fxcrt/widestring_unittest.cpp
index 42819b3349..aaa6d9cae7 100644
--- a/core/fxcrt/widestring_unittest.cpp
+++ b/core/fxcrt/widestring_unittest.cpp
@@ -1278,84 +1278,25 @@ TEST(WideStringView, TrimmedRight) {
}
TEST(WideString, FormatWidth) {
- {
- WideString str;
- str.Format(L"%5d", 1);
- EXPECT_EQ(L" 1", str);
- }
-
- {
- WideString str;
- str.Format(L"%d", 1);
- EXPECT_EQ(L"1", str);
- }
-
- {
- WideString str;
- str.Format(L"%*d", 5, 1);
- EXPECT_EQ(L" 1", str);
- }
-
- {
- WideString str;
- str.Format(L"%-1d", 1);
- EXPECT_EQ(L"1", str);
- }
-
- {
- WideString str;
- str.Format(L"%0d", 1);
- EXPECT_EQ(L"1", str);
- }
-
- {
- WideString str;
- str.Format(L"%1048576d", 1);
- EXPECT_EQ(L"", str);
- }
+ EXPECT_EQ(L" 1", WideString::Format(L"%5d", 1));
+ EXPECT_EQ(L"1", WideString::Format(L"%d", 1));
+ EXPECT_EQ(L" 1", WideString::Format(L"%*d", 5, 1));
+ EXPECT_EQ(L"1", WideString::Format(L"%-1d", 1));
+ EXPECT_EQ(L"1", WideString::Format(L"%0d", 1));
+ EXPECT_EQ(L"", WideString::Format(L"%1048576d", 1));
}
TEST(WideString, FormatPrecision) {
- {
- WideString str;
- str.Format(L"%.2f", 1.12345);
- EXPECT_EQ(L"1.12", str);
- }
-
- {
- WideString str;
- str.Format(L"%.*f", 3, 1.12345);
- EXPECT_EQ(L"1.123", str);
- }
-
- {
- WideString str;
- str.Format(L"%f", 1.12345);
- EXPECT_EQ(L"1.123450", str);
- }
-
- {
- WideString str;
- str.Format(L"%-1f", 1.12345);
- EXPECT_EQ(L"1.123450", str);
- }
-
- {
- WideString str;
- str.Format(L"%0f", 1.12345);
- EXPECT_EQ(L"1.123450", str);
- }
-
- {
- WideString str;
- str.Format(L"%.1048576f", 1.2);
- EXPECT_EQ(L"", str);
- }
+ EXPECT_EQ(L"1.12", WideString::Format(L"%.2f", 1.12345));
+ EXPECT_EQ(L"1.123", WideString::Format(L"%.*f", 3, 1.12345));
+ EXPECT_EQ(L"1.123450", WideString::Format(L"%f", 1.12345));
+ EXPECT_EQ(L"1.123450", WideString::Format(L"%-1f", 1.12345));
+ EXPECT_EQ(L"1.123450", WideString::Format(L"%0f", 1.12345));
+ EXPECT_EQ(L"", WideString::Format(L"%.1048576f", 1.2));
}
TEST(WideString, FormatOutOfRangeChar) {
- WideString str;
- str.Format(L"unsupported char '%c'", 0x00FF00FF);
+ WideString::Format(L"unsupported char '%c'", 0x00FF00FF);
}
TEST(WideString, Empty) {