Fix DrawableFlag returns empty texture if there's no flag avaliable for needed country

This commit is contained in:
Andrei Zavatski 2019-09-15 02:33:21 +03:00
parent bc2a1c91a1
commit babd34470e
2 changed files with 8 additions and 1 deletions

View File

@ -61,10 +61,17 @@ public TestSceneRankingsHeader()
FullName = "Belarus"
};
var unknownCountry = new Country
{
FlagName = "CK",
FullName = "Cook Islands"
};
AddStep("Set country", () => countryBindable.Value = country);
AddAssert("Check scope is Performance", () => scope.Value == RankingsScope.Performance);
AddStep("Set scope to Score", () => scope.Value = RankingsScope.Score);
AddAssert("Check country is Null", () => countryBindable.Value == null);
AddStep("Set country with no flag", () => countryBindable.Value = unknownCountry);
}
}
}

View File

@ -26,7 +26,7 @@ private void load(TextureStore ts)
if (ts == null)
throw new ArgumentNullException(nameof(ts));
Texture = ts.Get($@"Flags/{country?.FlagName ?? @"__"}");
Texture = ts.Get($@"Flags/{country?.FlagName ?? @"__"}") ?? ts.Get($@"Flags/__");
}
}
}