mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
* Replace MapManager.DeleteMap with SharedMapSystem.DeleteMap in various tests * Poke tests * I guess this is was technically a breaking change?
42 lines
1.4 KiB
C#
42 lines
1.4 KiB
C#
using System.Numerics;
|
|
using NUnit.Framework;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.Map;
|
|
using Robust.Shared.Maths;
|
|
using Robust.Shared.Physics;
|
|
using Robust.Shared.Physics.Components;
|
|
using Robust.Shared.Physics.Dynamics;
|
|
using Robust.Shared.Physics.Systems;
|
|
using Robust.UnitTesting.Server;
|
|
|
|
namespace Robust.UnitTesting.Shared.Physics;
|
|
|
|
[TestFixture]
|
|
public sealed class Fixtures_Test
|
|
{
|
|
[Test]
|
|
public void SetDensity()
|
|
{
|
|
var sim = RobustServerSimulation.NewSimulation().InitializeInstance();
|
|
|
|
var entManager = sim.Resolve<IEntityManager>();
|
|
var sysManager = sim.Resolve<IEntitySystemManager>();
|
|
var fixturesSystem = sysManager.GetEntitySystem<FixtureSystem>();
|
|
var physicsSystem = sysManager.GetEntitySystem<SharedPhysicsSystem>();
|
|
var mapSystem = sysManager.GetEntitySystem<SharedMapSystem>();
|
|
var map = sim.CreateMap().MapId;
|
|
|
|
var ent = sim.SpawnEntity(null, new MapCoordinates(Vector2.Zero, map));
|
|
var body = entManager.AddComponent<PhysicsComponent>(ent);
|
|
physicsSystem.SetBodyType(ent, BodyType.Dynamic, body: body);
|
|
var fixture = new Fixture();
|
|
fixturesSystem.CreateFixture(ent, "fix1", fixture);
|
|
|
|
physicsSystem.SetDensity(ent, "fix1", fixture, 10f);
|
|
Assert.That(fixture.Density, Is.EqualTo(10f));
|
|
Assert.That(body.Mass, Is.EqualTo(10f));
|
|
|
|
mapSystem.DeleteMap(map);
|
|
}
|
|
}
|