]> git.basschouten.com Git - openhab-addons.git/blob
3f4e700b6ab21ccabda81a26849f3ce34a87b491
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.loxone.internal.controls;
14
15 import org.junit.jupiter.api.BeforeEach;
16 import org.junit.jupiter.api.Test;
17 import org.openhab.core.library.types.IncreaseDecreaseType;
18 import org.openhab.core.library.types.PercentType;
19
20 /**
21  * Test class for (@link LxControlValueSelector} - version which allows for increasing only
22  *
23  * @author Pawel Pieczul - initial contribution
24  *
25  */
26 public class LxControlValueSelectorIncrTest extends LxControlValueSelectorTest {
27     @Override
28     @BeforeEach
29     public void setup() {
30         setupControl("132a7b7e-0022-3aac-ffff403fb0c34b9e", "0b734138-037d-034e-ffff403fb0c34b9e",
31                 "0fe650c2-0004-d446-ffff504f9410790f", "Selection Switch Increase Only");
32     }
33
34     @Override
35     @Test
36     public void testIncreaseDecreaseCommands() {
37         changeLoxoneState("min", 123.0);
38         changeLoxoneState("max", 456.0);
39         changeLoxoneState("step", 23.0);
40         changeLoxoneState("value", 400.0);
41         testChannelState(new PercentType(83));
42         executeCommand(IncreaseDecreaseType.INCREASE);
43         testAction("423.0");
44         changeLoxoneState("value", 423.0);
45         testChannelState(new PercentType(90));
46         executeCommand(IncreaseDecreaseType.INCREASE);
47         testAction("446.0");
48         changeLoxoneState("value", 446.0);
49         testChannelState(new PercentType(96));
50         executeCommand(IncreaseDecreaseType.INCREASE);
51         testAction("456.0"); // trim to max
52         changeLoxoneState("value", 456.0);
53         testChannelState(PercentType.HUNDRED);
54         executeCommand(IncreaseDecreaseType.DECREASE);
55         testAction(null);
56         changeLoxoneState("step", 100.0);
57         executeCommand(IncreaseDecreaseType.DECREASE);
58         testAction(null);
59         changeLoxoneState("value", 123.0);
60         testChannelState(PercentType.ZERO);
61     }
62 }