Esempio n. 1
0
def test_additional_background(
    encode_header_mock,
    alignment,
    tiling,
    image_width,
    image_height,
    pattern_width,
    pattern_height,
    pattern_x,
    pattern_y,
):
    encode_header_mock.return_value = ('foobaa', image_width, image_height)
    path = 'empty.png'
    background = AdditionalBackground(path, alignment, tiling, None)
    assert background.src == 'foobaa'
    assert background.width == image_width
    assert background.height == image_height
    background.calculate_pattern_offsets(
        amo.THEME_PREVIEW_RENDERINGS['header']['full'].width,
        amo.THEME_PREVIEW_RENDERINGS['header']['full'].height,
    )
    assert background.pattern_width == pattern_width
    assert background.pattern_height == pattern_height
    assert background.pattern_x == pattern_x
    assert background.pattern_y == pattern_y
Esempio n. 2
0
def test_additional_background(
        encode_header_mock, alignment, tiling, image_width, image_height,
        pattern_width, pattern_height, pattern_x, pattern_y):
    encode_header_mock.return_value = (
        'foobaa', image_width, image_height)
    path = 'empty.png'
    background = AdditionalBackground(path, alignment, tiling, None)
    assert background.src == 'foobaa'
    assert background.width == image_width
    assert background.height == image_height
    background.calculate_pattern_offsets(
        amo.THEME_PREVIEW_SIZES['header']['full'].width,
        amo.THEME_PREVIEW_SIZES['header']['full'].height)
    assert background.pattern_width == pattern_width
    assert background.pattern_height == pattern_height
    assert background.pattern_x == pattern_x
    assert background.pattern_y == pattern_y
Esempio n. 3
0
def test_additional_background(encode_header_image, alignment, tiling,
                               pattern_width, pattern_height, pattern_x,
                               pattern_y):
    encode_header_image.return_value = ('foobaa', 120, 450)
    path = 'empty.png'
    header_root = os.path.join(
        settings.ROOT, 'src/olympia/versions/tests/static_themes/')
    background = AdditionalBackground(path, alignment, tiling, header_root)
    assert background.src == 'foobaa'
    assert background.width == 120
    assert background.height == 450
    assert background.pattern_width == pattern_width
    assert background.pattern_height == pattern_height
    background.calculate_pattern_offsets(
        amo.THEME_PREVIEW_SIZES['full'].width,
        amo.THEME_PREVIEW_SIZES['full'].height)
    assert background.pattern_x == pattern_x
    assert background.pattern_y == pattern_y
Esempio n. 4
0
def test_additional_background(encode_header_image, alignment, tiling,
                               pattern_width, pattern_height, pattern_x,
                               pattern_y):
    encode_header_image.return_value = ('foobaa', 120, 450)
    path = 'empty.png'
    header_root = os.path.join(settings.ROOT,
                               'src/olympia/versions/tests/static_themes/')
    background = AdditionalBackground(path, alignment, tiling, header_root)
    assert background.src == 'foobaa'
    assert background.width == 120
    assert background.height == 450
    assert background.pattern_width == pattern_width
    assert background.pattern_height == pattern_height
    background.calculate_pattern_offsets(
        amo.THEME_PREVIEW_SIZES['header']['full'].width,
        amo.THEME_PREVIEW_SIZES['header']['full'].height)
    assert background.pattern_x == pattern_x
    assert background.pattern_y == pattern_y
Esempio n. 5
0
def test_additional_background_split_alignment(alignment, alignments_tuple):
    assert AdditionalBackground.split_alignment(alignment) == alignments_tuple
Esempio n. 6
0
def test_additional_background_split_alignment(alignment, alignments_tuple):
    assert AdditionalBackground.split_alignment(alignment) == alignments_tuple