ExporterTests.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using System.IO;
  2. using System.Windows.Media;
  3. using System.Windows.Media.Imaging;
  4. using PixiEditor.Models.DataHolders;
  5. using PixiEditor.Models.IO;
  6. using PixiEditor.Models.Layers;
  7. using PixiEditor.Models.Position;
  8. using Xunit;
  9. namespace PixiEditorTests.ModelsTests.IO
  10. {
  11. public class ExporterTests
  12. {
  13. private const string FilePath = "test.file";
  14. [Fact]
  15. public void TestThatSaveAsPngSavesFile()
  16. {
  17. Exporter.SaveAsPng(FilePath, 10, 10, BitmapFactory.New(10, 10));
  18. Assert.True(File.Exists(FilePath));
  19. File.Delete(FilePath);
  20. }
  21. [Fact]
  22. public void TestThatSaveAsEditableFileSavesPixiFile()
  23. {
  24. Document document = new Document(2, 2);
  25. string filePath = "testFile.pixi";
  26. document.Layers.Add(new Layer("layer1"));
  27. document.Layers[0].SetPixel(new Coordinates(1, 1), Colors.White);
  28. document.Swatches.Add(Colors.White);
  29. Exporter.SaveAsEditableFile(document, filePath);
  30. Assert.True(File.Exists(filePath));
  31. File.Delete(filePath);
  32. }
  33. }
  34. }