Titanium JIRA Archive
Alloy (ALOY)

[ALOY-1023] Issue merging font styles

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2014-05-23T13:50:24.000+0000
Affected Version/sAlloy 1.4.0
Fix Version/sAlloy 1.4.0
ComponentsStyling
Labelsqe-3.3.0, qe-testadded, regression
ReporterFederico Casali
AssigneeFeon Sua Xin Miao
Created2014-05-19T20:36:04.000+0000
Updated2014-10-28T15:48:37.000+0000

Description

Problem description

Font styles are not correctly merged and they could be applied to the wrong object.

Steps to reproduce

1. Get sample code from: https://github.com/appcelerator/alloy/tree/master/test/apps/advanced/complex_styling 2. Run on iOS device 3. Check #lbl6 and #lbl7 Result: using alloy 1.4.0-alpha version, the font style looks the same, while fontFamily, fontWeight and fontSize is actually only applied to #lbl6. Also, from the compiled code:
   $.__views.lbl6 = Ti.UI.createLabel({
        left: 0,
        color: "black",
        width: Ti.UI.FILL,
        height: Ti.UI.SIZE,
        textAlign: Ti.UI.TEXT_ALIGNMENT_LEFT,
        font: {
            fontSize: "16dp",
            fontWeight: "bold",
            fontFamily: "Zapfino"
        },
        text: "6. Bold, large, custom font, font properties mixed from various stylesheets",
        id: "lbl6"
    });
    $.__views.sv.add($.__views.lbl6);
    $.__views.lbl7 = Ti.UI.createLabel({
        left: 0,
        color: "blue",
        width: Ti.UI.FILL,
        height: Ti.UI.SIZE,
        textAlign: Ti.UI.TEXT_ALIGNMENT_LEFT,
        font: {
            fontSize: "16dp",
            fontWeight: "bold",
            fontFamily: "Zapfino"
        },
        text: "7. Theme controls color: iOS=blue, Android=green, MobileWeb=red, generic=black, font size from main index.tss",
        id: "lbl7"
    });
Color and text properties are fine, but the font properties, that should just be applied to #lbl6, are also applied to #lbl7.

Comments

  1. Feon Sua Xin Miao 2014-05-20

    Ran the sample app. It seems #lbl6's font style is applied to the labels after it and doesn't have fontFamily property specifically defined. Affected elements are #lbl7, #lbl9 and also the last two labels
  2. Feon Sua Xin Miao 2014-05-22

    PR : https://github.com/appcelerator/alloy/pull/411 Test apps: https://github.com/feons/alloy/tree/ALOY-1023/test/apps/testing/ALOY-1023 https://github.com/feons/alloy/tree/master/test/apps/advanced/complex_styling Functional Test: 1. Built the complex_styling app, font properties #lbl7, #lbl9 and also the last two labels are overwritten by #lbl6's font style 2. Built the test app, #lbl2 is not using #lbl1's font style.
  3. Tim Poulsen 2014-05-22

    I have submitted my own PR which solves the problem in a different way. As Feon discovered, the fault was the deepExtend() function. So rather than work around that defect, I've replaced that function. PR: https://github.com/appcelerator/alloy/pull/413 Test app: https://github.com/appcelerator/alloy/tree/master/test/apps/advanced/complex_styling Functional test: label 6 should have the custom font face, but the ones that follow after it should not (many were getting that font face before) Waiting on input from Federico and Feon before resolving this ticket and merging that PR
  4. Tim Poulsen 2014-05-23

    PR https://github.com/appcelerator/alloy/pull/413 merged to master and 1_4_X

JSON Source