Skip to content

Write ViewArrangement tests #4312

@tig

Description

@tig

Before we fix anything else related to ViewArrangement (e.g. #4308) we must implement a full suite of unit tests for it.

There is one unit test in place now:

    [Theory]
    [InlineData (ViewArrangement.Fixed)]
    [InlineData (ViewArrangement.Overlapped)]
    public void MoveSubViewToEnd_ViewArrangement (ViewArrangement arrangement)
    {
        View superView = new () { Arrangement = arrangement };

        var subview1 = new View
        {
            Id = "subview1"
        };

        var subview2 = new View
        {
            Id = "subview2"
        };

        var subview3 = new View
        {
            Id = "subview3"
        };

        superView.Add (subview1, subview2, subview3);

        superView.MoveSubViewToEnd (subview1);
        Assert.Equal ([subview2, subview3, subview1], superView.SubViews.ToArray ());

        superView.MoveSubViewToEnd (subview2);
        Assert.Equal ([subview3, subview1, subview2], superView.SubViews.ToArray ());

        superView.MoveSubViewToEnd (subview3);
        Assert.Equal ([subview1, subview2, subview3], superView.SubViews.ToArray ());
    }

in SubviewTests.

There's also this:

using System.Text;
using Xunit.Abstractions;

namespace UnitTests_Parallelizable.ViewTests;

public class ArrangementTests (ITestOutputHelper output)
{
    private readonly ITestOutputHelper _output = output;

    // Test that TopResizable and Movable are mutually exclusive and Movable wins
    [Fact]
    public void TopResizableAndMovableMutuallyExclusive ()
    {
      // TODO: Write test.
    }

}

We need a comprehensive set of unit tests (ideally all parallizable) for this functionality.

The actualy arragnment functionality is implemented across:

  • View.Arragnement.cs
  • Border.Arrangement.cs
  • View.Keyboard.cs

With a few references elsewhere.

Step one is to figure out if the current functionality depends on Application or anything else that would prevent tests from running concurrently and fixing that if possible.

Then we should write a set of tests that test the rudimentary methods in Border.Arragnement.cs (making those methods more testsable if needed).

Then move up a level to simulate user mouse and keyboard interactions and different layouts.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

Status

No status

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions