Filip Filmar 29998f07fa Configures ICU to load the timezone data (#13952)
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.
2019-12-05 17:32:55 -08:00

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