D17317: match and tc setting

Jan Grulich noreply at phabricator.kde.org
Mon Dec 3 12:28:52 GMT 2018


jgrulich added inline comments.

INLINE COMMENTS

> matchsettingtest.cpp:29
> +
> +#if !NM_CHECK_VERSION(1, 12, 0)
> +#define NM_SETTING_MATCH_INTERFACE_NAME    "interface-name"

NM 1.14.0, which is not released yet.

> jgrulich wrote in tcsettingtest.cpp:74
> Something like:
> 
>   NMVariantMapList list = it.value();
>   NMVariantMapList list1 = map1.value(it.key());
>   QCOMPARE(list.count(), list1.count());
>   
>   int comparedMaps = 0;
>   NMVariantMapList::const_iterator listIt = list.constBegin();
>   while (listIt != list.constEnd() {
>       NMVariantMapList::const_iterator list1It = list1.constBegin();
>       while (list1it != list1.constEnd()) {
>            QVariantMap listMap = listIt.value();
>            QVariantMap1 listMap1 = list1It.value();
>            // Test if keys do match, because the list can be in different order
>            QStringList listMapKeys = listMap.keys();
>            QStringList listMapKeys1 = listMap1.keys();
>            listMapKeys.sort();
>            listMapKeys1.sort();
>            if (listMapKeys.join(QChar(' ')) ==  listMapKeys1.join(QChar(' '))) {
>                  // Here the maps should have same keys so compare QVariantMaps as we do now
>                  .........
>                  ++comparedMaps;
>            }
>            ++list1it;  
>        }
>        ++listIt;
>   }
>   
>   // Test if we compared all maps, if not, then probably they didn't match
>   QCOMPARE(comparedMaps, list.count();

It should be:

  // Will fail if set some default values, because they are skipped in toMap() method
  QVariantMap::const_iterator it = map.constBegin();
  while (it != map.constEnd()) {
      NMVariantMapList list = it.value().value<NMVariantMapList>();
      NMVariantMapList list1 = map1.value(it.key()).value<NMVariantMapList>();
      QCOMPARE(list.count(), list1.count());
  
      int comparedMaps = 0;
      NMVariantMapList::const_iterator listIt = list.constBegin();
      while (listIt != list.constEnd()) {
          NMVariantMapList::const_iterator list1It = list1.constBegin();
          while (list1It != list1.constEnd()) {
              QVariantMap listMap = *listIt;
              QVariantMap listMap1 = *list1It;
              // Test if keys do match, because the list can be in different order
              QStringList listMapKeys = listMap.keys();
              QStringList listMapKeys1 = listMap1.keys();
              listMapKeys.sort();
              listMapKeys1.sort();
              if (listMapKeys.join(QChar(' ')) ==  listMapKeys1.join(QChar(' '))) {
                  // Here the maps should have same keys so compare QVariantMaps as we do now
                  .........
                  ++comparedMaps;
              }
              ++list1It;
          }
          ++listIt;
      }
      ++it;
  }

You just need to add missing comparison of variant maps, which should be trivial.

> matchsetting.cpp:26
> +
> +#if !NM_CHECK_VERSION(1, 12, 0)
> +#define NM_SETTING_MATCH_SETTING_NAME      "match"

This is actually in master only, which means upcoming NM 1.14.0.

> setting.cpp:33
> +#endif
> +#if !NM_CHECK_VERSION(1, 12, 0)
> +#define NM_SETTING_MATCH_SETTING_NAME      "match"

Same here, should be NM 1.14.0.

REPOSITORY
  R282 NetworkManagerQt

REVISION DETAIL
  https://phabricator.kde.org/D17317

To: pranavgade, jgrulich
Cc: kde-frameworks-devel, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20181203/e9632f9d/attachment.html>


More information about the Kde-frameworks-devel mailing list