Remove the colour range function as it will not be used
This commit is contained in:
@@ -150,36 +150,6 @@ def hexToInt(value, default=0):
|
|||||||
return default
|
return default
|
||||||
return default
|
return default
|
||||||
|
|
||||||
def colRange(rgbStart, rgbEnd, nStep):
|
|
||||||
"""Generate a range of colours from one RGB value to another.
|
|
||||||
"""
|
|
||||||
if len(rgbStart) != 3 and len(rgbEnd) != 3 and nStep < 1:
|
|
||||||
logger.error("Cannot create colour range from given parameters")
|
|
||||||
return None
|
|
||||||
|
|
||||||
if nStep == 1:
|
|
||||||
return rgbStart
|
|
||||||
elif nStep == 2:
|
|
||||||
return [rgbStart, rgbEnd]
|
|
||||||
|
|
||||||
dC = [0, 0, 0]
|
|
||||||
for c in range(3):
|
|
||||||
cA = rgbStart[c]
|
|
||||||
cB = rgbEnd[c]
|
|
||||||
dC[c] = (cB-cA)/(nStep-1)
|
|
||||||
|
|
||||||
retCol = [rgbStart]
|
|
||||||
for n in range(nStep):
|
|
||||||
if n > 0 and n < nStep:
|
|
||||||
retCol.append([
|
|
||||||
int(retCol[n-1][0] + dC[0]),
|
|
||||||
int(retCol[n-1][1] + dC[1]),
|
|
||||||
int(retCol[n-1][2] + dC[2]),
|
|
||||||
])
|
|
||||||
retCol[-1] = rgbEnd
|
|
||||||
|
|
||||||
return retCol
|
|
||||||
|
|
||||||
def formatInt(theInt):
|
def formatInt(theInt):
|
||||||
"""Formats an integer with k, M, G etc.
|
"""Formats an integer with k, M, G etc.
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import time
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from nw.common import (
|
from nw.common import (
|
||||||
checkString, checkBool, checkInt, colRange, formatInt, transferCase,
|
checkString, checkBool, checkInt, formatInt, transferCase,
|
||||||
fuzzyTime, checkHandle, formatTimeStamp, formatTime, hexToInt,
|
fuzzyTime, checkHandle, formatTimeStamp, formatTime, hexToInt,
|
||||||
makeFileNameSafe, isHandle, isTitleTag, isItemClass, isItemType,
|
makeFileNameSafe, isHandle, isTitleTag, isItemClass, isItemType,
|
||||||
isItemLayout, numberToRoman
|
isItemLayout, numberToRoman
|
||||||
@@ -191,34 +191,6 @@ def testBaseCommon_HexToInt():
|
|||||||
|
|
||||||
# END Test testBaseCommon_HexToInt
|
# END Test testBaseCommon_HexToInt
|
||||||
|
|
||||||
@pytest.mark.base
|
|
||||||
def testBaseCommon_ColRange():
|
|
||||||
"""Test the colRange function.
|
|
||||||
"""
|
|
||||||
assert colRange([0, 0], [0, 0], 0) is None
|
|
||||||
assert cmpList(
|
|
||||||
colRange([200, 50, 0], [50, 200, 0], 1),
|
|
||||||
[200, 50, 0]
|
|
||||||
)
|
|
||||||
assert cmpList(
|
|
||||||
colRange([200, 50, 0], [50, 200, 0], 2),
|
|
||||||
[[200, 50, 0], [50, 200, 0]]
|
|
||||||
)
|
|
||||||
assert cmpList(
|
|
||||||
colRange([200, 50, 0], [50, 200, 0], 3),
|
|
||||||
[[200, 50, 0], [125, 125, 0], [50, 200, 0]]
|
|
||||||
)
|
|
||||||
assert cmpList(
|
|
||||||
colRange([200, 50, 0], [50, 200, 0], 4),
|
|
||||||
[[200, 50, 0], [150, 100, 0], [100, 150, 0], [50, 200, 0]]
|
|
||||||
)
|
|
||||||
assert cmpList(
|
|
||||||
colRange([200, 50, 0], [50, 200, 0], 5),
|
|
||||||
[[200, 50, 0], [162, 87, 0], [124, 124, 0], [86, 161, 0], [50, 200, 0]]
|
|
||||||
)
|
|
||||||
|
|
||||||
# END Test testBaseCommon_ColRange
|
|
||||||
|
|
||||||
@pytest.mark.base
|
@pytest.mark.base
|
||||||
def testBaseCommon_FormatTimeStamp():
|
def testBaseCommon_FormatTimeStamp():
|
||||||
"""Test the formatTimeStamp function.
|
"""Test the formatTimeStamp function.
|
||||||
|
|||||||
Reference in New Issue
Block a user