-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement ProgressColor property in ProgressBarHandlers (#600)
* Implement ProgressColor property in ProgressBarHandlers * Add PortHandler attributes * Implemented on WinUI too * Fixed build error * Fixed build errors * Added sample * Fix build error * Delete unnecessary netstandard extensions Co-authored-by: Jonathan Dick <[email protected]>
- Loading branch information
1 parent
16772b0
commit 0a1f603
Showing
17 changed files
with
156 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 19 additions & 3 deletions
22
src/Core/tests/DeviceTests/Handlers/ProgressBar/ProgressBarTests.Android.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,30 @@ | ||
using Microsoft.Maui.Handlers; | ||
using System; | ||
using System.Threading.Tasks; | ||
using Microsoft.Maui.Graphics; | ||
using Microsoft.Maui.Handlers; | ||
using AProgressBar = Android.Widget.ProgressBar; | ||
|
||
namespace Microsoft.Maui.DeviceTests | ||
{ | ||
public partial class ProgressBarHandlerTests | ||
{ | ||
AProgressBar GetNativeProgressBar(ProgressBarHandler progressBarHandler) => | ||
(AProgressBar)progressBarHandler.NativeView; | ||
progressBarHandler.NativeView; | ||
|
||
double GetNativeProgress(ProgressBarHandler progressBarHandler) => | ||
(double)GetNativeProgressBar(progressBarHandler).Progress / ProgressBarExtensions.Maximum; | ||
} | ||
|
||
Task ValidateNativeProgressColor(IProgress progressBar, Color color, Action action = null) => | ||
ValidateHasColor(progressBar, color, action); | ||
|
||
Task ValidateHasColor(IProgress progressBar, Color color, Action action = null) | ||
{ | ||
return InvokeOnMainThreadAsync(() => | ||
{ | ||
var nativeProgressBar = GetNativeProgressBar(CreateHandler(progressBar)); | ||
action?.Invoke(); | ||
nativeProgressBar.AssertContainsColor(color); | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 18 additions & 3 deletions
21
src/Core/tests/DeviceTests/Handlers/ProgressBar/ProgressBarTests.iOS.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,29 @@ | ||
using Microsoft.Maui.Handlers; | ||
using System; | ||
using System.Threading.Tasks; | ||
using Microsoft.Maui.Graphics; | ||
using Microsoft.Maui.Handlers; | ||
using UIKit; | ||
using Xunit; | ||
|
||
namespace Microsoft.Maui.DeviceTests | ||
{ | ||
public partial class ProgressBarHandlerTests | ||
{ | ||
UIProgressView GetNativeProgressBar(ProgressBarHandler progressBarHandler) => | ||
(UIProgressView)progressBarHandler.NativeView; | ||
progressBarHandler.NativeView; | ||
|
||
double GetNativeProgress(ProgressBarHandler progressBarHandler) => | ||
GetNativeProgressBar(progressBarHandler).Progress; | ||
} | ||
|
||
async Task ValidateNativeProgressColor(IProgress progressBar, Color color, Action action = null) | ||
{ | ||
var expected = await GetValueAsync(progressBar, handler => | ||
{ | ||
var native = GetNativeProgressBar(handler); | ||
action?.Invoke(); | ||
return native.ProgressTintColor.ToColor(); | ||
}); | ||
Assert.Equal(expected, color); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters