Skip to content
This repository was archived by the owner on Nov 3, 2023. It is now read-only.

Commit e70c05d

Browse files
decriptorTherzok
authored andcommitted
[Gtk2] Add simple Atk test
1 parent e892b6f commit e70c05d

File tree

4 files changed

+43
-5
lines changed

4 files changed

+43
-5
lines changed

.editorconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ charset = utf-8
99
indent_style = tab
1010
trim_trailing_whitespace = true
1111
max_line_length = 120
12+
end_of_line = lf
1213

1314
# MSBuild
1415
[*.{csproj,proj,projitems,shproj,fsproj,target,props}]

src/Gir.Tests/Gir.Tests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
</Reference>
3434
</ItemGroup>
3535
<ItemGroup>
36+
<Compile Include="Gtk2\Atk\AtkTests.cs" />
3637
<Compile Include="Test.cs" />
3738
<Compile Include="EnumerationTests.cs" />
3839
<Compile Include="GenerationTestBase.cs" />

src/Gir.Tests/Gtk2/Atk/AtkTests.cs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using NUnit.Framework;
2+
3+
namespace Gir.Tests.Gtk2.Atk
4+
{
5+
[TestFixture]
6+
class AtkTests : GenerationTestBase
7+
{
8+
[Test]
9+
public void GenerateAtkAction ()
10+
{
11+
var result = GenerateType (Gtk2Atk1, "Action", true);
12+
13+
Assert.AreEqual (@"using System;
14+
15+
namespace Atk
16+
{
17+
public interface Action
18+
{
19+
bool DoAction (int i);
20+
21+
string GetDescription (int i);
22+
23+
string GetKeybinding (int i);
24+
25+
string GetLocalizedName (int i);
26+
27+
int GetNActions ();
28+
29+
string GetName (int i);
30+
31+
bool SetDescription (int i, string desc);
32+
}
33+
}
34+
", result);
35+
}
36+
}
37+
}

src/Gir/Generation/IGeneratableExtensions.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.IO;
44
using System.Linq;
@@ -88,11 +88,10 @@ public static void GenerateCallableDefinition (this INativeCallable callable, IG
8888

8989
// generate ReturnValue then Parameters
9090
var result = BuildParameters (callable, writer.Options, !callable.IsInstanceCallable (gen, writer.Options));
91-
writer.Write (string.Format ("{0} {1} ({2})", returnType, callable.Name.ToCSharp (), result.TypesAndNames));
91+
writer.Write ($"{returnType} {callable.Name.ToCSharp ()} ({result.TypesAndNames})");
9292

93-
if (gen is Interface)
94-
{
95-
writer.Write(";");
93+
if (gen is Interface) {
94+
writer.Write (";");
9695
writer.WriteLine();
9796
return;
9897
}

0 commit comments

Comments
 (0)