Example #1
0
        public static async Task RunVisualTest(string inputFile, Settings?settings = null,
                                               IList <double>?tracks = null, string?message = null)
        {
            try
            {
                inputFile = $"test-data/visual-tests/{inputFile}";
                var inputFileData =
                    await TestPlatform.LoadFile(inputFile);

                var referenceFileName = TestPlatform.ChangeExtension(inputFile, ".png");
                var score             = ScoreLoader.LoadScoreFromBytes(inputFileData, settings);

                await VisualTestHelper.RunVisualTestScore(score, referenceFileName, settings,
                                                          tracks, message);
            }
            catch (Exception e)
            {
                Assert.Fail($"Failed to run visual test {e}");
            }
        }
Example #2
0
        public static async Task RunVisualTestTex(string tex, string referenceFileName,
                                                  Settings?settings     = null,
                                                  IList <double>?tracks = null, string?message = null)
        {
            try
            {
                if (settings == null)
                {
                    settings = new Settings();
                }

                var importer = new AlphaTexImporter();
                importer.Init(ByteBuffer.FromString(tex), settings);
                var score = importer.ReadScore();

                await VisualTestHelper.RunVisualTestScore(score, referenceFileName, settings,
                                                          tracks, message);
            }
            catch (Exception e)
            {
                Assert.Fail($"Failed to run visual test {e}");
            }
        }