mirror of
https://github.com/ivall/xcl.git
synced 2026-11-24 05:14:57 +01:00
Config: title_memory is read in any case (#106)
resolve compared title_memory with "auto" and "advanced" as written, while the manifest's value is lowercased and device_type is compared in any case: title_memory = "Auto" ignored the manifest, "Advanced" got 2048 MiB of unified memory instead of 4095. The value is trimmed and lowercased once. Unit test: "Auto" with an Advanced manifest and "ADVANCED" without one.
This commit is contained in:
@@ -76,6 +76,8 @@ impl Config {
|
||||
pub fn resolve(&mut self, manifest: Option<&crate::manifest::Manifest>) -> Vec<String> {
|
||||
let mut from = Vec::new();
|
||||
let series_s = self.is_series_s();
|
||||
// "Auto" / "Advanced" in xcl.toml: read in any case, as device_type and the manifest (#106)
|
||||
self.title_memory = self.title_memory.trim().to_ascii_lowercase();
|
||||
if self.title_memory == "auto" {
|
||||
let m = manifest.and_then(|m| if series_s { m.lockhart_memory.clone() } else { m.anaconda_memory.clone() });
|
||||
if let Some(m) = &m {
|
||||
@@ -338,6 +340,16 @@ mod tests {
|
||||
assert_eq!((c.title_memory.as_str(), c.title_memory_mb), ("standard", 13_824));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn title_memory_is_read_in_any_case() {
|
||||
let manifest = crate::manifest::Manifest { anaconda_memory: Some("Advanced".into()), ..Default::default() };
|
||||
for (setting, m) in [("Auto", Some(&manifest)), ("ADVANCED", None)] {
|
||||
let mut c = Config { title_memory: setting.into(), ..Config::default() };
|
||||
c.resolve(m);
|
||||
assert_eq!((c.title_memory.as_str(), c.uma_mb), ("advanced", 4095), "{setting}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn raytracing_tier_parsing() {
|
||||
assert_eq!(parse_raytracing_tier("auto"), None);
|
||||
|
||||
Reference in New Issue
Block a user