Browse Source

Merge remote-tracking branch 'origin/master' into prototype-integration

flabbet 2 years ago
parent
commit
00684e0cc9

+ 54 - 0
PixiEditor/Properties/AssemblyInfo.cs

@@ -0,0 +1,54 @@
+using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Windows;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("PixiEditor")]
+[assembly: AssemblyDescription("A lighweighted Pixel Art editor.")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("PixiEditor")]
+[assembly: AssemblyProduct("PixiEditor")]
+[assembly: AssemblyCopyright("Copyright PixiEditor © 2017 - 2022")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components.  If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// In order to begin building localizable applications, set
+// <UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
+// inside a <PropertyGroup>.  For example, if you are using US english
+// in your source files, set the <UICulture> to en-US.  Then uncomment
+// the NeutralResourceLanguage attribute below.  Update the "en-US" in
+// the line below to match the UICulture setting in the project file.
+
+// [assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
+
+// ResourceDictionaryLocation.None where theme specific resource dictionaries are located
+// (used if a resource is not found in the page,
+// or application resource dictionaries)
+
+// ResourceDictionaryLocation.SourceAssembly where the generic resource dictionary is located
+// (used if a resource is not found in the page,
+// app, or any theme specific resource dictionaries)
+[assembly: ThemeInfo(
+    ResourceDictionaryLocation.None,
+    ResourceDictionaryLocation.SourceAssembly)
+]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("0.1.9.1")]
+[assembly: AssemblyFileVersion("0.1.9.1")]

+ 82 - 0
PixiEditorTests/ModelsTests/ControllersTests/ShortcutControllerTests.cs

@@ -0,0 +1,82 @@
+using System.Windows.Input;
+using PixiEditor.Helpers;
+using PixiEditor.Models.Controllers;
+using Xunit;
+
+namespace PixiEditorTests.ModelsTests.ControllersTests
+{
+    public class ShortcutControllerTests
+    {
+        //[StaTheory]
+        //[InlineData(Key.A, ModifierKeys.None, Key.A, ModifierKeys.None)]
+        //[InlineData(Key.A, ModifierKeys.Alt, Key.A, ModifierKeys.Alt)]
+        //[InlineData(Key.B, ModifierKeys.Alt | ModifierKeys.Control, Key.B, ModifierKeys.Alt | ModifierKeys.Control)]
+        //public void TestThatShortcutControllerExecutesShortcut(Key shortcutKey, ModifierKeys shortcutModifiers, Key clickedKey, ModifierKeys clickedModifiers)
+        //{
+        //    int result = -1;
+        //    RelayCommand shortcutCommand = new RelayCommand(arg => { result = (int)arg; });
+        //    ShortcutController controller = GenerateStandardShortcutController(shortcutKey, shortcutModifiers, shortcutCommand);
+
+        //    controller.KeyPressed(clickedKey, clickedModifiers);
+        //    Assert.Equal(0, result);
+        //}
+
+        //[StaTheory]
+        //[InlineData(Key.B, ModifierKeys.None, Key.A, ModifierKeys.None)]
+        //[InlineData(Key.A, ModifierKeys.Alt, Key.A, ModifierKeys.None)]
+        //[InlineData(Key.C, ModifierKeys.Alt | ModifierKeys.Control, Key.C, ModifierKeys.Alt | ModifierKeys.Windows)]
+        //public void TestThatShortcutControllerNotExecutesShortcut(Key shortcutKey, ModifierKeys shortcutModifiers, Key clickedKey, ModifierKeys clickedModifiers)
+        //{
+        //    int result = -1;
+        //    RelayCommand shortcutCommand = new RelayCommand(arg => { result = (int)arg; });
+        //    ShortcutController controller = GenerateStandardShortcutController(shortcutKey, shortcutModifiers, shortcutCommand);
+
+        //    controller.KeyPressed(clickedKey, clickedModifiers);
+        //    Assert.Equal(-1, result);
+        //}
+
+        //[StaFact]
+        //public void TestThatShortcutControllerIsBlocked()
+        //{
+        //    int result = -1;
+        //    RelayCommand shortcutCommand = new RelayCommand(arg => { result = (int)arg; });
+
+        //    ShortcutController controller = GenerateStandardShortcutController(Key.A, ModifierKeys.None, shortcutCommand);
+        //    ShortcutController.BlockShortcutExection("Test");
+
+        //    controller.KeyPressed(Key.A, ModifierKeys.None);
+        //    Assert.Equal(-1, result);
+        //}
+
+        //[StaFact]
+        //public void TestThatShortcutControllerPicksCorrectShortcut()
+        //{
+        //    int result = -1;
+        //    RelayCommand shortcutCommand = new RelayCommand(arg => { result = (int)arg; });
+
+        //    ShortcutController controller = GenerateStandardShortcutController(Key.A, ModifierKeys.None, shortcutCommand);
+        //    controller.ShortcutGroups.Add(new ShortcutGroup(string.Empty, new Shortcut(Key.A, shortcutCommand, 1, ModifierKeys.Control)));
+
+        //    controller.KeyPressed(Key.A, ModifierKeys.Control);
+        //    Assert.Equal(1, result);
+        //}
+
+        //[StaFact]
+        //public void TestThatKeyPressedSetsLastShortcut()
+        //{
+        //    ShortcutController controller = GenerateStandardShortcutController(Key.A, ModifierKeys.None, new RelayCommand(parameter => { }));
+
+        //    Assert.Null(controller.LastShortcut);
+        //    controller.KeyPressed(Key.A, ModifierKeys.None);
+        //    Assert.Equal(controller.ShortcutGroups[0].Shortcuts[0], controller.LastShortcut);
+        //}
+
+        //private static ShortcutController GenerateStandardShortcutController(Key shortcutKey, ModifierKeys modifiers, RelayCommand shortcutCommand)
+        //{
+        //    ShortcutController controller = new ShortcutController();
+        //    controller.ShortcutGroups.Add(new ShortcutGroup(string.Empty, new Shortcut(shortcutKey, shortcutCommand, 0, modifiers)));
+        //    ShortcutController.UnblockShortcutExecutionAll();
+        //    return controller;
+        //}
+    }
+}