~vanvugt/compiz/fix-1026920

Viewing all changes in revision 3491.

  • Committer: Tarmac
  • Author(s): Sam Spilsbury
  • Date: 2012-11-29 11:40:16 UTC
  • mfrom: (3480.4.13 compiz.fix_1063617.6)
  • Revision ID: tarmac-20121129114016-z6m9zjp07ir7wzrc
Provide infrastructure for testing the ccsSet* functions

Provide infrastructure for testing value containers.

It will be useful for later tests to be able to specify a value and allow
the use of templates to automatically create a CCSValue for those. These value
containers handle the tricky issues around how those values have their
lifecycles managed, as every value needs a valid parent setting in order
to be destroyed properly (as type information is stored in the parent
setting).

ContainNormal and ContainList are convenience functions which forward
to NormalValueContainer and ListValueContainer.

NormalValueContainer will wrap a normal "raw" value and provide a means to
construct a CCSValue on-demand and a way to get the raw value.

ListValueContainer will wrap a normal "raw" value as the first member of
a CCSSettingValueList, safely wrap that in a SettingValueListWrapper and
then provde a means to construct a CCSValue from that on-demand and a way
to get the raw CCSSettingValueList.

Both use RawValueCopy in order to handle internal value copy semantics
properly.

RawValueCopy returns a copy of the "raw" value (i.e. not another
CCSSettingValue), doing deep copies as appropriate. It is implemented
as a series of template specializations to handle some of the various
pointer types, such as const char * and CCSSettingValueList.

Also provide SetWithDisallowedValue template + specializations

It will be useful in future to provide methods in the tests to set a
value which would otherwise be disallowed because it is out of range for
a particular type. The actual out-of-range error varies between the
types, so we need to provide some specializations for some of the
different types

Also expose ccsCopyInfo and separate ccsCopyValueInto from ccsCopyValue. The
latter returns a newly allocated copy of the value, the former deep-

There was a bug in ccsCopyInfo which caused the copy-from info to be
overwritten with the copy-to info. That was fixed.

There are no tests at present. The testing framework for this will be
quite similar to what we need to test settings, and will be adapted for
that purpose in testing this code. Fixes: https://bugs.launchpad.net/bugs/1063617.

Approved by Sam Spilsbury, PS Jenkins bot, Daniel van Vugt.

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: