From 42046f64c8da1d2a51718055c88b7dd2f0e45b80 Mon Sep 17 00:00:00 2001 From: dhq_boiler Date: Thu, 16 Feb 2023 01:32:57 +0900 Subject: [PATCH 1/3] bugfix --- boilersGraphics/ViewModels/DiagramViewModel.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/boilersGraphics/ViewModels/DiagramViewModel.cs b/boilersGraphics/ViewModels/DiagramViewModel.cs index 90ade1c7..643c1a1d 100644 --- a/boilersGraphics/ViewModels/DiagramViewModel.cs +++ b/boilersGraphics/ViewModels/DiagramViewModel.cs @@ -3368,6 +3368,11 @@ private int Count(List allViews) /// private void ScanEffectViewModelObjects() { + if (boilersGraphics.App.IsTest) + { + return; + } + App.Current.Dispatcher.BeginInvoke(() => { foreach (var item in AllItems.Value.OrderBy(x => x.ZIndex.Value)) From 541ffcd4470a5e7e455eae64a39ad86fb62a97ef Mon Sep 17 00:00:00 2001 From: dhq_boiler Date: Thu, 16 Feb 2023 01:33:09 +0900 Subject: [PATCH 2/3] fix tests --- boilersGraphics.Test/BoundaryTest.cs | 50 ++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 6 deletions(-) diff --git a/boilersGraphics.Test/BoundaryTest.cs b/boilersGraphics.Test/BoundaryTest.cs index ed406442..85323f46 100644 --- a/boilersGraphics.Test/BoundaryTest.cs +++ b/boilersGraphics.Test/BoundaryTest.cs @@ -1,5 +1,7 @@ using boilersGraphics.ViewModels; +using Moq; using NUnit.Framework; +using Prism.Services.Dialogs; using System; using System.Windows; @@ -8,9 +10,15 @@ namespace boilersGraphics.Test [TestFixture] public class BoundaryTest { - [Test] + [Test, Apartment(System.Threading.ApartmentState.STA)] public void Basic() { + boilersGraphics.App.IsTest = true; + + var dlgService = new Mock(); + MainWindowViewModel mainWindowViewModel = new MainWindowViewModel(dlgService.Object); + var diagramViewModel = new DiagramViewModel(mainWindowViewModel); + var diagrams = new SelectableDesignerItemViewModelBase[] { new NRectangleViewModel(10, 10, 10, 10) @@ -21,9 +29,15 @@ public void Basic() Assert.That(actual, Is.EqualTo(new Rect(10, 10, 10, 10))); } - [Test] + [Test, Apartment(System.Threading.ApartmentState.STA)] public void Rotate_45() { + boilersGraphics.App.IsTest = true; + + var dlgService = new Mock(); + MainWindowViewModel mainWindowViewModel = new MainWindowViewModel(dlgService.Object); + var diagramViewModel = new DiagramViewModel(mainWindowViewModel); + var diagrams = new SelectableDesignerItemViewModelBase[] { new NRectangleViewModel(10, 10, 10, 10, 45) @@ -34,9 +48,15 @@ public void Rotate_45() Assert.That(actual, Is.EqualTo(new Rect(15 - 5 * Math.Sqrt(2), 15 - 5 * Math.Sqrt(2), 10 * Math.Sqrt(2), 10 * Math.Sqrt(2)))); } - [Test] + [Test, Apartment(System.Threading.ApartmentState.STA)] public void Rotate_90() { + boilersGraphics.App.IsTest = true; + + var dlgService = new Mock(); + MainWindowViewModel mainWindowViewModel = new MainWindowViewModel(dlgService.Object); + var diagramViewModel = new DiagramViewModel(mainWindowViewModel); + var diagrams = new SelectableDesignerItemViewModelBase[] { new NRectangleViewModel(10, 10, 10, 10, 90) @@ -47,9 +67,15 @@ public void Rotate_90() Assert.That(actual, Is.EqualTo(new Rect(10, 10, 10, 10))); } - [Test] + [Test, Apartment(System.Threading.ApartmentState.STA)] public void Rotate_180() { + boilersGraphics.App.IsTest = true; + + var dlgService = new Mock(); + MainWindowViewModel mainWindowViewModel = new MainWindowViewModel(dlgService.Object); + var diagramViewModel = new DiagramViewModel(mainWindowViewModel); + var diagrams = new SelectableDesignerItemViewModelBase[] { new NRectangleViewModel(10, 10, 10, 10, 180) @@ -60,9 +86,15 @@ public void Rotate_180() Assert.That(actual, Is.EqualTo(new Rect(10, 10, 10, 10))); } - [Test] + [Test, Apartment(System.Threading.ApartmentState.STA)] public void Multiple_2() { + boilersGraphics.App.IsTest = true; + + var dlgService = new Mock(); + MainWindowViewModel mainWindowViewModel = new MainWindowViewModel(dlgService.Object); + var diagramViewModel = new DiagramViewModel(mainWindowViewModel); + var diagrams = new SelectableDesignerItemViewModelBase[] { new NRectangleViewModel(10, 10, 10, 10), @@ -74,9 +106,15 @@ public void Multiple_2() Assert.That(actual, Is.EqualTo(new Rect(10, 10, 20, 20))); } - [Test] + [Test, Apartment(System.Threading.ApartmentState.STA)] public void Multiple_3() { + boilersGraphics.App.IsTest = true; + + var dlgService = new Mock(); + MainWindowViewModel mainWindowViewModel = new MainWindowViewModel(dlgService.Object); + var diagramViewModel = new DiagramViewModel(mainWindowViewModel); + var diagrams = new SelectableDesignerItemViewModelBase[] { new NRectangleViewModel(10, 10, 10, 10), From e74382fdcc47d41035cfd844be4f97a21f1e9426 Mon Sep 17 00:00:00 2001 From: dhq_boiler Date: Thu, 16 Feb 2023 01:37:47 +0900 Subject: [PATCH 3/3] Update ReleaseNote.md --- ReleaseNote.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ReleaseNote.md b/ReleaseNote.md index 3e89f3b8..e7889bae 100644 --- a/ReleaseNote.md +++ b/ReleaseNote.md @@ -1,6 +1,13 @@ # リリースノート +## v9.0.1 + +### バグフィックス + +* ユニットテスト中に NullReferenceException が発生するバグを修正しました。 +* ユニットテストを修正しました。 + ## v9 ### 新機能