Changeset 574


Ignore:
Timestamp:
07/16/14 03:57:54 (5 years ago)
Author:
jls17
Message:
  • while the AR_CURRENCY_PART_FIELD type should be the normal field, devstudio does resolve it to "<field-name>.FIELD"; now ARInside does the same
  • now CDocTextReferences uses the CDocCurrencyField to create the documentation
Location:
branches/work_311
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/work_311/core/ARParseField.cpp

    r573 r574  
    5050                if (result == FINISHED) 
    5151                { 
    52                         if (typeId >= AR_CURRENCY_PART_VALUE && typeId <= AR_CURRENCY_PART_DATE) 
     52                        if (typeId >= AR_CURRENCY_PART_FIELD && typeId <= AR_CURRENCY_PART_DATE) 
    5353                        { 
    5454                                SetupCurrencyField(fieldId, typeId); 
  • branches/work_311/core/ARParseFieldTest.cpp

    r573 r574  
    102102        ASSERT_TRUE(isCurrencyField(result, 536870987, AR_CURRENCY_PART_DATE)); 
    103103} 
     104 
     105TEST(ARParseFieldTests, CurrencySupportForFieldPartType) 
     106{ 
     107        CARParseField parseField("536870987.0"); 
     108        const ARParseField &result = parseField.getField(); 
     109 
     110        ASSERT_TRUE(isCurrencyField(result, 536870987, AR_CURRENCY_PART_FIELD)); 
     111} 
  • branches/work_311/doc/DocTextReferences.cpp

    r572 r574  
    1717#include "stdafx.h" 
    1818#include "DocTextReferences.h" 
     19#include "DocCurrencyField.h" 
    1920#include "../core/ARParseField.h" 
    2021#include "../output/ObjNotFound.h" 
     
    267268void CDocTextReferences::docField(std::ostream &strm, const ARParseField &parsedField) 
    268269{ 
    269         int fieldId = 0; 
    270         switch (parsedField.tag) 
    271         { 
    272         case AR_FIELD: 
    273         case AR_STAT_HISTORY: 
    274                 fieldId = parsedField.u.fieldId; 
    275                 break; 
    276         case AR_CURRENCY_FLD: 
    277                 fieldId = parsedField.u.currencyField->fieldId; 
    278                 break; 
    279         } 
    280  
     270        if (parsedField.tag == AR_CURRENCY_FLD) 
     271        { 
     272                CDocCurrencyField docCurrency(schemaInsideId, *parsedField.u.currencyField); 
     273                docCurrency.GetResolvedAndLinkedField(strm, *refItem, rootLevel); 
     274                return; 
     275        } 
     276 
     277        int fieldId = parsedField.u.fieldId; 
    281278        strm << refFieldID(fieldId); 
    282279 
     
    295292                strm << "."; 
    296293                strm << CAREnum::StatHistoryTag(parsedField.u.statHistory.userOrTime); 
    297         } 
    298         else if (parsedField.tag == AR_CURRENCY_FLD) 
    299         { 
    300                 // handle currency details 
    301                 strm << "."; 
    302                 strm << CAREnum::CurrencyPart(parsedField.u.currencyField->partTag); 
    303                 strm << "."; 
    304                 strm << parsedField.u.currencyField->currencyCode; 
    305294        } 
    306295} 
  • branches/work_311/doc/DocTextReferencesTest.cpp

    r572 r574  
    2323        ASSERT_STREQ("select * from $SCHEMA$", result.c_str()); 
    2424} 
     25 
     26TEST(DocTextReferencesTests, DISABLED_CurrencyDate) 
     27{ 
     28        // since DocTextReferences uses the CDocCurrencyField class, this test fails 
     29        // because currently it's not possible to replace this dependency easily 
     30        // without using virtual methods. 
     31        // 
     32        // TODO: change the responsibility of the DocTextReferences class a little more 
     33        // ~~~~~~~~~~~~~ 
     34        // it splits text into parts, replaces the parts with links, scans for special 
     35        // commands an so on. At least replacing the parts should be done by other 
     36        // classes (like CDocCurrencyField does) which could be used in serveral places 
     37        CDocTextReferencesTest textRef("select $8.3$", "$", 1, 1, true, NULL); 
     38        string result = textRef.TextFindFields(); 
     39        ASSERT_STREQ("select $<a href='Test'>8</a>.DATE$", result.c_str()); 
     40} 
Note: See TracChangeset for help on using the changeset viewer.