interface_test.cpp 1.43 KB
Newer Older
Arun Das's avatar
Arun Das committed
1
/*******************************************************************************
Arun Das's avatar
Arun Das committed
2
3
4
5
6
7
8
9
 * Copyright (c) 2021, Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
 *
 * This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License 2.0
 * which is available at https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *******************************************************************************/
Arun Das's avatar
Arun Das committed
10
11
12
13
14

//-----------------------------------------------------------------------------
/** @file  interface_test.cpp */
//-----------------------------------------------------------------------------

Arun Das's avatar
Arun Das committed
15
#include "MantleAPI/Test/test_utils.h"
Arun Das's avatar
Arun Das committed
16
17
18

TEST(InterfaceTest, GivenTeleportAction_When_ThenHostVehicleIsPlaced)
{
René Paris's avatar
René Paris committed
19
  mantle_api::Position inert_pos{};
20
  inert_pos = mantle_api::OpenDrivePosition{{0, 0}, units::length::meter_t{0}, units::length::meter_t{0}};
René Paris's avatar
René Paris committed
21
22
  mantle_api::MockEnvironment env{};
  env.CreateMap("dummy_map_path", {});
Arun Das's avatar
Arun Das committed
23

René Paris's avatar
René Paris committed
24
25
26
  mantle_api::VehicleProperties vehicle_properties;
  vehicle_properties.is_host = true;
  vehicle_properties.model = "G12";
Arun Das's avatar
Arun Das committed
27

René Paris's avatar
René Paris committed
28
29
30
31
32
  auto& repo = env.GetEntityRepository();
  auto& host_vehicle = repo.Create(0, "host", vehicle_properties);
  const auto* const converter = env.GetConverter();
  auto world_pos = converter->Convert(inert_pos);
  host_vehicle.SetPosition(world_pos);
33
  host_vehicle.SetVisibility(mantle_api::EntityVisibilityConfig{true, false, true, {"radar"}});
Arun Das's avatar
Arun Das committed
34
}