Exemplo n.º 1
0
        public void AssembleImagesTest1()
        {
            try
            {
                var          imagePaths     = Directory.GetFiles(Path.Combine(Environment.CurrentDirectory, "InputImages\\new\\NonphotoIndexed")).ToList().AsReadOnly();
                var          packingType    = SpritePackingType_Accessor.Vertical;
                const string mapFileName    = "ReplaceLog.xml";
                var          inputImageList = ArgumentParser.ConvertToInputImageList(imagePaths.ToArray());
                ImageAssembleGenerator_Accessor.AssembleImages(inputImageList.AsReadOnly(), SpritePackingType_Accessor.Vertical, string.Empty, mapFileName, false, new WebGreaseContext(new WebGreaseConfiguration()));
                Assert.IsTrue(ValidateImageGenerationFromLog(mapFileName));
                var separatedList = new List <BitmapContainer_Accessor>();
                foreach (var inputImage in inputImageList)
                {
                    Bitmap bitmap = null;
                    try
                    {
                        bitmap = (Bitmap)Image.FromFile(inputImage.AbsoluteImagePath);
                    }
                    catch
                    {
                        bitmap = null;
                    }

                    separatedList.Add(new BitmapContainer_Accessor(inputImage)
                    {
                        Bitmap = bitmap
                    });
                }

                ImageAssembleBaseTest.ValidateLogFile(separatedList, "combine.png", packingType);
            }
            finally
            {
                var filepath = Path.Combine(Environment.CurrentDirectory, "Combine.png");
                var logpath  = Path.Combine(Environment.CurrentDirectory, "ReplaceLog.xml");
                File.Delete(filepath);
                File.Delete(logpath);
            }
        }