mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-20 19:39:22 +00:00
fa4755ce9e
+ store the card state in user settings + amend the BannerCard close button state. It needs to change color on hover and to become visible only when the card is hovered.
78 lines
2.1 KiB
QML
78 lines
2.1 KiB
QML
import QtQuick 2.15
|
|
import QtTest 1.15
|
|
|
|
import AppLayouts.Wallet.controls 1.0
|
|
|
|
Item {
|
|
id: root
|
|
width: 600
|
|
height: 400
|
|
|
|
Component {
|
|
id: bannerCardComponent
|
|
|
|
BannerCard {}
|
|
}
|
|
|
|
TestCase {
|
|
id: bannerCardTest
|
|
|
|
when: windowShown
|
|
|
|
property BannerCard componentUnderTest
|
|
|
|
function init() {
|
|
componentUnderTest = createTemporaryObject(bannerCardComponent, root)
|
|
}
|
|
|
|
function test_empty() {
|
|
compare(componentUnderTest.image, "")
|
|
compare(componentUnderTest.title, "")
|
|
compare(componentUnderTest.subTitle, "")
|
|
compare(componentUnderTest.closeEnabled, true)
|
|
}
|
|
|
|
function test_geometry() {
|
|
verify(componentUnderTest.height > 0)
|
|
verify(componentUnderTest.width > 0)
|
|
}
|
|
|
|
function test_hoverState() {
|
|
compare(componentUnderTest.hovered, false)
|
|
mouseMove(componentUnderTest, componentUnderTest.width / 2, componentUnderTest.height / 2)
|
|
compare(componentUnderTest.hovered, true)
|
|
|
|
const closeButton = findChild(componentUnderTest, "bannerCard_closeButton")
|
|
verify(!!closeButton)
|
|
verify(closeButton.visible)
|
|
verify(closeButton.width > 0)
|
|
verify(closeButton.height > 0)
|
|
|
|
mouseMove(closeButton, closeButton.width / 2, closeButton.height / 2)
|
|
compare(componentUnderTest.hovered, true)
|
|
}
|
|
|
|
function test_click() {
|
|
let clicked = false
|
|
componentUnderTest.clicked.connect(() => {
|
|
clicked = true
|
|
})
|
|
mouseClick(componentUnderTest)
|
|
compare(clicked, true)
|
|
|
|
clicked = false
|
|
|
|
const closeButton = findChild(componentUnderTest, "bannerCard_closeButton")
|
|
|
|
let closed = false
|
|
componentUnderTest.close.connect(() => {
|
|
closed = true
|
|
})
|
|
mouseMove(closeButton, closeButton.width / 2, closeButton.height / 2)
|
|
mouseClick(closeButton)
|
|
compare(closed, true)
|
|
compare(clicked, false)
|
|
}
|
|
}
|
|
}
|