File tree 4 files changed +58
-0
lines changed
tests/Magick.NET.Tests/ResourceLimitsTests 4 files changed +58
-0
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,11 @@ public interface IResourceLimits
36
36
/// </summary>
37
37
ulong MaxMemoryRequest { get ; set ; }
38
38
39
+ /// <summary>
40
+ /// Gets or sets the max size of a profile in bytes that can be added to the image.
41
+ /// </summary>
42
+ ulong MaxProfileSize { get ; set ; }
43
+
39
44
/// <summary>
40
45
/// Gets or sets the pixel cache limit in bytes. Once this memory limit is exceeded, all subsequent pixels cache
41
46
/// operations are to/from disk. The default value of this is 50% of the available memory on the machine in 64-bit mode.
Original file line number Diff line number Diff line change @@ -32,6 +32,11 @@ private partial class NativeResourceLimits
32
32
[ Throws ]
33
33
public static partial void MaxMemoryRequest_Set ( ulong value ) ;
34
34
35
+ public static partial ulong MaxProfileSize_Get ( ) ;
36
+
37
+ [ Throws ]
38
+ public static partial void MaxProfileSize_Set ( ulong value ) ;
39
+
35
40
public static partial ulong Memory_Get ( ) ;
36
41
37
42
public static partial void Memory_Set ( ulong value ) ;
Original file line number Diff line number Diff line change @@ -56,6 +56,15 @@ public static ulong MaxMemoryRequest
56
56
set => NativeResourceLimits . MaxMemoryRequest_Set ( value ) ;
57
57
}
58
58
59
+ /// <summary>
60
+ /// Gets or sets the max size of a profile in bytes that can be added to the image.
61
+ /// </summary>
62
+ public static ulong MaxProfileSize
63
+ {
64
+ get => NativeResourceLimits . MaxProfileSize_Get ( ) ;
65
+ set => NativeResourceLimits . MaxProfileSize_Set ( value ) ;
66
+ }
67
+
59
68
/// <summary>
60
69
/// Gets or sets the pixel cache limit in bytes. Once this memory limit is exceeded, all subsequent pixels cache
61
70
/// operations are to/from disk. The default value of this is 50% of the available memory on the machine in 64-bit mode.
@@ -151,6 +160,15 @@ ulong IResourceLimits.MaxMemoryRequest
151
160
set => MaxMemoryRequest = value ;
152
161
}
153
162
163
+ /// <summary>
164
+ /// Gets or sets the max size of a profile in bytes that can be added to the image.
165
+ /// </summary>
166
+ ulong IResourceLimits . MaxProfileSize
167
+ {
168
+ get => MaxProfileSize ;
169
+ set => MaxProfileSize = value ;
170
+ }
171
+
154
172
/// <summary>
155
173
/// Gets or sets the pixel cache limit in bytes. Once this memory limit is exceeded, all subsequent pixels cache
156
174
/// operations are to/from disk. The default value of this is 50% of the available memory on the machine in 64-bit mode.
Original file line number Diff line number Diff line change
1
+ // Copyright Dirk Lemstra https://github.com/dlemstra/Magick.NET.
2
+ // Licensed under the Apache License, Version 2.0.
3
+
4
+ using ImageMagick ;
5
+ using Xunit ;
6
+
7
+ namespace Magick . NET . Tests ;
8
+
9
+ public partial class ResourceLimitsTests
10
+ {
11
+ [ Collection ( nameof ( RunTestsSeparately ) ) ]
12
+ public class TheMaxProfileSizePropertry
13
+ {
14
+ [ Fact ]
15
+ public void ShouldHaveTheCorrectValue ( )
16
+ {
17
+ Assert . Equal ( ( ulong ) long . MaxValue , ResourceLimits . MaxProfileSize ) ;
18
+ }
19
+
20
+ [ Fact ]
21
+ public void ShouldReturnTheCorrectValueWhenChanged ( )
22
+ {
23
+ var maxProfileSize = ResourceLimits . MaxProfileSize ;
24
+
25
+ ResourceLimits . MaxProfileSize = 42U ;
26
+ Assert . Equal ( 42U , ResourceLimits . MaxProfileSize ) ;
27
+ ResourceLimits . MaxProfileSize = maxProfileSize ;
28
+ }
29
+ }
30
+ }
You can’t perform that action at this time.
0 commit comments