mirror of
https://github.com/encounter/engine.git
synced 2026-03-30 11:09:55 -07:00
ca68af252c
The converters are still in a separate target that must be included manually. This allows targets that depend on FML but not Dart runtime not have to depend on the runtime. Adds a test that includes this target and tests image decompression from assets. There is also a test for the standalone DartConvertor in shell_unittests but not in fml_unittests be cause FML uni-tests cannot yet launch a VM. I will work on adding fixtures for those.
69 lines
2.4 KiB
C++
69 lines
2.4 KiB
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.
|
|
|
|
#ifndef TESTING_TESTING_H_
|
|
#define TESTING_TESTING_H_
|
|
|
|
#include <string>
|
|
|
|
#include "flutter/fml/file.h"
|
|
#include "flutter/fml/mapping.h"
|
|
#include "flutter/testing/assertions.h"
|
|
#include "gtest/gtest.h"
|
|
|
|
namespace flutter {
|
|
namespace testing {
|
|
|
|
//------------------------------------------------------------------------------
|
|
/// @brief Returns the directory containing the test fixture for the target
|
|
/// if this target has fixtures configured. If there are no
|
|
/// fixtures, this is a link error. If you see a linker error on
|
|
/// this symbol, the unit-test target needs to depend on a
|
|
/// `test_fixtures` target.
|
|
///
|
|
/// @return The fixtures path.
|
|
///
|
|
const char* GetFixturesPath();
|
|
|
|
//------------------------------------------------------------------------------
|
|
/// @brief Opens the fixtures directory for the unit-test harness.
|
|
///
|
|
/// @return The file descriptor of the fixtures directory.
|
|
///
|
|
fml::UniqueFD OpenFixturesDirectory();
|
|
|
|
//------------------------------------------------------------------------------
|
|
/// @brief Opens a fixture of the given file name.
|
|
///
|
|
/// @param[in] fixture_name The fixture name
|
|
///
|
|
/// @return The file descriptor of the given fixture. An invalid file
|
|
/// descriptor is returned in case the fixture is not found.
|
|
///
|
|
fml::UniqueFD OpenFixture(std::string fixture_name);
|
|
|
|
//------------------------------------------------------------------------------
|
|
/// @brief Opens a fixture of the given file name and returns a mapping to
|
|
/// its contents.
|
|
///
|
|
/// @param[in] fixture_name The fixture name
|
|
///
|
|
/// @return A mapping to the contents of fixture or null if the fixture does
|
|
/// not exist or its contents cannot be mapped in.
|
|
///
|
|
std::unique_ptr<fml::Mapping> OpenFixtureAsMapping(std::string fixture_name);
|
|
|
|
//------------------------------------------------------------------------------
|
|
/// @brief Gets the name of the currently running test. This is useful in
|
|
/// generating logs or assets based on test name.
|
|
///
|
|
/// @return The current test name.
|
|
///
|
|
std::string GetCurrentTestName();
|
|
|
|
} // namespace testing
|
|
} // namespace flutter
|
|
|
|
#endif // TESTING_TESTING_H_
|