mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
The timezone data in Fuchsia is at a fixed path. This will have the flutter runner attempt to load it and log, but not fail if loading does not work out. Added two tests (1) Shows that the specific TZ data version loaded takes effect after initialization (2) Shows that when TZ data files are absent the initialization continues.
29 lines
983 B
C++
29 lines
983 B
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 <gtest/gtest.h>
|
|
|
|
#include "runner.h"
|
|
#include "third_party/icu/source/i18n/unicode/timezone.h"
|
|
|
|
namespace flutter_runner {
|
|
|
|
TEST(RunnerTest, TZData) {
|
|
UErrorCode err = U_ZERO_ERROR;
|
|
const auto version_before = std::string(icu::TimeZone::getTZDataVersion(err));
|
|
ASSERT_EQ(U_ZERO_ERROR, err) << "unicode error: " << u_errorName(err);
|
|
|
|
// This loads the tzdata. In Fuchsia, we force the data from this package
|
|
// to be version 2019a, so that we can test the resource load.
|
|
bool success = Runner::SetupICUInternal();
|
|
ASSERT_TRUE(success) << "failed to load timezone data";
|
|
|
|
const auto version_after = std::string(icu::TimeZone::getTZDataVersion(err));
|
|
ASSERT_EQ(U_ZERO_ERROR, err) << "unicode error: " << u_errorName(err);
|
|
|
|
EXPECT_EQ("2019a", version_after);
|
|
}
|
|
|
|
} // namespace flutter_runner
|