예제 #1
0
        public void CanGetDecal()
        {
            // Execution
            var decal   = DecalSystem.GetDecal(decalData);
            var hasPool = PoolingSystem.HasPool <DecalData>(decalData);

            // Result
            Assert.IsFalse(hasPool);
            Assert.IsNotNull(decal);
            LogAssert.NoUnexpectedReceived();
        }
예제 #2
0
        public void CanGetDecalPooled()
        {
            // Execution
            var hasPool = DecalSystem.HasDecalPool(decalDataPooled);
            var decal   = DecalSystem.GetDecal(decalDataPooled);

            // Result
            Assert.IsTrue(hasPool);
            Assert.IsNotNull(decal);
            LogAssert.NoUnexpectedReceived();
        }
예제 #3
0
        public void CanRemoveDecal()
        {
            // Execution
            var decal = DecalSystem.GetDecal(decalData);
            var obj   = decal.gameObject;

            DecalSystem.RemoveDecal(decal);

            // Result
            LogAssert.NoUnexpectedReceived();
        }
        public IEnumerator ExclusiveChooser_DeactivateOnlyChild_ReactivatesChild()
        {
            m_child1.transform.parent = m_exclusiveChooser.transform;
            m_child1.SetActive(false);
            yield return(new WaitForSeconds(1f));

            //should have reactivated itself
            Assert.IsTrue(m_child1.activeSelf);
            LogAssert.NoUnexpectedReceived();
            yield return(null);
        }
예제 #5
0
        [StandaloneFixme] // UnityEngine.Debug.Log is at a very basic level in ZeroJobs
        public void OnStopRunning_WithDisabledAndShouldRun_CalledOnce()
        {
            LogAssert.Expect(LogType.Log, TestSystem.OnStartRunningString);
            system.Update();

            LogAssert.Expect(LogType.Log, TestSystem.OnStopRunningString);
            system.Enabled = false;
            ShouldRunSystem(true);
            system.Update();
            LogAssert.NoUnexpectedReceived();
        }
예제 #6
0
        public void NullLoggerService()
        {
            serviceLocatorManager.Register <IServiceLocatorManagerLogger>(null);
            Assert.IsNull(serviceLocatorManager.Resolve <IServiceLocatorManagerLogger>());
            var test = serviceLocatorManager.Resolve <IMockInterface>();

            Assert.IsNull(test);
            serviceLocatorManager.Register <IMockInterface>(new MockServiceNewFeature());
            serviceLocatorManager.Reset();
            LogAssert.NoUnexpectedReceived();
        }
예제 #7
0
            protected override void Evaluate()
            {
                Assert.NotNull(GameObject.Find("Cube"));

                GameObject rotator = GameObject.Find("GameObjectRotator");

                Assert.NotNull(rotator);
                Assert.NotNull(rotator.GetComponent <Adic.Examples.BindingGameObjects.GameObjectRotator>());

                LogAssert.NoUnexpectedReceived();
            }
    public void MeasureProfilerSamples_string_WithNoSamples_DoesNotRecordSampleGroups()
    {
        LogAssert.NoUnexpectedReceived();
        using (Measure.ProfilerMarkers(new string[0]))
        {
        }

        var result = PerformanceTest.Active;

        Assert.AreEqual(0, result.SampleGroups.Count);
    }
예제 #9
0
        [DotsRuntimeFixme] // UnityEngine.Debug.Log is at a very basic level in ZeroJobs
        public void OnStopRunning_WhenDestroyingActiveManager_CalledOnce()
        {
            LogAssert.Expect(LogType.Log, TestSystem.OnStartRunningString);
            system.Update();

            LogAssert.Expect(LogType.Log, TestSystem.OnStopRunningString);
            World.DestroySystem(system);
            system = null;

            LogAssert.NoUnexpectedReceived();
        }
예제 #10
0
    public static void DestroyDoesNotDeleteMeshBackByAsset()
    {
        var    pb   = ShapeFactory.Instantiate <Cube>();
        string path = TestUtility.SaveAssetTemporary <Mesh>(pb.mesh);
        Mesh   mesh = pb.GetComponent <MeshFilter>().sharedMesh;

        UObject.DestroyImmediate(pb.gameObject);
        Assert.IsFalse(mesh == null);
        AssetDatabase.DeleteAsset(path);
        LogAssert.NoUnexpectedReceived();
    }
예제 #11
0
        [DotsRuntimeFixme] // UnityEngine.Debug.Log is at a very basic level in ZeroJobs
        public void OnStopRunning_WhenShouldRunSystemBecomesFalse_CalledOnce()
        {
            LogAssert.Expect(LogType.Log, TestSystem.OnStartRunningString);
            system.Update();

            LogAssert.Expect(LogType.Log, TestSystem.OnStopRunningString);
            system.Enabled = false;
            system.Update();

            LogAssert.NoUnexpectedReceived();
        }
예제 #12
0
            protected override void Evaluate()
            {
                Assert.NotNull(GameObject.Find("LeftCube"));
                Assert.NotNull(GameObject.Find("RightCube"));

                GameObject rotator = GameObject.Find("Rotator");

                Assert.NotNull(rotator);
                Assert.NotNull(rotator.GetComponent <Adic.Examples.UsingConditions.GameObjectRotator>());

                LogAssert.NoUnexpectedReceived();
            }
예제 #13
0
        public void TestErrorExpect()
        {
            LogAssert.Expect(LogType.Error, "Failed.");
            Debug.LogError("Failed.");

            LogAssert.NoUnexpectedReceived();

            LogAssert.ignoreFailingMessages = true;
            Debug.LogError("Failed 2.");
            Debug.LogError("Failed 3.");
            LogAssert.ignoreFailingMessages = false;
        }
예제 #14
0
        public void RemovingEventListener()
        {
            MEvents.Add <TestEvent>(TestEventListener);

            MEvents.RaiseEvent(new TestEvent(1));
            LogAssert.Expect(LogType.Log, "TestEvent" + 1);

            MEvents.Remove <TestEvent>(TestEventListener);
            MEvents.RaiseEvent(new TestEvent(1));

            LogAssert.NoUnexpectedReceived();
        }
        public void ComponentSystemGroup_UpdateBeforeTargetIsSelf_LogsWarning([Values(true, false)] bool legacy)
        {
            var parent = World.CreateSystem <TestGroup>();

            parent.UseLegacySortOrder = legacy;
            var child = World.CreateSystem <UpdateBeforeSelfSystem>();

            LogAssert.Expect(LogType.Warning, new Regex(@"Ignoring invalid \[UpdateBefore\].+UpdateBeforeSelfSystem.+cannot be updated before itself."));
            parent.AddSystemToUpdateList(child);
            parent.SortSystems();
            LogAssert.NoUnexpectedReceived();
        }
예제 #16
0
        public void CanEnableInstance()
        {
            // Setup
            TestObject instance;

            // Execution
            var getInstance = PoolingSystem.TryGetInstance(m_Key, out instance);

            // Result
            Assert.IsTrue(ProcessorTestResults.instanceEnabled);
            LogAssert.NoUnexpectedReceived();
        }
예제 #17
0
        public void DispatchingUnregisteredActionShouldLogAnError()
        {
            var store = new MockStore(new MockState(k_MockStateDefault));

            store.Register <PassThroughAction>(MockReducers.PassThrough);
            store.Register <ChangeFooAction>(MockReducers.ReplaceFoo);
            store.Register <ChangeBarAction>(MockReducers.ReplaceBar);

            LogAssert.Expect(LogType.Error, $"No reducer for action type {typeof(UnregisteredAction)}");
            store.Dispatch(new UnregisteredAction());
            LogAssert.NoUnexpectedReceived();
        }
        public IEnumerator ExclusiveChooser_ReparentingChild1_Child1Active()
        {
            m_child1.transform.parent = m_exclusiveChooser.transform;
            m_child2.transform.parent = m_exclusiveChooser.transform;

            Assert.False(m_child2.activeSelf, "a second child of a ExclusiveChooser should be inactive when a the first is active");
            // ReSharper disable once Unity.InefficientPropertyAccess
            m_child1.transform.parent = null;
            Assert.True(m_child2.activeSelf, "a second child of a ExclusiveChooser should be active when a second child is reparented away from the ExclusiveChooser");
            LogAssert.NoUnexpectedReceived();
            yield return(null);
        }
예제 #19
0
        public void CanReturnInstance()
        {
            // Setup
            GameObject instance;

            // Execution
            PoolingSystem.TryGetInstance(m_Key, out instance);
            PoolingSystem.ReturnInstance(m_Key, instance);

            // Result
            LogAssert.NoUnexpectedReceived();
        }
예제 #20
0
파일: DecalTests.cs 프로젝트: tjm35/kDecals
        public void CanUnregisterDecal()
        {
            // Execution
            var decal = DecalSystem.GetDecal(decalDataPooled);

            DecalSystem.RemoveDecal(decal);
            var registered = DecalSystem.decals.Contains(decal);

            // Result
            Assert.IsFalse(registered);
            LogAssert.NoUnexpectedReceived();
        }
예제 #21
0
        public void TrivialMessage(MessageImportance importance, LoggerVerbosity verbosity)
        {
            _logger.Verbosity = verbosity;

            _engine.LogMessageEvent(new BuildMessageEventArgs(
                                        "message",
                                        "helpKeyword",
                                        "senderName",
                                        importance));

            LogAssert.NoUnexpectedReceived();
        }
예제 #22
0
        public void InstrumentCooldownNodeModelDoesNotThrow()
        {
            var start    = GraphModel.CreateEventFunction(typeof(TestStencil.TestArchetype).GetMethod("Start"), Vector2.zero);
            var cooldown = GraphModel.CreateLoopStack <ForEachHeaderModel>(Vector2.down);
            var loopNode = cooldown.CreateLoopNode(start, -1);

            GraphModel.CreateEdge(cooldown.InputPort, loopNode.OutputPort);
            var result = GraphModel.CreateTranslator().TranslateAndCompile(GraphModel, AssemblyType.None, CompilationOptions.Tracing);

            Assert.That(result.status, Is.EqualTo(CompilationStatus.Succeeded));
            LogAssert.NoUnexpectedReceived();
        }
        public void ComponentSystemGroup_UpdateBeforeTargetIsNotSibling_LogsWarning([Values(true, false)] bool legacy)
        {
            var parent = World.CreateSystem <TestGroup>();

            parent.UseLegacySortOrder = legacy;
            var child = World.CreateSystem <NonSibling2System>();

            LogAssert.Expect(LogType.Warning, new Regex(@"Ignoring invalid \[UpdateBefore\] attribute on .+NonSibling2System targeting.+NonSibling1System"));
            parent.AddSystemToUpdateList(child);
            parent.SortSystems();
            LogAssert.NoUnexpectedReceived();
        }
예제 #24
0
        public void ExceptionTest(bool showColor, Log.Levels levels)
        {
            Log.level = levels;

            Exception myException = new IOException(SomeMessage);

            // Exception isnt effected by log level
            LogAssert.Expect(UnityEngine.LogType.Error, $"EXCEPTION: <color=red>{nameof(IOException)}</color> Message: {SomeMessage}\n{myException.StackTrace}");
            Log.Exception(myException);

            LogAssert.NoUnexpectedReceived();
        }
        public void GenerateLineRendererFromXodr(string file)
        {
            testHelpers.GetTestRoadNetwork(file, out road);
            testHelpers.GenerateMeshTypeRoads(road, TestHelpers.MeshGenerationType.MeshRoad);

            var roadGameObj = GameObject.Find($"{road.name} (Road Network Mesh)");

            Assert.IsNotNull(roadGameObj, "OpenDrive GameObject was never created");
            Assert.IsNotEmpty(road.AllJunctions, "OpenDrive mesh doesn't junction contain data");
            Assert.IsNotEmpty(road.AllRoads, "OpenDrive mesh doesn't road contain data");
            LogAssert.NoUnexpectedReceived();
        }
        public void ComponentSystemGroup_UpdateBeforeTargetIsNotSystem_LogsWarning([Values(true, false)] bool legacy)
        {
            var parent = World.CreateSystem <TestGroup>();

            parent.UseLegacySortOrder = legacy;
            var child = World.CreateSystem <InvalidUpdateBeforeSystem>();

            LogAssert.Expect(LogType.Warning, new Regex(@"Ignoring invalid \[UpdateBefore\].+InvalidUpdateBeforeSystem.+NotEvenASystem is not a subclass of ComponentSystemBase"));
            parent.AddSystemToUpdateList(child);
            parent.SortSystems();
            LogAssert.NoUnexpectedReceived();
        }
예제 #27
0
    public override IEnumerator LoadScenes([ValueSource(nameof(GetVDBScenes))] string scenePath)
    {
        var vdbProcess = new System.Diagnostics.Process();

        // Close any existing instances of the VDB and make a new one
        {
            string vdbExe         = System.IO.Path.GetFullPath("Packages/com.havok.physics/Tools/VisualDebugger/HavokVisualDebugger.exe");
            string vdbProcessName = System.IO.Path.GetFileNameWithoutExtension(vdbExe);

            List <System.Diagnostics.Process> processes = new List <System.Diagnostics.Process>();
            processes.AddRange(System.Diagnostics.Process.GetProcessesByName(vdbProcessName));
            foreach (var process in processes)
            {
                process.CloseMainWindow();
                process.Close();
            }

            vdbProcess.StartInfo.FileName  = vdbExe;
            vdbProcess.StartInfo.Arguments = "";
            vdbProcess.Start();
            vdbProcess.WaitForInputIdle();
            // How do we ensure the VDB is ready to connect?
            yield return(new WaitForSeconds(2));

            vdbProcess.Refresh();
        }

        var havokConfig = HavokConfiguration.Default;

        // Enabled VDB
        havokConfig.VisualDebugger.Enable = 1;
        yield return(SetupAndLoadScene(World.DefaultGameObjectInjectionWorld, havokConfig, scenePath));

        // Disabled VDB
        havokConfig.VisualDebugger.Enable = 0;
        yield return(SetupAndLoadScene(World.DefaultGameObjectInjectionWorld, havokConfig, scenePath));

        // Enabled VDB with zero Timer memory
        havokConfig.VisualDebugger.Enable = 1;
        havokConfig.VisualDebugger.TimerBytesPerThread = 0;
        yield return(SetupAndLoadScene(World.DefaultGameObjectInjectionWorld, havokConfig, scenePath));

        // Close VDB client
        vdbProcess.CloseMainWindow();
        vdbProcess.Close();

        // Enabled VDB with no Client running.
        havokConfig = HavokConfiguration.Default;
        havokConfig.VisualDebugger.Enable = 1;
        yield return(SetupAndLoadScene(World.DefaultGameObjectInjectionWorld, havokConfig, scenePath));

        LogAssert.NoUnexpectedReceived();
    }
        public IEnumerator ExclusiveChooser_ActivatingChild2_Child1Inactive()
        {
            m_child1.transform.parent = m_exclusiveChooser.transform;
            m_child2.transform.parent = m_exclusiveChooser.transform;

            m_child2.SetActive(true);

            Assert.False(m_child1.activeSelf, "a first child of a ExclusiveChooser should be inactive when a second child is activated");
            Assert.True(m_child2.activeSelf, "a second child of a ExclusiveChooser should be active when activated");
            LogAssert.NoUnexpectedReceived();
            yield return(null);
        }
        public void ErrorCheckBundleSettings_WarnsOfMismatchedLoadPath()
        {
            var group  = Settings.CreateGroup("PackedTest", false, false, false, null, typeof(BundledAssetGroupSchema));
            var schema = group.GetSchema <BundledAssetGroupSchema>();

            schema.LoadPath.Id = "BadPath";

            var errorStr = BuildScriptPackedMode.ErrorCheckBundleSettings(schema, group, Settings);

            LogAssert.NoUnexpectedReceived();
            Assert.IsTrue(errorStr.Contains("is set to the dynamic-lookup version of StreamingAssets, but LoadPath is not."));
        }
예제 #30
0
        public void LogRegisterEvent()
        {
            //expect register to be logged twice. Once for the new logger and once for the mock interface.
            LogAssert.Expect(LogType.Log, ServiceManagerLogType.Registered.ToString());
            LogAssert.Expect(LogType.Log, ServiceManagerLogType.Registered.ToString());
            serviceLocatorManager.Register <IServiceLocatorManagerLogger>(new MockLogger());
            serviceLocatorManager.Register <IMockInterface>(new MockServiceNewFeature());
            var test = serviceLocatorManager.Resolve <IMockInterface>();

            LogAssert.NoUnexpectedReceived();
            Assert.IsNotNull(test);
        }