# -*- coding: utf-8 -*-
# Copyright (c) Alexei Znamensky (russoz@gmail.com)
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later

---
- id: test_simple_property_get
  input:
    channel: xfwm4
    property: /general/inactive_opacity
  output:
    value: '100'
    is_array: false
  run_command_calls:
    - command: [/testbin/xfconf-query, --channel, xfwm4, --property, /general/inactive_opacity]
      environ: &env-def {environ_update: {LANGUAGE: C, LC_ALL: C}, check_rc: true}
      rc: 0
      out: "100\n"
      err: ""
- id: test_simple_property_get_nonexistent
  input:
    channel: xfwm4
    property: /general/i_dont_exist
  output: {}
  run_command_calls:
    - command: [/testbin/xfconf-query, --channel, xfwm4, --property, /general/i_dont_exist]
      environ: *env-def
      rc: 1
      out: ""
      err: 'Property "/general/i_dont_exist" does not exist on channel "xfwm4".\n'
- id: test_property_no_channel
  input:
    property: /general/i_dont_exist
  output:
    failed: true
    msg: "missing parameter(s) required by 'property': channel"
  run_command_calls: []
- id: test_property_get_array
  input:
    channel: xfwm4
    property: /general/workspace_names
  output:
    is_array: true
    value_array: [Main, Work, Tmp]
  run_command_calls:
    - command: [/testbin/xfconf-query, --channel, xfwm4, --property, /general/workspace_names]
      environ: *env-def
      rc: 0
      out: "Value is an array with 3 items:\n\nMain\nWork\nTmp\n"
      err: ""
- id: get_channels
  input: {}
  output:
    channels: [a, b, c]
  run_command_calls:
    - command: [/testbin/xfconf-query, --list]
      environ: *env-def
      rc: 0
      out: "Channels:\n  a\n  b\n  c\n"
      err: ""
- id: get_properties
  input:
    channel: xfwm4
  output:
    properties:
      - /general/wrap_cycle
      - /general/wrap_layout
      - /general/wrap_resistance
      - /general/wrap_windows
      - /general/wrap_workspaces
      - /general/zoom_desktop
  run_command_calls:
    - command: [/testbin/xfconf-query, --list, --channel, xfwm4]
      environ: *env-def
      rc: 0
      out: |
        /general/wrap_cycle
        /general/wrap_layout
        /general/wrap_resistance
        /general/wrap_windows
        /general/wrap_workspaces
        /general/zoom_desktop
      err: ""
