Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 5a16185

Browse files
committed
[[ Bug 22412 ]] Save tabAlign when tabStops is not set
This patch ensures that if the `tabAlign` property of a field is set but the `tabStops` is not then it will still be saved.
1 parent 8375a0a commit 5a16185

File tree

5 files changed

+41
-17
lines changed

5 files changed

+41
-17
lines changed

docs/notes/bugfix-22412.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Fix `tabAlign` property not saving when `tabStops` is not set

engine/src/field.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2586,7 +2586,7 @@ IO_stat MCField::extendedsave(MCObjectOutputStream& p_stream, uint4 p_part, uint
25862586
}
25872587

25882588
// SN-2015-04-30: [[ Bug 15175 ]] Save the tabalign property of the field
2589-
if (ntabs != 0)
2589+
if (nalignments != 0)
25902590
{
25912591
t_flags |= FIELD_EXTRA_TABALIGN;
25922592
// Save number of tab alignments, and then each of them.

tests/_testlib.livecodescript

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ command TestEnsureJVM
750750
end if
751751
end TestEnsureJVM
752752

753-
command TestEnumPropRoundTrip pObjectType, pProperty, pValues
753+
command TestPropRoundTrip pObjectType, pProperty, pValues
754754
local tStack
755755
put "TestRoundTrip" & pProperty into tStack
756756
create stack tStack
@@ -766,20 +766,23 @@ command TestEnumPropRoundTrip pObjectType, pProperty, pValues
766766
put the long id of stack tStack into tObject
767767
end if
768768

769-
repeat for each item tValue in pValues
770-
set the pProperty of tObject to tValue
771-
TestAssert format("round trip %s '%s'", pProperty, tValue), \
772-
the pProperty of tObject is tValue
773-
TestDiagnostic format("%s is '%s'", pProperty, the pProperty of tObject)
774-
775-
save stack tStack
776-
delete stack tStack
777-
TestAssert format("round trip to disk %s '%s'", pProperty, tValue), \
778-
the pProperty of tObject is tValue
779-
TestDiagnostic format("%s is '%s'", pProperty, the pProperty of tObject)
769+
repeat for each element tValue in pValues
770+
_TestPropRoundTrip tStack, tObject, pProperty, tValue
780771
end repeat
781772

782773
delete file the filename of stack tStack
783774
delete stack tStack
784-
end TestEnumPropRoundTrip
785-
775+
end TestPropRoundTrip
776+
777+
private command _TestPropRoundTrip pStack, pObject, pProperty, pValue
778+
set the pProperty of pObject to pValue
779+
TestAssert format("round trip %s '%s'", pProperty, pValue), \
780+
the pProperty of pObject is pValue
781+
TestDiagnostic format("%s is '%s'", pProperty, the pProperty of pObject)
782+
783+
save stack pStack
784+
delete stack pStack
785+
TestAssert format("round trip to disk %s '%s'", pProperty, pValue), \
786+
the pProperty of pObject is pValue
787+
TestDiagnostic format("%s is '%s'", pProperty, the pProperty of pObject)
788+
end _TestPropRoundTrip

tests/lcs/core/field/line-properties.livecodescript

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,3 +191,17 @@ on _TestMixedEffectiveLineProperties pProp, pValue1, pValue2
191191

192192
delete field "Test"
193193
end _TestMixedEffectiveLineProperties
194+
195+
on TestLinePropertyRoundTrip
196+
repeat for each element tTest in sTests
197+
if not tTest["effective"] then
198+
next repeat
199+
end if
200+
201+
local tValues
202+
put tTest["value-1"] into tValues[1]
203+
put tTest["value-2"] into tValues[2]
204+
205+
TestPropRoundTrip "field", tTest["property"], tValues
206+
end repeat
207+
end TestLinePropertyRoundTrip

tests/lcs/core/field/softkeyboardproperties.livecodescript

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,16 @@ You should have received a copy of the GNU General Public License
1717
along with LiveCode. If not see <http://www.gnu.org/licenses/>. */
1818

1919
on TestKeyboardTypeRoundTrip
20-
TestEnumPropRoundTrip "field", "keyboardType", ",default,numeric,url,number,phone,contact,email"
20+
local tValues
21+
put ",default,numeric,url,number,phone,contact,email" into tValues
22+
split tValues by comma
23+
TestPropRoundTrip "field", "keyboardType", tValues
2124
end TestKeyboardTypeRoundTrip
2225

2326
on TestReturnKeyTypeRoundTrip
24-
TestEnumPropRoundTrip "field", "returnKeyType", ",default,go,google,join,next,route,search,send,yahoo,done,emergency call"
27+
local tValues
28+
put ",default,go,google,join,next,route,search,send,yahoo,done,emergency call" into tValues
29+
split tValues by comma
30+
TestPropRoundTrip "field", "returnKeyType", tValues
2531
end TestReturnKeyTypeRoundTrip
2632

0 commit comments

Comments
 (0)