Skip to content

Commit

Permalink
Merge branch 'feature/performance_tuning' into feature/sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
Haruma-K committed Jan 18, 2024
2 parents 79a306f + 4273d6e commit def3342
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void CreateEntry()
var service = new ApplyLayoutRuleService(layoutRule, new UnityVersionExpressionParser(),
addressableSettingsAdapter, assetDatabaseAdapter);

var result = service.TryAddEntry(assetGuid, true);
var result = service.TryAddEntry(assetGuid, true, false);
var assetEntry = addressableSettingsAdapter.FindAssetEntry(assetGuid);
Assert.That(result, Is.True);
Assert.That(assetEntry, Is.Not.Null);
Expand All @@ -61,7 +61,7 @@ public void PreSetup()
addressableSettingsAdapter, assetDatabaseAdapter);

service.Setup();
var result = service.TryAddEntry(assetGuid, false);
var result = service.TryAddEntry(assetGuid, false, false);
var assetEntry = addressableSettingsAdapter.FindAssetEntry(assetGuid);
Assert.That(result, Is.True);
Assert.That(assetEntry, Is.Not.Null);
Expand All @@ -84,7 +84,7 @@ public void MatchedLayoutRuleNotExists_ReturnFalse()
var service = new ApplyLayoutRuleService(layoutRule, new UnityVersionExpressionParser(),
addressableSettingsAdapter, assetDatabaseAdapter);

var result = service.TryAddEntry(assetGuid, true);
var result = service.TryAddEntry(assetGuid, true, false);
Assert.That(result, Is.False);
}

Expand All @@ -103,7 +103,7 @@ public void GroupIsNull_ReturnFalse()
var service = new ApplyLayoutRuleService(layoutRule, new UnityVersionExpressionParser(),
addressableSettingsAdapter, assetDatabaseAdapter);

var result = service.TryAddEntry(assetGuid, true);
var result = service.TryAddEntry(assetGuid, true, false);
Assert.That(result, Is.False);
}

Expand All @@ -122,7 +122,7 @@ public void VersionIsSatisfied()
var service = new ApplyLayoutRuleService(layoutRule, new UnityVersionExpressionParser(),
addressableSettingsAdapter, assetDatabaseAdapter);

var result = service.TryAddEntry(assetGuid, true, "[1.2.3,1.2.4)");
var result = service.TryAddEntry(assetGuid, true, false, "[1.2.3,1.2.4)");
var assetEntry = addressableSettingsAdapter.FindAssetEntry(assetGuid);
Assert.That(result, Is.True);
Assert.That(assetEntry, Is.Not.Null);
Expand All @@ -145,7 +145,7 @@ public void VersionIsNotSatisfied_ReturnFalse()
var service = new ApplyLayoutRuleService(layoutRule, new UnityVersionExpressionParser(),
addressableSettingsAdapter, assetDatabaseAdapter);

var result = service.TryAddEntry(assetGuid, true, "(1.2.3,1.3)");
var result = service.TryAddEntry(assetGuid, true, false, "(1.2.3,1.3)");
Assert.That(result, Is.False);
}

Expand All @@ -164,7 +164,7 @@ public void InvalidVersionExpression_Exception()
var service = new ApplyLayoutRuleService(layoutRule, new UnityVersionExpressionParser(),
addressableSettingsAdapter, assetDatabaseAdapter);

Assert.That(() => service.TryAddEntry(assetGuid, true, "(1.2.3, 1.3)"), Throws.InstanceOf<Exception>());
Assert.That(() => service.TryAddEntry(assetGuid, true, false, "(1.2.3, 1.3)"), Throws.InstanceOf<Exception>());
}

[Test]
Expand All @@ -183,7 +183,7 @@ public void SetLabel()
var service = new ApplyLayoutRuleService(layoutRule, new UnityVersionExpressionParser(),
addressableSettingsAdapter, assetDatabaseAdapter);

var result = service.TryAddEntry(assetGuid, true);
var result = service.TryAddEntry(assetGuid, true, false);
var assetEntry = addressableSettingsAdapter.FindAssetEntry(assetGuid);
Assert.That(result, Is.True);
Assert.That(assetEntry, Is.Not.Null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public IAddressableAssetEntryAdapter FindAssetEntry(string guid)
}

/// <inheritdoc />
public IAddressableAssetEntryAdapter CreateOrMoveEntry(string groupName, string guid)
public IAddressableAssetEntryAdapter CreateOrMoveEntry(string groupName, string guid, bool invokeModificationEvent)
{
if (_guidToEntryMap.TryGetValue(guid, out var entry))
{
Expand All @@ -36,12 +36,12 @@ public IAddressableAssetEntryAdapter CreateOrMoveEntry(string groupName, string
}

/// <inheritdoc />
public bool RemoveEntry(string guid)
public bool RemoveEntry(string guid, bool invokeModificationEvent)
{
return _guidToEntryMap.Remove(guid);
}

public void RemoveAllEntries(string groupName)
public void RemoveAllEntries(string groupName, bool invokeModificationEvent)
{
var targetGuids = _guidToEntryMap
.Values
Expand All @@ -52,6 +52,11 @@ public void RemoveAllEntries(string groupName)
_guidToEntryMap.Remove(guid);
}

public void InvokeBatchModificationEvent()
{
// Do nothing when testing.
}

/// <inheritdoc />
public IReadOnlyList<string> GetLabels()
{
Expand Down

0 comments on commit def3342

Please sign in to comment.