Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
tig committed Mar 16, 2024
2 parents 13ceabb + 214ff12 commit 5ec744f
Show file tree
Hide file tree
Showing 11 changed files with 75 additions and 39 deletions.
34 changes: 17 additions & 17 deletions .github/workflows/dotnet-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,23 @@ jobs:
- name: Test
run: |
sed -i 's/"stopOnFail": false/"stopOnFail": true/g' UnitTests/xunit.runner.json
dotnet test --no-restore --verbosity normal --collect:"XPlat Code Coverage" --settings UnitTests/coverlet.runsettings
mv -v UnitTests/TestResults/*/*.* UnitTests/TestResults/
dotnet test --no-restore --verbosity normal #--collect:"XPlat Code Coverage" --settings UnitTests/coverlet.runsettings
#mv -v UnitTests/TestResults/*/*.* UnitTests/TestResults/
# Note: this step is currently not writing to the gist for some reason
- name: Create Test Coverage Badge
uses: simon-k/dotnet-code-coverage-badge@v1.0.0
id: create_coverage_badge
with:
label: Unit Test Coverage
color: brightgreen
path: UnitTests/TestResults/coverage.opencover.xml
gist-filename: code-coverage.json
# https://gist.github.com/migueldeicaza/90ef67a684cb71db1817921a970f8d27
gist-id: 90ef67a684cb71db1817921a970f8d27
gist-auth-token: ${{ secrets.GIST_AUTH_TOKEN }}
# - name: Create Test Coverage Badge
# uses: simon-k/dotnet-code-coverage-badge@v1.0.0
# id: create_coverage_badge
# with:
# label: Unit Test Coverage
# color: brightgreen
# path: UnitTests/TestResults/coverage.opencover.xml
# gist-filename: code-coverage.json
# # https://gist.github.com/migueldeicaza/90ef67a684cb71db1817921a970f8d27
# gist-id: 90ef67a684cb71db1817921a970f8d27
# gist-auth-token: ${{ secrets.GIST_AUTH_TOKEN }}

- name: Print Code Coverage
run: |
echo "Code coverage percentage: ${{steps.create_coverage_badge.outputs.percentage}}%"
echo "Badge data: ${{steps.create_coverage_badge.outputs.badge}}"
# - name: Print Code Coverage
# run: |
# echo "Code coverage percentage: ${{steps.create_coverage_badge.outputs.percentage}}%"
# echo "Badge data: ${{steps.create_coverage_badge.outputs.badge}}"
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
![Terminal.Gui](https://socialify.git.ci/gui-cs/Terminal.Gui/image?description=1&font=Rokkitt&forks=1&language=1&logo=https%3A%2F%2Fraw.githubusercontent.com%2Fgui-cs%2FTerminal.Gui%2Fdevelop%2Fdocfx%2Fimages%2Flogo.png&name=1&owner=1&pattern=Circuit%20Board&stargazers=1&theme=Auto)
![.NET Core](https://github.com/gui-cs/Terminal.Gui/workflows/.NET%20Core/badge.svg?branch=develop)
![Code scanning - action](https://github.com/gui-cs/Terminal.Gui/workflows/Code%20scanning%20-%20action/badge.svg)
[![Version](https://img.shields.io/nuget/v/Terminal.Gui.svg)](https://www.nuget.org/packages/Terminal.Gui)
![Code Coverage](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/migueldeicaza/90ef67a684cb71db1817921a970f8d27/raw/code-coverage.json)
[![Downloads](https://img.shields.io/nuget/dt/Terminal.Gui)](https://www.nuget.org/packages/Terminal.Gui)
Expand Down Expand Up @@ -34,10 +33,10 @@ dotnet run
## Documentation

* [Documentation Home](https://gui-cs.github.io/Terminal.Gui/index.html)
* [Terminal.Gui Overview](https://gui-cs.github.io/Terminal.Gui/articles/overview.html)
* [List of Views/Controls](https://gui-cs.github.io/Terminal.Gui/articles/views.html)
* [Conceptual Documentation](https://gui-cs.github.io/Terminal.Gui/articles/index.html)
* [API Documentation](https://gui-cs.github.io/Terminal.Gui)
* [Terminal.Gui Overview](https://gui-cs.github.io/Terminal.Gui/docs/overview.html)
* [List of Views/Controls](https://gui-cs.github.io/Terminal.Gui/docs/views.html)
* [Conceptual Documentation](https://gui-cs.github.io/Terminal.Gui/docs/index.html)
* [API Documentation](https://gui-cs.github.io/Terminal.Gui/api/Terminal.Gui)

_The Documentation matches the most recent Nuget release from the `main` branch ([![Version](https://img.shields.io/nuget/v/Terminal.Gui.svg)](https://www.nuget.org/packages/Terminal.Gui))_

Expand Down
4 changes: 2 additions & 2 deletions ReactiveExample/ReactiveExample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<InformationalVersion>1.14.0-pre.1+Branch.develop.Sha.e0b7464669ef87b96b57f2285200e02bcf85d0e7</InformationalVersion>-->
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ReactiveUI.Fody" Version="19.5.39" />
<PackageReference Include="ReactiveUI" Version="19.5.39" />
<PackageReference Include="ReactiveUI.Fody" Version="19.5.41" />
<PackageReference Include="ReactiveUI" Version="19.5.41" />
<PackageReference Include="ReactiveMarbles.ObservableEvents.SourceGenerator" Version="1.3.1" PrivateAssets="all" />
</ItemGroup>
<ItemGroup>
Expand Down
11 changes: 8 additions & 3 deletions Terminal.Gui/Core/View.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2894,9 +2894,14 @@ public virtual bool OnMouseEvent (MouseEvent mouseEvent)
return false;
}

var args = new MouseEventArgs (mouseEvent);
if (OnMouseClick (args))
return true;
if ((mouseEvent.Flags & MouseFlags.Button1Clicked) != 0 || (mouseEvent.Flags & MouseFlags.Button2Clicked) != 0
|| (mouseEvent.Flags & MouseFlags.Button3Clicked) != 0 || (mouseEvent.Flags & MouseFlags.Button4Clicked) != 0) {

var args = new MouseEventArgs (mouseEvent);
if (OnMouseClick (args)) {
return true;
}
}
if (MouseEvent (mouseEvent))
return true;

Expand Down
3 changes: 1 addition & 2 deletions Terminal.Gui/Terminal.Gui.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageTags>csharp, terminal, c#, f#, gui, toolkit, console, tui</PackageTags>
<Description>Cross platform Terminal UI toolkit for .NET</Description>
<Owners>Miguel de Icaza, Tig Kindel</Owners>
<Owners>Tig Kindel</Owners>
<Summary>A toolkit for building rich console apps for .NET that works on Windows, Mac, and Linux/Unix.</Summary>
<Title>Terminal.Gui - Cross platform Terminal User Interface (TUI) toolkit for .NET</Title>
<PackageReleaseNotes>
Expand All @@ -100,7 +100,6 @@
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<EnableSourceLink>true</EnableSourceLink>
<!--<DebugType>Embedded</DebugType>-->
<Authors>Miguel de Icaza, Tig Kindel (@tig), @BDisp</Authors>
<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile>Terminal.Gui.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
Expand Down
4 changes: 1 addition & 3 deletions Terminal.Gui/Views/ListView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -802,8 +802,6 @@ public override bool MouseEvent (MouseEvent me)
selected = top + me.Y;
if (AllowsAll ()) {
Source.SetMark (SelectedItem, !Source.IsMarked (SelectedItem));
SetNeedsDisplay ();
return true;
}
OnSelectedChanged ();
SetNeedsDisplay ();
Expand Down Expand Up @@ -877,7 +875,7 @@ void RenderUstr (ConsoleDriver driver, ustring ustr, int col, int line, int widt
/// <inheritdoc/>
public void Render (ListView container, ConsoleDriver driver, bool marked, int item, int col, int line, int width, int start = 0)
{
var savedClip = container.ClipToBounds();
var savedClip = container.ClipToBounds ();
container.Move (col - start, line);
var t = src? [item];
if (t == null) {
Expand Down
2 changes: 1 addition & 1 deletion UICatalog/UICatalog.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.6" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.2" />
<PackageReference Include="CsvHelper" Version="30.0.1" />
<PackageReference Include="CsvHelper" Version="31.0.0" />
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="3.1.6" />
</ItemGroup>
<ItemGroup>
Expand Down
10 changes: 5 additions & 5 deletions UnitTests/UnitTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
<DefineConstants>TRACE;DEBUG_IDISPOSABLE</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="ReportGenerator" Version="5.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="ReportGenerator" Version="5.2.2" />
<PackageReference Include="System.Collections" Version="4.3.0" />
<PackageReference Include="xunit" Version="2.6.6" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
<PackageReference Include="xunit" Version="2.7.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.7">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.0">
<PackageReference Include="coverlet.collector" Version="6.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
19 changes: 19 additions & 0 deletions UnitTests/Views/ListViewTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -545,5 +545,24 @@ tem 2
tem 3
tem 4", output);
}

[Fact]
public void SelectedItemChanged_Event_Is_Also_Raised_With_AllowsMarking_True_By_Keyboard_Or_Mouse ()
{
var itemChanged = 0;
var lv = new ListView (new List<string> () { "Item1", "Item2", "Item3" }) { Width = 5, Height = 3, AllowsMarking = true };
lv.SelectedItemChanged += (e) => itemChanged = e.Item;

Assert.Equal (0, lv.SelectedItem);
Assert.Equal (lv.SelectedItem, itemChanged);

Assert.True (lv.ProcessKey (new KeyEvent (Key.CursorDown, new KeyModifiers())));
Assert.Equal (1, lv.SelectedItem);
Assert.Equal (lv.SelectedItem, itemChanged);

Assert.True (lv.MouseEvent (new MouseEvent(){ X = 0, Y = 2, Flags = MouseFlags.Button1Clicked}));
Assert.Equal (2, lv.SelectedItem);
Assert.Equal (lv.SelectedItem, itemChanged);
}
}
}
2 changes: 1 addition & 1 deletion UnitTests/Views/ViewDisposalTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using Xunit;
using Xunit.Abstractions;

namespace UnitTests.ViewsTests {
namespace Terminal.Gui.ViewTests {

public class ViewDisposalTest {

Expand Down
16 changes: 16 additions & 0 deletions UnitTests/Views/ViewTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4581,5 +4581,21 @@ public void View_Instance_Use_Attribute_Normal_On_Draw ()
011110
000000", new Attribute [] { Colors.TopLevel.Normal, Colors.TopLevel.Focus });
}

[Theory]
[InlineData (MouseFlags.Button1Pressed, MouseFlags.Button1Released, MouseFlags.Button1Clicked)]
[InlineData (MouseFlags.Button1Pressed | MouseFlags.ButtonCtrl, MouseFlags.Button1Released | MouseFlags.ButtonCtrl, MouseFlags.Button1Clicked | MouseFlags.ButtonCtrl)]
public void OnMouseClick_Is_Only_Raised_Once (MouseFlags pressed, MouseFlags released, MouseFlags clicked)
{
var mouseClicks = 0;
var view = new View ();
view.MouseClick += (_) => mouseClicks++;

view.OnMouseEvent (new MouseEvent () { Flags = pressed });
view.OnMouseEvent (new MouseEvent () { Flags = released });
view.OnMouseEvent (new MouseEvent () { Flags = clicked });

Assert.Equal (1, mouseClicks);
}
}
}

0 comments on commit 5ec744f

Please sign in to comment.