public void Warnings_FromDifferentProviders_SortedAfterErrors()
 {
     var mixedMgr = new MessageManager();
     mixedMgr.AddOrAppendError(p0, node0, e0);
     mixedMgr.AddOrAppendError(p0, node0, w0);
     mixedMgr.AddOrAppendError(p1, node0, e1);
     mixedMgr.AddOrAppendError(p1, node0, w1);
     
     var ret = GetListFrom(mixedMgr)[0].Value;
     Assert.AreEqual(e0, ret[0]);
     Assert.AreEqual(e1, ret[1]);
     Assert.AreEqual(w0, ret[2]);
     Assert.AreEqual(w1, ret[3]);
 }
예제 #2
0
        HashSet <INode> ProcessUberErrors(GenerationResults results)
        {
            var errNodes = new HashSet <INode>();
            var message  = new StringBuilder();
            var messages = ShaderUtil.GetShaderMessages(m_UberShader);

            message.AppendFormat(@"Preview shader for graph has {0} error{1}:\n", messages.Length, messages.Length != 1 ? "s" : "");
            foreach (var error in messages)
            {
                var node = results.sourceMap.FindNode(error.line);

                message.AppendFormat("Shader compilation error in {3} at line {1} (on {2}):\n{0}\n",
                                     error.message, error.line, error.platform,
                                     node != null ? string.Format("node {0} ({1})", node.name, node.guid) : "graph");
                message.AppendLine(error.messageDetails);
                message.AppendLine();

                if (node != null)
                {
                    m_Messenger.AddOrAppendError(this, node.tempId, error);
                    errNodes.Add(node);
                }
            }
            Debug.LogWarning(message.ToString());
            return(errNodes);
        }
예제 #3
0
 void CheckForErrors(PreviewShaderData shaderData)
 {
     shaderData.hasError = ShaderUtil.ShaderHasError(shaderData.shader);
     if (shaderData.hasError)
     {
         var messages = ShaderUtil.GetShaderMessages(shaderData.shader);
         if (messages.Length > 0)
         {
             m_Messenger.AddOrAppendError(this, shaderData.node.objectId, messages[0]);
         }
     }
 }
        public void Setup()
        {
            m_EmptyMgr = new MessageManager();

            m_ComplexMgr = new MessageManager();
            m_ComplexMgr.AddOrAppendError(p0, node0, e0);
            m_ComplexMgr.AddOrAppendError(p0, node0, e1);
            m_ComplexMgr.AddOrAppendError(p0, node1, e2);
            m_ComplexMgr.AddOrAppendError(p1, node0, e1);
            m_ComplexMgr.AddOrAppendError(p1, node1, e0);
            m_ComplexMgr.AddOrAppendError(p1, node1, e1);
            m_ComplexMgr.AddOrAppendError(p1, node2, e3);
        }
        public void AddMessage_CreatesMessage()
        {
            m_EmptyMgr.AddOrAppendError(p0, node0, e0);

            var ret = GetListFrom(m_EmptyMgr);

            Assert.IsNotEmpty(ret);
            Assert.AreEqual(node0, ret[0].Key);
            Assert.IsNotEmpty(ret[0].Value);
            Assert.AreEqual(e0, ret[0].Value[0]);
        }