Exemplo n.º 1
0
        public void EntityManagerDestructionDetectsUnregisteredJob()
        {
#if !NET_DOTS
#if UNITY_DOTSRUNTIME
            LogAssert.ExpectReset();
#endif
            LogAssert.Expect(LogType.Error, new System.Text.RegularExpressions.Regex("job is still running"));
#endif

            /*var entity =*/ m_Manager.CreateEntity(typeof(EcsTestData));
            var group = m_Manager.CreateEntityQuery(typeof(EcsTestData));

            var job = new TestIncrementJob();
            job.entities = group.ToEntityArray(Allocator.TempJob);
            job.data     = m_Manager.GetComponentDataFromEntity <EcsTestData>();
            var jobHandle = job.Schedule();

            // This should detect the unregistered running job & emit the expected error message
            CleanupWorld();

            // Manually complete the job before cleaning up for real
            jobHandle.Complete();
            CleanupWorld();
            job.entities.Dispose();
#if !NET_DOTS
            LogAssert.NoUnexpectedReceived();
#endif
        }
Exemplo n.º 2
0
        public override void Setup()
        {
            base.Setup();
#if UNITY_DOTSRUNTIME
            LogAssert.ExpectReset();
#endif
        }
Exemplo n.º 3
0
        public override void Setup()
        {
            base.Setup();
            system = World.GetOrCreateSystem <TestSystem>();
            ShouldRunSystem(true);

#if UNITY_DOTSRUNTIME
            LogAssert.ExpectReset();
#endif
        }
        public void CreateCachedQuery_OverflowWithCacheSize1_ResizesAndWarns()
        {
            var cache = new EntityQueryCache(1);

            SimpleWrapCreateCachedQuery(cache, 0, k_DummyGroup);

#if UNITY_DOTSRUNTIME
            LogAssert.ExpectReset();
#endif
            LogAssert.Expect(LogType.Error, k_ResizeError);
            SimpleWrapCreateCachedQuery(cache, 1, k_DummyGroup);
            LogAssert.NoUnexpectedReceived();
        }
        public void CreateCachedQuery_OverflowWithCacheSize4_ResizesByAtLeastHalf()
        {
            var cache = new EntityQueryCache(4);

            SimpleWrapCreateCachedQuery(cache, 0, k_DummyGroup);
            SimpleWrapCreateCachedQuery(cache, 1, k_DummyGroup);
            SimpleWrapCreateCachedQuery(cache, 2, k_DummyGroup);
            SimpleWrapCreateCachedQuery(cache, 3, k_DummyGroup);

#if UNITY_DOTSRUNTIME
            LogAssert.ExpectReset();
#endif
            LogAssert.Expect(LogType.Error, k_ResizeError);
            SimpleWrapCreateCachedQuery(cache, 4, k_DummyGroup);
            LogAssert.NoUnexpectedReceived();

            // this should not error
            SimpleWrapCreateCachedQuery(cache, 5, k_DummyGroup);
            LogAssert.NoUnexpectedReceived();
        }