Initial commit: application ColorPicker (palette, pipette ecran, couleur de dossier)
This commit is contained in:
46
tests/TestHarness.cs
Normal file
46
tests/TestHarness.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
|
||||
namespace ColorPickerApp
|
||||
{
|
||||
internal static class TestHarness
|
||||
{
|
||||
private static void Main(string[] args)
|
||||
{
|
||||
string testDir = Path.Combine(Path.GetTempPath(), "cp_test_" + Guid.NewGuid().ToString("N").Substring(0, 8));
|
||||
Directory.CreateDirectory(testDir);
|
||||
Console.WriteLine("Dossier de test: " + testDir);
|
||||
|
||||
FolderColorizer.ApplyColor(testDir, Color.FromArgb(220, 40, 60));
|
||||
Console.WriteLine("Apres ApplyColor:");
|
||||
foreach (var f in Directory.GetFiles(testDir, "*", SearchOption.TopDirectoryOnly))
|
||||
{
|
||||
Console.WriteLine(" " + f + " attrs=" + File.GetAttributes(f));
|
||||
}
|
||||
Console.WriteLine(" dossier attrs=" + new DirectoryInfo(testDir).Attributes);
|
||||
Console.WriteLine(" HasCustomColor=" + FolderColorizer.HasCustomColor(testDir));
|
||||
|
||||
string iniPath = Path.Combine(testDir, "desktop.ini");
|
||||
Console.WriteLine("--- desktop.ini ---");
|
||||
Console.WriteLine(File.ReadAllText(iniPath));
|
||||
|
||||
string icoPath = Path.Combine(testDir, ".colorpicker_folder.ico");
|
||||
var icoBytes = File.ReadAllBytes(icoPath);
|
||||
Console.WriteLine("Taille .ico: " + icoBytes.Length + " octets, count entries=" + BitConverter.ToUInt16(icoBytes, 4));
|
||||
|
||||
FolderColorizer.RestoreDefault(testDir);
|
||||
Console.WriteLine("Apres RestoreDefault:");
|
||||
foreach (var f in Directory.GetFiles(testDir, "*", SearchOption.TopDirectoryOnly))
|
||||
{
|
||||
Console.WriteLine(" " + f);
|
||||
}
|
||||
Console.WriteLine(" dossier attrs=" + new DirectoryInfo(testDir).Attributes);
|
||||
Console.WriteLine(" HasCustomColor=" + FolderColorizer.HasCustomColor(testDir));
|
||||
Console.WriteLine("Fichiers restants: " + Directory.GetFiles(testDir).Length);
|
||||
|
||||
Directory.Delete(testDir, true);
|
||||
Console.WriteLine("OK - test termine sans exception.");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user