Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion qml/pages/wallet/ImportWalletOptions.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Page {
signal next
background: null
readonly property bool hasImportError: walletController.walletLoadError.length > 0
readonly property real heroWidth: Math.min(parent.width - 40, 520)
readonly property real heroWidth: Math.min(root.width - 40, 520)
readonly property int heroTopMargin: 64
readonly property int importHeroTopMargin: heroTopMargin + 10
readonly property int heroIconSize: 60
Expand Down
1 change: 1 addition & 0 deletions test/qml/bitcoin_qmltests.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<file>tst_dropdownbutton.qml</file>
<file>tst_externalsignerreviewactions.qml</file>
<file>tst_feeselection.qml</file>
<file>tst_importwalletoptions.qml</file>
<file>tst_mainrouting.qml</file>
<file>tst_mempoolinformationrows.qml</file>
<file>tst_mempoolinformationsettings.qml</file>
Expand Down
72 changes: 72 additions & 0 deletions test/qml/tst_importwalletoptions.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// Copyright (c) 2026 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

import QtQuick 2.15
import QtTest 1.2
import "../../qml/pages/wallet"

TestCase {
name: "ImportWalletOptions"
when: windowShown
width: 520
height: 720

Item {
id: pageContainer
width: 460
height: 680
}

Component {
id: importWalletOptionsComponent

ImportWalletOptions {
width: 460
height: 680
}
}

function init() {
walletController.reset()
}

function test_hero_width_without_a_parent() {
const page = createTemporaryObject(importWalletOptionsComponent, null)
verify(page !== null)
compare(page.parent, null)
compare(page.heroWidth, 420)

const errorView = findChild(page, "importWalletErrorView")
verify(errorView !== null)
compare(errorView.width, 420)
}

function test_hero_width_follows_the_page_width() {
const page = createTemporaryObject(importWalletOptionsComponent, pageContainer)
verify(page !== null)
compare(page.heroWidth, 420)

page.width = 300
compare(page.heroWidth, 260)

page.width = 900
compare(page.heroWidth, 520)
}

function test_error_view_reports_the_wallet_load_error() {
const page = createTemporaryObject(importWalletOptionsComponent, pageContainer)
verify(page !== null)
verify(!page.hasImportError)

walletController.walletLoadError = "Corrupted wallet file."

verify(page.hasImportError)
const errorView = findChild(page, "importWalletErrorView")
verify(errorView !== null)
compare(errorView.width, page.heroWidth)
const errorDescription = findChild(page, "importWalletErrorDescription")
verify(errorDescription !== null)
compare(errorDescription.text, "Corrupted wallet file.")
}
}
Loading