Unfortunately, no, you are incorrect.
Ron makes a good point, you didn't provide a subnet mask, so if we were to assume the classful mask, the 10.x.x.x address would have a 255.0.0.0 mask, which would actually put the two hosts on the same network. If that is the case, they would have no problem communicating.
However, given the nature of your question, I imagine you intended for each of these hosts to use a smaller mask -- we'll go ahead and use 255.255.255.0, which puts both hosts in two different subnets.
That being said, the heart of what you are missing lies in forgetting about ARP (Address Resolution Protocol). Specifically, in whom HostA decides to ARP for. Let me explain...
Before any host puts any packet on the wire, the first thing it does is determine whether the destination IP is on its own network, or on a foreign network. Let's run through it from the perspective of Host A.
Host A know its IP (10.1.2.1), and its Subnet Mask (/24, or 255.255.255.0). With a little subnetting, HostA determines that its network spans all the IP addresses in the range of 10.1.2.0 through 10.1.2.255. (We'll leave out details of the NetID and BroadcastIP, since for the moment they aren't relevant)
Host A also knows its destination IP is 10.1.3.1, which falls outside of the range of IP addresses within Host A's own network. As such, Host A would would come to the conclusion that the destination IP 10.1.3.1 is on a foreign network, and Host A could only reach a foreign network by speaking through a Router. Or more specifically, through HostA's default gateway.
If HostA isn't configured with a Default Gateway at this point, then the process ends here with a general failure. HostA can not speak to HostB.
If HostA is configured with a Default Gateway, it would send out an ARP Request (which is itself a Broadcast frame), asking for the MAC address of its default gateway -- NOT the MAC address of the final destination IP.
The switch, having received the broadcast frame would flood the packet out all interfaces, to include the one HostB is connected to. HostB would indeed receive the packet, but since the ARP is looking for the Default Gateway's MAC address (and not the MAC address of HostB), HostB would simply drop and ignore the ARP Request, without ever sending any sort of response.
HostA, then, would never receive a MAC address for its default gateway, and would therefore be unable to encapsulate the Layer 3 Packet with a Layer 2 header. The packet would fail there.
You can see the ARP process illustrated in this video.
That said, although somewhat unrelated to your question, I did want to speak to something you said. This may be terminology nuance, but I just want to make sure it is communicated. A switch only does two things: forwards frame for which it know the destination MAC address, or flood frames for which it doesn't know the destination MAC address. A switch never broadcasts.
A broadcast is a frame who's destination MAC address is
ffff.ffff.ffff. This is a specially reserved MAC address, specifically designed for broadcast frames. When a switch encounters a frame destined to ffff.ffff.ffff, its behavior is to always flood that frame.
You could look at it like this, since ffff.ffff.ffff is a reserved MAC address, it is un-learn-able by the switch. Therefore, whenever a switch receives something destined to ffff.ffff.ffff, it is forced to flood it out all ports in the VLAN that the frame was originally received in.