74 lines
2.7 KiB
C#
74 lines
2.7 KiB
C#
using MatterHackers.MatterControl;
|
|
using NUnit.Framework;
|
|
using System;
|
|
using System.IO;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using System.Text;
|
|
using System.Globalization;
|
|
using MatterHackers.MatterControl.SettingsManagement;
|
|
using MatterHackers.Agg.PlatformAbstract;
|
|
using MatterHackers.MatterControl.Tests.Automation;
|
|
|
|
namespace MatterControl.Tests.MatterControl
|
|
{
|
|
class PrinterChooserUnitTests
|
|
{
|
|
[Test, Category("FixNeeded" /* Disabled until MCWS production is updated */)]
|
|
public void PrinterChooserHonorsWhitelist()
|
|
{
|
|
StaticData.Instance = new MatterHackers.Agg.FileSystemStaticData(Path.Combine("..", "..", "..", "..", "StaticData"));
|
|
|
|
MatterControlUtilities.OverrideAppDataLocation();
|
|
|
|
var manufacturers = new string[] { "3D Factory", "3D Stuffmaker", "Airwolf 3D", "BCN", "BeeVeryCreative", "Blue Eagle Labs", "Deezmaker", "FlashForge", "gCreate", "IRA3D", "JumpStart", "Leapfrog", "Lulzbot", "MAKEiT", "Maker's Tool Works", "MakerBot", "MakerGear", "Me3D", "OpenBeam", "Organic Thinking System", "Other", "Portabee", "Printrbot", "PrintSpace", "Revolution 3D Printers", "ROBO 3D", "SeeMeCNC", "Solidoodle", "Tosingraf", "Type A Machines", "Ultimaker", "Velleman", "Wanhao" };
|
|
|
|
var allManufacturers = manufacturers.Select(m => new KeyValuePair<string, string>(m, m)).ToList();
|
|
|
|
BoundDropList dropList;
|
|
|
|
// Whitelist on non-OEM builds should contain all printers
|
|
dropList = new BoundDropList("Test");
|
|
dropList.ListSource = allManufacturers;
|
|
Assert.Greater(dropList.MenuItems.Count, 20);
|
|
|
|
var whitelist = new List<string> { "3D Stuffmaker" };
|
|
|
|
OemSettings.Instance.SetManufacturers(allManufacturers, whitelist);
|
|
|
|
dropList = new BoundDropList("Test");
|
|
dropList.ListSource = OemSettings.Instance.AllOems;
|
|
Assert.AreEqual(1, dropList.MenuItems.Count);
|
|
|
|
whitelist.Add("Airwolf 3D");
|
|
OemSettings.Instance.SetManufacturers(allManufacturers, whitelist);
|
|
|
|
dropList = new BoundDropList("Test");
|
|
dropList.ListSource = OemSettings.Instance.AllOems;
|
|
Assert.AreEqual(2, dropList.MenuItems.Count);
|
|
|
|
/*
|
|
* Disable Esagono tests
|
|
*
|
|
SetPrivatePrinterWhiteListMember(new List<string>() { "Esagono" });
|
|
var manufacturerNameMapping = new ManufacturerNameMapping();
|
|
manufacturerNameMapping.NameOnDisk = "Esagono";
|
|
manufacturerNameMapping.NameToDisplay = "Esagonò";
|
|
printChooser = new PrinterChooser();
|
|
|
|
string expectedItem = null;
|
|
foreach (var menuItem in printChooser.ManufacturerDropList.MenuItems)
|
|
{
|
|
if(menuItem.Text.StartsWith("Esa"))
|
|
{
|
|
expectedItem = menuItem.Text;
|
|
}
|
|
}
|
|
Assert.IsTrue(!string.IsNullOrEmpty(expectedItem) && expectedItem == "Esagonò");
|
|
*/
|
|
}
|
|
|
|
}
|
|
}
|