1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-22 14:23:10 +08:00

Add NRT coverage for FileChooserLabelledTextBox

This commit is contained in:
Bartłomiej Dach 2022-06-02 20:36:28 +02:00
parent 11f6190091
commit ec24b32fa6
No known key found for this signature in database
GPG Key ID: BCECCD4FA41F6497

View File

@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
#nullable enable
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
@ -27,10 +29,10 @@ namespace osu.Game.Screens.Edit.Setup
public IEnumerable<string> HandledExtensions => handledExtensions; public IEnumerable<string> HandledExtensions => handledExtensions;
private readonly Bindable<FileInfo> currentFile = new Bindable<FileInfo>(); private readonly Bindable<FileInfo?> currentFile = new Bindable<FileInfo?>();
[Resolved] [Resolved]
private OsuGameBase game { get; set; } private OsuGameBase game { get; set; } = null!;
public FileChooserLabelledTextBox(params string[] handledExtensions) public FileChooserLabelledTextBox(params string[] handledExtensions)
{ {
@ -45,7 +47,7 @@ namespace osu.Game.Screens.Edit.Setup
currentFile.BindValueChanged(onFileSelected); currentFile.BindValueChanged(onFileSelected);
} }
private void onFileSelected(ValueChangedEvent<FileInfo> file) private void onFileSelected(ValueChangedEvent<FileInfo?> file)
{ {
if (file.NewValue == null) if (file.NewValue == null)
return; return;
@ -72,7 +74,7 @@ namespace osu.Game.Screens.Edit.Setup
private class FileChooserPopover : OsuPopover private class FileChooserPopover : OsuPopover
{ {
public FileChooserPopover(string[] handledExtensions, Bindable<FileInfo> currentFile) public FileChooserPopover(string[] handledExtensions, Bindable<FileInfo?> currentFile)
{ {
Child = new Container Child = new Container
{ {