Skip to content

Commit

Permalink
Foreign typed records: Implement IDisposable
Browse files Browse the repository at this point in the history
  • Loading branch information
badcel committed Aug 18, 2024
1 parent 2952889 commit 19b0ab1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace {Namespace.GetPublicName(record.Namespace)};
// AUTOGENERATED FILE - DO NOT MODIFY
{PlatformSupportAttribute.Render(record as GirModel.PlatformDependent)}
public partial class {name} : GLib.BoxedRecord
public partial class {name} : GLib.BoxedRecord, IDisposable
{{
public {internalHandleName} Handle {{ get; }}
Expand All @@ -49,6 +49,11 @@ System.IntPtr GLib.BoxedRecord.GetHandle()
}}
{FunctionRenderer.Render(record.TypeFunction)}
public void Dispose()
{{
Handle.Dispose();
}}
}}";
}
}
9 changes: 8 additions & 1 deletion src/Tests/Libs/Cairo-1.0.Tests/ContextTest.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
using FluentAssertions;
using System;
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Cairo.Tests;

[TestClass, TestCategory("UnitTest")]
public class ContextTest : Test
{
[TestMethod]
public void ImplementsIDisposable()
{
typeof(Context).Should().Implement<IDisposable>();
}

[TestMethod]
public void BindingsShouldSucceed()
{
Expand Down

0 comments on commit 19b0ab1

Please sign in to comment.