Example #1
0
		protected void SetUp()
		{
			Common.Testing = true;
			RegistryKey myKey = Registry.LocalMachine.OpenSubKey("Software\\Classes\\AutoIt3Script\\Shell\\Run\\Command", false);
			if (myKey != null)
			{
				_autoIt = myKey.GetValue("", "").ToString();
				if (_autoIt.EndsWith(@" ""%1"" %*"))
					_autoIt = _autoIt.Substring(0, _autoIt.Length - 8);
				else if (_autoIt.EndsWith(@" ""%1"""))
					_autoIt = _autoIt.Substring(0, _autoIt.Length - 5);     // Remove "%1" at end
			}
			_scriptPath = PathPart.Bin(Environment.CurrentDirectory, "/XhtmlExport");
			_tf = new TestFiles("XhtmlExport");
			var pwf = Common.PathCombine(Common.GetAllUserAppPath(), "SIL");
			var zf = new FastZip();
			zf.ExtractZip(_tf.Input("Pathway.zip"), pwf, ".*");
		}
Example #2
0
        public void LoadModelWithUnlitMaterial()
        {
            var f = TestFiles
                    .GetSampleModelsPaths()
                    .FirstOrDefault(item => item.EndsWith(@"UnlitTest\glTF-Binary\UnlitTest.glb"));

            var model = ModelRoot.Load(f);

            Assert.NotNull(model);

            Assert.IsTrue(model.LogicalMaterials[0].Unlit);

            // do a model roundtrip
            var modelBis = ModelRoot.ParseGLB(model.WriteGLB());

            Assert.NotNull(modelBis);

            Assert.IsTrue(modelBis.LogicalMaterials[0].Unlit);
        }
Example #3
0
        public static void OutlineFile(IEditorShell editorShell, EditorTestFilesFixture fixture, string name)
        {
            string testFile     = fixture.GetDestinationPath(name);
            string baselineFile = testFile + ".outline";
            string text         = fixture.LoadDestinationFile(name);

            OutlineRegionCollection rc = BuildOutlineRegions(editorShell, text);
            string actual = TextRangeCollectionWriter.WriteCollection(rc);

            if (_regenerateBaselineFiles)
            {
                baselineFile = Path.Combine(fixture.SourcePath, Path.GetFileName(testFile)) + ".outline";
                TestFiles.UpdateBaseline(baselineFile, actual);
            }
            else
            {
                TestFiles.CompareToBaseLine(baselineFile, actual);
            }
        }
Example #4
0
        public void CheckInvalidBinaryFiles()
        {
            var files = TestFiles
                        .GetKhronosValidationPaths()
                        .Where(item => item.EndsWith(".glb"));

            foreach (var f in files)
            {
                var json   = System.IO.File.ReadAllText(f + ".report.json");
                var report = GltfValidator.ValidationReport.Parse(json);

                TestContext.Progress.WriteLine($"{f}...");
                TestContext.WriteLine($"{f}...");

                var result = Schema2.ModelRoot.Validate(f);

                Assert.IsTrue(result.HasErrors == report.Issues.NumErrors > 0);
            }
        }
Example #5
0
        public async Task PreviewAutomatic(string sourceFile)
        {
            _settings.AutomaticSync = true;
            var content      = _files.LoadDestinationFile(sourceFile);
            var baselinePath = Path.Combine(_files.DestinationPath, sourceFile) + ".html";

            using (var script = await _editorHost.StartScript(_services, content, sourceFile, MdContentTypeDefinition.ContentType, _sessionProvider)) {
                script.DoIdle(500);
                var margin  = script.View.Properties.GetProperty <PreviewMargin>(typeof(PreviewMargin));
                var control = margin?.Browser?.Control;
                control.Should().NotBeNull();

                await _services.MainThread().SwitchToAsync();

                var htmlDoc = (HTMLDocument)control.Document;
                var actual  = htmlDoc.documentElement.outerHTML.Replace("\n", "\r\n");
                TestFiles.CompareToBaseLine(baselinePath, actual);
            }
        }
 public void ReadAsTagTest2()
 {
     // read the whole thing as one tag
     byte[] testData = new NbtFile(TestFiles.MakeValueTest()).SaveToBuffer(NbtCompression.None);
     {
         var reader = new NbtReader(new MemoryStream(testData));
         var root   = (NbtCompound)reader.ReadAsTag();
         TestFiles.AssertValueTest(new NbtFile(root));
     }
     {
         // Try the same thing but with end tag skipping disabled
         var reader = new NbtReader(new MemoryStream(testData))
         {
             SkipEndTags = false
         };
         var root = (NbtCompound)reader.ReadAsTag();
         TestFiles.AssertValueTest(new NbtFile(root));
     }
 }
        public void ReadListAsArrayRecast()
        {
            NbtCompound intList = TestFiles.MakeListTest();

            var ms = new MemoryStream();

            new NbtFile(intList).SaveToStream(ms, NbtCompression.None);
            ms.Seek(0, SeekOrigin.Begin);
            var reader = new NbtReader(ms);

            // test bytes as shorts
            reader.ReadToFollowing("ByteList");
            short[] bytes = reader.ReadListAsArray <short>();
            Assert.Equal(bytes,
                         new short[]
            {
                100, 20, 3
            });
        }
Example #8
0
        public void FindDependencyFiles()
        {
            TestContext.CurrentContext.AttachShowDirLink();
            TestContext.CurrentContext.AttachGltfValidatorLinks();

            foreach (var f in TestFiles.GetBabylonJSValidModelsPaths())
            {
                TestContext.WriteLine(f);

                var dependencies = ModelRoot.GetSatellitePaths(f);

                foreach (var d in dependencies)
                {
                    TestContext.WriteLine($"    {d}");
                }

                TestContext.WriteLine();
            }
        }
Example #9
0
        public void LoadGeneratedTangetsTest(string fileName)
        {
            TestContext.CurrentContext.AttachShowDirLink();

            var path = TestFiles.GetSampleModelsPaths().FirstOrDefault(item => item.EndsWith(fileName));

            var model = ModelRoot.Load(path);

            var mesh = model.DefaultScene
                       .EvaluateTriangles <Geometry.VertexTypes.VertexPositionNormalTangent, Geometry.VertexTypes.VertexTexture1>()
                       .ToMeshBuilder(m => m.ToMaterialBuilder());

            var editableScene = new Scenes.SceneBuilder();

            editableScene.AddRigidMesh(mesh, System.Numerics.Matrix4x4.Identity);

            model.AttachToCurrentTest("original.glb");
            editableScene.ToSchema2().AttachToCurrentTest("WithTangents.glb");
        }
Example #10
0
    public void ReloadNonSeekableStream()
    {
        var loadedFile = new NbtFile(TestFiles.Big);

        using var ms  = new MemoryStream();
        using var nss = new NonSeekableStream(ms);

        long bytesWritten = loadedFile.SaveToStream(nss, NbtCompression.None);

        ms.Position = 0;
        Assert.Throws <NotSupportedException>(() => loadedFile.LoadFromStream(nss, NbtCompression.AutoDetect));
        ms.Position = 0;
        Assert.Throws <InvalidDataException>(() => loadedFile.LoadFromStream(nss, NbtCompression.ZLib));
        ms.Position = 0;
        long bytesRead = loadedFile.LoadFromStream(nss, NbtCompression.None);

        Assert.Equal(bytesWritten, bytesRead);
        TestFiles.AssertNbtBigFile(loadedFile);
    }
Example #11
0
        public void LoadTests(IList <string> files)
        {
            if (IsPackageLoaded)
            {
                UnloadTests();
            }

            _events.FireTestsLoading(files);

            TestFiles.Clear();
            TestFiles.AddRange(files);

            TestPackage         = MakeTestPackage(files);
            _lastRunWasDebugRun = false;

            Runner = TestEngine.GetRunner(TestPackage);

            try
            {
                Tests = new TestNode(Runner.Explore(NUnit.Engine.TestFilter.Empty));
            }
            catch (Exception ex)
            {
                _events.FireTestLoadFailure(ex);
                return;
            }

            MapTestsToPackages();
            AvailableCategories = GetAvailableCategories();

            Results.Clear();

            _assemblyWatcher.Setup(1000, files as IList);
            _assemblyWatcher.AssemblyChanged += (path) => _events.FireTestChanged();
            _assemblyWatcher.Start();

            _events.FireTestLoaded(Tests);

            foreach (var subPackage in TestPackage.SubPackages)
            {
                RecentFiles.Latest = subPackage.FullName;
            }
        }
Example #12
0
        public void CheckInvalidJsonFiles()
        {
            var files = TestFiles
                        .GetKhronosValidationPaths()
                        .Where(item => item.EndsWith(".gltf"))
                        .Where(item => item.Contains("\\data\\json\\"));

            foreach (var f in files)
            {
                var report = ValidationReport.Load(f + ".report.json");

                TestContext.Progress.WriteLine($"{f}...");
                TestContext.Write($"{f}...");

                var result = Schema2.ModelRoot.Validate(f);

                Assert.IsTrue(result.HasErrors == report.Issues.NumErrors > 0);
            }
        }
Example #13
0
        public void LoadModelWithMorphTargets()
        {
            TestContext.CurrentContext.AttachShowDirLink();

            var path = TestFiles
                       .GetSampleModelsPaths()
                       .FirstOrDefault(item => item.Contains("MorphPrimitivesTest.glb"));

            var model = ModelRoot.Load(path);

            Assert.NotNull(model);

            var triangles = model.DefaultScene
                            .EvaluateTriangles <Geometry.VertexTypes.VertexPosition, Geometry.VertexTypes.VertexEmpty>(null, 0)
                            .ToArray();

            model.AttachToCurrentTest(System.IO.Path.ChangeExtension(System.IO.Path.GetFileName(path), ".obj"));
            model.AttachToCurrentTest(System.IO.Path.ChangeExtension(System.IO.Path.GetFileName(path), ".glb"));
        }
Example #14
0
        public void TestLoadPolly()
        {
            TestContext.CurrentContext.AttachShowDirLink();

            // load Polly model
            var model = GltfUtils.LoadModel(TestFiles.GetPollyFileModelPath());

            Assert.NotNull(model);

            // Save as GLB, and also evaluate all triangles and save as Wavefront OBJ
            model.AttachToCurrentTest("polly_out.glb");
            model.AttachToCurrentTest("polly_out.obj");

            // hierarchically browse some elements of the model:

            var scene = model.DefaultScene;

            var pollyNode = scene.FindNode("Polly_Display");

            var pollyPrimitive = pollyNode.Mesh.Primitives[0];

            var pollyIndices   = pollyPrimitive.GetIndices();
            var pollyPositions = pollyPrimitive.GetVertices("POSITION").AsVector3Array();
            var pollyNormals   = pollyPrimitive.GetVertices("NORMAL").AsVector3Array();

            for (int i = 0; i < pollyIndices.Count; i += 3)
            {
                var a = (int)pollyIndices[i + 0];
                var b = (int)pollyIndices[i + 1];
                var c = (int)pollyIndices[i + 2];

                var ap = pollyPositions[a];
                var bp = pollyPositions[b];
                var cp = pollyPositions[c];

                var an = pollyNormals[a];
                var bn = pollyNormals[b];
                var cn = pollyNormals[c];

                TestContext.WriteLine($"Triangle {ap} {an} {bp} {bn} {cp} {cn}");
            }
        }
        public void ReadToSiblingTest()
        {
            var reader = new NbtReader(TestFiles.MakeReaderTest());

            Assert.True(reader.ReadToFollowing());
            Assert.Equal("root", reader.TagName);
            Assert.True(reader.ReadToFollowing());
            Assert.Equal("first", reader.TagName);
            Assert.True(reader.ReadToNextSibling("third-comp"));
            Assert.Equal("third-comp", reader.TagName);
            Assert.True(reader.ReadToNextSibling());
            Assert.Equal("fourth-list", reader.TagName);
            Assert.True(reader.ReadToNextSibling());
            Assert.Equal("fifth", reader.TagName);
            Assert.True(reader.ReadToNextSibling());
            Assert.Equal("hugeArray", reader.TagName);
            Assert.False(reader.ReadToNextSibling());
            // Test twice, since we hit different paths through the code
            Assert.False(reader.ReadToNextSibling());
        }
Example #16
0
        public override int Init(object objParam)
        {
            int    ret     = base.Init(objParam);
            string strFile = String.Empty;

            TestFiles.CreateTestFile(ref strFile, EREADER_TYPE.GENERIC);
            TestFiles.CreateTestFile(ref strFile, EREADER_TYPE.XSLT_COPY);
            TestFiles.CreateTestFile(ref strFile, EREADER_TYPE.XMLSCHEMA);
            TestFiles.CreateTestFile(ref strFile, EREADER_TYPE.INVALID_DTD);
            TestFiles.CreateTestFile(ref strFile, EREADER_TYPE.INVALID_NAMESPACE);
            TestFiles.CreateTestFile(ref strFile, EREADER_TYPE.INVALID_SCHEMA);
            TestFiles.CreateTestFile(ref strFile, EREADER_TYPE.INVWELLFORMED_DTD);
            TestFiles.CreateTestFile(ref strFile, EREADER_TYPE.NONWELLFORMED_DTD);
            TestFiles.CreateTestFile(ref strFile, EREADER_TYPE.VALID_DTD);
            TestFiles.CreateTestFile(ref strFile, EREADER_TYPE.WELLFORMED_DTD);
            TestFiles.CreateTestFile(ref strFile, EREADER_TYPE.WHITESPACE_TEST);

            ReaderFactory = new XmlCharCheckingReaderFactory();
            return(ret);
        }
Example #17
0
        public void LoadInvalidModelsFromBabylonJs()
        {
            TestContext.CurrentContext.AttachShowDirLink();
            TestContext.CurrentContext.AttachGltfValidatorLinks();

            foreach (var f in TestFiles.GetBabylonJSInvalidModelsPaths())
            {
                TestContext.Progress.WriteLine(f);

                try
                {
                    var model = ModelRoot.Load(f);
                    Assert.Fail("Should throw");
                }
                catch (Exception ex)
                {
                    TestContext.WriteLine(ex.Message);
                }
            }
        }
        public void ReadToDescendantTest()
        {
            var reader = new NbtReader(TestFiles.MakeReaderTest());

            Assert.True(reader.ReadToDescendant("third-comp"));
            Assert.Equal("third-comp", reader.TagName);
            Assert.True(reader.ReadToDescendant("inComp2"));
            Assert.Equal("inComp2", reader.TagName);
            Assert.False(reader.ReadToDescendant("derp"));
            Assert.Equal("inComp3", reader.TagName);
            reader.ReadToFollowing(); // at fourth-list
            Assert.True(reader.ReadToDescendant("inList2"));
            Assert.Equal("inList2", reader.TagName);

            // Ensure ReadToDescendant returns false when at end-of-stream
            while (reader.ReadToFollowing())
            {
            }
            Assert.False(reader.ReadToDescendant("*"));
        }
Example #19
0
        public void LoadMultiUVTexture()
        {
            TestContext.CurrentContext.AttachShowDirLink();

            var path = TestFiles
                       .GetSampleModelsPaths()
                       .FirstOrDefault(item => item.Contains("TextureTransformMultiTest.glb"));

            var model = ModelRoot.Load(path);

            Assert.NotNull(model);

            var materials = model.LogicalMaterials;

            var normalTest0Mat              = materials.FirstOrDefault(item => item.Name == "NormalTest0Mat");
            var normalTest0Mat_normal       = normalTest0Mat.FindChannel("Normal").Value;
            var normalTest0Mat_normal_xform = normalTest0Mat_normal.TextureTransform;

            Assert.NotNull(normalTest0Mat_normal_xform);
        }
Example #20
0
        public void TestLoadSampleModels(string section)
        {
            TestContext.CurrentContext.AttachShowDirLink();
            TestContext.CurrentContext.AttachGltfValidatorLink();

            foreach (var f in TestFiles.GetSampleModelsPaths())
            {
                if (!f.Contains(section))
                {
                    continue;
                }

                var perf = System.Diagnostics.Stopwatch.StartNew();

                var model = ModelRoot.Load(f);
                Assert.NotNull(model);

                var perf_load = perf.ElapsedMilliseconds;

                // do a model clone and compare it
                _AssertAreEqual(model, model.DeepClone());

                var perf_clone = perf.ElapsedMilliseconds;

                // check extensions used
                if (!model.ExtensionsUsed.Contains("EXT_lights_image_based"))
                {
                    var detectedExtensions = model.RetrieveUsedExtensions().ToArray();
                    CollectionAssert.AreEquivalent(model.ExtensionsUsed, detectedExtensions);
                }

                // evaluate and save all the triangles to a Wavefront Object
                model.AttachToCurrentTest(System.IO.Path.ChangeExtension(System.IO.Path.GetFileName(f), ".obj"));
                var perf_wavefront = perf.ElapsedMilliseconds;

                model.AttachToCurrentTest(System.IO.Path.ChangeExtension(System.IO.Path.GetFileName(f), ".glb"));
                var perf_glb = perf.ElapsedMilliseconds;

                TestContext.Progress.WriteLine($"processed {f.ToShortDisplayPath()} - Load:{perf_load}ms Clone:{perf_clone}ms S.obj:{perf_wavefront}ms S.glb:{perf_glb}ms");
            }
        }
Example #21
0
        private static void FormatFileImplementation(CoreTestFilesFixture fixture, string name, RFormatOptions options)
        {
            string testFile     = fixture.GetDestinationPath(name);
            string baselineFile = testFile + ".formatted";
            string text         = fixture.LoadDestinationFile(name);

            RFormatter formatter = new RFormatter(options);

            string actual = formatter.Format(text);

            if (_regenerateBaselineFiles)
            {
                // Update this to your actual enlistment if you need to update baseline
                baselineFile = Path.Combine(fixture.SourcePath, @"Formatting\", Path.GetFileName(testFile)) + ".formatted";
                TestFiles.UpdateBaseline(baselineFile, actual);
            }
            else
            {
                TestFiles.CompareToBaseLine(baselineFile, actual);
            }
        }
Example #22
0
        public async Task ParseContent_should_decompress_content()
        {
            using (var decrypted = TestFiles.Read("IO.Demo7Pass.Decrypted.bin"))
            {
                var headers = new FileHeaders
                {
                    RandomAlgorithm    = CrsAlgorithm.Salsa20,
                    ProtectedStreamKey = CryptographicBuffer.DecodeFromBase64String(
                        "FDNbUwE9jt6Y9+syU+btBIOGRxYt2tiUqnb6FXWIF1E="),
                };

                var doc = await FileFormat.ParseContent(
                    decrypted, true, headers);

                Assert.NotNull(doc);

                var root = doc.Root;
                Assert.NotNull(root);
                Assert.Equal("KeePassFile", root.Name.LocalName);
            }
        }
Example #23
0
        public unsafe void ReadWithOpenHandle()
        {
            using var cleaner = new TestFileCleaner();
            string cursorPath = cleaner.GetTestPath() + ".cur";

            // Create a handle with read only sharing and leave open
            using FileStream file = new FileStream(cursorPath, FileMode.Create, FileAccess.ReadWrite, FileShare.Read);

            // Write out a valid file
            using (Stream data = TestFiles.GetTestCursor())
            {
                data.CopyTo(file);
            }
            file.Flush();

            // See that we can open a handle on it directly
            using (FileStream file2 = new FileStream(cursorPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { }

            // Try letting the OS read it in
            using (Windows.LoadCursorFromFile(cursorPath)) { };
        }
Example #24
0
        public void LoadModelsWithExtensions(string filePath)
        {
            TestContext.CurrentContext.AttachGltfValidatorLinks();

            filePath = TestFiles
                       .GetSampleModelsPaths()
                       .FirstOrDefault(item => item.EndsWith(filePath));

            var model = ModelRoot.Load(filePath);

            Assert.NotNull(model);

            // do a model clone and compare it
            _AssertAreEqual(model, model.DeepClone());

            // evaluate and save all the triangles to a Wavefront Object

            filePath = System.IO.Path.GetFileNameWithoutExtension(filePath);
            model.AttachToCurrentTest(filePath + "_wf.obj");
            model.AttachToCurrentTest(filePath + ".glb");
            model.AttachToCurrentTest(filePath + ".gltf");
        }
Example #25
0
        public void ReloadTests()
        {
            _events.FireTestsReloading();

            string[] files = TestFiles.ToArray();

            // NOTE: The `ITestRunner.Reload` method supported by the engine
            // has some problems, so we simulate Unload+Load. See issue #328.

            // Replace Runner in case settings changed
            Runner.Unload();
            Runner.Dispose();
            Runner = TestEngine.GetRunner(TestPackage);

            // Discover tests
            Tests = new TestNode(Runner.Explore(TestFilter.Empty));
            AvailableCategories = GetAvailableCategories();

            Results.Clear();

            _events.FireTestReloaded(Tests);
        }
Example #26
0
    public void WriteTagTest()
    {
        using var ms = new MemoryStream();

        var writer = new NbtWriter(ms, "root");

        {
            foreach (NbtTag tag in TestFiles.MakeValueTest().Tags)
            {
                writer.WriteTag(tag);
            }
            writer.EndCompound();
            Assert.True(writer.IsDone);
            writer.Finish();
        }
        ms.Position = 0;
        var  file      = new NbtFile();
        long bytesRead = file.LoadFromBuffer(ms.ToArray(), 0, (int)ms.Length, NbtCompression.None);

        Assert.Equal(bytesRead, ms.Length);
        TestFiles.AssertValueTest(file);
    }
Example #27
0
        public void TestLoadReferenceModels()
        {
            TestContext.CurrentContext.AttachShowDirLink();

            var files = TestFiles.GetReferenceModelPaths();

            foreach (var f in files)
            {
                // var errors = _LoadNumErrorsForModel(f);
                // if (errors > 0) continue;

                try
                {
                    var model = ModelRoot.Load(f);
                    model.AttachToCurrentTest(System.IO.Path.ChangeExtension(System.IO.Path.GetFileName(f), ".obj"));
                }
                catch (IO.UnsupportedExtensionException eex)
                {
                    TestContext.WriteLine($"{f.ToShortDisplayPath()} ERROR: {eex.Message}");
                }
            }
        }
Example #28
0
        public static void OutlineFile(EditorTestFilesFixture fixture, string name)
        {
            string testFile     = fixture.GetDestinationPath(name);
            string baselineFile = testFile + ".outline";
            string text         = fixture.LoadDestinationFile(name);

            OutlineRegionCollection rc = BuildOutlineRegions(text);
            string actual = TextRangeCollectionWriter.WriteCollection(rc);

            if (_regenerateBaselineFiles)
            {
                // Update this to your actual enlistment if you need to update baseline
                string enlistmentPath = @"F:\RTVS\src\R\Editor\Test\Files";
                baselineFile = Path.Combine(enlistmentPath, Path.GetFileName(testFile)) + ".outline";

                TestFiles.UpdateBaseline(baselineFile, actual);
            }
            else
            {
                TestFiles.CompareToBaseLine(baselineFile, actual);
            }
        }
Example #29
0
        private static void ParseFileImplementation(CoreTestFilesFixture fixture, string name)
        {
            string testFile     = fixture.GetDestinationPath(name);
            string baselineFile = testFile + ".tree";
            string text         = fixture.LoadDestinationFile(name);

            AstRoot actualTree = RParser.Parse(text);

            AstWriter astWriter = new AstWriter();
            string    actual    = astWriter.WriteTree(actualTree);

            if (_regenerateBaselineFiles)
            {
                // Update this to your actual enlistment if you need to update baseline
                baselineFile = Path.Combine(fixture.SourcePath, name) + ".tree";
                TestFiles.UpdateBaseline(baselineFile, actual);
            }
            else
            {
                TestFiles.CompareToBaseLine(baselineFile, actual);
            }
        }
Example #30
0
        public static void TestMeshDecodingBounds()
        {
            var modelPath = TestFiles.GetSampleModelsPaths()
                            .FirstOrDefault(item => item.Contains("BrainStem.glb"));

            var model = Schema2.ModelRoot.Load(modelPath);

            var(center, radius) = model.DefaultScene.EvaluateBoundingSphere(0.25f);

            var sceneTemplate = SceneTemplate.Create(model.DefaultScene);
            var sceneInstance = sceneTemplate.CreateInstance();

            sceneInstance.Armature.SetAnimationFrame(0, 0.1f);

            var vertices = sceneInstance.GetWorldVertices(model.LogicalMeshes.Decode()).ToList();

            foreach (var p in vertices)
            {
                var d = (p - center).Length();
                Assert.LessOrEqual(d, radius + 0.0001f);
            }
        }
Example #31
0
        public void LoadAndSaveToMemory()
        {
            var path = TestFiles.GetSampleModelsPaths().FirstOrDefault(item => item.EndsWith("Avocado.glb"));

            var model = ModelRoot.Load(path);
            // model.LogicalImages[0].TransferToSatelliteFile(); // TODO

            // we will use this dictionary as our in-memory model container.
            var dictionary = new Dictionary <string, ArraySegment <Byte> >();

            // write to dictionary
            var wcontext = WriteContext.CreateFromDictionary(dictionary);

            model.Save("avocado.gltf", wcontext);
            Assert.IsTrue(dictionary.ContainsKey("avocado.gltf"));
            Assert.IsTrue(dictionary.ContainsKey("avocado.bin"));

            // read back from dictionary
            var rcontext = ReadContext.CreateFromDictionary(dictionary);
            var model2   = ModelRoot.Load("avocado.gltf", rcontext);

            // TODO: verify
        }
 public void Setup()
 {
     _testFiles = new TestFiles("DictionaryForMIDsConvert");
 }
Example #33
0
 public void SetUp()
 {
     Common.Testing = true;
     _tf = new TestFiles("CssDialog");
 }
Example #34
0
		public void XPathwayDictionarySettingTest()
		{
			_tf = new TestFiles("epubConvert");
			var pwf = Common.PathCombine(Common.GetAllUserAppPath(), "SIL");
			string pathwaySettingFolder = Common.PathCombine(pwf, "Pathway");
			Common.CopyFolderandSubFolder(pathwaySettingFolder, pathwaySettingFolder + "test", true);

			var zfile = new FastZip();
			zfile.ExtractZip(_tf.Input("Pathway.zip"), pwf, ".*");

			LoadParamValue("Dictionary");

			CleanOutputDirectory();
			string inputDataFolder = Common.PathCombine(_inputPath, "DictionarySettingTest");
			string outputDataFolder = Common.PathCombine(_outputPath, "DictionarySettingTest");
			Common.CopyFolderandSubFolder(inputDataFolder, outputDataFolder, true);

			const string xhtmlName = "main.xhtml";
			const string cssName = "main.css";
			var projInfo = new PublicationInformation();
			projInfo.ProjectInputType = "Dictionary";
			projInfo.ProjectPath = outputDataFolder;
			projInfo.DefaultXhtmlFileWithPath = Common.PathCombine(outputDataFolder, xhtmlName);
			projInfo.DefaultCssFileWithPath = Common.PathCombine(outputDataFolder, cssName);
			projInfo.ProjectName = "ABSDictionaryTestCase";
			Common.Testing = true;
			var target = new Exportepub();
			var actual = target.Export(projInfo);

			Common.CopyFolderandSubFolder(pathwaySettingFolder + "test", pathwaySettingFolder, true);


			Assert.IsTrue(actual);


			var result = projInfo.DefaultXhtmlFileWithPath.Replace(".xhtml", ".epub");
			var zf = new FastZip();
			zf.ExtractZip(result, FileOutput("main"), ".*");
			var zfExpected = new FastZip();
			result = Common.PathCombine(_expectedPath, "mainExpected.epub");
			zfExpected.ExtractZip(result, FileOutput("mainExpected"), ".*");

			string expectedFilesPath = FileOutput("mainExpected");
			expectedFilesPath = Common.PathCombine(expectedFilesPath, "OEBPS");
			string[] filesList = Directory.GetFiles(expectedFilesPath);
			foreach (var fileName in filesList)
			{
				var info = new FileInfo(fileName);
				if (info.Extension == ".xhtml" && !info.Name.Contains("File2Cpy"))
				{
					FileCompare("main/OEBPS/" + info.Name, "mainExpected/OEBPS/" + info.Name);
				}
			}
		}
 public void Setup()
 {
     _testFiles = new TestFiles("DictionaryForMIDsConvert");
     Common.ProgInstall = Environment.CurrentDirectory;
 }
Example #36
0
 public void Setup()
 {
     _tf = new TestFiles("Build");
 }
Example #37
0
 public void Setup()
 {
     _testFiles = new TestFiles("GoBibleConvert");
 }