aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.UnitTesting
diff options
context:
space:
mode:
authorVictoria Plitt <Victoria.Plitt@twine-s.com>2019-05-12 18:14:51 +0300
committerVictoria Plitt <Victoria.Plitt@twine-s.com>2019-05-12 18:14:51 +0300
commit9ce2c2bf189f30ed39d0b8d9317a6f4a91b747ed (patch)
tree1c94b2aee8c556547fff695138143eaa946ec386 /Software/Visual_Studio/Tango.UnitTesting
parent97f31af8f7659e186c1b31dd4fe53f1e04376d9d (diff)
parent8d58d0b03648069600f8abf39dbe68b16c90559b (diff)
downloadTango-9ce2c2bf189f30ed39d0b8d9317a6f4a91b747ed.tar.gz
Tango-9ce2c2bf189f30ed39d0b8d9317a6f4a91b747ed.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/Tango.UnitTesting')
-rw-r--r--Software/Visual_Studio/Tango.UnitTesting/Pulse/Pulse_TST.cs42
-rw-r--r--Software/Visual_Studio/Tango.UnitTesting/SendGrid/SendGrid_TST.cs29
2 files changed, 46 insertions, 25 deletions
diff --git a/Software/Visual_Studio/Tango.UnitTesting/Pulse/Pulse_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/Pulse/Pulse_TST.cs
index 073841997..65bb31208 100644
--- a/Software/Visual_Studio/Tango.UnitTesting/Pulse/Pulse_TST.cs
+++ b/Software/Visual_Studio/Tango.UnitTesting/Pulse/Pulse_TST.cs
@@ -82,5 +82,47 @@ namespace Tango.UnitTesting.Pulse
Helper.ShowInExplorer(imgFile);
}
+
+ [TestMethod]
+ public void Create_Twn_Sample_File()
+ {
+ String abcFile = Path.Combine(Helper.GetResourcePath(), "Pulse", "ABC.dst");
+
+ TwnFile twnFile = new TwnFile();
+ twnFile.Name = "My design";
+ twnFile.NumberOfCopies = 1;
+ twnFile.MediaID = 0;
+ twnFile.SpoolingMethod = SpoolingMethods.SpoolPerSegment;
+
+ Bitmap thumbnail = new Bitmap(1280, 720);
+ using (Graphics g = Graphics.FromImage(thumbnail))
+ {
+ g.Clear(Color.Gray);
+ g.DrawString("My design", new Font(new FontFamily("Arial"), 70), Brushes.Red, 1280 / 2, 720 / 2);
+ }
+ twnFile.Thumbnail = thumbnail;
+
+ twnFile.EmbroideryFileFormat = "dst";
+ twnFile.EmbroideryFile = File.ReadAllBytes(abcFile);
+
+ //Add gradient segment.
+ TwnSegment gradientSegment = new TwnSegment();
+ gradientSegment.Length = 100 * 10; //10 meters.
+ gradientSegment.BrushStops.Add(new TwnStop(255, 0, 0, 0)); //0%
+ gradientSegment.BrushStops.Add(new TwnStop(0, 0, 255, 1)); //100%
+ twnFile.Segments.Add(gradientSegment);
+
+ //Add solid segment.
+ TwnSegment solidSegment = new TwnSegment();
+ solidSegment.Length = 100 * 20; //20 meters.
+ solidSegment.BrushStops.Add(new TwnStop(0, 255, 0, 0));
+ twnFile.Segments.Add(solidSegment);
+
+ var twnFilePath = TemporaryManager.Default.CreateFile(".twn");
+
+ twnFile.ToFile(twnFilePath);
+
+ twnFilePath.Display();
+ }
}
}
diff --git a/Software/Visual_Studio/Tango.UnitTesting/SendGrid/SendGrid_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/SendGrid/SendGrid_TST.cs
index 9465676ef..ca0ba1143 100644
--- a/Software/Visual_Studio/Tango.UnitTesting/SendGrid/SendGrid_TST.cs
+++ b/Software/Visual_Studio/Tango.UnitTesting/SendGrid/SendGrid_TST.cs
@@ -50,26 +50,12 @@ namespace Tango.UnitTesting.SendGrid
msg.Subject = "SnapMatch Color Result";
msg.SetTemplateId("d-619b8adc604d4f6fa486d7bbc9e3c2cc");
- Bitmap rect = new Bitmap(80, 80);
- using (Graphics g = Graphics.FromImage(rect))
+ var dynamicTemplateData = new
{
- g.Clear(Color.FromArgb(255, 0, 0));
- }
-
- String image64 = String.Empty;
-
- using (MemoryStream ms = new MemoryStream())
- {
- rect.Save(ms, ImageFormat.Jpeg);
- ms.Position = 0;
- image64 = Convert.ToBase64String(ms.ToArray());
- }
-
- var dynamicTemplateData = new ExampleTemplateData
- {
- Name = "Roy",
Message = "This is my personal note...",
- ImageSource = image64,
+ R = 0,
+ G = 255,
+ B = 0,
};
msg.SetTemplateData(dynamicTemplateData);
@@ -86,12 +72,5 @@ namespace Tango.UnitTesting.SendGrid
Assert.IsTrue(result.StatusCode == HttpStatusCode.Accepted);
}
-
- public class ExampleTemplateData
- {
- public String Name { get; set; }
- public String ImageSource { get; set; }
- public String Message { get; set; }
- }
}
}