• Tor Lillqvist's avatar
    Add hack to optionally get stable ODF output from the same input · c1015fdd
    Tor Lillqvist yazdı
    To be used in regression testing and similar scenarios, where the output ODF
    is *not* intended to be further manipulated in LibreOffice. An environment
    variable LIBO_ONEWAY_STABLE_ODF_EXPORT is used to toggle this behaviour. I am
    not 100% sure whether the generated ODF with the hack toggled on is even fully
    correct, but correctness is not the purpose of the hack anyway.
    
    Two classes of issues handled: 1) Automatic style names and 2) use of
    randomness.
    
    For class 1), when the hack toggle is in effect, we generate the names at
    first as strings based on all the properties of the style, and sort them based
    on those, and then rename them (for brevity in the output) to the "normal"
    form of a short prefix plus a number (like "P12").
    
    Sure, it would have been better to just figure out *why* the automatic style
    naming currently is not stable in the first place, but outputs the styles in
    different order (with some styles being assigned different numbers) in
    separate invokations of LibreOffice), but I was unable to understand that.
    
    Possibly this code could be used in all cases, except that it does break some
    unit test (can't recall which right now). I don't know whether that is simply
    because the unit test assumes too much knowledge of the internal workings of
    the automatic style name generation, or whether the generated ODF is actually
    invalid.
    
    For 2), I found a handful of places where randomness was used to generated
    various kinds of identifiers in ODF output. I changed those to just use large
    (64-bit) non-overlapping integers instead. I assume there *is* a point in the
    original code in each case that explains why randomness is needed, so the hack
    definitely needs to be optional and used only for the above mentioned
    scenarios.
    
    Change-Id: I17b657197e38bcf24abdfe61ad4a277f4339eeae
    c1015fdd
Adı
Son kayıt (commit)
Son güncelleme
..
unit Loading commit data...
unoapi Loading commit data...