ExporterTests.cs 1.2 KB

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