mirror of
https://github.com/ppy/osu
synced 2025-01-10 08:09:40 +00:00
Move long filename to fixture level
This commit is contained in:
parent
8c772a723f
commit
99236f0ae8
@ -15,6 +15,9 @@ namespace osu.Game.Tests.Database
|
||||
private TestLegacyExporter legacyExporter = null!;
|
||||
private TemporaryNativeStorage storage = null!;
|
||||
|
||||
private const string long_filename =
|
||||
"some file with super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name";
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
@ -30,7 +33,7 @@ namespace osu.Game.Tests.Database
|
||||
const string filename = "normal file name";
|
||||
var item = new TestPathInfo(filename);
|
||||
|
||||
Assert.That(item.Filename.Length, Is.LessThan(TestLegacyExporter.GetMaxPathLength()));
|
||||
Assert.That(item.Filename.Length, Is.LessThan(TestLegacyExporter.MAX_FILENAME_LENGTH));
|
||||
exportItemAndAssert(item, exportStorage, filename);
|
||||
}
|
||||
|
||||
@ -42,7 +45,7 @@ namespace osu.Game.Tests.Database
|
||||
const string filename = "normal file name";
|
||||
var item = new TestPathInfo(filename);
|
||||
|
||||
Assert.That(item.Filename.Length < TestLegacyExporter.GetMaxPathLength(), Is.True);
|
||||
Assert.That(item.Filename.Length < TestLegacyExporter.MAX_FILENAME_LENGTH, Is.True);
|
||||
|
||||
//Export multiple times
|
||||
for (int i = 0; i < 10; i++)
|
||||
@ -57,15 +60,12 @@ namespace osu.Game.Tests.Database
|
||||
{
|
||||
var exportStorage = storage.GetStorageForDirectory(@"exports");
|
||||
|
||||
const string fullname =
|
||||
"some file with super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name";
|
||||
int expectedLength = TestLegacyExporter.MAX_FILENAME_LENGTH - (legacyExporter.GetExtension().Length);
|
||||
string expectedName = long_filename.Remove(expectedLength);
|
||||
|
||||
int expectedLength = TestLegacyExporter.GetMaxPathLength() - (legacyExporter.GetExtension().Length);
|
||||
string expectedName = fullname.Remove(expectedLength);
|
||||
var item = new TestPathInfo(long_filename);
|
||||
|
||||
var item = new TestPathInfo(fullname);
|
||||
|
||||
Assert.That(item.Filename.Length > TestLegacyExporter.GetMaxPathLength(), Is.True);
|
||||
Assert.That(item.Filename.Length > TestLegacyExporter.MAX_FILENAME_LENGTH, Is.True);
|
||||
exportItemAndAssert(item, exportStorage, expectedName);
|
||||
}
|
||||
|
||||
@ -74,15 +74,12 @@ namespace osu.Game.Tests.Database
|
||||
{
|
||||
var exportStorage = storage.GetStorageForDirectory(@"exports");
|
||||
|
||||
const string fullname =
|
||||
"some file with super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name super long name";
|
||||
int expectedLength = TestLegacyExporter.MAX_FILENAME_LENGTH - (legacyExporter.GetExtension().Length);
|
||||
string expectedName = long_filename.Remove(expectedLength);
|
||||
|
||||
int expectedLength = TestLegacyExporter.GetMaxPathLength() - (legacyExporter.GetExtension().Length);
|
||||
string expectedName = fullname.Remove(expectedLength);
|
||||
var item = new TestPathInfo(long_filename);
|
||||
|
||||
var item = new TestPathInfo(fullname);
|
||||
|
||||
Assert.That(item.Filename.Length > TestLegacyExporter.GetMaxPathLength(), Is.True);
|
||||
Assert.That(item.Filename.Length > TestLegacyExporter.MAX_FILENAME_LENGTH, Is.True);
|
||||
|
||||
//Export multiple times
|
||||
for (int i = 0; i < 10; i++)
|
||||
@ -123,8 +120,6 @@ namespace osu.Game.Tests.Database
|
||||
{
|
||||
}
|
||||
|
||||
public static int GetMaxPathLength() => MAX_FILENAME_LENGTH;
|
||||
|
||||
public string GetExtension() => FileExtension;
|
||||
|
||||
protected override string FileExtension => ".ots";
|
||||
|
Loading…
Reference in New Issue
Block a user