Addendum: -setPrototype:(EOAttribute *)prototype is defined in the API
for EOF 4.0 and 4.5. A revised patch is attached which sets
_flags.protoOverride and updates the propertyList at the start of
-initWithPropertyList:owner. This replaces my patch from yesterday.

-- Mark

On 05/18/2017 10:50 PM, Mark Clements wrote:
> Thanks for accepting my earlier patch on the GDL2 test suite.
>
> As a reminder, GDL2 has prototypes for different types of attributes:
> the prototypes are used to set properties when those properties have not
> already been specified for an attribute. The prototypes are specific to
> an EOAdaptor. The current issue is that the properties are not being
> updated from the prototypes.
>
> Under the EOAttribute class, -initWithPropertyList:owner calls
> -setPrototype early, which sets _flags.protoOverride = 0 and then calls
> -_updatePrototype, which carefully manipulates keys based on
> _flags.protoOverride -- which has already been set to zero and therefore
> does nothing (?). Interestingly, _flags.protoOverride is updated later
> in -initWithPropertyList:owner -- but this all happens /after/
> -setPrototype has been called with no other effects.
>
> As most of the remainder of -initWithPropertyList:owner uses
> propertyList, one fix would be to update propertyList from the prototype
> at -setPrototype. I have attached a draft patch that does this -- but is
> this the right approach? Note that this is a more general solution to my
> earlier patch. An alternative approach would be to call -setPrototype
> late in -initWithPropertyList:owner.
>
> The patch increased the number of passed tests from 1033 to 1101.
>
> Kindly, Mark.
>
> On 05/14/2017 06:22 PM, Fred Kiefer wrote:
>> Hi Mark,
>>
>> thank you very much for this fix on the gdl2 tests. I have applied this
>> patch. The only thing I did change was instead of commenting out the
>> TEST_EXCEPTION macros I replaced them with the newer PASS_EXCEPTION calls.
>>
>> Cheers,
>> Fred
>>
>> Am 02.05.2017 um 07:49 schrieb Mark Clements:
>>> I have now attached a diff file for these changes.
>>>
>>> Kindly, Mark.
>>>
>>> On 05/01/2017 11:25 PM, Mark Clements wrote:
>>>> I have had a first attempt at getting the testsuite working with GDL2.
>>>>
>>>> It seems to have been a while since the GDL2 testsuite was updated (see
>>>> patch below). Suggested changes include:
>>>>  + Bug fixes on labelling
>>>>  + Change -cString to -UTF8String
>>>>  + Change sel_eq to sel_isEqual
>>>>  + Change #include "../ObjectTesting.h" to #include "ObjectTesting.h"
>>>>  + Change ADDITIONAL_NATIVE_LIBS+=EOControl EOAccess  to
>>>> ADDITIONAL_NATIVE_LIBS+=EOAccess EOControl (?)
>>>>  + Comment out TEST_EXCEPTION: is this still defined?
>>>>
>>>> This gave me 1031 passed tests, 10 failed sets, 9 failed tests and 5
>>>> failed files.
>>>>
>>>> I was not certain whether the failed tests indicate that the Key Value
>>>> Coding mechanism is broken. Any guidance on this point would be welcomed.
>>>>
>>>> Kindly, Mark.

Index: EOAccess/EOAttribute.m
===================================================================
--- EOAccess/EOAttribute.m	(revision 40502)
+++ EOAccess/EOAttribute.m	(working copy)
@@ -148,8 +148,11 @@
 	{
 	  EOAttribute *attr = [[_parent model] prototypeAttributeNamed: tmpString];
 
-	  if (attr)
+	  if (attr) {
+	    _flags.protoOverride = 0;
+	    [self _setOverrideAndUpdate:propertyList fromPrototype:attr];
 	    [self setPrototype: attr];
+	  }
 	}
 
       [self setExternalType: [propertyList objectForKey: @"externalType"]];
@@ -876,7 +879,7 @@
      && ![_prototypeName isEqualToString:[prototype name]])
     {
       [self willChange];
-      _flags.protoOverride = 0;
+      // _flags.protoOverride = 0;
       ASSIGN(_prototypeName, [prototype name]);
       if (_prototypeName != nil)
 	{
@@ -2299,4 +2302,18 @@
   return ((_prototype != nil && (_flags.protoOverride & 1 << keyEnum) == 0) ? YES : NO);
 }
 
+- (void) _setOverrideAndUpdate: (NSDictionary *) propertyList
+		 fromPrototype: (EOAttribute *) prototype
+{
+  int i=0;
+  for(i = 0; i < EOATTRIBUTE_PROTO_OVERRIDE_BITS_COUNT; i++)
+    {
+      NSString* key = [GDL2_EOAttributeClass _keyForEnum:i];
+      if ([propertyList objectForKey:key])
+	_flags.protoOverride|= 1 << i;
+      else if ([prototype valueForKey:key])
+	[propertyList setValue:[prototype valueForKey:key] forKey:key];
+    }
+}
+
 @end
Index: EOAccess/EOAttributePriv.h
===================================================================
--- EOAccess/EOAttributePriv.h	(revision 40502)
+++ EOAccess/EOAttributePriv.h	(working copy)
@@ -77,6 +77,8 @@
 - (void)_setOverrideForKeyEnum: (EOAttributeProtoOverrideBits)keyEnum;
 - (BOOL)_isKeyEnumOverriden: (EOAttributeProtoOverrideBits)keyEnum;
 - (BOOL)_isKeyEnumDefinedByPrototype: (EOAttributeProtoOverrideBits)keyEnum;
+- (void) _setOverrideAndUpdate: (NSDictionary *)propertyList
+		 fromPrototype: (EOAttribute *)prototype;
 @end
 
 #endif  /* __EOAttributePriv_h__ */
_______________________________________________
Discuss-gnustep mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep

Reply via email to