Esempio n. 1
0
        /// <summary>
        /// Save the image locally or on the server.
        /// </summary>
        /// <param name="textureToSave">The texture to save.</param>
        /// <param name="frameIndex">The index of the frame.</param>
        public void SaveImage(Texture textureToSave, int frameIndex)
        {
            if (textureToSave == null)
            {
                return;
            }

            Console.WriteLine(@"Saving non null image");
            var testName = NUnit.Framework.TestContext.CurrentContext.Test.FullName;

            if (saveLocally)
            {
                Console.WriteLine(@"saving locally.");
                using (var image = textureToSave.GetDataAsImage())
                {
                    var textureName = testName + "_" + PlatformPermutator.GetCurrentPlatformName();
                    using (var resultFileStream = File.OpenWrite(FileNameGenerator.GetFileName(textureName)))
                    {
                        image.Save(resultFileStream, ImageFileType.Png);
                    }
                }
            }
            else if (client != null)
            {
                Console.WriteLine(@"saving remotely.");
                using (var image = textureToSave.GetDataAsImage())
                {
                    try
                    {
                        SendImage(image, currentDevice.Serial, testName, frameIndex);
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(@"An error occured when trying to send the data to the server.");
                    }
                }
            }
        }
Esempio n. 2
0
 public override string ToString()
 {
     return(Name + " " + Serial + " " + PlatformPermutator.GetPlatformName(Platform));
 }
Esempio n. 3
0
 /// <summary>
 /// Get the name of the base image to compare the generated images to.
 /// </summary>
 /// <param name="platform">The platform the test is performed on.</param>
 /// <param name="deviceName">The name of the device.</param>
 /// <returns>The name of the file.</returns>
 public string GenerateBaseFileNameFromVersion(TestPlatform platform, string deviceName)
 {
     return(this.GetType().Name + @"_" + PlatformPermutator.GetPlatformName(platform) + @"_" + deviceName + @"_v" + BaseVersionNumber + @".png");
 }