Skip to content

Commit

Permalink
fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
shimat committed Feb 24, 2024
1 parent 84f17a6 commit 1873f4a
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 69 deletions.
2 changes: 2 additions & 0 deletions OpenCvSharp.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeStyle/Naming/CppNaming/Rules/=Local_0020variables/@EntryIndexedValue">&lt;NamingElement Priority="6"&gt;&lt;Descriptor Static="Indeterminate" Constexpr="Indeterminate" Const="Indeterminate" Volatile="Indeterminate" Accessibility="NOT_APPLICABLE"&gt;&lt;type Name="local variable" /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;&lt;/NamingElement&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CppNaming/Rules/=Parameters/@EntryIndexedValue">&lt;NamingElement Priority="5"&gt;&lt;Descriptor Static="Indeterminate" Constexpr="Indeterminate" Const="Indeterminate" Volatile="Indeterminate" Accessibility="NOT_APPLICABLE"&gt;&lt;type Name="parameter" /&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;&lt;/NamingElement&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=LTRB/@EntryIndexedValue">LTRB</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=LUT/@EntryIndexedValue">LUT</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=PCA/@EntryIndexedValue">PCA</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=QR/@EntryIndexedValue">QR</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=RB/@EntryIndexedValue">RB</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=RNG/@EntryIndexedValue">RNG</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SURF/@EntryIndexedValue">SURF</s:String>
Expand Down
3 changes: 1 addition & 2 deletions test/OpenCvSharp.Tests/core/FileStorageTest.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#nullable enable
using Xunit;
using Xunit;
using Xunit.Abstractions;

namespace OpenCvSharp.Tests.Core;
Expand Down
8 changes: 0 additions & 8 deletions test/OpenCvSharp.Tests/core/Rect2dTest.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
using Xunit;
using Xunit.Abstractions;

namespace OpenCvSharp.Tests.Core;

public class Rect2dTest
{
private readonly ITestOutputHelper testOutputHelper;

public Rect2dTest(ITestOutputHelper testOutputHelper)
{
this.testOutputHelper = testOutputHelper;
}

[Fact]
public void TopLeft()
{
Expand Down
9 changes: 1 addition & 8 deletions test/OpenCvSharp.Tests/core/Rect2fTest.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
using Xunit;
using Xunit.Abstractions;

namespace OpenCvSharp.Tests.Core;

// ReSharper disable once InconsistentNaming
public class Rect2fTest
{
private readonly ITestOutputHelper testOutputHelper;

public Rect2fTest(ITestOutputHelper testOutputHelper)
{
this.testOutputHelper = testOutputHelper;
}

[Fact]
public void TopLeft()
{
Expand Down
8 changes: 0 additions & 8 deletions test/OpenCvSharp.Tests/core/RectTest.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
using Xunit;
using Xunit.Abstractions;

namespace OpenCvSharp.Tests.Core;

public class RectTest
{
private readonly ITestOutputHelper testOutputHelper;

public RectTest(ITestOutputHelper testOutputHelper)
{
this.testOutputHelper = testOutputHelper;
}

[Fact]
public void TopLeft()
{
Expand Down
1 change: 1 addition & 0 deletions test/OpenCvSharp.Tests/core/SizeTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace OpenCvSharp.Tests.Core;
public class SizeTest
{
[Fact]
// ReSharper disable once InconsistentNaming
public void Size2f()
{
var obj = new Size2f(0.5, 0.5);
Expand Down
20 changes: 8 additions & 12 deletions test/OpenCvSharp.Tests/objdetect/HOGDescriptorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,18 @@ public class HOGDescriptorTest : TestBase
[Fact]
public void PropertyCellSize()
{
using (var obj = new HOGDescriptor())
{
Size value = new Size(123, 789);
obj.CellSize = value;
Assert.Equal(value, obj.CellSize);
}
using var obj = new HOGDescriptor();
Size value = new Size(123, 789);
obj.CellSize = value;
Assert.Equal(value, obj.CellSize);
}

[Fact]
public void PropertyWinSize()
{
using (var obj = new HOGDescriptor())
{
Size value = new Size(123, 789);
obj.WinSize = value;
Assert.Equal(value, obj.WinSize);
}
using var obj = new HOGDescriptor();
Size value = new Size(123, 789);
obj.WinSize = value;
Assert.Equal(value, obj.WinSize);
}
}
12 changes: 3 additions & 9 deletions test/OpenCvSharp.Tests/system/AppDomainTest.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#nullable enable

#if NET48
using System;
#if NET48
using System.Globalization;
using System.Security.Policy;
using Xunit;
Expand All @@ -12,10 +9,7 @@ namespace OpenCvSharp.Tests;
public class MarshalByRefAction : MarshalByRefObject
{
public Action? Action { get; set; }
public void Run()
{
Action?.Invoke();
}
public void Run() => Action?.Invoke();
}

[Collection(nameof(AppDomainTest))] // should not be run test in parallel
Expand Down Expand Up @@ -64,7 +58,7 @@ public void Test()
}

// avoid AppDomainUnloadedException on subsequent tests https://codeday.me/jp/qa/20190609/973822.html
System.Threading.Thread.Sleep(TimeSpan.FromSeconds(2));
Thread.Sleep(TimeSpan.FromSeconds(2));
}

private static void RunAtIsolatedDomain(Evidence securityInfo, AppDomainSetup info, Action action)
Expand Down
4 changes: 1 addition & 3 deletions test/OpenCvSharp.Tests/system/WindowsLibraryLoaderTest.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#nullable enable

using OpenCvSharp.Internal;
using OpenCvSharp.Internal;
using Xunit;

namespace OpenCvSharp.Tests;
Expand Down
31 changes: 12 additions & 19 deletions test/OpenCvSharp.Tests/wechat_qrcode/WeChatQRCodeTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,32 @@

namespace OpenCvSharp.Tests.WeChatQRCode;

public class WeChatQRCodeTest : TestBase
public class WeChatQRCodeTest(ITestOutputHelper testOutputHelper) : TestBase
{
const string _wechat_QCODE_detector_prototxt_path = "_data/wechat_qrcode/detect.prototxt";
const string _wechat_QCODE_detector_caffe_model_path = "_data/wechat_qrcode/detect.caffemodel";
const string _wechat_QCODE_super_resolution_prototxt_path = "_data/wechat_qrcode/sr.prototxt";
const string _wechat_QCODE_super_resolution_caffe_model_path = "_data/wechat_qrcode/sr.caffemodel";

private readonly ITestOutputHelper _testOutputHelper;

public WeChatQRCodeTest(ITestOutputHelper testOutputHelper)
{
_testOutputHelper = testOutputHelper;
}
private const string WechatQcodeDetectorPrototxtPath = "_data/wechat_qrcode/detect.prototxt";
private const string WechatQcodeDetectorCaffeModelPath = "_data/wechat_qrcode/detect.caffemodel";
private const string WechatQcodeSuperResolutionPrototxtPath = "_data/wechat_qrcode/sr.prototxt";
private const string WechatQcodeSuperResolutionCaffeModelPath = "_data/wechat_qrcode/sr.caffemodel";

[Fact]
public void WechatQrcodeDecodeRun()
{
Assert.True(File.Exists(_wechat_QCODE_detector_prototxt_path), $"DetectorPrototxt '{_wechat_QCODE_detector_prototxt_path}' not found");
Assert.True(File.Exists(_wechat_QCODE_detector_caffe_model_path), $"DetectorcaffeModel '{_wechat_QCODE_detector_caffe_model_path}' not found");
Assert.True(File.Exists(_wechat_QCODE_super_resolution_prototxt_path), $"SuperResolutionprototxt '{_wechat_QCODE_super_resolution_prototxt_path}' not found");
Assert.True(File.Exists(_wechat_QCODE_super_resolution_caffe_model_path), $"SuperResolutionCaffe_model '{_wechat_QCODE_super_resolution_caffe_model_path}' not found");
Assert.True(File.Exists(WechatQcodeDetectorPrototxtPath), $"DetectorPrototxt '{WechatQcodeDetectorPrototxtPath}' not found");
Assert.True(File.Exists(WechatQcodeDetectorCaffeModelPath), $"DetectorcaffeModel '{WechatQcodeDetectorCaffeModelPath}' not found");
Assert.True(File.Exists(WechatQcodeSuperResolutionPrototxtPath), $"SuperResolutionprototxt '{WechatQcodeSuperResolutionPrototxtPath}' not found");
Assert.True(File.Exists(WechatQcodeSuperResolutionCaffeModelPath), $"SuperResolutionCaffe_model '{WechatQcodeSuperResolutionCaffeModelPath}' not found");

using var wechatQrcode = OpenCvSharp.WeChatQRCode.Create(
_wechat_QCODE_detector_prototxt_path, _wechat_QCODE_detector_caffe_model_path,
_wechat_QCODE_super_resolution_prototxt_path, _wechat_QCODE_super_resolution_caffe_model_path);
WechatQcodeDetectorPrototxtPath, WechatQcodeDetectorCaffeModelPath,
WechatQcodeSuperResolutionPrototxtPath, WechatQcodeSuperResolutionCaffeModelPath);
using var src = Cv2.ImRead(@"_data/image/qr_multi.png", ImreadModes.Grayscale);

wechatQrcode.DetectAndDecode(src, out var rects, out var texts);
Assert.NotEmpty(texts);
Assert.Equal(2, texts.Length);
foreach (var item in texts)
{
_testOutputHelper.WriteLine(item);
testOutputHelper.WriteLine(item);
Assert.NotEmpty(item);
}
}
Expand Down

0 comments on commit 1873f4a

Please sign in to comment.