Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Flow.Launcher.Test/Flow.Launcher.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Flow.Launcher\Flow.Launcher.csproj" />
<ProjectReference Include="..\Plugins\Flow.Launcher.Plugin.Calculator\Flow.Launcher.Plugin.Calculator.csproj" />
<ProjectReference Include="..\Plugins\Flow.Launcher.Plugin.Explorer\Flow.Launcher.Plugin.Explorer.csproj" />
<ProjectReference Include="..\Plugins\Flow.Launcher.Plugin.Program\Flow.Launcher.Plugin.Program.csproj" />
Expand Down
36 changes: 36 additions & 0 deletions Flow.Launcher.Test/MouseWheelTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System;
using System.Reflection;
using System.Windows;
using System.Windows.Input;
using System.Windows.Interop;
using Flow.Launcher.Resources.Controls;
using NUnit.Framework;

namespace Flow.Launcher.Test;

[TestFixture]
public class MouseWheelTest
{
[Test]
[RequiresThread(System.Threading.ApartmentState.STA)]
public void Test_Scroll_MouseWheel()
{
var scrollView = new CustomScrollViewerEx();

var mouseDevice = Mouse.PrimaryDevice;
var e = new MouseWheelEventArgs(mouseDevice, Environment.TickCount, 120)
{
RoutedEvent = UIElement.MouseWheelEvent
};

var onMouseWheelMethod = typeof(CustomScrollViewerEx).GetMethod(
"OnMouseWheel",
BindingFlags.NonPublic | BindingFlags.Instance
);

Assert.DoesNotThrow(() =>
{
onMouseWheelMethod.Invoke(scrollView, new object[] { e });
});
Comment thread
Jack251970 marked this conversation as resolved.
}
}
6 changes: 4 additions & 2 deletions Flow.Launcher/Resources/Controls/CustomScrollViewerEx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ public Orientation Orientation
#region AutoHideScrollBars

public static readonly DependencyProperty AutoHideScrollBarsProperty =
ScrollViewerHelper.AutoHideScrollBarsProperty
.AddOwner(
ScrollViewerHelper.AutoHideScrollBarsProperty.AddOwner(
typeof(CustomScrollViewerEx),
new PropertyMetadata(true, OnAutoHideScrollBarsChanged));

Expand Down Expand Up @@ -86,6 +85,9 @@ protected override void OnInitialized(EventArgs e)
/// <inheritdoc/>
protected override void OnMouseWheel(MouseWheelEventArgs e)
{
if (ActualHeight <= 0)
return;

var Direction = GetDirection();
ScrollViewerBehavior.SetIsAnimating(this, true);

Expand Down
Loading