Exemplo n.º 1
0
        public void Halo1TestCOLLADAModelImport()
        {
            // this isn't importing collada files to gbxmodels or anything, just loading the collada file and validating it
            // so that we know the exported file can be imported without error

            var serializer = new System.Xml.Serialization.XmlSerializer(typeof(Render.COLLADA.ColladaFile));

            foreach (var model_def in ModelTestDefinitions)
            {
                string file_path = Path.Combine(kTestTagIndexTagsPath, @"data\");
                file_path = Path.Combine(file_path, Path.GetFileNameWithoutExtension(model_def.Name) + "_all.dae");

                using (var reader = new System.Xml.XmlTextReader(file_path))
                {
                    var collada_file = serializer.Deserialize(reader) as Render.COLLADA.ColladaFile;

                    var validator = new BlamLib.Render.COLLADA.Validation.ColladaFileValidator();

                    validator.ErrorOccured += new EventHandler <BlamLib.Render.COLLADA.ColladaErrorEventArgs>(ValidatorErrorOccured);
                    bool success = validator.ValidateFile(collada_file);
                    validator.ErrorOccured -= new EventHandler <BlamLib.Render.COLLADA.ColladaErrorEventArgs>(ValidatorErrorOccured);

                    if (!success)
                    {
                        Assert.Fail("COLLADA file failed validation");
                    }
                }
            }
        }
Exemplo n.º 2
0
		public void Halo1TestCOLLADAModelImport()
		{
			// this isn't importing collada files to gbxmodels or anything, just loading the collada file and validating it
			// so that we know the exported file can be imported without error

			var serializer = new System.Xml.Serialization.XmlSerializer(typeof(Render.COLLADA.ColladaFile));

			foreach (var model_def in ModelTestDefinitions)
			{
				var file_path = Path.Combine(Path.Combine(kTestInstallationRootPath, kTestDataDir));
				file_path = Path.Combine(file_path, model_def.Name);
				file_path = Path.ChangeExtension(file_path, "dae");
				
				using (var reader = new System.Xml.XmlTextReader(file_path))
				{
					var collada_file = serializer.Deserialize(reader) as Render.COLLADA.ColladaFile;

					var validator = new BlamLib.Render.COLLADA.Validation.ColladaFileValidator();

					validator.ErrorOccured += new EventHandler<BlamLib.Render.COLLADA.ColladaErrorEventArgs>(ValidatorErrorOccured);
					bool success = validator.ValidateFile(collada_file);
					validator.ErrorOccured -= new EventHandler<BlamLib.Render.COLLADA.ColladaErrorEventArgs>(ValidatorErrorOccured);

					if (!success)
						Assert.Fail("COLLADA file failed validation");
				}
			}
		}