зеркало из https://github.com/mozilla/gecko-dev.git
Bug 950546 - Make color analyzer deterministic by breaking ties via comparing original colors. r=MattN
This commit is contained in:
Родитель
b9fc69218b
Коммит
6406460888
|
@ -119,7 +119,7 @@ onmessage = function(event) {
|
|||
|
||||
// only send back the most desirable colors
|
||||
mergedColors.sort(function(a, b) {
|
||||
return b.desirability - a.desirability;
|
||||
return b.desirability != a.desirability ? b.desirability - a.desirability : b.color - a.color;
|
||||
});
|
||||
mergedColors = mergedColors.map(function(metadata) {
|
||||
return metadata.color;
|
||||
|
@ -216,7 +216,7 @@ function mergeColors(colorFrequencies, numPixels, threshold) {
|
|||
}
|
||||
|
||||
function descendingFreqSort(a, b) {
|
||||
return b.freq - a.freq;
|
||||
return b.freq != a.freq ? b.freq - a.freq : b.color - a.color;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -330,13 +330,13 @@ tests.push(function test_categoryDiscover() {
|
|||
});
|
||||
|
||||
tests.push(function test_localeGeneric() {
|
||||
frcTest(filePrefix + "localeGeneric.png", 0x00A400,
|
||||
"localeGeneric analysis returns orange");
|
||||
frcTest(filePrefix + "localeGeneric.png", 0x3EC23E,
|
||||
"localeGeneric analysis returns green");
|
||||
});
|
||||
|
||||
tests.push(function test_dictionaryGeneric() {
|
||||
frcTest(filePrefix + "dictionaryGeneric-16.png", 0x502E1E,
|
||||
"dictionaryGeneric-16 analysis returns blue");
|
||||
frcTest(filePrefix + "dictionaryGeneric-16.png", 0x854C30,
|
||||
"dictionaryGeneric-16 analysis returns brown");
|
||||
});
|
||||
|
||||
tests.push(function test_extensionGeneric() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче